Search Results

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

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

  • replace new lines with comas in shell

    - by mpapis
    I want to replace new lines in text with coma or space but do not change the last new line. I know of this question: How to replace new lines with tab characters - but it does produce an tab on end instead of new line. So far I have come with: awk 'NR>1{printf","} {printf $1} END{printf"\n"}' Is there an easier way to do this? This is not an assignment, I am just curious want to level up my scripting.

    Read the article

  • What is the minimal licensable source code?

    - by Hernán Eche
    Let's suppose I want to "protect" this code about being used without attribution, patenting it, or through any open source licence... #include<stdio.h> int main (void) { int version=2; printf("\r\n.Hello world, ver:(%d).", version); return 0; } It's a little obvious or just a language definition example.. When a source stop being "trivial, banal, commonplace, obvious", and start to be something that you may claim "rights"? Perhaps it depends on who read it, something that could be great geniality for someone that have never programmed, could be just obvious for an expert. It's easy when watching two sources there are 10000 same lines of code, that's a theft.. but that's not always so obvious. How to measure amount of "ownness", it's about creativity? line numbers? complexity? I can't imagine objetive answers for that, only some patches. For example perhaps the complexity, It's not fair to replace "years of engeneering" with "copy and paste". But is there any objetive index for objetive determination of this subject? (In a funny way I imagine this criterion: If the licence is longer than the code, then there is no owner, just to punish not caring storage space and world resources =P)

    Read the article

  • why does vector.size() read in one line too little?

    - by ace
    when running the following code, the amount of lines will read on less then there actually is (if the input file is main itself, or otherwise) why is this and how can i change that fact (besides for just adding 1)? #include <fstream> #include <iostream> #include <string> #include <vector> using namespace std; int main() { // open text file for input string file_name; cout << "please enter file name: "; cin >> file_name; // associate the input file stream with a text file ifstream infile(file_name.c_str()); // error checking for a valid filename if ( !infile ) { cerr << "Unable to open file " << file_name << " -- quitting!\n"; return( -1 ); } else cout << "\n"; // some data structures to perform the function vector<string> lines_of_text; string textline; // read in text file, line by line while (getline( infile, textline, '\n' )) { // add the new element to the vector lines_of_text.push_back( textline ); // print the 'back' vector element - see the STL documentation cout << "line read: " << lines_of_text.back() << "\n"; } cout<<lines_of_text.size(); return 0; }

    Read the article

  • Unexpected Blank lines in python output

    - by Martlark
    I have a bit of code that runs through a dictionary and outputs the values from it in a CSV format. Strangely I'm getting a couple of blank lines where all the output of all of the dictionary entries is blank. I've read the code and can't understand has anything except lines with commas can be output. The blank line should have values in it, so extra \n is not the cause. Can anyone advise why I'd be getting blank lines? Other times I run the missing line appears. Missing line: 6415, 6469, -4.60, clerical, 2, ,,,joe,030193027org,joelj,030155640dup Using python 2.6.5 Bit of code: tfile = file(path, 'w') tfile.write('Rec_ID_A, Rec_ID_B, Weight, Assigned, Run, By, On, Comment\n') rec_num_a = 0 while (rec_num_a <= max_rec_num_a): try: value = self.dict['DA'+str(rec_num_a)] except: value = [0,0,0,'rejected'] if (value[3]!='rejected'): weightValue = "%0.2f" % value[2] line = value[0][1:] + ', ' + value[1][1:] + ', ' + weightValue \ + ', ' + str(value[3]) + ', ' + str(value[4]) if (len(value)>5): line = line + ', ' + value[5] + ',' + value[6] + ',' + value[7] (a_pkey, b_pkey) = self.derive_pkeys(value) line = line + a_pkey + b_pkey tfile.write( line + '\n') rec_num_a +=1 Sample output 6388, 2187, 76.50, clerical, 1, ,,,cameron,030187639org,cameron,030187639org 6398, 2103, 70.79, clerical, 1, ,,,caleb,030189225org,caldb,030189225dup 6402, 2205, 1.64, clerical, 2, ,,,jenna,030190334org,cameron,020305169dup 6409, 7892, 79.09, clerical, 1, ,,,liam,030191863org,liam,030191863org 6416, 11519, 79.09, clerical, 1, ,,,thomas,030193156org,thomas,030193156org 6417, 8854, 6.10, clerical, 2, ,,,ruby,030193713org,mia,020160397org 6421, 2864, -0.84, clerical, 2, ,,,kristin,030194394org,connou,020023478dup 6423, 413, 75.63, clerical, 1, ,,,adrian,030194795org,adriah,030194795dup

    Read the article

  • Overwriting lines in file in C

    - by KáGé
    Hi, I'm doing a project on filesystems on a university operating systems course, my C program should simulate a simple filesystem in a human-readable file, so the file should be based on lines, a line will be a "sector". I've learned, that lines must be of the same length to be overwritten, so I'll pad them with ascii zeroes till the end of the line and leave a certain amount of lines of ascii zeroes that can be filled later. Now I'm making a test program to see if it works like I want it to, but it doesnt. The critical part of my code: file = fopen("irasproba_tesztfajl.txt", "r+"); //it is previously loaded with 10 copies of the line I'll print later in reverse order /* this finds the 3rd line */ int count = 0; //how much have we gone yet? char c; while(count != 2) { if((c = fgetc(file)) == '\n') count++; } fflush(file); fprintf(file, "- . , M N B V C X Y Í U Á É L K J H G F D S A Ú O P O I U Z T R E W Q Ó Ü Ö 9 8 7 6 5 4 3 2 1 0\n"); fflush(file); fclose(file); Now it does nothing, the file stays the same. What could be the problem? Thank you.

    Read the article

  • Mysterious horizontal lines on my site when rendered on iPad

    - by Ferdy
    The following site: http://staging.jungledragon.com Has a few rendering issues on the iPad using Safari, so I'm trying to fix them. There is one issue where I am stuck though. If you have an iPad, open the site in portrait mode. There are two unwanted horizontal lines appearing, a top one that crosses the tabs (Popular, Fresh, etc) and a bottom one that sits right above the lizard illustration. Both lines should not be there. These lines do not appear on any other browser tested, including Safari on Windows. When you move that same site into landscape mode on the iPad, the top horizontal line dissapears, whilst the bottom one stays. If you zoom in a bit to the bottom line, it then dissapears too. I've been trying out various CSS fixes to no avail and am now beginning to think this is a rendering issue of Safari, although possibly triggered by me. Any help is greatly appreciated. It seems like a minor issue but I hate sloppiness.

    Read the article

  • How can I set `less` or `more` max lines (scrollable height) limit/boundary in linux?

    - by Rudie
    (Sorry for the title. Any suggestions?) I've set my commandline PS1 to cover 3 lines: white space user, server and pwd $ or # to input I think less (or more?) is configured to break after window's height - 1, because when I do a $ git log, the first two lines are invisible at the top of the window and the rest is scrollable. I'm not sure who handles this scrolling and its configuration, but I assume GIT uses less/more. Where can I configure that my scrollable window is window height - 3 lines and not window height - 1? More info: If I cat lines.txt | less with a 23 line file, it shows the entire file and no scrolling. If I do the same with a 24 line file, it doesn't show line 1 (and no scrolling). With 25 lines: doesn't show lines 1 and 2 (and no scrolling). With 26 lines: shows line 1 and scrolling! The less breakpoint is at the wrong height...

    Read the article

  • Lines don't overlap when they should Java Swing

    - by Sven
    I'm drawing lines in a JFrame on a self made gridPanel. Problem is, I draw the lines between 2 points. When I have a line that is between point 1 and point 2 and a line between point 2 and point 3, the lines should connect. This however isn,t the case, there is a small gap in between, no idea why. But it isn't drawing till the end of the specified point. (start point is correct.) Here is the code of the JFrame: public void initialize(){ this.setLayout(new BorderLayout()); this.setPreferredSize(new Dimension(500, 400)); gridPane = new GridPane(); gridPane.setBackground(Color.WHITE); gridPane.setSize(this.getPreferredSize()); gridPane.setLocation(0, 0); this.add(gridPane,BorderLayout.CENTER); //createSampleLabyrinth(); drawWall(0,5,40,5); //These are the 2 lines that don't connect. drawWall(40,5,80,5); this.pack(); } drawWall calls a method that calls a method in GridPane. The relevant code in gridPane: /** * Draws a wall on this pane. With the starting point being x1, y1 and its end x2,y2. * @param x1 * @param y1 * @param x2 * @param y2 */ public void drawWall(int x1, int y1, int x2, int y2) { Wall wall = new Wall(x1,y1,x2,y2, true); wall.drawGraphic(); wall.setLocation(x1, y1); wall.setSize(10000,10000); this.add(wall, JLayeredPane.DEFAULT_LAYER); this.repaint(); } This method creates a wall and puts it in the Jframe. The relevant code of the wall: public class Wall extends JPanel { private int x1; private int x2; private int y1; private int y2; private boolean black; /** * x1,y1 is the start point of the wall (line) end is x2,y2 * * @param x1 * @param y1 * @param x2 * @param y2 */ public Wall(int x1, int y1, int x2, int y2, boolean black) { this.x1 = x1; this.x2 = x2; this.y1 = y1; this.y2 = y2; this.black = black; setOpaque(false); } private static final long serialVersionUID = 1L; public void drawGraphic() { repaint(); } public void paintComponent(Graphics g) { super.paintComponent(g); Graphics2D g2 = (Graphics2D) g; if(black){ g2.setColor(Color.BLACK); g2.setStroke(new BasicStroke(8)); } else { g2.setColor(Color.YELLOW); g2.setStroke(new BasicStroke(3)); } g2.drawLine(x1, y1, x2, y2); } } So, where am I going wrong? The true/false is to determine if the wall should be black or yellow, nothing to be concerned about.

    Read the article

  • How To Draw More Precise Lines using Core Graphics and CALayer

    - by user308444
    Hello I am having a hard time making this UI element look the way I want (see screenshot). Notice the image on the right--how the line width and darkness looks inconsistent compared to the image on the left (which happens to be a screen grab from safari) where the border width is more consistent. How does apple make their lines so perfect? I'm using a CALayer and the Core Graphics API to draw the image on the right. Is it possible to draw such perfect lines with the standard apis?

    Read the article

  • awk and cat - How to ignore multiple lines?

    - by Filipe YaBa Polido
    I need to extract Voip log from a D-Link router, so I've setup a little python script that executes a command in this router via telnet. My script does a "cat /var/log/calls.log" and returns the result, however... it also sends non-important stuff, like the BusyBox banner, etc... How can I ignore lines from 1 to 6 and the last 2 ? This is my current output: yaba@foobar:/stuff$ python calls.py BusyBox v1.00 (2009.04.09-11:17+0000) Built-in shell (msh) Enter 'help' for a list of built-in commands. DVA-G3170i/PT # cat /var/call.log 1 ,1294620563,2 ,+351xxx080806 ,xxx530802 ,1 ,3 ,1 DVA-G3170i/PT # exit And I just need: 1 ,1294620563,2 ,+351xxx080806 ,xxx530802 ,1 ,3 ,1 (it can have multiple lines) So that I can save it to a CSV and later to a sql db. Thanks, and sorry my bad english.

    Read the article

  • PDF Disable Anti-alias on Lines

    - by Travis
    I'm creating a dynamically generated PDF using FPDF. My PDF requires many exactly horizontal/vertical lines in a grid and when rendered they are anti-aliased and look very fuzzy and unacceptable to the client. I need to remove the anti-aliasing for these(or all) lines in the doc. I know this is possible because it's shown correctly in the adobe pdf specs itself http://www.adobe.com/devnet/acrobat/pdfs/PDF32000_2008.pdf (warning: big file) see the box in page 2 for how this should look. How would I duplicate the box shown on this page?

    Read the article

  • filter to reverse lines of a text file

    - by Greg Hewgill
    I'm writing a small shell script that needs to reverse the lines of a text file. Is there a standard filter command to do this sort of thing? My specific application is that I'm getting a list of Git commit identifiers, and I want to process them in reverse order: git log --pretty=oneline work...master | grep -v DEBUG: | cut -d' ' -f1 | reverse The best I've come up with is to implement reverse like this: ... | cat -b | sort -rn | cut -f2- This uses cat to number every line, then sort to sort them in descending numeric order (which ends up reversing the whole file), then cut to remove the unneeded line number. The above works for my application, but may fail in the general case because cat -b only numbers nonblank lines. Is there a better, more general way to do this?

    Read the article

  • MATLAB fill area between lines

    - by dustynrobots
    I'm trying to do something similar to what's outlined in this post: MATLAB, Filling in the area between two sets of data, lines in one figure but running into a roadblock. I'm trying to shade the area of a graph that represents the mean +/- standard deviation. The variable definitions are a bit complicated but it boils down to this code, and when plotted without shading, I get the screenshot below: x = linspace(0, 100, 101)'; mean = torqueRnormMean(:,1); meanPlusSTD = torqueRnormMean(:,1) + torqueRnormStd(:,1); meanMinusSTD = torqueRnormMean(:,1) - torqueRnormStd(:,1); plot(x, mean, 'k', 'LineWidth', 2) plot(x, meanPlusSTD, 'k--') plot(x, meanMinusSTD, 'k--') But when I try to implement shading just on the lower half of the graph (between mean and meanMinusSTD) by adding the code below, I get a plot that looks like this: fill( [x fliplr(x)], [mean fliplr(meanMinusSTD)], 'y', 'LineStyle','--'); It's obviously not shading the correct area of the graph, and new near-horizontal lines are being created close to 0 that are messing with the shading. Any thoughts? I'm stumped.

    Read the article

  • Git tool to remove lines from staging if they consist only of changes in whitespace

    - by Max Howell
    The point in removing trailing whitespace is that if everyone does it always then you end up with a diff that is minimal, ie. it consists only of code changes and not whitespace changes. However when working with other people who do not practice this, removing all trailing whitespace with your editor or a pre-commit hook results in an even worse diff. You are doing the opposite of your intention. So I am asking here if there is a tool that I can run manually before I commit that unstages lines from staging that are only changes in whitespace. Also a bonus would be to change the staged line to have trailing whitespace removed for lines that have code changes. Also a bonus would be to not do this to Markdown files (as trailing space has meaning in Markdown). I am asking here as I fully intend to write this tool if it doesn't already exist.

    Read the article

  • iphone quartz drawing 2 lines on top of each other causes worm effect

    - by Leonard
    I'm using Quartz-2D for iPhone to display a route on a map. The route is colored according to temperature. Because some streets are colored yellow, I am using a slightly thicker black line under the route line to create a border effect, so that yellow parts of the route are spottable on yellow streets. But, even if the black line is as thick as the route line, the whole route looks like a worm (very ugly). I tought this was because I was drawing lines from waypoint to waypoint, instead using the last waypoint as the next starting waypoint. That way if there is a couple of waypoints missing, the route will still have no cuts. What do I need to do to display both lines without a worm effect? -(void) drawRect:(CGRect) rect { CSRouteAnnotation* routeAnnotation = (CSRouteAnnotation*)self.routeView.annotation; // only draw our lines if we're not int he moddie of a transition and we // acutally have some points to draw. if(!self.hidden && nil != routeAnnotation.points && routeAnnotation.points.count > 0) { CGContextRef context = UIGraphicsGetCurrentContext(); Waypoint* fromWaypoint = [[Waypoint alloc] initWithDictionary:[routeAnnotation.points objectAtIndex:0]]; Waypoint* toWaypoint; for(int idx = 1; idx < routeAnnotation.points.count; idx++) { toWaypoint = [[Waypoint alloc] initWithDictionary:[routeAnnotation.points objectAtIndex:idx]]; CLLocation* fromLocation = [fromWaypoint getLocation]; CGPoint fromPoint = [self.routeView.mapView convertCoordinate:fromLocation.coordinate toPointToView:self]; CLLocation* toLocation = [toWaypoint getLocation]; CGPoint toPoint = [self.routeView.mapView convertCoordinate:toLocation.coordinate toPointToView:self]; routeAnnotation.lineColor = [fromWaypoint.weather getTemperatureColor]; CGContextBeginPath(context); CGContextSetLineWidth(context, 3.0); CGContextSetStrokeColorWithColor(context, [UIColor blackColor].CGColor); CGContextMoveToPoint(context, fromPoint.x, fromPoint.y); CGContextAddLineToPoint(context, toPoint.x, toPoint.y); CGContextStrokePath(context); CGContextClosePath(context); CGContextBeginPath(context); CGContextSetLineWidth(context, 3.0); CGContextSetStrokeColorWithColor(context, routeAnnotation.lineColor.CGColor); CGContextMoveToPoint(context, fromPoint.x, fromPoint.y); CGContextAddLineToPoint(context, toPoint.x, toPoint.y); CGContextStrokePath(context); CGContextClosePath(context); fromWaypoint = toWaypoint; } [fromWaypoint release]; [toWaypoint release]; } } Also, I get a <Error>: CGContextClosePath: no current point. error, which I think is bullshit. Please hint me! :)

    Read the article

  • iPhone, I can send accelerometer data via wifi only 248 lines

    - by newbie
    I have created one application on iPhone. I build an application that gather accelerometer value and pass this value to c# server in realtime via wifi connection. I use NSStream with IP and port number. I was working perfectly, but now I realize that it stops after fetch value only 248 lines. I tried to write this value in text file locally on iPhone. I can obtain more than 260 lines of data. Therefore, I suspect that it has some limitation or other problems on NSStream of wifi connection.

    Read the article

  • iPhone CGContext: drawing two lines with two different colors

    - by phonecoddy
    I am having some troubles using the CGContext with an iPhone app. I am trying to draw several lines with different colors, but all the lines always end up having to color, which was used last. I tried several approaches I could think of, but haven't been lucky. I set up a small sample project to deal with that issue. This is my code, I use in the drawRect method. I am trying to draw a red and a blue line: - (void)drawRect:(CGRect)rect{ NSLog(@"drawrect!"); CGContextRef bluecontext = UIGraphicsGetCurrentContext(); CGContextSetLineWidth(bluecontext, 2.0); CGContextSetStrokeColorWithColor(bluecontext, [UIColor blueColor].CGColor); CGContextMoveToPoint(bluecontext, 1, 1); CGContextAddLineToPoint(bluecontext, 100, 100); CGContextSetStrokeColorWithColor(bluecontext, [UIColor redColor].CGColor); CGContextAddLineToPoint(bluecontext, 200, 100); CGContextStrokePath(bluecontext); } thanks for your help

    Read the article

  • Qt4.6: QTextDocument <HR> tag prints only very thin, almost invisible hair lines

    - by hurikhan77
    When printing a QTextDocument with doc->print() I almost cannot see the horizontal rules inserted by <hr>. When printing to PDF these are clearly visible. But when printed to a printer these lines are very very thin lines, almost invisible on the paper. How do I fix this? I currently helped myself by inserting an <img> with a black pixel but this is very cumbersome as I have to exactly figure out the proper pixel width by trial and error.

    Read the article

  • How do I get rid of extra lines in my output from Rails

    - by Dan B
    I am using Rails 2.1 to output tables from a database. But the output includes lots of extra lines and tabs. I am using a while loop with lots of nested if statements. I am also wrapping all of my non-output lines in <%- code -%. Any idea what might be happening and a solution? Thanks, ex: <tr> <td>Some data</td> <td>more data</td>

    Read the article

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