Search Results

Search found 540 results on 22 pages for 'whitespace'.

Page 4/22 | < Previous Page | 1 2 3 4 5 6 7 8 9 10 11 12  | Next Page >

  • Tool for braceless, whitespace sensitive C syntax

    - by Ollie Saunders
    I'm writing some C at the moment and because I like whitespace sensitive syntax, I'd like to write it like this: #include <stdio.h> int main(void) printf("Hello, world!") return 0 Instead of this: #include <stdio.h> int main(void) { printf("Hello, world!"); return 0; } Does anybody know of a tool that will convert the former into the latter? Edit: I've really no interest in arguing with those that think this is a bad idea. By all means continue to think that, you have your reasons. But at least know this: I'm aware Python is a whitespace sensitive language but I have not used it. Why would I? I know Ruby already. Also know: I am not just learning C for the first time and I have used PHP and JavaScript for more than four years, so I am not requesting this out of some personal difficulty, lack of familiarity with block syntax, or dogmatic affiliation. I am also aware of what would be involved in writing one of these and that's not beyond my ability but I don't want this enough to justify spending the time writing one.

    Read the article

  • IE bug with TD's tables and whitespace?

    - by mark smith
    Hi there, I have a page that is using tables, in FF etc it works perfect, but in IE7 it causes issues, its basically where the four corners have a td and and img (its a rounded corner form) .. if i remove the whitespace from the document it fixes the issue.. What actually happens is that it messes up the tables.. it puts a thin white line between the upper tr that holds the 2 corners and the next tr I need to remove the the whitespace between the img and the TD, is there a better work around, as i have lots and not only that if i reformat the document the problem returns.. here is a simple example.. <table width="100%" height="418" border="0" cellpadding="0" cellspacing="0" bgcolor="#F04A23" style="margin: 0px; padding: 0px"> <tr> <td width="12" align="left" valign="top"> <img src="content/images/corner_left.gif" width="12" height="12" /> </td> as you can see there is white space between img and td... and i remove it so it looks like this <img src="content/images/corner_left.gif" width="12" height="12" /></td> the problem is gone, (notice the td and image are right next to each other) Any ideas, i tried setting all sorts of css, padding 0px, margins 0px etc ... Any ideas really appreciated

    Read the article

  • PHP RegEx: How to Stripe Whitespace Between Two Strings

    - by roydukkey
    I have been trying to write a regex that will remove whitespace following a semicolon (';') when it is between both an open and close curly brace ('{','}'). I've gotten somewhere but haven't been able to pull it off. Here what I've got: <?php $output = '@import url("/home/style/nav.css"); body{color:#777; background:#222 url("/home/style/nav.css") top center no-repeat; line-height:23px; font-family:Arial,Times,serif; font-size:13px}' $output = preg_replace("#({.*;) \s* (.*[^;]})#x", "$1$2", $output); ?> The the $output should be as follows. Also, notice that the first semicolon in the string still is followed by whitespace, as it should be. <?php $output = '@import url("/home/style/nav.css"); body{color:#777;background:#222 url("/home/style/nav.css") top center no-repeat;line-height:23px;font-family:Arial,Times,serif;font-size:13px}'; ?> Thanks! In advance to anyone willing to give it a shot.

    Read the article

  • How to make HTML layout whitespace-agnostic?

    - by ssg
    If you have consecutive inline-blocks white-space becomes significant. It adds some level of space between elements. What's the "correct" way of avoiding whitespace effect to HTML layout if you want those blocks to look stuck to each other? Example: <span>a</span> <span>b</span> This renders differently than: <span>a</span><span>b</span> because of the space inbetween. I want whitespace-effect to go away without compromising HTML source code layout. I want my HTML templates to stay clean and well-indented. I think these options are ugly: 1) Tweaking text-indent, margin, padding etc. (Because it would be dependent on font-size, default white-space width etc) 2) Putting everything on a single line, next to each other. 3) Zero font-size. That would require overriding font-size in blocks, which would otherwise be inherited. 4) Possible document-wide solutions. I want the solution to stay local for a certain block of HTML. Any ideas, any obvious points which I'm missing?

    Read the article

  • Escape whitespace in paths using nautilus script

    - by Tommy Brunn
    I didn't think this would be as tricky as it turned out to be, but here I am. I'm trying to write a Nautilus script in Python to upload one or more images to Imgur just by selecting and right clicking them. It works well enough with both single images and multiple images - as long as they don't contain any whitespace. In fact, you can upload a single image containing whitespace, just not multiple ones. The problem is that NAUTILUS_SCRIPT_SELECTED_FILE_PATHS returns all the selected files and directories as a space separated string. So for example, it could look like this: print os.environment['NAUTILUS_SCRIPT_SELECTED_FILE_PATHS'] /home/nevon/Desktop/test image.png /home/nevon/Desktop/test.jpg What I need is a way to -either in bash or Python- escape the spaces in the path - but not the spaces that delimit different items. Either that, or a way to put quotation marks around each item. The ultimate solution would be if I could do that in bash and then send the items as separate arguments to my python script. Something like: python uploader.py /home/nevon/Desktop/test\ image.png /home/nevon/Desktop/test.jpg I've tried RTFM'ing, but there doesn't seem to be a lot of good solutions for this. At least not that I've found. Any ideas?

    Read the article

  • How to avoid whitespace in PHP and ASP.NET? [closed]

    - by Goma
    You know that the PHP interpreter avoids whitespace and comments. However, I have heared that there is something you can do to make the interpreter does not see the whitespace at all and does not even think to avoid it, the same for the compiler in ASP.NET. What is that thing? Is it a function in PHP and a class in ASP.NET? or what exactly? Edit: For example the php_strip_whitespace function in PHP "Returns the PHP source code in filename with PHP comments and whitespace removed". Will this help in load time?

    Read the article

  • Ignoring Whitespace with Regex(perl)

    - by Zerobu
    Hello, I am using Perl Regular expressions. How would i go about ignoring white space and still perform a test to see if a string match. For example. $var = " hello "; #I want var to igonore whitespace and still match if($var =~ m/hello/) { }

    Read the article

  • How to trim whitespace from bash variable?

    - by too much php
    I have a shell script with this code: var=`hg st -R "$path"` if [ -n "$var" ]; then echo $var fi But the conditional code always executes because hg st always prints at least one newline character. Is there a simple way to strip whitespace from $var (like trim() in php)? or Is there a standard way of dealing with this issue? I could use sed or awk, but I'd like to think there is a more elegant solution to this problem.

    Read the article

  • XML::LibXML Line Ending (whitespace) Problem.

    - by Gilbeg
    HI, I am parsing an XML file using LibXML in Perl. The problem that I have is the ending characters (whitespace) is treated as a text node. For instance, given an input like the following abc 123 The parser thinks that the number of child of node "books" is 3, they are: - text node (containing the char between and - element node of "book" - text node (containing the char between and Question is how do I tell LibXML to ignore whitespaces? I tried with no_blanks (that is $parser = XML::LibXML-new(no_blanks = 1) when construction the parser) but it seems that it has no effect. Thanks in advance

    Read the article

  • Removing whitespace between HTML elements when using line breaks

    - by Skilldrick
    I have a page with a row of about 10 imgs. For readability of the HTML, I want to put a linebreak in between each img tag, but doing so renders whitespace between the images, which I do not want. Is there anything I can do other than break in the middle of the tags rather than between them? Edit: Here is a screenshot of what I have so far. I would like the book spine images to display in random combinations, using PHP. This is why I need separate img tags.

    Read the article

  • copying program arguments to a whitespace separated std::string

    - by PaulH
    I have a Visual Studio 2008 C++ application where I would like to copy all of program arguments in to a string separated by a whitespace " ". i.e., if my program is called as foo.exe \Program Files, then my folder string below would contain \Program Files Below is an example of what I'm doing now. I was wondering if there was a shorter or easier method of doing this. Is there an easy way to eliminate the std::wstringstream variable? int _tmain( int argc, _TCHAR* argv[] ) { std::wstringstream f; std::copy( argv + 1, argv + argc, std::ostream_iterator< std::wstring, wchar_t >( f, L" " ) ); std::wstring folder = f.str(); // ensure the folder begins with a backslash if( folder[ 0 ] != L'\\' ) folder.insert( 0, 1, L'\\' ); // remove the trailing " " character from the end added by the std::copy() above if( *folder.rbegin() == L' ') folder.erase( folder.size() - 1 ); // ... } Thanks, PaulH

    Read the article

  • Regex help -- cleaning up whitespace -- Java

    - by FarmBoy
    I'm trying to view the text of HTML files in a reasonable way. After I remove all of the markup and retain only the visible text, I obtain a String that looks something like this: \n\n\n\n \n\n\n \n\n \n Title here \n\n\n \n\n \n\n Menu Item 1 \n\n \n\n Menu Item 2 \n\n\n \n\n you get the point. I would like to use String.replaceAll(String regex, String regex) to replace any whitespace substring that contains more than two occurances of \n with "\n\n". Any ideas?

    Read the article

  • PHP FUNCTION TO AUTOMATICALLY REMOVE WHITESPACE AND TRIM DOWN IDENTIFIERS

    - by H8 MY H0ST
    I HAVE A WEBSITE WHICH GETS WAY TOO MUCH TRAFFIC. MY HOST IS MAKING ME UPGRADE AND I'M LIKE MAN MY SITE MAKES $0 CUZ I AINT NO SPAMMER YA DIGG? I WILL CUT DOWN ON THE BANDWITH AND THEY'RE LIKE OKAY. GONNA DO GZIP. BUT I NEED LIKE A FUNCTION TO STRIP ALL WHITESPACE AND EXTRA SHIT FROM OUTPUT TOO IF POSSIBLE. AND THEN STUFF THAT CAN TURN MY #WRAPPER INTO LIKE #A #B #C ?? USING ZEND FRAMEWORK AT THE MOMENT. THANK YOU ALL VERY MUCH FOR YOUR TIME.

    Read the article

  • Replacing whitespace with sed in a CSV (to use w/ postgres copy command)

    - by Wells
    I iterate through a collection of CSV files in bash, running: iconv --from-code=ISO-8859-1 --to-code=UTF-8 ${FILE} | \ sed -e 's/\"//g' | \ sed -e 's/, /,/g' \ > ${FILE}.utf8 Running iconv to fix UTF-8 characters, then the first sed call removes the double quote characters, and the final sed call is supposed to remove leading and trailing whitespace around the commas. HOWEVER, I still have a line like this in the saved file: FALSE,,,, 2.40,, The COPY command in postgres is kind of dumb, so it thinks " 2.40" is not valid syntax for a numeric value. Where am I going wrong w/ my processing of the CSV file? Thanks!

    Read the article

  • Java doesn't work with regex \s, says: invalid escape sequence

    - by Jayomat
    hi, I want to replace all whitespace characters in a string with a "+" and all "ß" with "ss"... it works well for "ß", but somehow eclipse won't let me use \s for a whitespace.. I tried "\t" instead, but it doesn't work either.. I get the following error: Invalid escape sequence (valid ones are \b \t \n \f \r \" \' \ ) this is my code: try { String temp1 = from.getText().toString(); start_from = temp1.replaceAll("ß", "ss"); start_from = start_from.replaceAll("\s", "+"); } why doesn't it work? is it a problem with android, eclipse or what? thanks in advance!

    Read the article

  • html doctype adds whitespace ??

    - by pstanton
    can someone please explain to me why having a doctype of <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN"> and <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"> render the following block differently under firefox? <table style="border-collapse:collapse; margin:0; padding:0;"> <tr> <td style="border:1px solid red; margin:0; padding:0;"><img src="http://images.smh.com.au/2010/06/01/1533814/th_park-90x60.jpg" style="border:none; padding:0; margin:0;" /></td> </tr> </table> using 'Transitional', there is no white space below the image, using 'Strict' there is! 2nd question, using strict, is it at all possible to remove this whitespace?

    Read the article

  • Tokenizing a string with variable whitespace

    - by Ron Holcomb
    I've read through a few threads detailing how to tokenize strings, but I'm apparently too thick to adapt their suggestions and solutions into my program. What I'm attempting to do is tokenize each line from a large (5k+) line file into two strings. Here's a sample of the lines: 0 -0.11639404 9.0702948e-05 0.00012207031 0.0001814059 0.051849365 0.00027210884 0.062103271 0.00036281179 0.034423828 0.00045351474 0.035125732 The difference I'm finding between my lines and the other sample input from other threads is that I have a variable amount of whitespace between the parts that I want to tokenize. Anyways, here's my attempt at tokenizing: #include <iostream> #include <iomanip> #include <fstream> #include <string> using namespace std; int main(int argc, char *argv[]) { ifstream input; ofstream output; string temp2; string temp3; input.open(argv[1]); output.open(argv[2]); if (input.is_open()) { while (!input.eof()) { getline(input, temp2, ' '); while (!isspace(temp2[0])) getline(input, temp2, ' '); getline (input, temp3, '\n'); } input.close(); cout << temp2 << endl; cout << temp3 << endl; return 0; } I've clipped it some, since the troublesome bits are here. The issue that I'm having is that temp2 never seems to catch a value. Ideally, it should get populated with the first column of numbers, but it doesn't. Instead, it is blank, and temp3 is populated with the entire line. Unfortunately, in my course we haven't learned about vectors, so I'm not quite sure how to implement them in the other solutions for this I've seen, and I'd like to not just copy-paste code for assignments to get things work without actually understanding it. So, what's the extremely obvious/already been answered/simple solution I'm missing? I'd like to stick to standard libraries that g++ uses if at all possible.

    Read the article

< Previous Page | 1 2 3 4 5 6 7 8 9 10 11 12  | Next Page >