formatting

Format date in String Template email

I'm creating an email using String Template but when I print out a date, it prints out the full date (eg. Wed Apr 28 10:51:37 BST 2010). I'd like to print it out in the format dd/mm/yyyy but don't know how to format this in the .st file. I can't modify the date individually (using java's simpleDateFormatter) because I iterate over a col...

WPF - TextBlock - Cannot override OnRender

Hi, I am creating a custom control by deriving TextBlock, my intention is to do some custom rendering based on some dependency properties. However the OnRender method is sealed on TextBlock. Although I can get my work done by overriding OnRenderSizeChanged, this is not correct. Any ideas on how can i do it the right way? Thanks in adva...

ASP.NET Line Breaks in Title Element

I'm trying to optimize SEO readability on our websites and one issue I've come across is ASP.NET butchering the title element of my MasterPage. Entered as such in my MasterPage (manually reformatted to remove line breaks caused by the <% %> tags): <title><asp:ContentPlaceHolder ID="TitleContent" runat="server" /> - <%=WebsiteSettings.We...

Datetime string formatting and CultureInfo

I was suprised to see FxCop complaining that I wasn't specifying a CultureInfo in the following: string s = day.ToString("ddd"); Surely the format string param in ToString is completely independent of CultureInfo? Is there any way which CultureInfo could affect the returned string? EDIT: sorry, this is a total fail of a question. It'...

vim c++ break line

Hello: How can I break long lines when writing c++ code in vim? For example, if I have something like 56 fprintf(stderr, "Syntax error reading recursion value on 57 line %d in file %s\n", line_count, filename); I get the following compile errors: :56:25: warning: missing terminating " character :56: error: missing te...

Python dictionary formating

I made a python function to convert dictionaries to formatted strings. My goal was to have a function take a dictionary for input and turn it into a string that looked good. For example, something like "{'text':'Hello', 'blah':{'hi':'hello','hello':'hi'}}" would be turned into this: text: Hello blah: hi: hello hello...

Is there a django template filter to display percentages?

I would like something similar to the string formatting from the standard library. '%' Percentage. Multiplies the number by 100 and displays in fixed ('f') format, followed by a percent sign. ...

Help with DateTime in format I need

I am working with DateTime, trying to get date in the format like this: 03.05.2010-04.05.23 that is: dd.MM.yyyy-HH.mm.ss I'm using DateTime.ParseExact to try to achieve this (maybe wrong) So far I have: var dateInFormat = DateTime.ParseExact(DateTime.Now.ToShortDateString(), "dd.MM.yyyy.HH.mm.ss", null); But can't quite get exactly...

Mixing JSP/HTML any new features or suggestions

Hi all, I guess my questions are not well described. Is this coding style (like the example below) still recommended? Aren't there any new methods of mixing html with jsp? I see some examples with the blockquote < script > < /script >. I guess that's for seperating code blockwise and not always the best way. Any suggestions, let's say...

How do I change the caption for a figure in Latex?

I would like to change the caption from being: Figure 1: ... to From left to right: ... If I try and renewcommand the figurename, they still get numbered. This is unecessary as there is only a single image in the document. Any suggestions? ...

Tool to format lines of text into array

I frequently come across this problem. I have a file: something something2 something3 which I want output as: "something","something2","something3" any quick tool for this, preferably online? ...

How do you obtain a formatted date and time for the current locale in C?

What C function should I call to obtain a formatted date and time for the locale where the program is being executed? I'm asking this question because I have run into a problem using the ClamAV daemon API. The VERSION command returns the date and time of the latest virus definitions, but the code uses a call to ctime to format it. As fa...

What does "%.6d" mean in printf

What does %.6d mean in: printf("%s.%.6d len:%d ", timestr, header->ts.tv_usec, header->len); Is it a typo? It seems %.6d is the same as %6d. ...

Delphi 2010 Code Formatter: "(MyVar as TMyType).MyMethod" is split in two lines

How to prevent the code formatter from doing this? It seems that it moves casts with "as" always a line up. Is this a bug, or is there any setting in the formatter? // Before formatting: procedure TMyFrame.WidthEditChange(Sender: TObject); begin (Properties as TMyProperties).Width := (Sender as TJvSpinEdit).AsInteger; end; // After ...

Set cell format in google spreadsheet using python api

I am using gd_client.UpdateCell to update values in a google spreadsheet and am looking for a way to update the formatting of the cell i.e. color, lines, textsize..... Can this be done? Are there examples or other documentation available? Anything to get me going would be great ...

How do I format a date column in MySQL?

My query returns the row value as "2/27/2010 12:00:00 AM" but I need to get "2/27/2010". What do I use to get the format as I need it for MySQL? ...

How can I format a double for currency using Formatter on BlackBerry?

I have a need to display a currency value in my application. There doesn't seem to be an easy way to do this with the RIM API, so I'm reduced to creating my own solution (a common refrain for BlackBerry development, unfortunately) Currently I'm using the Formatter class, from javax.microedition.locale like so protected String formatRes...

Visual Studio Formatting -- Change Method Color

The default appearance of a method for example, ".ToString()" is by default the color black. I want to make it a different color to stand out but I do not see any options that reference this option specifically. I remember one of former collegues showing me his VS IDE years ago and he had it setup this way but I cannot recall what he d...

Should a Trim method generally in the Data Access Layer or with in the Domain Layer?

I'm dealing with a database that contains data with inconsistencies such as white leading and trailing white space. In general I see a lot of developers practice defensive coding by trimming almost all strings that come from the database that may have been entered by a user at some point. In my oppinoin it is better to do such formatin...

Change paper size in the middle of a latex document?

Does anyone know how to change these length parameters in the middle of a latex document? \paperwidth \paperheight I would like to define a page size for a single page (possibly two or three). I tried v5.3 of the geometry package, which just added some new features; like \newgeometry. Unfortunately \newgeometry cannot be used to rede...