formatting

c# parse a string that contains conditions , key=value.

I m giving a string that contains several different combination of data. For example : string data = "(age=20&gender=male) or (city=newyork)" string data1 = "(job=engineer&gender=female)" string data2 = "(foo =1 or foo = 2) & (bar =1)" I need to parse this string and create structure out of it and i have to evaluate this to a condi...

How to correctly format text based on currency

Hello, In my application a calculation is performed which display the text to the GUI. The application multiplies a user given amount by a defined number (Say 0.85) to create a total (User types in 2, application works out 2 x 0.85). As the number that is displayed is that of a currency I am trying to correctly format the text to make ...

Formatting html.ep

Is there any tool available to just format (remove whitespace and indent correctly) an *.html.ep file? Its a template file of a perl app. Thanks ...

When using String.Format is there a simple way to add parenthesis around a string value if it is not null or empty.

I am attempting to isolate (for localization purposes) the formatting of some messages. In one of the cases, I have several parameters, some of which may be an empty string. An example is probably called for here.... If the parameters are Parameter one and Parameter two then I want the result to be Some message Parameter one (Parameter ...

Verbally format a number in Python

How do pythonistas print a number as words, like the equivalent of the Common Lisp code: [3]> (format t "~r" 1e25) nine septillion, nine hundred and ninety-nine sextillion, nine hundred and ninety-nine quintillion, seven hundred and seventy-eight quadrillion, one hundred and ninety-six trillion, three hundred and eight billion, three hu...

PHP Function to Indent PHP Code?

I'm looking for a PHP function that will take a string like this: function func() { $testing; $testing; } And turn it into something like this: function func() { $testing; $testing; } Does anyone have any recommendations? ...

Trouble posting HTML as variable in Curl

I am using CURL to post an array. It didn't work without using http_build_query(). I set one of the rows in the array like this: $postVars['key']=' <table style="border-style: solid;" width="850" align="center" bgcolor="#e9e9e9" border="3" bordercolor="#999999" cellpadding="0" cellspacing="0"> <tbody><tr> <td colspa...

Customizing the formatting output of .sass?

#foo { color:black; } Is there some sort of option to prefix a newline before the trailing } when a .css file is generated from .sass? I would appreciate it if someone included an example of combining sass --watch style.scss:style.css, which is what I'm using, along with this newline requirement. ...

Retain formatting

Im using a function to return a text file that is tab delimited and read in, the format of the text file is: 1_0 NP_250397 100.00 140 0 0 1 140 1 140 6e-54 198 1_0 NP_250378 60.00 140 0 0 1 140 1 140 6e-54 198 1_0 NP_257777 ...

Iterate a format string over a list

In Lisp, you can have something like this: (setf my-stuff '(1 2 "Foo" 34 42 "Ni" 12 14 "Blue")) (format t "~{~d ~r ~s~%~}" my-stuff) What would be the most Pythonic way to iterate over that same list? The first thing that comes to mind is: mystuff = [1, 2, "Foo", 34, 42, "Ni", 12, 14, "Blue"] for x in xrange(0, len(mystuff)-1, 3): ...

How to Un-format a document in Visual Studio 2008?

So there's a messy XML file where all white spaces between tags have been stripped, so it's a valid XML file but it's somewhat unreadable. I press the magic Ctrl+K, D, and the file is beautifully formatted. I edit it, and then I want to put it back into the compressed, hardly readable state, removing all whitespaces between the tags. H...

WD Scorpio Blue external drive gives input/output error when i try formarting in ubuntu 10.04

hey everyone i/'m to fix a WD Scorpio Blue 320Gig external hard drive on ubuntu. when i insert it into the USB port it/'s undetected however "disk utility" program recognizes it as 320GB USB HDD but not partitioned when i try formating it, i get an input/output error Error creating partition table: helper exited with exit code 1: ...

Convert seconds to Hour:Minute:Second

I need to convert seconds to Hour:Minute:Second for example : 685 converted to 00:11:25 can you please help me achieve this thanks ...

How to print vertically aligned text

I want to print an output of the following format in a file.. 1 Introduction 1 1.1 Scope 1 1.2 Relevance 1 1.2.1 Advantages 1 1.2.1.1 Economic ...

Convert and format datetime to String in C#

I have birth dates stored as datetime in SQL Server 2008 like so: 2010-04-25 00:00:00.000 What is the best way, using C#, to convert and format this into a string with a YYYYMMDD format? In the end, all I need is a string like: 20100425 Any help is greatly appreciated! ...

Is there a document markup language that can "do it all"?

I work on a lot of language-based projects, and the larger ones require semi-formal specification documents. In the past, I've used OpenOffice.org or just plain HTML for these documents, and manually converted them to whatever other formats were needed. For my current project, however, I need to generate output in several formats (HTML, ...

Objective-C: Formatting text in a string object within a plist

Hello - I am a new objective-c/iPhone developer and am wondering if there is any way to apply formatting to text within a string in a plist? I have a plist that is an array of dictionaries. Each dictionary contains a few string objects, some of which I would like to contain lists and paragraphs of information. I am calling these string...

How to preserve formatting for C++ streams?

I have the following code (simplified): ostringstream oss; oss << "Text "; oss << hex << uppercase; oss.width(8); oss.fill('0'); oss << var1 << " "; oss << var2 << " "; oss << dec << nouppercase; oss.width(1); oss << var3 << " another text." << endl; string result = oss.str(); // work with result... Where var1, var2 are unsigned...

I get weird characters when removing line breaks in my aspx files

I wrote a small .NET applications that removes all line breaks in aspx/html/css code to make it harder to read for people trying to steal my design. And surprisingly I get weird characters that appear out of nowhere such as Â, » and others. They all stay at the same places, but I have no clue why they appear. Do you have any ideas on ho...

Generate Excel using php, format cells as string number etc

I am generating an excel file using php. The file gets created how ever strings with leading zeros example 0234 get converted to 234. ...