text

Windows batch command(s) to read first line from text file

How can I read the first line from a text file using a Windows batch file? Since the file is large I only want to deal with the first line. ...

newline character(s)

Does your software handle newline characters from other systems? Linux/BSD linefeed ^J 10 x0A Windows/IBM return linefeed ^M^J 13 10 x0D x0A old Macs return ^M 13 x0D others? For reasons of insanity, I am going with using the Linux version of the newline character in my text files. But, when...

How to remove accents and tilde in a C++ std::string

Hi everyone, I have a problem with a string in C++ which has several words in Spanish. This means that I have a lot of words with accents and tildes. I want to replace them for their not accented counterparts. Example: I want to replace this word: "había" for habia. I tried replace it directly but with replace method of string class but...

Parsing Performance (If, TryParse, Try-Catch)

I know plenty about the different ways of handling parsing text for information. For parsing integers for example, what kind of performance can be expected. I am wondering if anyone knows of any good stats on this. I am looking for some real numbers from someone who has tested this. Which of these offers the best performance in which si...

What is the best way to change text contained in an XML file using Python?

Let's say I have an existing trivial XML file named 'MyData.xml' that contains the following: <?xml version="1.0" encoding="utf-8" ?> <myElement>foo</myElement> I want to change the text value of 'foo' to 'bar' resulting in the following: <?xml version="1.0" encoding="utf-8" ?> <myElement>bar</myElement> Once I am done, I want to s...

How can I find the Rect of wrapped text on an iPhone?

Can anybody recommend a good method for determining the Rect of some wrapped text on an iPhone? I've tried all the built-in methods for NSString in the 2.1 SDK to no avail. The size methods never return sizes that allow me to completely fit wrapped text in my custom view. I'm drawing some user customizable text that should always be a...

Storing formatted text in a DB while maintaining abstraction.

How would you store formatted blocks of text (line breaks, tabs, lists - etc.) in a database (nothing specific) to be displayed on the web (XHTML) while maintaining a level of abstraction so that the data can be used in other applications or if the structure of the website were to change in the future? ...

Java Setting tab size in table cell renderer

I have a class which extends DefaultTableCellRenderer, which renders strings in a monospace font, with a particular color. By default, it appears that tabs are not rendered at all (0 spaces). How can I set the tab size and/or cause them to be rendered? edits: By "tabs" i mean tab characters, which I would just like to be rendered as som...

What is the most elegant way to read a text file with c++?

Hi, I'd like to read whole content of a text file to a std::string object with c++. With Python, I can write: text = open("text.txt", "rt").read() It is very simple and elegance. I hate ugly stuff, so I'd like to know what is the most elegance way to read a text file with c++? Thanks. ...

How do I set the formatting of tinyMCE?

I am using the wysiwyg editor TinyMCE and I have stripped out most of the functions to create a simpler version. However, I need the make the formatting as basic as possible as well, e.g., instead of <p> tags i need to use <br /> tags. Also, I would like it to not convert ' in &rsquo; as I will be using the output in Flash. The only edi...

How do I send text to a dom object with jQuery?

Rather than population said DOM object with an external page such as HTML CFM or PHP, what if I simply want to send text? I've tried: $("#myDOMObject").val("some text"); No errors, but the object value doesn't update either. ...

Searching for marked (selected) text in emacs

I use emacs for viewing and editing code and other text files. I wanted to know if there is a way to search forward or backward for text which is marked in the current buffer. Similar to what I can do in notepad or wordpad. As in can I mark some text in the buffer and do a C-s or C-r and be able to search with the marked text without act...

How can I extract and save text using Perl?

No extracted data output to data2.txt? What goes wrong to the code? MyFile.txt ex1,fx2,xx1 mm1,nn2,gg3 EX1,hh2,ff7 This is my desired output in data2.txt: ex1,fx2,xx1 EX1,hh2,ff7 #! /DATA/PLUG/pvelasco/Softwares/PERLINUX/bin/perl -w my $infile ='My1.txt'; my $outfile ='data2.txt'; open IN, '<', $infile or die "Cant open $in...

Convert text to 7-bit ASCII from command-line

I'm on OS X 10.5.5 (though it does not matter much I guess) I have a set of text files with fancy characters like double backquotes, ellipsises ("...") in one character etc. I need to convert these files to good old plain 7-bit ASCII, preferably without losing character meaning (that is, convert those ellipses to three periods, backqu...

What does it mean when my text is displayed as boxes?

I'm attempting to display some text in my program using (say) Windows GDI and some of the unicode characters are displayed as boxes? What is up? See also: What does it mean when my text is displayed as Question Marks? ...

What does it mean when my text is displayed as Question Marks?

I'm attempting to display some text in my program using (say) Windows GDI and some of the unicode characters are displayed as question marks? What is up? See also: What does it mean when my text is displayed as boxes? ...

Algorithms or libraries for textual analysis, specifically: dominant words, phrases across text, and collection of text

I'm working on a project where I need to analyze a page of text and collections of pages of text to determine dominant words. I'd like to know if there is a library (prefer c# or java) that will handle the heavy lifting for me. If not, is there an algorithm or multiple that would achieve my goals below. What I want to do is similar...

Convert time fields to strings in Excel

I have an excel sheet full of times. They are formatted so that they look like: 1:00:15 However if I change the format on the cells to text, they change to the underlying numeric representation of the time: 0.041840278 How can I convert the cells to be text cells but still have the time in them ? ...

Notepad replacement for viewing very large text files

I have a program that creates daily log files that are 30-60MBs in size. I often need to open these files and search for various events. Notepad.exe takes a very long time to open a file that large. I've tried various shareware programs, some are better than notepad, but they all take a while to load these log files. I'm guessing part of...

Soft hyphen in HTML (<wbr> vs. &shy;)

How do you solve the problem with soft hyphens on your web pages? In a text there can be long words which you might want to line break with a hyphen. But you do not want the hyphen to show if the whole word is on the same line. According to comments on this page <wbr> is a non standard "tag soup invented by Netscape". It seems like &shy...