whitespace

The white-space property between blocks

Is the CSS 'white-space' propert supposed to be able to affect the whitespace between block elements? For example, in the document used as an example in "Whitespace in the DOM" as follows, there is whitespace between the </h1> and the <p>: <!-- My document --> <html> <head> <title>My Document</title> </head> <body> <h1>Header</h1> ...

Long constructor initialization lists

How do you deal with them? I have some classes (usually classes that hold stats etc.) with some 20+ variable members, and the initialization lists end up very long, extending beyond the page width if I don't manually wrap around. Do you try and break down such classes or do you deal with this in some other way? It doesn't look very tid...

Enable whitespace in php regular expresssion

I want to have A-Z, 0-9 and whitespace ignored in regular expression, currently I have this, it works but whitespaces are ignored too but I need them. preg_match_all("/[^\w]/",$string,$matches); ...

Bash, curl, eval and whitespace

I'm writing a script to execute CURL commands for a given user input. The script has multiple helper function to create the list of parameters (arguments) that will eventually be passed to CURL. A stripped out example, is as follows : #!/bin/bash function create_arg_list { # THIS HTTP HEADER VALUE COMES FROM THE USER and MAY CONTAI...

Heading \subsection at start of framed environment in LaTeX without leading padding

I've got a framed environment of the memoir class with content like this: \begin{framed} \subsection{Article 1} Content of Article 1 \subsection{Article 2} Content: Article 2 \end{framed} This renders in the following way: ._________________. | | <-- superfluous whitespace | Article 1 | | Content of Art- | | i...

Cocoa - Trim all leading whitespace from NSString

Hi all, (have searched, but not been able to find a simple solution to this one either here, or in Cocoa docs) Q. How can I trim all leading whitespace only from an NSString? (i.e. leaving any other whitespace intact.) Unfortunately, for my purposes, NSString's stringByTrimmingCharactersInSet method works on both leading and trailing...

counting newlines, spaces, and tabs

This problem is from K&R p. 20: Write a program to count blanks, tabs, and newlines. Here's my attempt: #include <stdio.h> int main() { int character, whitespace = 0; printf("Enter some text, and press Ctrl-d when you're done.\n\n"); while((character = getchar() != EOF) { if(character == (' ' || '\n' || '\t')) { ++wh...

Filter all types of whitespace in PHP

Hi, I know that there are many types of space (em space, en space, thin space, non-breaking space, etc), but, all these, that I refered, have HTML entities (at least, PHP's htmlentities() return something like &emsp;. But, what about those spaces that have no HTML entities? Example: http://iorbix.com/social/display-profile.php?id=71123...

How to check that Java String is not all whitespaces

I want to check that Java String/character array is not just made up of whitespaces. How would I go about doing this in Java. This is a very similar question except it's Javascript http://stackoverflow.com/questions/2031085/check-if-string-contains-characters-whitespaces-not-only-whitespaces EDIT: I removed the bit about alphanumeric c...

Removing blank lines in XSLT

Hi, I'm using: <xsl:template match="material_id | location_code"></xsl:template> To get rid of elements in the source XML called material_id and location_code, but whitespace lines remain, leaving an output XML something like: <entries> <Identity>conflab1</Identity> <price>24.36</price> <pricedate>15-Jul-2010 13:35:18 ...

convert txt file with mixed spaces/tabs to tabs only (where possible)

Hi, I have some source code file which has mixed tabs/spaces and I want to convert it to a file where it has automatically replaced all indentation spaces by tabs for a given tab space length (i.e. for example tab = 2 spaces). Any easy solution (with common Unix tools, MacOSX, bash or zsh)? Some sed script or Python command or so? Tha...

php Form fileupload problem with whitespaces in filename

Hi folks, I still have the problem with whitespaces: I have an uploadform for users to upload mp3-files. It works fine, except when there are whitespaces in the filename. At the moment I tell the user not to use Filenames with whitespaces, but apparently its very common to use them in mp3s. So I would like to solve this problem. What h...

In Eclipse's text editors, is it possible to have tabs not look the same as spaces

Is it possible to set tabs to have a different background color (e.g. slightly grey) or put a little symbol (like "↦") in Eclipse text editors? If it's language specific, I'm using PHP. Our company coding standard is Tabs for indenting, but often there are spaces in the source code, so it would be great to see where these spaces are so ...

Weird whitespace appearing on Joomla

While polishing my site I noticed there was some unwanted space between 2 elements, so I decided to remove it. But looking at the source, I found this: Please check it by yourself, there's no trace of this server-side. Live page here: http://www.playersonline.com.ar/guias Any help would be appreciated. ...

PHP String Parsing Strip *First* enter/return space from form textarea

How do you strip the first (before any visible text) enter/return space from text taken from a variable (submitted from a textarea)? ...

Remove white space at top of page between header and main content seen with some browsers.

Hi, seem to have a inconsistent problem with one of my pages. In some IE browsers it displays nearly a whole screen of blank white space between the header and the main content, strangely enough on my pc using both firefox and ie the page displays correctly however on some other pc's it shows the blank space. http://kiwiradio.blakjak.n...

Generate a space with HTML that a printer will ignore

I have some code that generates bills for multiple customers on one web page. I use the div element style="page-break-after:always" so the user can print every customers bill at once, and the bills for unique customers will all be printed on a separate sheet of paper. My issue is that I want the bills to be a little more readable on th...

How can I diff two files, but ignore differences in Perl/C/C++ comments?

Hi, I would like to take the diff of two source code files, but I don't want it to report any differences for lines that only contain a programming language comment. The types of comments I would like it to ignore are: // ... # ... /* ... */ ...

git - trim whitespace

I've accidentally put some whitespace in my initial commit - it shows up red in git diff --color. What's the best way to get rid of the existing whitespace and how can I avoid this happening again? I am not necessarily looking for a built-in git command. Any external program available for free on Ubuntu would also be welcome. ...

Is it possible to change width of tab symbol in textarea?

By default tab symbol in textarea equals to the width of 8 spaces. Is it possible to change this value to 4 for example? I am mostly interested in using this in Chrome browser. ...