Search Results

Search found 8384 results on 336 pages for 'lines'.

Page 8/336 | < Previous Page | 4 5 6 7 8 9 10 11 12 13 14 15  | Next Page >

  • How to search file for matching whole lines?

    - by WilliamKF
    I have a command which sends to stdout a series of numbers, each on a new line. I need to determine whether a particular number exists in the list. The match needs to be exact, not a subset. For example, a simple way to approach this that does not work would be to do: /run/command/outputing/numbers | grep -c <numberToSearch> My this gives a false positive on the following list when searching for '456': 1234567 98765 23 1771 If the count is non-zero, a match was found or if it was zero, the number is not in the list. The issue with this is that the numberToSearch could match a subsequence of numbers on a line, instead I only want hits on the whole line. I looked at the man page for grep and did not see any way to only match whole lines. Is there a way to do this, or would I be better off using awk or sed or some other tool instead? I need a binary answer as to whether the number being search for is present or not.

    Read the article

  • I can't change mysql port (5.6.12) changing the lines of my.ini (windows 8)

    - by videador
    I was trying to change the port of my mysql server in my local machine but i can't. The version of mysql is 5.6.12, is an installation from wamp and I am on Windows 8. I change these lines in my my.ini file located in (C:\wamp\bin\mysql\mysql5.6.12). [client] #password = your_password port = 3307 socket = /tmp/mysql.sock [wampmysqld] port = 3307 socket = /tmp/mysql.sock key_buffer = 16M max_allowed_packet = 1M The previous values were 3306. Ok then I've reset the server installed, but it doesn't works, the mysql server is still running on 3306. Then, I rename the path of the services with this, to make sure that the my.ini is read by the mysql instance. c:\wamp\bin\mysql\mysql5.6.12\bin\mysqld.exe --defaults-file="C:\wamp\bin\mysql\mysql5.6.12\my.ini" wampmysqld But nothing, it stil doesn't works. My last bullet was to copy the content of my.ini to a file my-default.ini (a file that is placed in C:\wamp\bin\mysql\mysql5.6.12\ and that I don't know what is its mission). However it still doesn't work and the port is still 3306.

    Read the article

  • alert(line) alerts 'ac' and typeof(line) is 'string', but charAt is not a function

    - by Delirium tremens
    alert(line) alerts 'ac' typeof(line) is 'string' When I run line.charAt(0), charAt is not a function. When line is 'http://www.google.com/', it works, I think it's the UTF-8 encoding of the file that I opened... How to make charAt work with UTF-8? UPDATED: http://mxr.mozilla.org/mozilla-central/source/netwerk/dns/src/effective_tld_names.dat?raw=1 is in my extension's chrome folder as effective_tld_names.dat To run the code: authority = 'orkut.com.br'; lines = sc_geteffectivetldnames(); lines = sc_preparetouse(lines); domainname = sc_extractdomainname(authority, lines); The code: function sc_geteffectivetldnames () { var MY_ID = "[email protected]"; var em = Components.classes["@mozilla.org/extensions/manager;1"]. getService(Components.interfaces.nsIExtensionManager); var file = em.getInstallLocation(MY_ID).getItemFile(MY_ID, "chrome/effective_tld_names.dat"); var istream = Components.classes["@mozilla.org/network/file-input-stream;1"]. createInstance(Components.interfaces.nsIFileInputStream); istream.init(file, 0x01, 0444, 0); istream.QueryInterface(Components.interfaces.nsILineInputStream); var line = {}, lines = [], hasmore; do { hasmore = istream.readLine(line); lines.push(line.value); } while(hasmore); istream.close(); return lines; } function sc_preparetouse(lines) { lines = sc_notcomment(lines); lines = sc_notempty(lines); return lines; } function sc_notcomment(lines) { var line; var commentre; var matchedcomment; var replacedlines; replacedlines = new Array(); var i = 0; while (i < lines.length) { line = lines[i]; commentre = new RegExp("^//", 'i'); matchedcomment = line.match(commentre); if(matchedcomment) { lines.splice(i, 1); } else { i++; } } return lines; } function sc_notempty(lines) { var line; var emptyre; var matchedempty; var replacedlines; replacedlines = new Array(); var i = 0; while (i < lines.length) { line = lines[i]; emptyre = new RegExp("^$", 'i'); matchedempty = line.match(emptyre); if(matchedempty) { lines.splice(i, 1); } else { i++; } } return lines; } function sc_extractdomainname(authority, lines) { for (var i = 0; i < lines.length; i++) { line = lines[i]; alert(line); alert(typeof(line)); if (line.chatAt(0) == '*') { alert('test1'); continue; } if (line.chatAt(0) == '!') { alert('test2'); line.chatAt(0) = ''; } alert('test3'); checkline = sc_checknotasteriskline(authority, line); if (checkline) { domainname = checkline; } } if (!domainname) { for (var i = 0; i < lines.length; i++) { line = lines[i]; alert(line); if (line.chatAt(0) != '*') { alert('test4'); continue; } if (line.chatAt(0) == '!') { alert('test5'); line.chatAt(0) = ''; } alert('test6'); checkline = sc_checkasteriskline(authority, line); if (checkline) { domainname = checkline; } } } return domainname; } It alerts 'ac', then 'string', then nothing.

    Read the article

  • alert(line) alerts 'ac' and typeof(line) is 'string', but charAt is not a function

    - by Delirium tremens
    alert(line) alerts 'ac' typeof(line) is 'string' When I run line.charAt(0), charAt is not a function. When line is 'http://www.google.com/', it works, I think it's the UTF-8 encoding of the file that I opened... How to make charAt work with UTF-8? UPDATED: http://mxr.mozilla.org/mozilla-central/source/netwerk/dns/src/effective_tld_names.dat?raw=1 is in my extension's chrome folder as effective_tld_names.dat To run the code: authority = 'orkut.com.br'; lines = sc_geteffectivetldnames(); lines = sc_preparetouse(lines); domainname = sc_extractdomainname(authority, lines); The code: function sc_geteffectivetldnames () { var MY_ID = "[email protected]"; var em = Components.classes["@mozilla.org/extensions/manager;1"]. getService(Components.interfaces.nsIExtensionManager); var file = em.getInstallLocation(MY_ID).getItemFile(MY_ID, "chrome/effective_tld_names.dat"); var istream = Components.classes["@mozilla.org/network/file-input-stream;1"]. createInstance(Components.interfaces.nsIFileInputStream); istream.init(file, 0x01, 0444, 0); istream.QueryInterface(Components.interfaces.nsILineInputStream); var line = {}, lines = [], hasmore; do { hasmore = istream.readLine(line); lines.push(line.value); } while(hasmore); istream.close(); return lines; } function sc_preparetouse(lines) { lines = sc_notcomment(lines); lines = sc_notempty(lines); return lines; } function sc_notcomment(lines) { var line; var commentre; var matchedcomment; var replacedlines; replacedlines = new Array(); var i = 0; while (i < lines.length) { line = lines[i]; commentre = new RegExp("^//", 'i'); matchedcomment = line.match(commentre); if(matchedcomment) { lines.splice(i, 1); } else { i++; } } return lines; } function sc_notempty(lines) { var line; var emptyre; var matchedempty; var replacedlines; replacedlines = new Array(); var i = 0; while (i < lines.length) { line = lines[i]; emptyre = new RegExp("^$", 'i'); matchedempty = line.match(emptyre); if(matchedempty) { lines.splice(i, 1); } else { i++; } } return lines; } function sc_extractdomainname(authority, lines) { for (var i = 0; i < lines.length; i++) { line = lines[i]; alert(line); alert(typeof(line)); if (line.chatAt(0) == '*') { alert('test1'); continue; } if (line.chatAt(0) == '!') { alert('test2'); line.chatAt(0) = ''; } alert('test3'); checkline = sc_checknotasteriskline(authority, line); if (checkline) { domainname = checkline; } } if (!domainname) { for (var i = 0; i < lines.length; i++) { line = lines[i]; alert(line); if (line.chatAt(0) != '*') { continue; alert('test4'); } if (line.chatAt(0) == '!') { line.chatAt(0) = ''; alert('test5'); } alert('test6'); checkline = sc_checkasteriskline(authority, line); if (checkline) { domainname = checkline; } } } return domainname; } It alerts 'ac', then 'string', then nothing.

    Read the article

  • Diffplex wrapping long lines with diff highlights

    - by MicMit
    http://diffplex.codeplex.com/ I am looking at the samples provided. In these samples for the long lines they are trying NOT to wrap them which leads to horizontal scrolling. I believe, it should be possible to show those lines wrapped inside cells. In my scenario for left and right strings as input, after calling DiffPlex I just need them modified with html styles to be placed into table cells with wrapping.

    Read the article

  • Bash edit file and keep last 500 lines

    - by Lizard
    I am looking to create a cron job that opens a directory loops through all the logs i have created and deletes all lines but keep the last 500 for example. I was thinking of something along the lines of tail -n 500 filename > filename Would this work? I also not sure how to loop through a directory in bash Thanks in advance.

    Read the article

  • Python turtle module confusion

    - by John
    Hi, I'm trying to to add more lines to the triangle, so instead of 3 leading off there will be 5 depending on the parameter given but I really have no idea what to do at this stage and any help would be very welcome. Thanks in advance!:) def draw_sierpinski_triangle(tracer_on, colour, initial_modulus, line_width, initial_heading,initial_x, initial_y, steps): turtle=Turtle() turtle.name = 'Mother of all turtles' turtle.reset () turtle.tracer (tracer_on) turtle.speed ('fastest') turtle.color (colour) turtle.width (line_width) turtle.up() turtle.goto (initial_x, initial_y) turtle.down() turtle.set_heading (initial_heading) draw_sub_pattern (tracer_on, turtle, initial_modulus, 0, steps) def draw_sub_pattern (tracer_on, turtle, modulus, depth, steps): if (depth >= steps): return; x, y = turtle.position () heading = turtle.heading () # draw the pattern turtle.up() turtle.down() turtle.forward (modulus) draw_sub_pattern(tracer_on, turtle, modulus * 0.5, depth + 1, steps) turtle.up() turtle.goto(x, y) turtle.down() turtle.set_heading (heading + 120) turtle.forward (modulus) draw_sub_pattern(tracer_on, turtle, modulus * 0.5, depth + 1, steps) turtle.up() turtle.goto(x, y) turtle.down() turtle.set_heading (heading + 240) turtle.forward (modulus) draw_sub_pattern(tracer_on, turtle, modulus * 0.5, depth + 1, steps)

    Read the article

  • Sum of every N lines ; awk

    - by Sharat Chandra
    I have a file containing data in a single column .. I have to find the sum of every 4 lines and print the sum That is, I have to compute sum of values from 0-3rd line sum of line 4 to 7,sum of lines 8 to 11 and so on .....

    Read the article

  • AESlibrary only two lines

    - by user303968
    Does anyone know a c++ library that uses advanced encryption standard encryption that can achieve encryption and decryption (using counter mode) in just two lines of codes. No need of padding or buffering the plaintexts the library will take care of all this. I have had a look at crypto++, openssl and libtomcrypt but in these it seems I need to write codes to buffer and pad the plaintexts which I don't want. In brief, I need something along these lines: ciphertext = encrypt(ctr_mode(),plaintext,key) plaintext = decrypt(ctr_mode(),ciphertext,key) Thanks!

    Read the article

  • Blackberry ListField Text Wrapping - only two lines.

    - by Diego Tori
    Within my ListField, I want to be able to take any given long String, and just be able to wrap the first line within the width of the screen, and just take the remaining string and display it below and ellipsis the rest. Right now, this is what I'm using to detect wrapping within my draw paint call: int totalWidth = 0; int charWidth = 0; int lastIndex = 0; int spaceIndex = 0; int lineIndex = 0; String firstLine = ""; String secondLine = ""; boolean isSecondLine = false; for (int i = 0; i < longString.length(); i++){ charWidth = Font.getDefault().getAdvance(String.valueOf(longString.charAt(i))); //System.out.println("char width: " + charWidth); if(longString.charAt(i) == ' ') spaceIndex = i; if((charWidth + totalWidth) > (this.getWidth()-32)){ //g.drawText(longString.substring(lastIndex, spaceIndex), xpos, y +_padding, DrawStyle.LEFT, w - xpos); lineIndex++; System.out.println("current lines to draw: " + lineIndex); /*if (lineIndex = 2){ int idx = i; System.out.println("first line " + longString.substring(lastIndex, spaceIndex)); System.out.println("second line " + longString.substring(spaceIndex+1, longString.length())); }*/ //firstLine = longString.substring(lastIndex, spaceIndex); firstLine = longString.substring(0, spaceIndex); //System.out.println("first new line: " +firstLine); //isSecondLine=true; //xpos = 0; //y += Font.getDefault().getHeight(); i = spaceIndex + 1; lastIndex = i; System.out.println("Rest of string: " + longString.substring(lastIndex, longString.length())); charWidth = 0; totalWidth = 0; } totalWidth += charWidth; System.out.println("total width: " + totalWidth); //g.drawText(longString.substring(lastIndex, i+1), xpos, y + (_padding*3)+4, DrawStyle.ELLIPSIS, w - xpos); //secondLine = longString.substring(lastIndex, i+1); secondLine = longString.substring(lastIndex, longString.length()); //isSecondLine = true; } Now this does a great job of actually wrapping any given string (assuming the y values were properly offsetted and it only drew the text after the string width exceeded the screen width, as well as the remaining string afterwards), however, every time I try to get the first two lines, it always ends up returning the last two lines of the string if it goes beyond two lines. Is there a better way to do this sort of thing, since I am fresh out of ideas?

    Read the article

  • Sequencing 2 lines of JQUERY

    - by nobosh
    I have the following lines of JQUERY: // When dragging ends stop: function(event, ui) { // Replace the placeholder with the original $placeholder.after( $this.show() ).remove(); // Run a custom stop function specitifed in the settings settings.stop.apply(this); }, I don't want settings.stop.apply(this); to run UNTIL the line above is $placeholder.after( $this.show() ).remove();, right now what's happening is the settings.stop is running to early. With JQUERY, how can I Sequence these two lines to not proceed until the first is complete? Thanks

    Read the article

  • joining text files with 600M+ lines

    - by dnkb
    I have two files huge.txt and small.txt. Huge has around 600M rows and it's 14Gigs, each line has four space separated words (tokens) and finally another space separated column with a number. Small has 150K rows with a size of ~3M, a space separated word and a number. Both Files are sorted using the sort command, with no extra options. The words in both files may include apostrophes (') and dashes (-). The deisred output would contain all columns from the huge.txt and the second column (the number) from small txt where the first word of huge.txt and the first word of small.txt match. My attemtpts below failed miserably with the following error: cat huge.txt|join -o 1.1 1.2 1.3 1.4 2.2 - small.txt > output.txt join: memory exhausted What I suspect is that the sorting order isn't right somehow even though the files are pre-sorted using: sort -k1 huge.unsorted.txt > huge.txt sort -k1 small.unsorted.txt > small.txt Problems seem to appear around words that have apostrophes (') or dashes (-). I also tried dictinoary sorting using the -d option bumping into the same error at the end. I see two ways out of this but don't know how to implement any of them. 1) Any tips how to sort the files in a way that the join command considers them to be sorted properly? 2) I was thinking of calculating MD5 or some other hashes of the strings to get rid of the apostrophes and dashes, and do the sorting and joining with the hashes instead of the strings themselves an dat the "translate" back the hashes to strings, but leave the numbers intact at the end of the lines. Since there would be only 150K hashes it's not that bad. What would be a good way to calculate individual hashes for each of the strings? Some AWK magic? See file samples at the end. Thank you! sample of huge.txt had stirred me to 46 had stirred my corruption 57 had stirred old emotions 55 had stirred something in 69 had stirred something within 40 sample of small.txt caley 114881 calf 2757974 calfed 137861 calfee 71143 calflora 154624 calfskin 148347 calgary 9416465 calgon's 94846

    Read the article

  • how to detect lines of code with regex in VIM

    - by nightingale2k1
    Hi, I have so many println("") in my codes .. I know it is messy ... I want to put comment for each of the println(""); how to do that in VIM ? I mean I want to do that on multiple files. Also if possible, can it detect whether the lines has // already or not ... if the lines has been commented .. I don't want to add new //

    Read the article

  • FLOT: How to make different colored points in same data series, connected by a line?

    - by Mega Matt
    Hi all, I think I may have stumbled onto a limitation of Flot, but I'm not sure. I'm trying to represent a single data series over time. The items' "State" is represented on the Y-Axis (there are 5 of them), and time is on the X-Axis (items can change states over time). I want the graph to have points and lines connecting those points for each data series. In addition to tracking an item's State over time, I'd also like to represent it's "Status" at any of the particular points. This I would like to do by changing the color of the points. What this means is a single item may have different Statuses at different times, meaning for a single data series I need a line that connects different points (dots) of different colors. The only thing I've seen so far is the ability to specify the color for all points in a given dataseries. Does anyone know if there's a way to specify colors individually? Thanks.

    Read the article

  • Drawing connected lines with OpenGL

    - by user146780
    I'm drawing convex polygons with OpenGL. I then do the same thing but use GL_LINE_LOOP. The problem I have is the lines are not always connected. How could I ensure that the lines are always connected? In the photo below, Iv highlighted in green, the corners that are connected and in red, those that are not. I would like for them to be all like the green ones. http://img249.imageshack.us/i/notconnected.png/ Thanks

    Read the article

  • PHP how to limit lines in a string ?

    - by Axel
    Hi, i have a variable like the following and i want a function to only keep the first 20 lines, so it will strips any additional \n lines more than 20. <?php $mytext="Line1 Line2 Line3 ....." keeptwentyline($mytext); ?>

    Read the article

< Previous Page | 4 5 6 7 8 9 10 11 12 13 14 15  | Next Page >