formatting

Long code blocks inside if statements or for loops

This is a cross language question on coding style. I have to work with a lot of code that has very long code blocks, sometimes hundreds of lines, inside if statements or for loops. The code is procedural. Code like the following if(condition){ //hundreds of lines of code }else if{ //hundreds of lines of code } else { //hun...

JavaScript function in PHP page causing issues with PHP tabs format

I am trying to reference a JavaScript file, containing a table sort function, in a PHP file. Everything functions the way it should, but once I add the code below to my PHP report page it causes issues with the format of the tabs on my navigation page. The same issue comes up if I add a random document.write outside of the PHP code. Not ...

Organising top level functions in a Javascript file

Occasionaly we will have a page that required some page specific Javascript functionality. I will create a javascript file called myPageName.js. The question I have is how do people organise their top level functions. I currently have 15+ top level functions defined like this function function1 (containerElement) { ...do function1;...

Winforms control showing text and supporting individual line coloring

For a Winforms application, I'm looking for a control which is able to show text and supports individual line colors (fore and background colors per line). For instance, I'd like to have line 1 with a green background color and line 4 with red. ...

Date Input Validator (dd-MMM-yy, client side) ASP.NET 3.5 + MaskedEditValidator

I need a client-side date validator on a text box. BAM - Custom Validator. Operator="DataTypeCheck", Type="Date". Boo-ya. Golden, except that all dates get input in the format dd-MMM-yy. This method works fine for "12/12/2009" but fails on "12-Dec-09". So, how do I get client side validation of dates in whatever format I choose to ent...

Visual Studio copy/paste into Outlook with standard formatting?

I have custom settings in Visual Studio that include a dark background. Copy/pasting to Outlook produces a crime against eyeballs with a dark background in code on a white background of the mail. Does anyone have any ideas of how I can paste code in standard VS formatting (NOT unformatted text from paste special, and not paste with my c...

Recognizing newline characters in Python

So I would like to grab stdout from a subprocess and then write the output to a file using python. The problem I'm having is the stdout from the subprocess loses the formatting, it contains \n's where there are newlines. I would like to write the output to a file with formatting intact, meaning instead of one line containg \n's, the fi...

DataGridView decimal value formatting: kosher way.

Hi, I need to display decimal values in DataGridView if (dgvClients.SelectedRows.Count != 0) { DataGridViewRow row = dgvClients.SelectedRows[0]; row.Cells["NetAccountValue"].Value = info.DecimalValue; } I need to format value up to given digits after decimal separator. The problem is ...

I'm having trouble positioning this button nicely..

I've been goin at it now for an 1.5hrs and I just can't figure out a way to make it the way I want. I'm kind of new with all things web, and it takes about as much time (maybe more?) trying to get things where I want and doing it in a way that is elegant. Anyways, I have two text boxes, with two labels above them and centered over the b...

How do I find the DIV in which my cursor is placed at any moment

How do I find the DIV in which my cursor is placed at any moment, so I can change the formatting of that area. ...

Int String format problem

Hi guys, I'm returning this, it is similar to how you percieve dollars, $"32.95" etc. I calculate it in cents which is an int, but the problem is the second half cuts off the 10s of cents part if the number is less than that. For example if I have "32.08" it returns as "32.8". Any ideas ? i know i need an if but i cant think how to write...

How to format SSRS 2008 Pie Chart's Legend into Table?

I have a DataSet with 4 fields. For example: FieldA, FieldB, FieldC, FieldD FieldA is the data field, and FieldB is the category field. Normally the Legend will display the category field. By applying custom format in the Series Properties --> Legend --> Custom legend text, I could format it like this: FieldB - FieldC - FieldD Because...

Report loses color when exporting to Excel

Hi, I have a local report in a WinForms application that is giving me some trouble. On this report, I have a table and I am trying to change the BackgroundColor of the Detail row. When I change it to "Red" and view the report, the row is Red as hoped for. When I export the report to Excel and PDF, the row is Red, too. So far, so g...

Formatting good in FireFox, bad in IE.... help

I am a newb for sure. I have been developing in the firefox, and just barely checked in IE. Someone please help me out. Don't know where I went wrong. Thanks! www.clgproperty.com ...

Most intuitive, readable API / language reference documentation

I'm working on the dreaded last stage of a project: documenting the API for a semi-technical audience. I'm wondering: what API docs have you found to be particularly elegant? Note that this has nothing to do with how elegant the API itself is: this is purely a question of the formatting/appearance of the API docs themselves. Which lang...

How can perltidy align the opening parenthesis for method arguments?

Hi, is there a possibility to make perltidy vertically align brackets like this: $foo->bar (1); $foo->bat (2); $foo->bac (3); $foo->bad (4); $foo->bae (5); $foo->baf ...

Reflowing label widget for Swing

Is there a widget for Swing that behaves like a JLabel, that automatically reflows the text if its dimensions have changed? For example: Large horizontal space available: +--------------+ | Foo bar baz | +--------------+ Small horizontal space available: +---------+ | Foo bar | | baz | +---------+ I am currently using JEditorPa...

LaTex: Possible to include large block of Regex?

Hi, is it possible to include a large block of a regex (like this one: http://www.ex-parrot.com/pdw/Mail-RFC822-Address.html) without escaping all colliding characters first? i think of something like \begin{following_section_will_not_be_parsed_by_latex} (a+?b) \end{...} thank you! Andrew ...

Jalopy to format return/throw statements

Hi all, I would like Jalopy to format my return and throw statements such that they look like a method call since they are: return(true); throw(new IllegalArgumentException("You can't do that, what we you thinking?")); I have the rest of the code formatted exactly the way I want so this is the icing on the cake. Also as an aside, I...

Applying html formatting in email's body

I am still trying to figure out, why i cannot apply html formatting in the body of a custom email. I am sure i am missing something, or i need a new pair of eyes! Here is the info added to the of the web page <head runat="server"> <link href="~/MyStyle.css" rel="stylesheet" type="text/css" /> </head> Mystyle.css contains the fo...