line

Calculating similarity between drawn lines

I need an algorithm to calculate, numerically, the degree of similarity between two drawn lines. The lines are drawn using a mouse, and are stored as a set of cartesian coordinates before being filtered and smoothed using separate algorithms. For example, within the following diagram: Lines A and B are clearly similar, but B and C are...

Decode HTML from XML with NewLine

Hi! First I parse XML and retrieve this: &#60;p&#62;&#60;strong&#62;Berns Salonger &#45; the City&#39;s The I decode it with MWFeedParser (stringByDecodingHTMLEntities) and retrieve this: <p><strong>Berns Salonger - the City's Ideal Meeting Place Note that this is only one line of many many lines which includes alot of tags. Th...

To draw a vertical line in Android when a button is pressed?

Hi, I want to draw a straight vertical line on my Android activity, when a button is pressed. Please explain how I can draw the line with a position & length I want. Elaboration: I have a linear layout with vertical orientation. A set of buttons constitute this linear layout. When I press one button, I want a line to appear to the righ...

draw track on mapview

I use following code to draw a track on the mapview, but i find that the bitmap only cache the mapview size. if some line outside the map. the bitmap will not cache. That make the track not complete. how can i solve that problem? Thank you `if ((bmap == null) || (lastZoom != mapv.getZoomLevel())) { Projection proj = mapv.getProject...

IPhone: Change line spacing in UITextView?

I've been looking all over the 'net for information/examples... I'm trying to change the line spacing of text inside a UITextView object to double spaced. I thought you could do it via Core Text, but haven't found a solution! Any example code or information would be greatly appreciated! Thanks! ...

ZedGraph - How to make a horizontal line drag-able?

I have some straight horizontal lines that I want the user be able to drag vertically. How would this be possible? I think the best parameter for line selection would be a fixed number of pixels near the line. So if mouse is +/- 2 pixels, I should change the mouse cursor and make the line drag-able.. I see the CurveItem class has prop...

How To Slice a Simple Polygon with a Line

I have a simple polygon (convex or concave, but no holes) that I need to slice into parts with a line segment. I'm not sure how to actually determine how many polygons result after the slice, or how to group the vertices. Basic convex cases the always results in 2 sub-polygons are easy, but how would I deal with a complicated concave sh...

Python - Most efficient way to find how often each possible pair of words occurs in the same line in a text file?

Hi all, This particular problem is easy to solve, but I'm not so sure that the solution I'd arrive at would be computationally efficient. So I'm asking the experts! What would be the best way to go through a large file, collecting stats (for the entire file) on how often two words occur in the same line? For instance, if the text cont...

fuzzy pixel straddling when drawing in a CATiledLayer on iPhone 4

Hi, I'm drawing a line in a CATiledLayer using the following code: - (void)drawLayer:(CALayer *)layer inContext:(CGContextRef)ctx { CGContextMoveToPoint(ctx, 130, 100.5); CGContextAddLineToPoint(ctx, 160, 100.5); CGContextSetRGBStrokeColor(ctx, 1, 0, 0, 1); CGContextSetRGBFillColor(ctx, 1, 0, 0, 1); CGContextDrawPath...

Java will not compile properly from the command line "cannot find my source files"

This has been frustrating me intensely. I am trying to compile my source code from the Windows 7 command prompt. I have added the directory in which my *.java file is located to the classpath. Yet, I still get this error: C:\Users\Alex>javac HelloThere.java javac: file not found: HelloThere.java Usage: javac use -help for a list of p...

Looking for a fast outlined line rendering algorithm

I'm looking for a fast algorithm to draw an outlined line. For this application, the outline only needs to be 1 pixel wide. It should be possible, whether by default or through an option, to make two lines connect together seemlessly, if they share a common point. Excuse the ASCII art but this is probably the best way to demonstrate it....

How to draw horizontal & vertical lines one pixel wide in Quartz?

Hi, I am having trouble drawing one pixel wide lines. All lines are perfectly horizontal or vertical (I am not drawing diagonal lines) but they do not draw cleanly. It looks like it is drawing across two pixels at a reduced alpha. No doubt due to antialiasing. I've searched the docs and forums and have come across a statement saying that...

How do cache lines work ?

I understand that the processor brings data into the cache via cache lines, which - for instance, on my atom processor - bring in about 64 bytes at a time, whatever the size of the actual data being read. My question is : Imagine that you need to read one byte from memory, which 64 bytes will be brought into the cache ? The two possib...

Terminal - Delete All Folders Not Conatining .mp3 Files

Hi, I'm using Banshee on Linux and I have it auto-organize my music collection in folder hierarchies. When I add a new album to my Music folder, Banshee automatically moves (and renames) the mp3s and puts them into the correct Artist folder. If there is no other file in the folder, then the folder is also deleted, but if other files are ...

What is the best Linux comand line server monitoring tool

I have a desktop at my house that has a SSH shell running htop that i use to keep an eye on my remote server. Do you know of any other tools that run in a shell that give more of an overview of the general server? Which maybe monitors online users, mysql, email etc... ...

eclipse java code display linenumber

what plugins do i need to install on eclipse so that .java files will show line number? how about show line number on .xml/.html as well? ...

How to allow line wrapping on my termnal?

Hi, I have VT100 and Xterm terminals and I can't line wrap with any of them. Whenever I have text, which runs out of the screen it gets cut off, instead of being put on the next line. I tried export COLUMNS=500 (more than enough I think) and also increasing the columns size for the my terminal app (SecureCRT) but nothing helped. Any sug...

linux python - can a program call itself?

I have a python program that runs a cell model continuously. when I press "A" or "B" certain functions are called - cell divide, etc. when the "esc" key is pressed the simulation exits. Is there a way for the program to exit and then restart itself when "esc" is pressed? ...

Item in listview to be displayed in single line each

Hi there, I have created a simple listview and added a few items in it. I am trying to add really long text in each item. I want this text to be displayed in single line only. the text that does not fit should fade in the corners. I have seen this kind of list in samsung galaxy s but somehow I am not able to achieve this. Can anyone hel...

Line and Line Segment intersection

How can I detect whether a line (direction d and -d from point p) and a line segment (between points p1 and p2) intersects in 2D? If they do, how can I get their intersection point. There are lots of example how to detect whether two line segments intersects but this should be even simpler case. I found this but I do not understand wha...