text

Basic Python file searching and I/O

Hello, I'm trying to complete a simple task in Python and I'm new to the language (I'm C++). I hope someone might be able to point me in the right direction. Problem: I have an XML file (12mb) full of data and within the file there are start tags 'xmltag' and end tags '/xmltag' that represent the start and end of the data sections I w...

Show exact same selection range in two text fields

I have two text fields on top of one another. The one on top the user types into. The one behind it auto-completes out words with a light gray font. It works great, until you're up against the edge of the text field on top. How can I scroll the bottom text field along with the top to keep their text perfectly overlaid? Thanks in ad...

How to resize a button depending on its text

Hey all, In the process of translating an application with C# + Winforms, I need to change a button's text depending on the language. My problem is the following : Let's say I want to translate a button from "Hi all!" to "Bonjour tout le monde" ! As you can guess, the button's size won't be the same if I enter english text or french ...

Search a text with single quote

For example I have a list of words: men's package, moment, immensely How can I search in mysql sample text: "men's" and return only "men's package" I'm using this $str = str_replace("s", "%s", $str); If I search for "men's", it will only show: men's package but when I search for "mens" it will also show: men's package, moment, immense...

How to replace more than once?

This is my code so far: $("h1.intro:contains('|')").each(function() { $(this).html($(this).html().replace('|','</span><br /><span>')) }); This works just once, but it has to work for all of those "|"... any ideas? ...

How can I manage bits/binary in c++?

What I need to do is open a text file with 0s and 1s to find patterns between the columns in the file. So my first thought was to parse each column into a big array of bools, and then do the logic between the columns (now in arrays). Until I found that the size of bools is actually a byte not a bit, so i would be wasting 1/8 of memory,...

Python command isn't reading a .txt file.

Trying to follow the guide here, but it's not working as expected. I'm sure I'm missing something. http://docs.python.org/tutorial/inputoutput.html#reading-and-writing-files file = open("C:/Test.txt", "r"); print file file.read() file.read() file.read() file.read() file.read() file.read() Using the readline() method gives the same re...

What am I doing wrong in my Perl script written to parse a CSV file?

I have two scripts in which I'm experimenting with CSV_XS. In the first, I hard-coded everything: source directory, filename, and the csv delimiter I wanted to look for. The script works great. In the second, however, I try to dynamically discover as much as possible. That script seems to run, but it outputs nothing. I'm having trouble...

Flex: Remove all space around text in label

If I create a mx:Label or mx:Text control in Flex and then set an opaqueBackground to it, I notice that there is some space around the text. I would like to be able to get rid of that space to where the text is completely flush to the top and bottom of the label. Changing the gap, padding, and leading didn't seem to help. Is it possibl...

Text is not fully shown in JTextField

They say a single image is worth 1000 words: I'll just note that the size is set to default. (build in NetBeans) any idea how do I fix this? Adam. ...

Bash: Verifying numbers inside line closer to "big" log file

What I'm trying to do: Make a bash script that performs some tests on my system, wich than reads some log files, and in the end points me some analyzes. I have, for example, a log file (and although it's not so big sometimes, I want to save proccess when possible) that has in the end something like this: Ran 6 tests with 1 failures and...

Is there a text compression library for .NET?

I a looking for a library that can compress text. Not short string but rather pages. Is there any known library or opensource code? ...

passing text through a dictionary in Python

I currently have python code that compares two texts using the cosine similarity measure. I got the code here. What I want to do is take the two texts and pass them through a dictionary (not a python dictionary, just a dictionary of words) first before calculating the similarity measure. The dictionary will just be a list of words, alt...

mysql multi word search with one query

I'm wanting to do an ANDing or ORing in my mysql query, but the LIMIT needs to be the same regardless. eg. SELECTION * FROM table WHERE text LIKE %word1 OR word2 OR word3% LIMIT 10 I'd like this to work the same way it does on twitter, but I'm finding no help from google :( ...

Save Text From UITextVIEW ????

Hi Guys! I'm having a problem : i can' find a way to save properly my UITextView in a NSString. I have created 4 UITextViews and i want them to be saved in the same file. Heres the code : -(void)destinataireTextView { self.destiView = [[[UITextView alloc] initWithFrame:CGRectMake(200, 160, 150, 120)] autorelease]; [self.view a...

How to draw text at runtime

Basically, Im making a paint application very similar to MSPaint. The idea is that, that the the user clicks anywhere on the form and should be able to write text in a control. And then following that, that text should be displayed in g.drawstring graphic method. ...

How to Parse text data and store the same in array with splitting in j2me?

How to Parse text data and store the same in array with splitting in j2me? I have proceeded with the following code and i get to see all the text data but can't go any further. Can you guide me? /* * To change this template, choose Tools | Templates * and open the template in the editor. */ import java.io.*; import javax.microedition...

How to vertically align 2 different sizes of text?

I know to vertically align text to the middle of a block, you set the line-height to the same height of the block. However, if I have a sentence with a word in the middle, that is 2em. If the entire sentence has a line-height the same as the containing block, then the larger text is vertically aligned but the smaller text is on the same...

grabbing text between two anchor words using jquery

Hi, I'm retrieving data from a form, using Jquery's ajax method. The data is coming back fine, and I can retrieve individual div elements by id or class. My problem is this - within one div I want to retrieve specific text occuring between two constant anchor words; this text occurs right at the start of the div. I've created a string...

Convert line-broken paragraphs into single paragraphs? (Folding text?)

I have searched everywhere for an answer to this, but I think I must not be using the right lingo... I have text like this: This text is actually just one paragraph, but every few words are broken to a new line, and that's annoying as hell, because I have to go to each line and fix it by hand... Then there's a second paragraph which d...