formatting

SQL Formatter for SQL Management Studio

I was wondering if there is a plugin/tool for SQL Server Management Studio that will format your SQL? I'm working with some large-ish stored procs that are a mangled mess of poorly formatted SQL and it'd be nice if I could just go "Select All -> Format SQL" ...

How to format a Date without using code - Format String Question

How can I achieve the following with a format string: Do 01.01.2009 ? It has to work in all languages (the example would be for Germany). So there should only be the short weekday and then the short date. I tried 'ddd d' (without the '). However, this leads to 'Do 01'. Is there maybe a character I can put before the 'd' so that it is tr...

Hiding implementation details on an email templating system written in Python

I am writing an application where one of the features is to allow the user to write an email template using Markdown syntax. Besides formatting, the user must be able to use placeholders for a couple of variables that would get replaced at runtime. The way this is currently working is very simple: the templates have the Pythonic %(var...

What's the simplest way to format a .NET DateTime according to YYYYMMDD or the like?

I have a DateTime class and wish to display it according to some format... in this case, I specifically want to format it as YYYYMMDD format. What's the best C#/.NET API function for doing this? ...

How do I change eclipse to use spaces instead of tabs?

By default eclipse indents with a hard tab character, how do I change it to spaces? ...

Remove whitespace before a field using AWK

(Almost exact duplicate of http://stackoverflow.com/questions/408469/keeping-original-format-post-passing-through-awk submitted by same person.) I have a simple question pertaining to gawk, illustrated below: 1 int blah (void) 2 { 3 if (foo) { 4 printf ("blah\n"); 5 } 6 return ...

Converting a normalized phone number to a user-friendly version

In my C# application, I use a regular expression to validate the basic format of a US phone number to make sure that the user isn't just entering bogus data. Then, I strip out everything except numbers, so this: (123) 456-7890 x1234 becomes 12345678901234 in the database. In various parts of my application, however, I would l...

Looking for a tool to quickly test C# format strings

I am constantly forgetting what the special little codes are for formatting .NET strings. Either through ToString() or using String.Format(). Alignment, padding, month vs. minute (month is uppercase M?), abbreviation vs. full word, etc. I can never remember. I have the same problem with regexes, but luckily there's Expresso to help me o...

How to format an int as currency in C#?

I want to format an int as a currency in C#, but with no fractions. For example, 100000 should be "$100,000", instead of "$100,000.00" (which 100000.ToString("C") gives). I know I can do this with 100000.ToString("$#,0"), but that's $-specific. Is there a way to do it with the currency ("C") formatter? ...

Why do multiple spaces in an HTML file show up as single spaces in the browser?

I have long recognized that any set of whitespace in an HTML file will only be displayed as a single space. For instance, this: <p>Hello. Hello. Hello. Hello. Hello.</p> displays as: Hello. Hello. Hello. Hello. Hello. This is perfectly fine, as if you need multiple spaces of...

What is the WPF XAML Data Binding equivalent of String.Format?

Or, to be more clear, how can I format a block of text (in my case, to be included within a tooltip) such that some portions of the text come from bound values. In plain C# I would use: _toolTip.Text = string.Format("{1:#0}% up, {2:#0}% down", Environment.NewLine, percentageOne, percentage2); However the WPF XAML markup for a Tex...

How to adjust >> and << behavior in Emacs (Vim emulation, indent, dedent)?

In Vim emulation mode (viper + vimpulse) << and >> are working similarly to Vim's. I would just like them to indent with 2 spaces. How do I do that? (I know, trivial. But useful) ...

How to format a DateTime like "Oct. 10, 2008 10:43am CST" in C#

Is there a clean way to format a DateTime value as "Oct. 10, 2008 10:43am CST". I need it with the proper abbreviations and the "am" (or "pm") in lower case etc etc. I've done it myself but it's ugly so I'm looking for a different take on it. Thanks. ...

How do you format date and time in Android?

How do you format correctly according to the device configuration a date and time when having year, month, day, hour and minute? ...

XSL: Formatting numbers, excluding trailing zeroes

Hi, first time SO user :) I know that I can format a number like this: format-number($value, '###,###.00') But I would like to remove the dot and the zeroes if $value is zero. So, 37368 -> 37,368 2.666667 -> 2.66 Is this possible using just number formatting (doesn't seem like it) or do I have to do something along the lines of ...

Auto formatting for vi?

Does an auto-formatting tool exist for vi that'll allow me to define per language preferences? edit: I'm not looking for syntax highlighting. I'm looking for something that will apply formatting rules to my code. (Like brace positioning, spaces around oeprators, etc) ...

GWT get users local decimal separator char

How can I get users local decimal separator character from GWT. I have found the NumberFormat utility, which only returns the whole format and provides parsing. NumberFormat.getDecimalFormat()... Is there a (simple) way to get the decimal separator, thousand separator from the decimal format. ...

css icon height issue

I want to have a standard method of formatting "Show More" links in my HTML pages. In HTML I use: <span class="showMore">Show more details</span> Then in the css, I have: .showMore {color: #0E4B82; padding-left: 18px; background:url("images/icons/add.png") no-repeat 0px 0px;} .showMore:hover {color:#F5891D; cursor: pointer; } wher...

Format string as UK phone number

I'm looking for a routine that will format a string of numbers as a UK phone number. The routine should account for UK area codes that require different formatting (i.e. London compared to Edinburgh compared to Worcester) as well as mobile numbers. My phone numbers are stored in the database as strings, containing only numeric character...

Can I reformat HTML in Visual Studio without removing blank lines ?

The HTML formatting in Visual Studio works great -- especially considering you can pick a selection and just format that. You can just select a tag or block, right click and do 'Format Selection'. You can also reformat the whole document. However I like to use a lot of whitespace in my documents to keep things organized and the reformat...