format

On iphone, how can i get the system date in the proper format

Based on local user settings, I want to get the correct date format. For example, it could be any of these: 5 Jan 2010 January 5, 2010 1/5/10 And how about on windows? Thanks. ...

String has how many parameters

Before using String.Format to format a string in C#, I would like to know how many parameters does that string accept? For eg. if the string was "{0} is not the same as {1}", I would like to know that this string accepts two parameters For eg. if the string was "{0} is not the same as {1} and {2}", the string accepts 3 parameters How...

PHP convert one date into another date format

Hi, Is there a very simple way in PHP to convert one date format into another date format? I have this: $old_date = date('y-m-d-h-i-s'); // works $middle = strtotime($old_date); // returns (bool)false $new_date = date('Y-m-d H:i:s', $middle); // returns 1970-01-01 00:00:00 But I'd of course like it to r...

Using std::streams to format output

I have an object that I want to be able to stream. But I want to be able to stream it in different ways by using different formats, or should I say ways to describe this object. And I wonder how this is supposed to be solved with streams. What I want is to be able to use a generic format and use some kind of format adapter to transform...

EXE format - how to Interpret CS:IP

Hi I've got a problem with EXE format http://www.delorie.com/djgpp/doc/exe/. I've loaded my file as hex into my editor (qedit) then I disassembled that and I was surprised ! My CS equalled 0 and IP also but code of my program (maybe it's 00000040 ?) is starting several bytes later and I can't be even sure because the code which I wrote...

Rails: Alternative ways to serve multiple layouts? e.g. iphone.example.com vs. example.com/iphone

I can use this method to signal an alternative layout. someformat.example.com but when I cache that it will be in, for example public/someformat Why involve DNS and the web server if I don't have to? Is there a way to make a Rails app just stay in a url subdir, i.e. to make all url generation relative? I'm attempting this for a Fa...

Do I always have to write a converter for date-formatting?

I often use textboxes in my wpf-projects which are bound to datetime-propertys. I want to format the dates into the german format dd.MM.yyyy. Currently I do this with a self-written converter, which I can give the needed dateformat. For example like this: <TextBox Name="Date" Text="{Binding RelativeSource={RelativeSource Mode=FindAnces...

What is the Reference that we have to add to use the Format function in Visual Basic 6.0?

Hello, I'm using VB 6.0 and it gives me: "Compile Error: Can't Find Project or Library" in this sub: Private Sub MDITimer_Timer() Dim textStr As String textStr = Format(Now, "dd-mm-yyyy hh:mm:ss") StatusBar.Panels(1).Text = textStr End Sub I made it like this and the error still was in the Format function (so it is not a...

validating password format in Authlogic

Is there a way to get Authlogic to validate the format of a password, for instance must contain at least one letter and at least one number? The omission of a validates_format_of_password_options method to be used in the acts_as_authentic config block seems to indicate that Authlogic has the opinion that one should not be imposing such ...

What's this data format? It looks like some kind of reduced pseudo-XML to me...

Sorry, this might be a dumb question but I have no idea how to google this... I've got output from a CLI tool and I was wondering, what the format is called. I wouldn't want to write a parser myself if it's a common format, and I'm sure it is. It looks like this; statusList { status { int time="1260878400" value { char...

What's the point of XPS?

When I read books about WPF, I saw the authors mention XPS like it was something important. Windows also includes its XPS viewer, and I've seen that listed as a "feature" of Windows. But why? What's the point? Who the heck uses it? It's my understanding that XPS is, basically, like PDF, xhtml, or ePub (which is just xhtml)...or even Wor...

VS2008 switching between formatting logic

Hi ! I'm using Visual Studio 2008. I'm currently working with WPF and I'm using Edit->Format Document to format my source code. The problem is that I want to have formatting set total differently for style and for Controls themselves. Which means that I have to switch formatting logic every half an hour through this menu: Tools->O...

ISO-8601 week numbering vs "Outlook" numbering in PHP

I recently came across a big problem, as I have a system that's paying the customers weekly. As we all know, a year has 52 weeks, and there are standards for it. I'm using PHP aka date('W') to get the week number from a date, that calculates that according to the standard ISO-8601. Here are some references: http://www.iso.org/iso/da...

how to store and search mp3 by its content.

I want to store multiple mp3 files and search them by giving some part of song, to detect which song it is. I am thinking of storing all binary content in mysql and when I want to search for a specific song by content I will take some middle portion of song and actually match it with the binary data in MySQL. My questions are: Is thi...

WPF ComboBox a better way to format ItemsSource

Morning Guys, I have a few ComboBoxes bound to List of TimeSpan. I am formatting the TimeSpans using IValueConverter and ItemTemplate. I was wondering if there were an easier way to format the TimeSpans. Here's what I'm currently doing. public class TimeSpanConverter : IValueConverter { #region IValueConverter Members public o...

formatting currencies with Python

I would like to format integers as professional looking currency strings. For example: 1200000 -> $1.2 million 456 -> $456.00 Do you know a good library for this, ideally with localization to handle European formats. ...

PHP week of year problem?

Hi, i tried this: echo date('W'); It gives me "06" (without quotes), but I only want 6, instead of 06. Is there a way to get the week of year in single character if the week is less than 10. I have couple of ways to deal with this, like: Check if week is less than 10, then use substring. etc.. Is there any more convenient way? ...

Parse DateTime in c# from strange format

Hi, if i have a datetime string in a weird format, such as YYYY##MM##DD HH**M**SS, how can i create a new datetime object base on that? i have read something about the datetimeformatinfoclass but not sure how to get it working.. ...

xslt format-number decimal, number less than one

I have this as input called $material_price: 2.40 1000 0.60 They run through <!-- setup currency rendering --> <xsl:decimal-format name="dkk" decimal-separator="," grouping-separator="."/> <xsl:value-of select="format-number($material_price, '#.###,00', 'dkk')"/> Output is: 2,40 1.000,00 ,60 How can I make changes to the xslt so...

Java Printing a Binary Tree using Level-Order in a Specific Format

Okay, I have read through all the other related questions and cannot find one that helps with java. I get the general idea from deciphering what i can in other languages; but i am yet to figure it out. Problem: I would like to level sort (which i have working using recursion) and print it out in the general shape of a tree. So say i h...