lines

I need an algorithm for rendering soft paint brush strokes.

I have an array of mouse points, a stroke width, and a softness. I can draw soft circles and soft lines. Which algorithm should I use for drawing my array of points? I want crossed lines to look nice as well as end points. ...

count (non-blank) lines-of-code in bash

In Bash, how do I count the number of non-blank lines of code in a project? ...

Shell script/regex: extraction across multiple lines

I'm trying to write a log parsing script to extract failed events. I can pull these with grep: $ grep -A5 "FAILED" log.txt 2008-08-19 17:50:07 [7052] [14] DEBUG: data: 3a 46 41 49 4c 45 44 20 20 65 72 72 3a 30 32 33 :FAILED err:023 2008-08-19 17:50:07 [7052] [14] DEBUG: data: 20 74 65 78 74 3a 20 00 ...

How do I draw lines using XNA?

I've read a bunch of tutorials involving XNA (and it's various versions) and I still am a little confused on drawing primitives. Everything seems to be really convoluted. Can someone show me, using code, the simplest XNA implementation of drawing one or two lines on to the screen? Perhaps with a brief explanation (including the boiler...

How can I delete the last N lines of a file?

Can someone give some hints of how to delete the last n lines from a file in Perl? I have a very large file of around 400 MB, and I want to delete some 125,000 last lines from it. ...

Efficient maths algorithm to calculate intersections

For a game I am developing I need an algorithm that can calculate intersections. I have solved the problem, but the way I have done it is really nasty and I am hoping someone here might have a more elegant solution. A pair of points represent the end points of a line drawn between them. Given two pairs of points, do the drawn lines inte...

How to limit JTextArea max Rows and Coloums?

I am using JTextArea in JScrollPane I want to limit the maximum number of lines possible and the maximum chars in each line. I need that the string will be exactly like on the screen, each line will end with '\n' (if there another line after it) and the user will be able to insert only X lines and Y chars in each line. I tried to limit ...

Counting lines, words, characters and top ten words?

Hi I'm pretty new to Stack Overflow so I hope that I'm doing this correctly and that someone out there has the answer I need. I'm currently coding a program in Java with Eclipse IDE an my question is this: I need a snippet of code that does the following It's supposed to get a .TXT file containing text and from that .TXT file count t...

How can I calculate the number of lines in a text box?

I am hoping that someone can help me with a problem I've got at the moment using Compact Framework.Net 2 SP 2. At the moment I have a UI with a series of text boxes and each textbox displays the contents of a database field. These are shown one beneath another with a scroll bar on the right hand side of the form. Each textbox has a set ...

Displaying lines from text file in a batch file

Hi I'm tryin' to find a script that will let me display "linenumber# and linenumber# as well as lines#-#" from a text file in a batch file? I found this script here on this site.. @echo off setlocal enabledelayedexpansion if [%1] == [] goto usage if [%2] == [] goto usage SET /a counter=0 for /f "usebackq delims=" %%a in (%2) do ( if "...

PHP: Delete first four lines from the top in content stored in a variable

I have a variable that needs the first four lines stripped out before being displayed: Error Report Submission From: First Last, [email protected], 12345 Date: 2009-04-16 04:33:31 pm Eastern The content to be output starts here and can go on for any number of lines. I need to remove the 'header' from this data before I display it as ...

How can I keep only the first five lines in a Perl scalar?

From any kind of scalar, what regex could I use to match the first five lines of it and discard the rest? ...

Python - lines from files - all combinations

I have two files - prefix.txt and terms.txt both have about 100 lines. I'd like to write out a third file with the Cartesian product http://en.wikipedia.org/wiki/Join_(SQL)#Cross_join -about 10000 lines. What is the best way to approach this in Python? Secondly, is there a way to write the 10,000 lines to the third file in a rand...

Best way to display multiple lines of static text in C#?

Hi there, I am making a prompt in C# that instructs the user how to use the program before they can access it. What is the best way to display multiple lines of static text? Using a bunch labels doesn't seem like it would be the proper way... xD ...

What's a "Ch" in MSVC++?

I was thinking about my code, and I accidentally clicked the "Ln 74" at the botton of the MSVC++ window. I got a screen that said "Line number (1 - 136):", and it jumped the cursor to the line I entered. When I click the "Col 1" or "Ch 1" I get the same screen. I know Ln 74 means I'm on line 74, and Col 1 means I'm on column 1, but wh...

PHP: Output multiple line command-line outputs as different lines.

PHP: Output multiple line command-line outputs as different lines. Sorry if the title is difficult to understand. Basically I want my output like A, instead of B. It currently looks like B. I have tried nl2br. The script I am trying to run is: Script: echo "Virus Scan Results:"; $scanme = system('cd /var/www/upload/files; clamscan...

Ruby : Trim New blank lines

Hi All, Please help me to solve this. This is my string str = "aaa\n\n\nbbb\n\nccc\ddd\n" means four blank lines, all together eight lines I want to return this in one line Output should be like this (aaabbbcccddd) in single line I used various trim functions to get the output but still i am failing to do it. if Anyone know the pos...

Line functions in R

Hi, I was wondering if it was possible to graph three lines in R using fuctions. For instance, how could I get the functions: 3x+1 4x+2 x+1 to show up on the same graph in r? Thanks so much! ...

Batch / Find And Edit Lines in TXT file

I want to create a batch while which finds specific lines in a batch file and are able to edit these lines. Example: //TXT FILE// ex1 ex2 ex3 ex4 i want to let the batch file find 'ex3' and edit this to 'ex5' to let it look like this: ex1 ex2 ex5 ex4 ...

Find the line & edit it.

I posted another one on this,, but i had to edit it really much... What the thing bassicly is that a Batch (Maybe including VBScript) can find line 29 in a txtfile... it should edit this line. If line 29 is like this: 'option=21' it should change it to 'option=22' the problem is that this line is located more in the file. so it shou...