text

Use sed to delete all leading/following blank spaces in a text file

File1: hello world How would one delete the leading/trailing blank spaces within this file using sed - using one command (no intermediate files)? I've currently got: sed -e 's/^[ \t]*//' a > b For leading spaces. sed 's/ *$//' b > c And this for trailing spaces. ...

Where to get a list of almost all the words in English language?

I want to get some random text generated. I tried writing a basic Java programme, int nowords = r.nextInt(2000); int i, j; for (i = 0; i < nowords; i++) { int lengthofword = r.nextInt(10) + 2; for (j = 0; j < lengthofword; j++) { int ch = r.nextInt(26); System.out...

How can I prevent a Checkbox state switch when the user clicks on the text?

Hi, I have a list box with Checkboxes in it. I want to prevent the Checkbox from changing its status if the user clicks on the text next to it. I only want it to change if the small box is clicked directly. Is there any way to do this in windows forms? Greetings and thanks in advance. ...

How to remove duplicate paragraphs in multiple files?

I have two sets of files with newspaper articles in them; about 20 files with about 2000 articles, and 1 file with about 100 articles. The 100 articles in the single file should be disjoint from the others, but are in fact duplicated randomly throughout the 20 files (once each). Any ideas for an easy way to find and remove the 100 dupl...

Problem embedding font and displaying it correctly in Flash

Hi guys, I'm looking for the right textfield parameters or work-around for my latest problem here dealing with Flash fonts & text fields. I have a textFormat and textField generation some text using the Font: Franklin Gothic Book point size 8. Currently this is how the font will look when I run the movie: The bottom ®MYLOGO is a jpg ...

How to change html part of a tag with jquery ?

I have , `<span class="icon">&#9658;</span>` in Jquery I did, $(this).html('&#9660;'); and tried $(this).replaceWith('&#9660;'); too. but it displays '&#9660;' instead of converting it to a html icon like ▼. thanks ...

Text Typing Effect in iPhone cocos2d Game

In many games, when a character is speaking (dialogue), the text has a typing effect, where it looks like you are watching the character type the text. What would be a good way to achieve this look and (simple) "animation" for an iPhone game which uses cocos2d? It's good if there's a way to do it with cocos2d, but I'm not completely op...

sIFR 3 HTML text does not display, .sIFR-alternate causing problem

It seems my sIFR 3 text does not show HTML text if the Flash text is not displayed. Here's one of the pages in question: http://www.jeremyschultz.com/client/orchardplace/website/beta/volunteer/ One person has reported not seeing anything when viewing this page, and I can recreate it by removing the Flash text with Firebug. Testing wit...

JQuery change text to input

Hey guys, I have a table setup like below: <table> <tr> <td class="url"> <a href="http://www.domainname.com/page1.html" /> </td> </tr> <tr> <td class="url"> <a href="http://www.domainname.com/page2.html" /> </td> </tr> <tr> <td class="url"> <a href="http://www.domainname.com/page3.html...

A Java Library for text extraction from PDF documents preserving empty spaces and lines

Hi, do you know a Java library, with which I can extract the text of a PDF document as a string, and which also preserves all empty lines and empty spaces from the original document (as they appear in the pdf document)? I am using right now the PDFTextStripper class from the PDFBox-0.7.3 library, and I use the getText() method, which ...

getSelection() and insertNode -- Javascript Text Selection

Does anyone know how to set the browser selection to a newly / independently created range? I understand how to get the text selection from the browser, and I understand how to create a range, but I don't know how to tell the browser to change the selection to the range I've created. I would have thought it would be something like "setSe...

Remove empty new lines in a text file via grep

FILE: hello world foo bar How can when remove all the empty new lines in this FILE? Output of command: FILE: hello world foo bar ...

Remove odd lines in a text file

File: /home/USER/DIR/a http://www.here.is.a.hyper.link.net/ /home/USER/DIR/b http://www.here.is.another.hyper.link.net/ Need to remove all the odd lines in this file (PUBLIC-DIRECTORY-LIST)? Its for my batch script which can be found below (dropbox batch puburl creator): for PATH in `cat LIST` do echo $PATH dropbox puburl $PATH done ...

simple rand() question

I need a random 4 digit number right now im using rand(1000,9999) that always gives me a 4 digit number but i eliminates 0000-0999 as possible results. how do you pad a random number? (also this is eventually going to be added to a string do i need to cast the int as a string?) thanks ...

Python strategy for extracting text from malformed html pages

I'm trying to extract text from arbitrary html pages. Some of the pages (which I have no control over) have malformed html or scripts which make this difficult. Also I'm on a shared hosting environment, so I can install any python lib, but I can't just install anything I want on the server. pyparsing and html2text.py also did not seem ...

Surround all lines in a text file with quotes ('something')

I've got a list of directories that contain spaces. I need to surround them with ' ' to ensure that my batch scripts will work. How can one surround each new line with a ' and a ' (quotes). e.g. File1: /home/user/some type of file with spaces /home/user/another type of file with spaces To File2: '/home/user/some type of file wit...

How to hide vertical scrollbar in wxTextCtrl?

I'm using wxWidgets for a cross platform app. In this app, there is a text control that contains enough text to cause the vertical scrollbar to appear. However, I do not want the scrollbar to appear. There is a flag wxTE_NO_VSCROLL that works on Windows but not *nix. Any ideas? ...

SurroundContents on a range spanning multiple tags (getRangeAt problem?)

I have a script that (I think) needs to use surroundContents to wrap the selection area. Doing so allows me to append something, and then reassign the range as the selection. I believe I've narrowed the problem down to a misuse of getRangeAt, but I'm not quite sure how to correct it. Here's the brief bit of code: function getRang...

How to iterate over plain text segments with the Jericho HTML parser

Hi, For a Jericho Element, I am trying to find out how to loop over all child nodes, whether an element or plain text. Now there is Element.getNodeIterator(), but this references ALL descendants within the Element, not just the first descendants. I need the equivalent of Element.getChildSegments(). Any ideas? Thanks ...

How to convert dumbo sequence file input to tab separated text

I have in input, which could be a single primitive or a list or tuple of primitives. I'd like to flatten it to just a list, like so: def flatten(values): return list(values) The normal case would be flatten(someiterablethatisn'tastring) But if values = '1234', I'd get ['1', '2', '3', '4'], but I'd want ['1234'] And if values = ...