whitespace

How to remove excess whitespace added to code by FTP program?

This happens repeatedly and is very annoying. I upload some PHP code to a client's server. A few weeks pass. They ask for a change to be made and I re-download the code as they've made some changes. However, my code which used to be neat and tidy the last time I looked at it now has an extra lines of whitespace added everywhere. So now w...

Testing for whitespace in SQL Server

I've got some blank values in my table, and I can't seem to catch them in an IF statement. I've tried IF @value = '' and if @value = NULL and neither one catches the blank values. Is there any way to test whether or not a varchar is entirely whitespace? AHA! Turns out I was testing for null wrong. Thanks. ...

when is white-space not important in python

It seems to be ignored inside a list, for example: for x in range(5): list += [x, 1 ,2,3, 4,5] ...

Locating the node by value containing whitespaces using XPath

Hi there, I need to locate the node within an xml file by its value using XPath. The problem araises when the node to find contains value with whitespaces inside. F.e.: value value with spaces I can not construct the XPath locating the second Child node. Simple XPath /Root/Child perfectly works for both children, but /Root[Chil...

How do I change eclipse to use spaces instead of tabs?

By default eclipse indents with a hard tab character, how do I change it to spaces? ...

Keeping original format POST passing through AWK

I have an issue with using AWK to simply remove a field from a stream, illustrated below: 1 int blah (void) 2 { 3 if (foo) { 4 printf ("blah\n"); 5 } 6 return 0; 7 } I use the following code to remove the first field: $ awk '{ $1=""; print }' example.out int blah (void) ...

Remove whitespace before a field using AWK

(Almost exact duplicate of http://stackoverflow.com/questions/408469/keeping-original-format-post-passing-through-awk submitted by same person.) I have a simple question pertaining to gawk, illustrated below: 1 int blah (void) 2 { 3 if (foo) { 4 printf ("blah\n"); 5 } 6 return ...

build argument lists containing whitespace

In bash one can escape arguments that contain whitespace. foo "a string" This also works for arguments to a command or function: bar() { foo "$@" } bar "a string" So far so good, but what if I want to manipulate the arguments before calling foo? This does not work: bar() { for arg in "$@" do args="$args \"pre...

Can you preserve leading and trailing whitespace in XML?

How does one tell the XML parser to honor leading and trailing whitespace? Dim xml: Set xml = CreateObject("MSXML2.DOMDocument") xml.async = False xml.loadxml "<xml>1 2</xml>" wscript.echo len(xml.documentelement.text) Above prints out 3. Dim xml: Set xml = CreateObject("MSXML2.DOMDocument") xml.async = False xml.loadxml "<xml> 2</xm...

Emacs Command to Delete Up to Non-Whitespace Character

I often want to make a multiline function call and reduce it down to one line. For example, convert... function_call( 'first_arg', 'second') to function_call('first_arg', 'second') Does emacs have some commands to help with this. Specifically, is there a command that will delete all whitespace from the point to the first ...

How to force gcc preprocessor to preserve whitespace?

For the code: int i; gcc preprocessor outputs: int i; How to force it to preserve whitespace? I call preprocessor with: gcc -E somefile.c command. ...

VB.NET replace whitespace between HTML tags

Is there any way in VB.NET to remove all of the whitespaces between tags in HTML? Say, I've got this: <tr> <td> The string I've built is an entire HTML document, and it counts everything before those tags as legitimate space, so I need to trim it out. Is there a reg ex or function out there I could use to do this? Thanks ...

Normalizing space characters in Prolog atoms

What is the best way to normalize whitespace characters (space, newline, tab) in a Prolog atom, e.g. in SWI-Prolog. I.e. I would like to have a rule: normalize_space_in_atom(+Atom1, -Atom2) such that Atom2 has any sequence of whitespace characters turned into a single space starts with a non-space ends with a non-space ...

Space after LaTeX commands

I have a definition \newcommand{\arnold}{Arnold Schwarzenegger} when I refer to it by \arnold is a it is rendered as Arnold Schwarzeneggeris a In order to have a space in front of "is" I would need to write \arnold\ is a Is there another and shorter way? ...

Whitespace auto format - ReSharper and VS2008 fighting each other!

Consider the following line of code: things.Add(new Thing { ID = null, Name = "a thing" }); The whitespace formatting you see there is that which I get when I type the closing ;. Now, if I ask Visual Studio to reformat my code, or I type a closing } it gets reformatted: things.Add(new Thing{ID = null, Name = "a thing"}); I prefer ...

Make git automatically remove trailing whitespace before committing

I'm using git with my team and would like to remove whitespace changes from my diffs, logs, merges, etc. I'm assuming that the easiest way to do this would be for git to automatically remove trailing whitespace (and other whitespace errors) from all commits as they are applied. I have tried to add the following to by ~/.gitconfig file b...

Non-collapsing but still (line-)breakable space in HTML?

What can I use in HTML if I want to have whitespace in the middle of the line that looks like three spaces, but can still be broken if the line gets too long? Regular whitespace gets collapsed (a run of spaces looks the same as a single space), and at the non-breaking space (&nbsp) the line cannot be broken. Update: I think what I real...

Removing unnecessary whitespace in a J2EE/Struts Application in WebSphere

Is anyone familiar with a technique for removal of whitespace that results from the use of tag libraries such as JSTL? I know that you can do this in Tomcat via a trimSpaces initialization parameter, but does anyone have similar experience doing this type of thing within WebSphere App Server? ...

Are there any pitfalls with using whitespace in Python?

At the moment I have never had a problem with whitespace in Python (although I've only used it in two projects and I was the only programmer). What are some potential pitfalls with whitespace and indentation in Python for someone learning the language? ...

jQuery text() call preserves newlines in Firefox but not in IE

I'm doing: alert($("#div").text()); on something like this: <div id="div"> &lt;div&gt; Some text &lt;div&gt; </div> Why the escaped content? Because it is sometimes malformed and I don't want it interfering with or breaking the rest of the document. In FF it shows up preserving newlines. In IE7 it doesn't. I need to preserve th...