whitespace

Why does the Chrome spacing work in one JS file and not the other?

Update: Bug Resolved. Answer points go to whoever explains why the fix works. If you highlight and copy the text in the first paragraph on this page, then paste it into a rich text editor (dreamweaver or gmail in rich text mode), you will see that some of the text is automagically linked. Basically, it works: http://seox.org/link-build...

Why is there excessive use of whitespaces in expressions in most sample code?

A statement that could be written as: foo=(bar*5)+baz; is usually written in sample code (documentation, tutorials etc) as: foo = ( bar * 5 ) + baz; This appears to require extra work and seems counter-productive to me. Is there a rational reason for this? Is this a good coding practice, or just for sample code? (The reason I ask ...

How can I strip line breaks from my XML with XSLT?

I have this XSLT: <xsl:strip-space elements="*" /> <xsl:template match="math"> <img class="math"> <xsl:attribute name="src">http://latex.codecogs.com/gif.latex?&lt;xsl:value-of select="text()" /></xsl:attribute> </img> </xsl:template> Which is being applied to this XML (notice the line break): <math>\text{...

how to remove trailing and leading whitespace for user-provided input in a batch file?

I know how to do this when the variable is pre-defined. However, when asking for the user to enter in some kind of input, how do I trim leading and trailing whitespace? This is what I have so far: @echo off set /p input=: echo. The input is %input% before ::trim left whitespace for /f "tokens=* delims= " %%a in ("%input%") do set inpu...

How to "collapse" but not "normalize" whitespaces in xlst

I have an xml/tei like <p> In trattoria scoprii che c'era <del rend="tratto a matita">anche</del> Mirella, non la non vedevo da almeno sei anni. La spianata dava infatti l'impressione di fango secco, <del rend="matita">divorato dalle rughe</del><add place="margine sinistro" rend="ma...

How to get rid of bogus changes in git?

I'm a happy user of PortableGit 1.7.0.2. Today I wanted to pull a project changes from GitHub.com repository, so I did git pull. It failed with the following message: error: Your local changes to 'main.rb' would be overwritten by merge. Aborting.. I didn't care about the local changes so I typed git reset --hard HEAD (git clean from here...

Safe ASCII char to replace whitespace before storing

My code passes a big bunch of text data to a legacy lib, which is responsible for storing it. However, it tends to remove trailing whitespace. This is a problem when I read the data back. Since I cannot change the legacy code, I thought about replacing the all spaces with some uncommon ASCII character. When I read back the text, I can re...

What is the best way to use whitespace while programming?

I'm fairly new to programming and from learning I have seen different ways of formatting code, comments, etc; and have been recommended on different techniques. I mostly program in C#, C++, and Java so I want to know what is the the best way to layout code so that if other people where to go through it, they would be impressed by how si...

Fastest way to put contents of Set<String> to a single String with words separated by a whitespace?

I have a few Set<String>s and want to transform each of these into a single String where each element of the original Set is separated by a whitespace " ". A naive first approach is doing it like this Set<String> set_1; Set<String> set_2; StringBuilder builder = new StringBuilder(); for (String str : set_1) { builder.append(str).appe...

Gedit adds line at end of page

The answer to this must be somewhere but I'm not finding it -- can anyone help me understand why in Gedit, if I have a page of code there is no extra trailing blank line, but then when I do a file comparison for my svn commit it shows an extra line being added at the end of the file? I have a feeling that Gedit is automatically adding a...

Using perl to split a line that may contain whitespace

Okay, so I'm using perl to read in a file that contains some general configuration data. This data is organized into headers based on what they mean. An example follows: [vars] # This is how we define a variable! $var = 10; $str = "Hello thar!"; # This section contains flags which can be used to modify module behavior # All modules r...

[bash] don't know howto deal with dir/file with spacing as glob in bash scripting

Since i have some video courses in my laptop. I now want to calculate the total time of every course. So i write a simple script with bash. It succeeds for file/dir without space. But for dir/files with space, it goes wrong. I have tried to set IFS to something else, it doesn't work either. Well, there also some bugs in it. #!/bin/ba...

Can a base64 encoded string contain whitespace?

Might a base64 encoded string contain whitespace? Specifically, could it contain whitespace at the end of the string? PS. I'm thinking about the whole "MySQL will trim trailing whitespace when storing strings in VARCHAR fields" here ;-) ...

How do you specify a database column that contains a space in a linq statement

I thought this would have been quite common but can't find anything on this. I'm trying to query columns that have spaces immbedded within them. For the life of me I don't see a way of selecting them when I'm trying to assign them to an alias when creating an anonymous type result. Here's the code, but not sure how to go from here: D...

Haskell Custom Remove WhiteSpace

Hello to all, i have a and i would like to remove the white Space after "\n" and next character is white space. For instance, "username 123\n ugas 423\n peter 23\n asd234" become "username 123\nugas 423\npeter 23\nasd234" Please help. Thanks. ...

converting &#xD; into <br/> using XSL 1.0

Hi, Given XML of: <data> <field>Value 1&#xD;Value 2&#xD;Value 3&#xD;</field> </data> I would like to be able to create some HTML to display the values and convert the &#xD; into <br/> <html> <head/> <body> <div>Field Values</div> <div>Value 1<br/>Value 2<br/>Value 3<br/></div> </body> </html> However I can't think of way to do thi...

C++: why is the program reading the last blank from an input file as an element

My input file is: 2 5 <-- extra space at the end 4 <--extra space at the end int main(){ ifstream input("input.txt"); istream& in = input; string line1; while( getline(in,line1)){ istringstream number1(line1); while(number1.good()){ number1 >> temp1; cout<<temp1<<endl; }...

Remove all the whitespace after ',' and make first letter uppercase in CSV with PHP

I'm having a CSV like this. john,joy, anna, Lucy Bravo,boy I want to remove whitespace after ',' if it exist. And also make the first letter after ',' to be capital letter, if its not capital already. That is it should be like this: John,Joy,Anna,Lucy Bravo,Boy Only the whitespace after the ',' should go. I tried myself. But all fa...

Whitespace in version control (darcs)

A junior programmer in our office has an unfortunate (but understandable) habit of using Eclipse's "Correct all the indentation in this file" feature. As a result, his checked out copy includes thousands of lines that register as changes, simply because the whitespace is different. Accepting all these changes - while other people are als...

How to ignore PHP break lines with POEdit parser?

I am currently translating my PHP application using gettext with POEdit. Since I respect the print margin in my source code, I was used to writing strings like that: print $this->translate("A long string of text that needs to follow the print margin and since php outputs whitespaces for every break line I do my sites renders...