Search Results

Search found 82 results on 4 pages for 'oggz chop'.

Page 1/4 | 1 2 3 4  | Next Page >

  • Using JavaScript's split to chop up a string and put it in two arrays

    - by Pieter
    I can use JavaScript's split to put a comma-separated list of items in an array: var mystring = "a,b,c,d,e"; var myarray = mystring.split(","); What I have in mind is a little more complicated. I have this dictionary-esque string: myvalue=0;othervalue=1;anothervalue=0; How do I split this so that the keys end up in one array and the values end up in another array?

    Read the article

  • How to use linux csplit to chop up massive XML file?

    - by Fred
    Hi everyone, I have a gigantic (4GB) XML file that I am currently breaking into chunks with linux "split" function (every 25,000 lines - not by bytes). This usually works great (I end up with about 50 files), except some of the data descriptions have line breaks, and so frequently the chunk files do not have the proper closing tags - and my parser chokes halfway through processing. Example file: (note: normally each "listing" xml node is supposed to be on its own line) <?xml version="1.0" encoding="UTF-8"?> <listings> <listing><date>2009-09-22</date><desc>This is a description WITHOUT line breaks and works fine with split</desc><more_tags>stuff</more_tags></listing> <listing><date>2009-09-22</date><desc>This is a really annoying description field WITH line breaks that screw the split function</desc><more_tags>stuff</more_tags></listing> </listings> Then sometimes my split ends up like <?xml version="1.0" encoding="UTF-8"?> <listings> <listing><date>2009-09-22</date><desc>This is a description WITHOUT line breaks and works fine with split</desc><more_tags>stuff</more_tags></listing> <listing><date>2009-09-22</date><desc>This is a really annoying description field WITH line breaks ... EOF So - I have been reading about "csplit" and it sounds like it might work to solve this issue. I cant seem to get the regular expression right... Basically I want the same output of ~50ish files Something like: *csplit -k myfile.xml '/</listing>/' 25000 {50} Any help would be great Thanks!

    Read the article

  • Should I use procedural animation?

    - by user712092
    I have started to make a fantasy 3d fps swordplay game and I want to add animations. I don't want to animate everything by hand because it would take a lot of time, so I decided to use procedural animation. I would certainly use IK (starting with simple reaching an object with hand ...). I also assume procedural generation of animations will make less animations to do by hand (I can blend animations ...). I want also to have a planner for animation which would simplify complex animations; those which can be split to a sequence - run and then jump, jump and then roll - or which are separable - legs running and torso swinging with sword -. I want for example a character to chop a head of a big troll. If troll crouches character would just chop his head off, if it is standing he would climb on a troll. I know that I would have to describe the state ("troll is low", "troll is high", "chop troll head" ..) which would imply what regions animation will be in (if there is a gap between them character would jump), which would imply what places character can have some of legs and hands or would choose an predefined animation. My main goal is simplicity of coding, but I want my game to be looking cool also. Is it worthy to use procedural animation or does it make more troubles that it solves? (there can be lot of twiddling ...) I am using Blender Game Engine (therefore Python for scripting, and Bullet Physics).

    Read the article

  • Using IP Tables to deny packet patterns?

    - by Chris
    I'm not experienced with IP tables but it's something I'll be looking into if this is plausible. I'm looking to set up a system to inspect packets and look for a pattern similar to korek's chop chop attack. Is there a way to set up the IP tables to defend against this attack? Thanks

    Read the article

  • Unit Tests as a learning tool - a good idea?

    - by Ekkehard.Horner
    I'm interested in ways and means for learning (a) programming language(s) efficiently. I believe that using Unit Test concepts and infrastructure early in that process is a good thing, even better than starting with "Hello world". Why: To write a decent program even for a toy/restricted problem in a new language, you'll have to master many heterogenous concepts (control flow & variables & IO ...), you are tempted to glance over details just to get your program 'to work'. Putting (your understanding of) the facts about the new language in assertions with good descriptions (=success messages) enforces thinking thru/clearness/precision. Grouping topics and adding assertions to such groups is much easier than incorporation features from the 2. chapter of your "Learning X" book to your chapter 1 program. Why not: 'Real' Unit Tests are meant to output "1234 tests ok; 1 failure: saveWorld() chokes on negative input"; 'didactic' Unit Tests should output relevant facts about the new language like perl6 10-string.t # ### p5chop ... ok 13 - p5chop( "cbä" ) returns "ä" ok 14 - after that, victim is changed to "cb" # ### (p6) chop ... ok 27 - (p6) chop( "cbä" ) returns chopped copy: "cb" ok 18 - after that, victim is unchanged: "cbä" # ### chomp ... So (mis?)using Unit Tests may be counterproductive - practicing actions while learning you wouldn't use professionally. How: Writing 'didactic' Unit Tests in languages with lightweight testing systems (Perl 5/6) is easy; (mis?)using more elaborate systems (JUnit, CppUnit) may be not worth the effort or not suitable for a person just starting with a new language. So Is using Unit Tests as a learning tool a bad idea? Can the Unit Test tool(s) of your favourite language(s) used didactically? Should implementation details (eventually) be discussed here or over at stackoverflow.com?

    Read the article

  • Ruby: what the hell does this code saying ????

    - by wefwgeweg
    i discovered this in a dark place one day...what the hell is it supposed to do ?? def spliceElement(newelement,dickwad) dox = Nokogiri::HTML(newelement) fuck = dox.xpath("//text()").to_a fuck.each do |shit| if shit.text.include? ": " dickwad << shit.text.split(': ')[1].strip + "|" else if shit.text =~ /\s{1,}/ or shit.text =~ /\n{1,}/ puts "fuck" else dickwad << shit.text.squeeze(" ").strip + "|" end end end dickwad << "\n" end def extract(newdoc, newarray) doc = Nokogiri::HTML(newdoc) collection = Array.new newarray.each do |dong| newb = doc.xpath(dong).to_a #puts doc.xpath(dong).text collection << newb end dickwad = ""; if collection.length > 1 (0...collection.first.length).each do |i| (0...collection.length).each do |j| somefield = collection[j][i].to_s.gsub(/\s{2,}/,' ') spliceElement(somefield, dickwad) end newrow = dickwad.chop + "\n" return newrow.to_s end else collection.first.each do |shit| somefield = shit.to_s.gsub(/\s{2,}/,' ') spliceElement(somefield, dickwad) puts somefield + "\n\n" #newrow = dickwad.chop + "\n" #puts newrow #return newrow.to_s sleep 1 end end

    Read the article

  • This javascript works in every browser EXCEPT for internet explorer!

    - by user309641
    The webpage is here: http://develop.macmee.com/testdev/ I'm talking about when you click the ? on the left, it is supposed to open up a box with more content in it. It does that in every browser except IE! function question() { $('.rulesMiddle').load('faq.php?faq=rules_main',function(){//load page into .rulesMiddle var rulesa = document.getElementById('rulesMiddle').innerHTML; var rules = rulesa.split('<div class="blockbody">');//split to chop off the top above rules var rulesT = rules[1].split('<form class="block');//split to chop off below rules rulesT[0] = rulesT[0].replace('class=','vbclass');//get rid of those nasty vbulletin defined classes document.getElementById('rulesMiddle').innerHTML = rulesT[0];//readd the content back into the DIV $('.rulesMain').slideToggle();//display the DIV $('.rulesMain').center();//center DIV $('.rulesMain').css('top','20px');//align with top }); }

    Read the article

  • Database Design - Surrogate keys: Part 1 of many (Rules for Surrogate Keys, E. F. Codd and C J Date

    - by tonyrogerson
    I started writing an article for my blog on surrogate keys drawing in the original research by E F Codd and C J Date, its getting a bit big :) so I'm going to chop it up into a number of posts over the coming weeks depending on my time. I'm interested in your thoughts and if you disagree please let me know but more importantly give me references back to papers stating why you take that position. Hope it makes sense. Surrogate keys There are two factions in the world of Database Design that...(read more)

    Read the article

  • DBD::SQLite::st execute failed: datatype mismatch

    - by Barton Chittenden
    Here's a snippit of perl code: sub insert_timesheet { my $dbh = shift; my $entryref = shift; my $insertme = join(',', @_); my $values_template = '?, ' x scalar(@_); chop $values_template; chop $values_template; #remove trailing comma my $insert = "INSERT INTO timesheet( $insertme ) VALUES ( $values_template );"; my $sth = $dbh->prepare($insert); debug("$insert"); my @values; foreach my $entry (@_){ push @values, $$entryref{$entry} } debug("@values"); my $rv = $sth->execute( @values ) or die $dbh->errstr; debug("sql return value: $rv"); $dbh->disconnect; } The value of $insert: [INSERT INTO timesheet( idx,Start_Time,End_Time,Project,Ticket_Number,Site,Duration,Notes ) VALUES ( ?, ?, ?, ?, ?, ?, ?, ? );] Here are @values: [null '1270950742' '1270951642' 'asdf' 'asdf' 'adsf' 15 ''] Here's the schema of 'timesheet' timesheet( idx INTEGER PRIMARY KEY AUTOINCREMENT, Start_Time VARCHAR, End_Time VARCHAR, Duration INTEGER, Project VARCHAR, Ticket_Number VARCHAR, Site VARCHAR, Notes VARCHAR) Here's how things line up: ---- Insert Statement Schema @values ---- idx idx INTEGER PRIMARY KEY AUTOINCREMENT null: # this is not a mismatch, passing null will allow auto-increment. Start_Time Start_Time VARCHAR '1270950742' End_Time End_Time VARCHAR '1270951642' Project Project VARCHAR 'asdf' Ticket_Number Ticket_Number VARCHAR 'asdf' Site Site VARCHAR 'adsf' Duration Duration INTEGER 15 Notes Notes VARCHAR '' ... I can't see the data-type mis-match.

    Read the article

  • How to split an m4v file?

    - by Chris
    I downloaded a TV season on iTunes (.m4v files), however the files are clustered into 3 episodes each. I'd like to chop these up so that each episode is in it's own file. Googling around a while didn't provide any promising leads. What's the easiest way to split these files up? Thanks in advance, Cheers!

    Read the article

  • less -Sr colourful.log How to view colourful log in less?

    - by Vi
    Both less -r (preserve terminal control sequences) and less -S (chop long lines) work well alone. But using them together breaks things. It chops too late and it wrecks the next line. Reducing COLUMNS environment variable is no op: (man less) But if you have a windowing system which supports TIOCGWINSZ or WIOCGETD, the window system's idea of the screen size takes precedence over the LINES and COLUMNS environment variables. How to view colourful logs with less? Resoved before asked: less -SR

    Read the article

  • Large quotation marks in Word?

    - by hawbsl
    Is there a simple way in MS Word to get large quotation marks tightly round a paragraph of text, like you might see in print media to mark a quote? If you simply increase the font size of the quote character, it moves too far away from the text it's accompanying. Worse, the first and last lines start to detach from the rest of the paragraph. Here's what I mean (this is Calibri I think): But this is the desired effect (can't do this in Word, had to chop it about in a paint package):

    Read the article

  • Dev Lop

    - by Jason Franks
    Back in the early 90s, before I was a professional geek--much less a geek with a blog--I saw this old chop socky movie. I don't remember what it was called, or who was in it... all I remember is that, in one scene, the venerable sensei tells the hero: "You must develop your nunchaku technique." This became a bit fo a catchphrase amongst my high school mates. Well folks, I am developing my technuique. This blog has been renamed and the old posts removed--I could go into my reasons for this, but that would defeat the point of the exercise. Sorry if you liked 'em. It has been a good couple of years since I wrote anything here, so I doubt that I am putting out any regular readers. Will I be posting here more often, now that I've renamed and rethemed the place? I don't know. In the meantime, check it out: Bruce Lee playign ping pong with nunchaku. --JF

    Read the article

  • Separating text strings into a table of individual words in SQL via XML.

    - by Phil Factor
    p.MsoNormal {margin-top:0cm; margin-right:0cm; margin-bottom:10.0pt; margin-left:0cm; line-height:115%; font-size:11.0pt; font-family:"Calibri","sans-serif"; } Nearly nine years ago, Mike Rorke of the SQL Server 2005 XML team blogged ‘Querying Over Constructed XML Using Sub-queries’. I remember reading it at the time without being able to think of a use for what he was demonstrating. Just a few weeks ago, whilst preparing my article on searching strings, I got out my trusty function for splitting strings into words and something reminded me of the old blog. I’d been trying to think of a way of using XML to split strings reliably into words. The routine I devised turned out to be slightly slower than the iterative word chop I’ve always used in the past, so I didn’t publish it. It was then I suddenly remembered the old routine. Here is my version of it. I’ve unwrapped it from its obvious home in a function or procedure just so it is easy to appreciate. What it does is to chop a text string into individual words using XQuery and the good old nodes() method. I’ve benchmarked it and it is quicker than any of the SQL ways of doing it that I know about. Obviously, you can’t use the trick I described here to do it, because it is awkward to use REPLACE() on 1…n characters of whitespace. I’ll carry on using my iterative function since it is able to tell me the location of each word as a character-offset from the start, and also because this method leaves punctuation in (removing it takes time!). However, I can see other uses for this in passing lists as input or output parameters, or as return values.   if exists (Select * from sys.xml_schema_collections where name like 'WordList')   drop XML SCHEMA COLLECTION WordList go create xml schema collection WordList as ' <xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema"> <xs:element name="words">        <xs:simpleType>               <xs:list itemType="xs:string" />        </xs:simpleType> </xs:element> </xs:schema>'   go   DECLARE @string VARCHAR(MAX) –we'll get some sample data from the great Ogden Nash Select @String='This is a song to celebrate banks, Because they are full of money and you go into them and all you hear is clinks and clanks, Or maybe a sound like the wind in the trees on the hills, Which is the rustling of the thousand dollar bills. Most bankers dwell in marble halls, Which they get to dwell in because they encourage deposits and discourage withdrawals, And particularly because they all observe one rule which woe betides the banker who fails to heed it, Which is you must never lend any money to anybody unless they don''t need it. I know you, you cautious conservative banks! If people are worried about their rent it is your duty to deny them the loan of one nickel, yes, even one copper engraving of the martyred son of the late Nancy Hanks; Yes, if they request fifty dollars to pay for a baby you must look at them like Tarzan looking at an uppity ape in the jungle, And tell them what do they think a bank is, anyhow, they had better go get the money from their wife''s aunt or ungle. But suppose people come in and they have a million and they want another million to pile on top of it, Why, you brim with the milk of human kindness and you urge them to accept every drop of it, And you lend them the million so then they have two million and this gives them the idea that they would be better off with four, So they already have two million as security so you have no hesitation in lending them two more, And all the vice-presidents nod their heads in rhythm, And the only question asked is do the borrowers want the money sent or do they want to take it withm. Because I think they deserve our appreciation and thanks, the jackasses who go around saying that health and happi- ness are everything and money isn''t essential, Because as soon as they have to borrow some unimportant money to maintain their health and happiness they starve to death so they can''t go around any more sneering at good old money, which is nothing short of providential. '   –we now turn it into XML declare @xml_data xml(WordList)  set @xml_data='<words>'+ replace(@string,'&', '&amp;')+'</words>'    select T.ref.value('.', 'nvarchar(100)')  from (Select @xml_data.query('                      for $i in data(/words) return                      element li { $i }               '))  A(list) cross apply A.List.nodes('/li') T(ref)     …which gives (truncated, of course)…

    Read the article

  • Get system info from C program?

    - by Hamid
    I'm writing a little program in C that I want to use to output some system stats to my HD44780 16x2 character display. The system I'll be working with is a Debian ARM system and, although irrelevant, the display is on the GPIO header.(The system is a Raspberry Pi). As an initial (somewhat unambitious) attempt, I'd like to start with something simple like RAM and CPU usage (I'm new to C). I understand that if I make external command calls I need to fork() and execve() (or some equiv that will let me return the results), what I would like to know is how I go about getting the information I want in a nice clean format that I can use. Surely I will not have to call (for e.g); free -h And then use awk or similar to chop out the piece I want? There must be a cleaner way? The question should be seen as more of a generic, what is best practice for getting info about the system in C (the RAM/CPU usage are just an initial example).

    Read the article

  • Spam problem through cPanel

    - by mrtunes
    On a new website, I publicly display an email address, [email protected]. Then I set up an email forwarder in my hostmonster cPanel, so that if the public email address ever became spam ridden then we can chop off the forwarding. However, the client received a spam message that looked like the following. To: client's personal email address (not the public address) Subject: domain.com opportunities Body: marketing junk The problem is that the "to" should have said [email protected]. I am now worried that the real email address was retrieved on the backend of hostmonster.

    Read the article

  • Bash: trim a parameter from both ends

    - by Andrey Kazak
    Greetings! This are well know Bash parameter expansion patterns: ${parameter#word}, ${parameter##word} and ${parameter%word}, ${parameter%%word} I need to chop one part from the beginning and anoter part from the trailing of the parameter. Could you advice something for me please?

    Read the article

  • Code to parse user agent string?

    - by Spot
    As strange as I find this, I have not been able to find a good PHP function anywhere which will do an intelligent parse of a user agent string? Googled it for about 20 minutes now. I have the string already, I just need something that will chop it up and give me at least browser/ver/os. Know of a good snippet anywhere?

    Read the article

  • How do I delete the first line in a file?

    - by Soop
    I can't search for a particular string, since they're all very similar, but I'd like something simple to chop out the first 4 lines in a file. They're all variable length too. I've had a a think about perl, and it all seems harder than I thought, but I'd like to do it in Perl, AWK or a shell command if possible. Does anybody have a simple way of doing this?

    Read the article

  • Have macro 'return' a value

    - by bobobobo
    I'm using a macro and I think it works fine - #define CStrNullLastNL(str) {char* nl=strrchr(str,'\n'); if(nl){*nl=0;}} So it works to zero out the last newline in a string, really its used to chop off the linebreak when it gets left on by fgets. So, I'm wondering if I can "return" a value from the macro, so it can be called like func( CStrNullLastNL( cstr ) ) ; Or will I have to write a function

    Read the article

  • how to lower CPU usage for Ableton Live 8 in Mac OSX 10.6.8

    - by Travis Dtfsu Crum
    While running Ableton Live 8 after a project gets to a certain size, the audio starts to get a bit choppy and distorted. My levels are fine and is not the cause of the lag and chop. I have samples set to 1024 and the high quality button selected which I need to hear the sound. I always lower these when I'm recording audio with my mic but I need to have these turned up to be able to mix master the song. Anything I can do to lower the CPU usage? It sucks because I can't even use my iZotope Ozone plug-ins because of their CPU usage and they are AMAZING plug-ins that I would love to use.

    Read the article

  • Multiple .bkf files created in Backupexec 12.5 or 2010 related to heavy I/O?

    - by syuusuke
    Hey everyone, I was wondering if anyone who has used backupexec 12.5 or 2010 have ever experienced multiple .bkf files created for a single job. To describe what I mean by multiple files, the .bkf are being created with random file sizes under 2GB even though I've assigned the setting to chop the file after 10GB size. Some jobs will create 20x .bkf files in 1 job with file chunks ranging from 50MB to 800MB sizes. Is this is a sign of heavy I/O issues? Bandwidth limitations? I'm not sure, I'm here to seek some advices and suggestions. I've setup another backup server with the same exact settings and they seem to create a new .bkf file when 10GB limit has been reached. Although I am backing up different machines but I know my settings are an exact match to the problematic or atleast I think it's a problem.

    Read the article

  • Opening a file with a variable as name & checking for undefined values

    - by Harm De Weirdt
    Hello everyone. I'm having some problems writing data into a file using perl. sub startNewOrder{ my $name = makeUniqueFileName(); open (ORDER, ">$name.txt") or die "can't open file: $!\n"; format ORDER_TOP = PRODUCT<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<CODE<<<<<<<<AANTAL<<<<EENHEIDSPRIJS<<<<<<TOTAAL<<<<<<< . format ORDER = @<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< @<<<<<<<< @<<<< @<<<<<< @<<<<< $title, $code, $amount, $price, $total . close (ORDER); } This is the sub I use to make the file. (I translated most of it) The makeUniqueFileName method makes a fileName based upon current time("minuteshoursdayOrder"). The problem now is that I have to write in this file in another sub. sub addToOrder{ print "give productcode:"; $code = <STDIN>; chop $code; print "Give amount:"; $amount = <STDIN>; chop $amount; if($inventory{$code} eq undef){ #Does the product exist? print "This product does not exist"; }elsif($inventory{$code}[2] < $amount && !defined($inventaris{$code}[2]) ){ #Is there enough in the inventory? print "There is not enough in stock" }else{ $inventory{$code}[2] -= $amount; #write in order file open (ORDER ">>$naam.txt") or die "can't open file: $!\n"; $title = $inventory{$code}[0]; $code = $code; $amount = $inventory{$code}[2]; $price = $inventory{$code}[1]; $total = $inventory{$code}[1]; write; close(ORDER); } %inventory is a hashtable that has the productcode as key and an array with the title, price and amount as value. There are two problems here: when I enter an invalid product number, I still have to enter an amount even while my code says it should print the error directly after checking if there is a product with the given code. The second problem is that the writing doesn't seem to work. It always give's a "No such file or directory" error. Is there a way to open the ORDER file i made in the first sub without having to make $name not local? Or just a way to write in this file? I really don't know how to start here. I can't really find much info on writing a file that has been closed before, and in a different sub.. Any help is appreciated, Harm

    Read the article

1 2 3 4  | Next Page >