formatting

Formatting problems when fetching feeds

When I fetch data from a feed I store it in a table, the problem is that the format of the quote, so It will store ’ instead of ' (I hope you can see the difference) You get the same thing when you copy paste code from a website or word document in your editor. the problem is that when I display the content on my site I get the followi...

What's the best way to get the UTC offset in Perl?

I need to get the UTC offset of the current time zone in Perl in a cross platform (Windows and various flavors of Unix) way. It should meet this format: zzzzzz, which represents ±hh:mm in relation to UTC It looks like I should be able to get it via strftime(), but it doesn't appear to be consistent. Unix: Input: perl -MPOSIX -e ...

Exporting to Excel from a CrystalReportsViewer

Hi, I'm actually using the crystal report provide by Visual Studio 2008. I'm developping a wpf application in c#. So, i'm making a xmldoc and provide it to my crystalreport,and everything works properly,except when i want to export to excel from the crystalreportviewer. In my report,i have many data which are numbers like float,int......

.net Format decimal to two places or a whole number

For 10 I want 10 and not 10.00 For 10.11 I want 10.11 Is this possible without code? i.e. by specifying a format string alone simlar to {0:N2} Thanks! ...

Is there any way of troubleshooting Reporting Services formatting?

I'm using Reporting Services 2005, and keep running into issues like blank sheets between report pages. I'm trying to find some way of figuring out what I need to do to fix them. I'm assuming it's a border width issue or something. I've tried putting borders around items, but it doesn't seem to be telling me what to do to fix it. (Th...

what is scanf("%*s") and scanf("%*d") format identifiers ?

What is the practical use of the formats "%*" in scanf(). If this format exists, there has to be some purpose behind it. The following program gives weird output. #include<stdio.h> int main() { int i; char str[1024]; printf("Enter text: "); scanf("%*s", &str); printf("%s\n", str); printf...

Language for plain text documentation

Hi, I think about storing project documentation in plain text format. The primary reasons/requirements are: easy for source controls systems to manage and track versions; simple to edit (any text editor); REDUNDANT - no additional software required for preparing the document (not generating the formatted result); can be formatted to H...

Formatting Output

Hello fellow www-people! I need to output numbers in scientific notation such that there is always a "0" before the decimal point. e.g. For the number x = 134.87546, I need to produce the output 0.134875E03 NOT 1.348755E02 Does someone know how to do this? Thanks in Advance --Shiraz. ...

How can I get php source code to display neatly on my website?

Hi, is there some Javascript/CSS snippet or perhaps another solution to parse PHP source code intended as content on a web page so that it has highlighted elements for commands, variables, brackets etc? ...

Simpler way to format bytesize in a human readable way?

Hi, I came up with the following solution to format an integer (bytesize of a file). Is there any better/shorter solution? I esacially don't like the float_as_string() part. human_filesize(Size) -> KiloByte = 1024, MegaByte = KiloByte * 1024, GigaByte = MegaByte * 1024, TeraByte = GigaByte * 1024, PetaByte = TeraByte * 1024, ...

Is it possible to use String.format for a conditional decimal point?

In java, is it possible to use String.format to only show a decimal if there is actually a need? For example, if I do this: String.format("%.1f", amount); it will format: "1.2222" -> "1.2" "1.000" -> "1.0" etc, but in the second case (1.000) I want it to return just "1". Is this possible with String.format, or am going to have to us...

How to convert percentage string to double?

I have a string like "1.5%" and want to convert it to double value. It can be done simple with following: public static double FromPercentageString(this string value) { return double.Parse(value.SubString(0, value.Length - 1)) / 100; } but I don't want to use this parsing approach. Is any other approach with IFormatProvider or ...

Need tool to format html (indent, add whitespace)

I am working on a .net project that generates html. When the html string is generated, the is no whitespace or indenting. This makes understanding the generated html difficult. Is there a tool that will take my string of generated html and format it so that it looks nice? ...

Monodevelop reformat strings

In MonoDevelop when I select the "Format" menu to clean up the code spacing it converts this code: string a =@" sdfsdf sdfsdf sdfsdf"; into single line string a = @"sdfsdf\n\sdfsdf\n\sdfsdf\n\n"; Is there a way to tell the formatter to ignore strings on multiple lines? ...

How do I retrieve the locale-specific date format string in Flex / ActionScript 3?

How do I retrieve the locale-specific date format string in Flex / ActionScript 3? I am unable to find a method to return the actual format string (that which specifies the date format) based on the current locale. I am asking this question because I was hoping to find a way to convert a String to a Date based on the current SHORT date...

Java Date issues

Hi All, Im having a problem with java date's, when i pass a date before 1949 into the bellow method. The date i have returned is for example 2049, im aware it has somthing to do with the date format and thought using yyyy instead of RRRR would have fixed it. But i just dont understand why or how to reslove it. Any help will be much ap...

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...

How to insert new line in the div, which displays changes in texterea with jQuery

Hi, I have a textarea in the form, and I need to see what I type there in the separate div like on this site, when you post qestion or answer. In the textarea I got text from new line when pressing enter, but in the div text stays in the same line. How can I go to new line there? I'm using this: <script type="text/javascript"> ...

How can I improve this commify routine for speed?

I need an efficient commify filter or routine for use with Template::Toolkit. It is to be used many times on the page. It should support decimals. This one is found in The Perl Cookbook: sub commify { my $text = reverse $_[0]; $text =~ s/(\d\d\d)(?=\d)(?!\d*\.)/$1,/g; return scalar reverse $text; } Are there more efficien...

COM - How to convert DATE data type to a formatted string in UTC

How to convert DATE data type to a formatted string in UTC without using the library class COleDateTime. I do not have ATLComTime.h on my system I would like to pass it as a DATE data type and return a string in 'yyyy-mm-ddThh:mm:ssZ' ...