formatting

Report Builder 2.0 query: ElementPath with a space in a field name

I'm trying to use Report Builder 2.0 to query a Sharepoint List using an XML data source. I explicitly list the fields I want returned because otherwise I don't get all of them, due to some of them being null sometimes. However, one of the fields I need has a space in its name. If I do a query where I don't explicitly specify fields, ...

LaTeX - Adding a varying amount of horizontal spacing to the beginning of each new line in a sequence

I'm using LaTeX for an algorithms assignment and I need to show the steps for Horspool's algorithm for string matching similar to what is shown in the textbook. The way it demonstrates the algorithm is showing how the pattern shifts along the text for each failed comparison, with each shift on a new line. The pattern is shown below the...

Formatting Math.Pow Output

I hate to ask such a dumb question, but I'm just starting out, so here goes. myString = "2 to 2.5 power is " + Math.Pow(2, 2.5); I want to format the resulting number to 4 decimal places and show the string in a MessageBox. I can't seem to figure this out or find the answer in the book. Thanks! ...

Tool for CSS formatting

Is there a tool that can format CSS into a single-line format with indenting? #content-area ol {margin: 15px 0 0 25px; list-style: decimal;} #content-area ol ol {list-style: lower-alpha;} #content-area ul {margin: 0 0 0 5px; list-style: none;} #content-area ul li {padding: 0 0 0 20px...

Absolute positioning in printout with cout in C++ ?

How do you get "absolutely positioned" columns with cout, that leftaligns text and right-aligns numbers? #include <iostream> #include <iomanip> using namespace std; struct Human { char name[20]; char name2[20]; char name3[20]; double pts; }; int main() { int i; Human myHumen[3] = { {"Mr", "Alan", "Turin...

dealing with nested quotes in html generated from c#

i am using a 3rd party library to show tooltips, like so: string tooltip = "test"; output.Write("onmouseover='Tip(\"" + test + "\");'"); // work fine :) i'm having problem with situations like the following where i need quotes for formatting: string tooltip = "<span style='color:red;'>test</span>"; output.Write("onmouseover='Tip(\""...

C++ decimal output formatting

Hi, i'm writing a double value to a file. The numeric value is written with a point as a decimal separator. I would like to use a comma. How i can do that? ...

Good Use Cases of Comments

I've always hated comments that fill half the screen with asterisks just to tell you that the function returns a string, I never read those comments. However, I do read comments that describe why something is done and how it's done (usually the single line comments in the code); those come in really handy when trying to understand someo...

What layer should a date be formatted?

What layer of a system should a date be formatted? Should the date be formatted when it is selected from the database (data layer) or should it be formatted at the presentation layer? I am thinking that the formatting is a visual preference so I would tend to put it as close to the presentation layer as possible. Where do you store t...

Ruby whitespace: Is { :a => 1 } better than {:a => 1}?

Looking at other people's code it seems really common to include an extra space inside curly brace blocks. Is there a reason for that? To me it seems to add extra keystrokes for added ugliness. Especially when things get nested: lambda { (1..5).map { |i| { :a => { :b => i } } } } For some reason it just looks more concise and coherent...

Anyone know how to stop Visual Studio 2005 editor formatting inserted text on a paste operation?

I grow tired of carefully hand indented multi-line function arguments or logic statements being reformatted on cut/copy - paste operations. i.e. code that started out like LPCTSTR FoldersToIgnore[] = { _T("_Disk"), _T("_Storage Card"), _T(".Production-Archive"), ...

Formatting an output file.

I'm currently indexing my music collection with python. Ideally I'd like my output file to be formatted as; "Artist; Album; Tracks - length - bitrate - md5 Artist2; Album2; Tracks - length - bitrate - md5" But I can't seem to work out how to achieve this. Any suggestions? ...

Regular Expression for formatting numbers in JavaScript

I need to display a formatted number on a web page using JavaScript. I want to format it so that there are commas in the right places. How would I do this with a regular expression? I've gotten as far as something like this: myString = myString.replace(/^(\d{3})*$/g, "${1},"); ...and then realized this would be more complex than I thi...

Parse date and format it using python?

Hi, I want to parse a date and change the format using python. Date has the format like 'Mon Feb 15 2010' and i want to change the format into '15/02/2010'. Any one can help me. Thanks in advance. Nimmy ...

Need custom JTextField for currency

I have people entering alot of ammounts in form, so pressing one key less is what will count on huge ammounts of data. Idea is not to press decimal separator when entering currency ammount. I need some subclass of JTextField which will automatically show decimal and thousand separators while entering number. Is out there something alrea...

How to format outgoing email - Create in code or use templates with replaceable values?

What is the best practice to create templates for outgoing email? Should I have each class create the html for the specific email? Should I have a text template with placeholders that are replaced by a common method? In the first option, I'd have a sendEmail method that takes the formatted html string and send the email. Multiple cla...

Format CSS file (compress/uncompress)

Hi there, I want to format my css files used in my web project. Formatting means: Compress/Uncompress CSS file Example: *{margin:0;padding:0;}body{min-height:101%;font:69%/141% Arial,Helvetica,sans-serif;color:#2d3742;} to: * { margin: 0; padding: 0; } body { min-height: 101%; font: 69%/141% Arial,Helvetica,sans-serif; ...

One word bold inside a text in winform control.

I want some way to make a given word bold(the first two characters of each item in a listbox), and nothing else, something like this: 01 car 02 house 03 market As for these three, being items in a listbox control, ALWAYS the first two characters, the rest should not be bold. Is there any practical way for doing so ? Data: Visua...

Which text editor to add line break (not word wrap) at same column throughout source code file?

I'm preparing some documentation and need to format my source code with line breaks that need to appear in column 70 throughout the file. The text editors I have only seem to have features to word wrap the source at this column. I'm wondering whether I need to do this manually since - because of the varying length of the last word at t...

Using .NET string formatting, how do I format a string to display blank (empty string) for zero (0)?

I am using a DataBinder.Eval expression in an ASP.NET Datagrid, but I think this question applies to String formatting in .NET in general. The customer has requested that if the value of a string is 0, it should not be displayed. I have the following hack to accomplish this: <%# IIf(DataBinder.Eval(Container.DataItem, "MSDWhole").Trim...