text

In HTML, how to word-break on a dash?

give a relatively simple css: <div style="width:150px;"> 12333-2333-233-23339392-332332323 </div> How do I make it so that the string stays constrained to the width of 150, and simply wraps to a newline on the hyphen? ...

Text Editor For Linux (Besides Vi)?

Let me preface this question by saying I use TextMate on Mac OSX for my text needs and I am in love with it. Anything comparable on the Linux platform? I'll mostly use it for coding python/ruby. Doing a google search yielded outdated answers. Edit: Since there has been some concern about the 'merit' of this question. I am about to ...

Formatting text in WinForm Label

Is it possible to format certain text in a WinForm Label instead of breaking the text into multiple labels? Please disregard the HTML tags within the label's text; it's only used to get my point out. For example: Dim myLabel As New Label myLabel.Text = "This is <b>bold</b> text. This is <i>italicized</i> text." Which would produce ...

Adapt Replace all strings in all tables to work with text

I have the following script. It replaces all instances of @lookFor with @replaceWith in all tables in a database. However it doesn't work with text fields only varchar etc. Could this be easily adapted? ------------------------------------------------------------ -- Name: STRING REPLACER -- Author: ADUGGLEBY -- Version: 20.05.2008 (1.2)...

Most elegant way to force a TEXTAREA element to line-wrap, *regardless* of whitespace

Html Textarea elements only wrap when they reach a space or tab character. This is fine, until the user types a looooooooooooooooooooooong enough word. I'm looking for a way to strictly enforce line breaks (eg.: even if it results in "loooooooooooo \n ooooooooooong"). The best I've found is to add a zero-width unicode space after ever...

A good algorithm similar to Levenstein but weighted for Qwerty keyboards?

I noticed some posts here on string matching, which reminded me of an old problem I'd like to solve. Does anyone have a good Levenstein-like algorithm that is weighted toward Qwerty keyboards? I want to compare two strings, and and allow for typos. Levenstein is okay, but I'd prefer to also accept spelling errors based on the physical d...

Highlight parents in xml string

Say I have: <ul> <li id="x"> <a href="x">x</a> </li> <li id="y"> <a href="y">y</a> <ul> <li id="z"> <a href="z">z</a> </li> </ul> </li> </ul> I want to add a class value to all the list items that are the parents of z. So, I want to modify y but ...

Best way to convert text files between character sets?

What is the fastest, easiest tool or method to convert text files between character sets? Specifically, I need to convert from UTF-8 to ISO-8859-15 and vice versa. Everything goes: one-liners in your favorite scripting language, command-line tools or other utilities for OS, web sites, etc. Best solutions so far: On Linux/UNIX/OS X/cy...

How to programmatically normalize music tags?

Suppose I have a large and legal collection of music that has been inconsistently tagged. I want to normalise a single field, eg Artist, so that, for example, the following artists all become the one artists: the Grateful Dead the gratefull dead grateful dead grateful dead, The So... should I be looking at trying to match against a ...

Font rendering libraries for C# / dot-NET?

Are there any free, third-party libraries for rendering arbitrarily scaled and rotated text in dot-NET applications? Although native GDI+ allows for text scaling and rotation, its methods for determining the rendered text's dimensions are not sufficiently precise and the differences in kerning as text is added to a rendered string make i...

How do I duplicate a whole line in Emacs?

I saw this same question for VIM and it has been something that I myself wanted to know how to do for Emacs. In ReSharper I use CTRL-D for this action. What is the least number of commands to perform this in Emacs? ...

Keyboard scancodes?

GNU/Linux text console, X11 not involved, indeed not even installed. Keyboard is US layout, keymap US default. Kernel version 2.20.x or later. An application written in C is getting keyboard input in translation mode, i.e. XLATE or UNICODE. When a key is pressed, the application receives the corresponding keystring. As an example, you p...

How can I detect the encoding/codepage of a text file

In our application, we receive text files (.txt, .csv, etc.) from diverse sources. When reading, these files sometimes contain garbage, because the files where created in a different/unknown codepage. Is there a way to (automatically) detect the codepage of a text file? (I use .Net / C#). The detectEncodingFromByteOrderMarks, on the ...

Text message receiving API - UK and USA

Looking for a cheap way of receiving text messages by HTTP POST or other easy way. I want it to be standard rate dedicated number (no keyword). I've looked at http://totext.net/ and it looks good for a UK number. Any other recommendations? Also, any recommendations for a US number? ...

What's the canonical way to store arbitrary (possibly marked up) text in SQL?

What do wikis/stackoverflow/etc. do when it comes to storing text? Is the text broken at newlines? Is it broken into fixed-length chunks? How do you best store arbitrarily long chunks of text? ...

SQL strip text and convert to integer

Hi all, In my database (SQL 2005) I have a field which holds a comment but in the comment I have an id and I would like to strip out just the id, and IF possible convert it to an int: 'activation successful of id 1010101' The line above is the exact structure of the data in the db field. And no I don't want to do this in the code of ...

Custom Text Wrapping in WPF

Is there a way of wrapping text in a non-rectangular container in WPF? Here is how it is done in photoshop ...

python regular expression to split paragraphs.

How would one write a regular expression to use in python to split paragraphs? A paragraph is defined by 2 linebreaks (\n). But one can have any ammount of spaces/tabs together with the line breaks, and it still should be considered as a paragraph. I am using python so the solution can use python's regular expression syntax which is ex...

How do I modify a text file in Python?

I'm using Python, and would like to insert a string into a text file without deleting or copying the file. How can I do that? ...

XML vs Text for Non-web development applications

I do alot of systems programming where my apps have no chance of being used to communicate over the web or viewed through a browser. But, there has been some push by management to use XML. For example, if I want to keep a time log I could use a text file like this: command date time project in 2008/09/23 08:00:00 PROJ1 change 2008/09/...