formatting

Formatting a period of time

In Java I have a long integer representing a period of time in milliseconds. The time period could be anything from a couple of seconds to a number of weeks. I would like to output this time period as a String with the appropriate unit. For example 3,000 should be output as "3 seconds", 61,200,000 should be output as "17 hours" and 1,81...

How to format "time with time zone" in Postgres?

I have a database field of type time with time zone. How can I query this field in EST5EDT time zone with the output format hh:mm:ss? All I can find is using multiple calls to EXTRACT: SELECT EXTRACT(HOUR FROM TIME WITH TIME ZONE '20:38:40-07' AT TIME ZONE 'EST5EDT'); [Edit:] To be clear, this query: SELECT TIME WITH TIME ZONE '...

LINQ to SQL - Format a string before saving?

I'm trying to convert an existing (non-LINQ to SQL) class into a LINQ to SQL entity class which has an existing (db column) property like: public string MyString { get { return myString; } set { myString = FormatMyString(value); } } Is there a way to do this sort of processing on the value of entity class property before savin...

Is there free text editor for JSON pretty print

Is there free text editor with JSON formatting capabilities like XML Tools for Notepad++? I tested some of Adobe AIR editors and all editors are completely lack of other must have text editing features. Ideally it should be a notepad++ plugin :). ...

How do I Create Multiple Headers with ColumnSpans in a WPF GridView?

I want to "group" some columns in a WPF GridView by having an additional header row that spans a couple of the columns in the GridView. In ASP.Net with a repeater this would look like: <asp:Repeater ID="myRepeater"> <HeaderTemplate> <table> <tr> <td></td> <td colspan="2">Group 1</td> <td ...

How can I format date by locale in Java?

I need to format date to app that has many languages, what is best way to format date, because every country has different kind of date formatting, so is it possible to format date by locale? ...

How do I define line height with Prawn when generating a pdf in rails app?

I am using prawn to generate a pdf. So far everything has been rather straight forward. I am having a problem defining the leading between lines of text. For example: when using a text_box pdf.text_box "Ipsum dolor sit amet consectetue?", :width => pdf.bounds.width - 10, :height => 150, :overflow => :ellipses This will genera...

WPF: Format Value in XAML with Decimal Seperator?

I have a little problem formatting double values in my XAML code. double price = 10300.455; This number should be displayed as 10,300.45 on US systems and as 10.300,45 on german systems. So far I managed to limit the numbers with the following Binding="{Binding price, StringFormat=F2}" But the result is 10300.45 and that is not wh...

Is there a quick way to fix line ending problems in Xcode?

I am looking at a project which contains a mix of source files - built on a variety of systems. When I attempt to compile it, I'm getting some errors from the pre-processor which suggest that my line ending formatting mix is just not cutting it. Is there a quick way to correct this in Xcode? I'm looking to globally change the line endin...

Decimal Casting

Hi, I have a decimal number like this: 62.000,0000000 I need to cast that decimal into int; it will always have zero decimal numbers; so I wont loose any precision. What I want is this: 62.000 Stored on an int variable in c#. I try many ways but it always give me an error, that the string isn't in the correct format, this is one of ...

iPhone SDK : NSString NSNumber IEEE-754

Hi everybody ! Can someone help me ? I have a NSString with @"12.34" and I want to convert it into a NSString with the same float number but in single precision 32bits binary floating-point format IEEE-754 : like @"\x41\x45\x70\xa4" (with hexa characters) or @"AEp¤"... I'm sure it's something easy but after many hours of reading the doc...

ASP.NET MVC ViewModel mapping with custom formatting

The project I'm working on has a large number of currency properties in the domain model and I'm needing for format these as $#,###.## for transmitting to and from the view. I've had a view thoughts as to different approaches which could be used. One approach could be to format the values explicitly inside the view, as in "Pattern 1" f...

ASP.NET How can i add superscript into a label control?

For example currently, the value is set with lblAmount.Text = Amount & " €" How can i add (dynamically) superscript to the € sign? ...

CSS Selector Style

I didn't see anything on here about it with a quick search, if there is let me know. Here is an example of a CSS selector I'd write. div#container div#h h1 { /* styles */ } div#container div#h ul#navi { /* styles */ } div#container div#h ul#navi li.selected { /* styles */ } I write all my CSS like. This allows me to stop from having ...

XML Database Performance and Custom Query Output Format

Greetings gurus, I need a database solution that satisfies: 1: Custom-formated output from queries. 2: Custom functions integrated into queries. Some implementations of XQuery with update facility might suite my needs. However, I'm unsure of their performance when it comes to thousands (and maybe millions) of records of various nesting...

Should I use printf in my C++ code?

So I generally use cout and cerr to write text to the console. However sometimes I find it easier to use the good old printf statement. I use it when I need to format the output. So one example of where I would use this is: // Lets assume that I'm printing coordinates... printf("(%d,%d)\n", x, y); // To do the same thing as above us...

Codeigniter: return datetime from db formatted

I'd like to format a datetime entry stored in a SQL db in a friendly format. I'm just returning a simple query as a row(date)... Is there a quick/easy way to do this? I can post examples, if need be. Right now the query is in a foreach loop: <?php print $row['exp_date']?> ...

WPF Formatting text in a TextBlock bound to a string

I have a custom control which has a string Description dependancy property as shown below: <CustomControl> <CustomControl.Description> Hello World </CustomControl.Description> </CustomControl> This description is bound in several places in TextBlock's as shown below: <Button> <Button.ToolTip> <TextBlock Te...

NSFormatter used with a NSPopUpButton

I have a NSPopUpButton whose content values are bound to an NSArray of NSNumbers. The NSPopUpButton correctly displays the array of numbers in it's popup-menu. However, when I change the selected value, I receive a message: HIToolbox: ignoring exception 'Unacceptable type of value for attribute: property = "tempo"; desired type = NSNumb...

Formatting floats in Objective C

I need to format a float (catchy title, he?) to 2 decimal places, but only if those decimal places have values that aren't zero. Example: I have a NSTextField named 'answer', after I do some math with a couple of floats, I want to assign my 'answerFloat' variable to the 'answer' NSTextField. So far I've got: [answer setStringValue:[NSS...