format

How can I get the Double.toString() behaviour AND thousands separator?

I want to add the thousands separator to a variable of type double. I have tried using String.format("%,f", x); and similar, but it seems to have a fixed number of decimal places, unlike Double.toString(). For example, with the value 1234.5: Double.toString(): 1234.5 String.format(): 1.234,500000 Desired: 1.234,5 ...

Check date format before parsing

Hello! I am parsing several documments with the field Duration. But in the differents files, it is in differnt formats, ex: "Duration": "00:43" "Duration": "113.046" "Duration": "21.55 s" I want to parse all of them to the format "Duration": "113.046", how could I check before any parsing in wich format it is?? Some conditions be...

Java convert image format with low memory footprint

I'm writing a Web application that let user upload images in several formats (e.g. png,jpg,bmp). After the image has been uploaded the system should convert it to "png" and scale it to a predefined resolution. To convert the image I use the handy method: javax.imageio.ImageIO.write(im, type, baos); Here's where the problem start. The...

converting text to dat

Hi All, I have a text file that contains the following contents (hexadecimal numbers), 60 80 61 80 16 04 4a 6f 68 6e 16 01 50 16 05 53 6d 69 74 68 00 00 42 01 33 a0 80 16 08 44 69 72 65 63 74 6f 72 00 00 a1 80 16 08 31 39 37 31 30 39 31 37 00 00 a2 80 61 80 16 04 4d 61 72 79 16 01 54 16 05 53 6d 69 74 68 00 00 00 00 a3 80 31 80 61 80 1...

Delphi DBGrid Format Display Values

Hi I need to format values in a DBGrid to display in a certain format ex '#,##0.00'. Any idea how to do that? Regards, Pieter ...

Rails link_to not automagically using request.format as extension in links

I'm setting request.format = :mobile within an ApplicationController before_filter. before_filter :some_filter def some_filter request.format = :mobile end I have this mapping in routes: map.my_list '/my_list.:format', :controller => "of_no", :action => "significance" When I do the following: <%= link_to "My List", my_list_path...

How to represent a .NET DateTime 24-hour format in 01-24 instead of 00-23?

I have a strange business requirement to output dates as 01:00 through 24:00, instead of the usual 00:00 through 23:00. It is really a crazy requirement, but unfortunately I don't think I can avoid it. This will be a configuration option in our software, so I'll still need to support the normal 00-23 as well, so I'm hoping I can do thi...

python format datetime with "st", "nd", "rd", "th" (english ordinal suffix) like PHP's "S"

I would like a datetime in python to output like this: Thu the 2nd at 4:30 But I find no way in python to output st, nd, rd, or th like I can with PHP datetime format with the S string (What they call "English Ordinal Suffix") (http://uk.php.net/manual/en/function.date.php). Is there a built-in way to do this in python? strftime isn'...

How to display hexadecimal numbers in C?

I have a list of numbers as below: 0, 16, 32, 48 ... I need to output those numbers in hexadecimal as: 0000,0010,0020,0030,0040 ... I have tried solution such as: printf("%.4x",a); // where a is an integer but the result that I got is: 0000, 0001, 0002, 0003, 0004 ... I think I'm close there. Can anybody help as I'm ...

Format date with month name in polish, in python.

Is there an out of the box way to format in python (or within django templates), a date with full month name in accordance to polish language rules? I want to get: 6 września 2010 and not: >>> datetime.today().date().strftime("%d %B %Y") '06 wrzesień 2010' ...

Formatting RSA keys for OpenSSL in Java

Background RSA key generation with OpenSSL on Linux using the command, openssl genrsa -out mykey.pem 1024 created the following: "-----BEGIN RSA PRIVATE KEY----- MIICXQIBAAKBgQChs9Fepy5FgeL0gNJ8GHcKRHsYnM2Kkw19zwydDQNyh2hrHWV2 B11wpLFp8d0imcl2Wjb0oV/AxOhb3unQgNzs66LVuXJwS8icp3oIJZtExs6tkxzE s5mnU68wMeCYtJqHIZOmNblVWvpJMLNAwAVi3o...

Extension-methods VS static method resolution - what do I miss in spec?

Hi! I've added an extension method that is a shortcut to string.Format: public static string Format(this string format, params object[] args) { return String.Format(format, args); } When I invoke this method like this: "{0}".Format(1); everything works like a charm. While "{0}".Format("1"); does not compile with this error...

New Payload type for RTP profile

I am designing a new RTP profile. How can I determine the next available RTP payload type, which I can assign to my profile type? ...

How to give correct input date format in iphone?

Hi friends, I donno to give the correct date format of the input date, so please give me to correct input date format. Here my sample code and the date formats. NSString *yourXMLDate = @"Thursday, September 9, 2010"; NSDateFormatter *inputFormatter = [[NSDateFormatter alloc] init]; [inputFormatter setDateForma...

Using time command in bash script

I'd like to use the time command in a bash script to calculate the elapsed time of the script and write that to a log file. I only need the real time, not the user and sys. Also need it in a decent format. e.g 00:00:00:00 (not like the standard output). I appreciate any advice. ...

jquery datepicker sending date not as a string using .serialize()

When I am sending my date using .serialize() it is sending as an string not exact date format ...is there a way I can send it as 09/01/2010... not as a string ...

How to use java.String.format?

I am trying to use a .format method of a string. But if I place %1, %2 etc in the string, java.util.UnknownFormatConversionException is thrown pointing to a confusing Java source code piece: private void checkText(String s) { int idx; // If there are any '%' in the given string, we got a bad format // specifier. if ((idx = s.in...

inserting Datetime into SQLCE with milliseconds C#

I have a string datetime in this format "dd-MM-yyyy HH:mm:ss.fff" like so.. DateTime mydate = Convert.ToDateTime("13-09-2010 02:30:14.905"); result.SetValue(1, mydate); //I get a error saying 'String was not recognized as a valid DateTime' if i do it this way DateTime mydate = DateTime.ParseExact("13-09-2010 02:30:14.905", "dd-...

convert number to decimal in php

Hi guys, I have a number stored in a variable. The number is pulled from the database as 9900..I need to convert this number to 99.00 in order to display to a customer in HTML. I was wondering how can I achieve this in php. Thanks. ...

Vertical spacing around UL tag

One of the unintended differences between a <div> tag and a <ol> or <ul> tag is that the list tags add 20px of padding at the top and bottom of the block to whatever is specified in the style properties. In fact, using a <div><li></li><li></li></div> gives exactly the desired results. Although this workaround is apparently illegal- (qu...