format

Custom formatting including dates

VB2005 In my app I present to the user an option to customize the name of the file that gets produced. The format string the program reads is something like "yyyyMMdd-%1-%2-%3-%4" which the user can customize to his liking. in this case the format of the date is yyyyMMdd and the %1 is the trip number like 1000P, %2 is the origin code l...

How to format plain text in WPF RichTextBox

hi everyone, I have developed a small chat client using WPF. In each chat window, it contains a richtextbox to display previous chat conversations and a textbox with send button to type a chat message. I want to format the display text in the richtextbox as shown below. user1: chat message goes here For the time being, I use AppendTex...

Rails saving datetime to MySQL database

I have a simple function within my model to set a completed datetime column in a database. this function worked until I tried to change the default rails format for datetime. After reading up on the issues with mysql datetime format and rails I decided to take out the formating code I had in the environment.rb It still does not save t...

How to convert String to Date without knowing the format?

Hi. I have a problem. I am trying to convert some strings to date, and I don't know the format the date is arriving. It might come as yyyy.mm.dd hh:mm:ss or MM.dd.yy hh:mm:ss and so on. How can I convert these strings to Date? I tried this: DateFormat formatter = new SimpleDateFormat("dd-MM-yyyy hh:mm:ss"); Date d = (Date)formatter.p...

How can I write in scientific notation using Perl formats?

I've always used printf, and I've never used write/format. Is there any way to reproduce printf("%12.5e", $num) using a format? I'm having trouble digesting the perlform documentation, but I don't see a straightforward way of doing this. EDIT: based on the answers I got, I'm just gonna keep on using printf. ...

How to get CSS background images to show up in HTML files opened by Word?

Hi all, My question is specifically what I'm after, but I'm also interested in 'general rules' around how to preserve styles when opening an HTML page in Word. More information on my context follows. The HTML file being opened in Word has <link ... /> elements including stylesheets. everything displays normally in a browser. So far I ...

Convert Text to Number Format In Excel

How to convert text to number, especially negative value:- 9,669.34 to 9,669.34 2,553.57- to (2,553.57) When I used this formula, =SUBSTITUTE(A1,CHAR(160),"")+0, it works well but only for positive value. I rcv'd #VALUE! for all negative values. ...

Changing Json output ASP.net MVC

Hi, I have a ASP.net MVC application that gets marker coordinates from a database (I use ActiveRecord) and outputs them as json to be used in google maps. The format however is not quite right. Does anyone know how I can change the output? Currently the output is: [ { "Id": 1, "Name": null, "Location": "13....

Oracle to_date function. Mask needed

I have string of date from xml file of such kind: '2010-09-09T22:33:44.OZ' I need to extract only date and time. I want to ignore symbol T and .OZ (time zone). Which mask I should use? Thanks in advance ...

jQuery adding html to the results

my input array has: results[num_row] = { 'title': title, 'url': url, 'support_url': support_url, 'description': description, 'contacts': contacts }; I get the results back: function formatItem(item){ var highlight = $.Autocompleter.defaults.highlight; var temp = '<span class="title">' + highlight(item.title...

add something to Jquery selection and format

Ok, so i'm trying to create an address out of some bits of code from another spot on the page. The code i'm trying to create the address from is this: <div class="adr"> <h3 class="name fn">Boardwalk Audi<div class="separator">|</div></h3> <h4 class="street street-address">5930 West Plano Pkwy</h4> <h4 class="city"> <span class=...

Style a JTextPane to have console-like formatting?

Is there a way to make the text in a JTextPane look similar to that of console output? By that I mean, basically, how each character is the same width, so that things like ASCII art, or spacing indentation would work correctly. For example, currently, if I type "First" and then 5 spaces, and then on a new line "Second" and then 4 spaces...

How to format a date in a given format

Hi all I need to format date exactly like this Dienstag 28. September 2010, 15:00 Uhr (German words), what is the best way? Thanks. I guess I have to use date function but how to compose format ...

Javascript Thousand Separator / string format

Is there any function in Javascript for formatting number and strings ? I am looking for a way for thousand separator for string or numbers... (Like String.Format In c#) ...

Need to create ChartObject in PowerPoint based on the C# chart control

Hello! I'm creating a variety of graphs within my application which are based on the .Net Chart control (using System.Windows.Forms.DataVisualization.Charting). What I'm trying to do is to allow users to copy these charts to Power Point in the "native" format, i.e. to enable them to paste special in PP and see "Microsoft Office Graphic ...

XSLT format-number with comma

Hi, I'm trying to format this and other elements alike, so it would look like this 2,590: <Add_Amount>2,59</Add_Amount> Doing it like this: <xsl:decimal-format name="dkk" decimal-separator="," grouping-separator="."/> .... <xsl:value-of select="translate(format-number(Add_Amount, '#.###,000', 'dkk'), ',', '.')" /> And the ou...

Using printf with a non-null terminated string

Suppose you have a string which is NOT null terminated and you know its exact size, so how can you print that string with printf in C? I recall such method but I can not find out know... ...

How to ensure interoperability with DataContractSerializer when talking to non-.NET app?

Say I have a non-.NET app which needs to write data to be deserialized by a .NET app via DataContractSerializer. Where's the specification describing the exact format necessary? Such a spec should describe a lot of stuff, including: Does the order of sibling elements matter? Should the xml namespace URIs always begin with http://schem...

Flex: Embedding fonts at runtime only works locally?

I'm trying to change the text format in a TextField I get from a .swf. I'm embedding my font in a myFont.swf: public class TemplateFont extends Sprite { [Embed(source='../fontFiles/geogrotesque/Geogrotesque-Regular.ttf', fontName='theFontName')] public static var FONT_TEXT:Class; } Then I'm loading it where I ne...

Convert date object to string in boost

Hi, Using the boost library how would I convert a date object: date d(2010,10,01); to a string with the format: DD-mmm-YYYY, so that variable d would become "01-Oct-2010". Now there are number of functions for converting a date object to a string such as std::string to_simple_string(date d) which returns a string in the ...