format

print spaces with String.format()

how I can rewrite this: for (int i = 0; i < numberOfSpaces; i++) { System.out.print(" "); } using String.format()? PS I'm pretty sure that this is possible but the javadoc is a bit confusing. ...

Excel VBA Format cell as custom "h"

I have a cell with a time value as 1:23:45 AM and would like to display just the hour value or use it for other calculations. Need to do this using vba. No, I cannot format the column manually. Thanks, Sam ...

ClassName to class_name

Hi, I'm sure this is an easy one for you geeks: Say I have a String "ThisIsMyString" and I want to format it like "this_is_my_string" using Ruby. How do I do that? Matt ...

archive-like format using XML

Hi all, I'm generating some code using XSLT but the generated sources should be localized in a set of distinct files. Is there a tool/format (based on XML ?) that could be used to store the files in a jar/ar/tar-like format . I'm thinking of something like this: <?xml version="1.0"?> <archive> <file path="test/Test01.java" content-type=...

Convert a String to Number - Java

Hi, What is the easiest and correct way to convert a String number with commas (for example: 835,111.2) to a Double instance. Thanks, Rod ...

How can I obtain the displayed value instead of actual value in Excel?

I have a cell containing a date ex. "05/11/09" It is currently displayed as "11-MAY-09". How do I copy-paste or use VBA to get the string "11-MAY-09" into the cell next to it ( NOT "05/11/09")? I can't figure it out other than piecing out the date pieces by itself. ...

VC++ 6.0 application crashing inside CString::Format when %d is given.

A VC++ 6.0 application is crashing when doing a CString::Format operation with %d format specifier. This does not occur always but occurs when the application memory grows upto 100MB or more. ALso sometimes same crash observed when a CString copy is done. The call stack would look like this mfc42u!CFixedAlloc::Alloc+82 mfc42u!CString:...

Magento Email Template Help

I need to format the date in an email template. The date gets included in the plain .html email as follows. Dispatch Date: {{var order.getShippingDate()}} Is there any way I can format this date? I've tried just using the standard php date() function to format it to no avail. ...

How do I work with Time in Rails?

I've been pulling my hair out trying to work with Time in Rails. Basically I need to set all time output (core as well as ActiveSupport) to the server's local time -- no GMT, no UTC, etc. I've seen various posts relating to Time, but they usually involve someone's need to set it for each user. Mine isn't nearly as complex, I simply wa...

sql reporting services formats ( datetime, numbers ...

i put the format of a textbox using expression like Format(Fields!name.Value, "dd/MM/yyyy") can i somehow set a global format for datetime and currency/floats without having the need to set it for each textbox in part ...

Easy way to convert exec sp_executesql to a normal query?

When dealing with debugging queries using Profiler and SSMS, its pretty common for me to copy a query from Profiler and test them in SSMS. Because I use parameterized sql, my queries are all sent as exec sp_executesql queries. exec sp_executesql N'/*some query here*/', N'@someParameter tinyint', @ someParameter =2 I'll take this ...

Formatting a double output using BufferedWriter in Java

I'm working on an assignment, and have completed the code, however I am having an issue with correct formatting of the output. I am taking a text file, separating the products based by price, and appending the data to two separate files. How do I make the format of the double correct with the BufferedWriter so that it appears as money ...

rendering open office files in ruby on rails

Hi All, I'm trying to render .odf files from a controller action in a rails application. I'd like to be able to put templates inside my view folders called show.odp.erb, show.odf.erb, etc.. and have that represent the content.xml file that is inside the zip. I'd also like to be able to render these actions in the controller like so: ...

Visual studio asp.net markup formatting

Our coding standards have us putting each attribute within a tag on a separate line. However, when I have VS (2008) format the markup is lumps all the attributes together. Is there a way to change this behavior?? Thanks ...

Java library to check whether a String contains a number *without* exceptions

I'm looking for a method that returns a boolean if the String it is passed is a valid number (e.g. "123.55e-9", "-333,556"). I don't want to just do: public boolean isANumber(String s) { try { BigDecimal a = new BigDecimal(s); return true; } catch (NumberFormatException e) { return false; } } Clea...

why is embedding JSON in XML bad?

My gut tells me that putting one format in another is wrong, but I can't seem to come up with concrete reasons. <root> <stuff> thing </stuff> <more> <[!CDATA[{"a":["b","c"]}]]> </more> </root> versus just putting it in the xml <root> <stuff> thing </stuff> <more> <a> b </a> <a> c </a> </more> </root> Th...

Possible preg match miss format in php

I have this code: //fetch data $data = $_POST['list']; echo($data); echo('<br>then<br>'); $data = str_replace("\t", " ", $data); echo($data); $matches = array(); $user = array(); preg_match( "/(.+?) ((?:[A-Z])(?:[0-9]+:){3}[0-9]+) ([0-9]+) \/([0-9]+) ([0-9]+) \/ ([0-9]+)/", $data, $matches ); list(,$user['base'],$user['location'...

Why weren't new (bit width specific) printf() format option strings adoped as part of C99?

While researching how to do cross-platform printf() format strings in C (that is, taking into account the number of bits I expect each integer argument to printf() should be) I ran across this section of the Wikipedia article on printf(). The article discusses non-standard options that can be passed to printf() format strings, such as (w...

xml validator source code in C

Hi, I am looking for a C source snippet to validate XML string fromat. ex: Generalised source which checks for xml formatting. 10 must give an error for format. Thnx ...

Zend Framework, mapping the extension of a URL to the format parameter?

Hi, It is possible to map the extension of a URL, to the format parameter in ZF? I'd like the default routing to still work, including mapping parameters from the URI, so you'd be able to say: http://example.com/controller/action/param1/value1/param2/value2.json Here: $this->_getParam('format') => "json" And likewise: http:/...