w3hello.com logo
Home PHP C# C++ Android Java Javascript Python IOS SQL HTML videos Categories
Safely wrap long HTML lines to avoid Postfix's smtp_line_length_limit
encode your text into base64 using base64_encode() set appropriate MIME header split this base64-ed blob into 80 character wide chunks using chunk_split() Profit!

Categories : PHP

Error "UTF-8 Unicode C++ program text, with very long lines" and "ASCII English text, with very long lines"
These are not error messages in themselves, but output from the identification utility file. It's not good at recognizing different programming languages, and might think a C++ file is English or Java. "Very long lines" refers to the fact that the files have lines over 300 characters long. Both files are already UTF-8 (ASCII is a subset of UTF-8), and therefore don't need conversion (but you might prefer translating the line endings from to with dos2unix or tr -d ' '.

Categories : Linux

wrap text and center align in javascript function by appending & prepending spaces
Aligning text by inserting space characters works ONLY in a very restricted environment: fixed-width horizontal space using a monospace font of a specific, known size. Change any of those parameters (width, font, font-size) and your alignment will be off. Alignment should be accomplished with CSS.

Categories : Javascript

How to wrap a sentence into mutiple lines?
there are many options. one would be to separate by "+" : canvas.drawText("Style.FILL.show the full complete text Thanks dude.."+ "I am searching for this thing since last three days. But no where"+ " they have given as simple as you given ", 75, 110, paint); another one would be to put the string into the strings.xml . this way you don't have "junk" in the code, plus you could add qualifiers for when to use each string (for example localizations) . EDIT: i thought you meant that it annoys you in the code. now i understand that you need it working in the app itself. the next code will take any text and will make it have word wrap according to a rectangle that you give it. in case the text is too long even for the max lines specified, the text will be truncated. it also supports tex

Categories : Android

Wrap long href in div with a floated image
Create an another class for <a> and apply the following css .container .content a{ display: inline-block; max-width: 130px; vertical-align: middle; } FIDDLE

Categories : CSS

PHP MYSQL line wrap long query?
PHP doesn't care much about what lines things are on - that's what the semicolons are there for. And neither does MySQL, so you could easily do this: $query = "SELECT ... FROM ... WHERE ..."; And that can definitely help readability when it comes to longer queries!

Categories : PHP

How to wrap long HTML table cell
It might be usefull for you.. <table style="width:300px;" border="1"> <tr> <td>Cell 1</td> <td>Cell 2</td> </tr> <tr> <td colspan="2" style="width: 70%;" >Very long cell that should just be as long as the first two cells and wrap, but not take all the screen width.</td> </tr> </table> Update after question update <table style="width:100%;" border="1"> <tr> <td style="width: 50%;">Cell 1</td> <td style="width: 50%;">Cell 2</td> </tr> <tr> <td colspan="2" style="width: 70%;" >Very long cell that should just be as long as the firs

Categories : HTML

Detect keyup event of contenteditable child whose parent is a contenteditable div
So this is a bug. Workaround confirmed for FF23 and CHROME29 (on linux with no vm so can't test IE). You must set the wrapping spans as contenteditable false, you can't just omit declaring the contenteditable attribute, which is rediculous. Solution via Keypress event on nested content editable (jQuery) Here is the fiddle: http://jsfiddle.net/aBYpt/14/ HTML <div class="parent" contenteditable="true"> Parent div text. <span contenteditable="false"> <span class="child" contenteditable="true">First child span text.</span></span> <span contenteditable="false"> <span class="child" contenteditable="true">Second child span text.</span> </span> </div> <div id="console"></div> JavaScript/j

Categories : Javascript

How can i clean the spaces and new lines?
Single regex replace for removing leading and trailing whitespaces, as well as limiting the amount of consecutive newlines: str = str.replace(/(s*(( ? ){2,})s*|s*(( ? ){1,2})s*)/g,"$2$4"); Turns: asdfasdf asdfafd sdf d d sa sadfdsaf Into: asdfasdf asdfafd sdf d d sa sadfdsaf Just fix 3+ multiple newlines .replace(/( ? ){3,}/g,"$1$1"); Just fix leading and trailing whitespaces .replace(/^ *| *$/gm,''); Update: first expression didn't clear spaces at beginning and end of string Now does everything! .replace(/^s*|s*$|(s*(( ? ){2,})s*|s*(( ? ){1,2})s*)/g,"$2$4");

Categories : Javascript

Get rid of spaces between lines in html
<div style="word-spacing: 3px;"> <a style="text-decoration:none;" href="www.stackoverflow.com"><font face="monospace" font size="4"><pre style="margin: 0;float:left;">[ Text1]</pre></font></a> <a style="text-decoration:none;" href="www.stackoverflow.com"><font face="monospace" font size="4"><pre style="margin: 0;">[ Text1]</pre></font></a> </div> Demo This may help you! The less word-spacing the more gap in between.

Categories : HTML

How to explode a string, with spaces and new lines?
Always go from the bigger to the smaller one. So first split by " " and then split by " ". $data = "This is a test And something new happens."; $rows = explode(" ", $data); $words = array(); foreach($rows as $row) { $temp = explode(" ", $row); foreach($temp as $word) $words[] = $word; } Will give you an array with all words in it.

Categories : PHP

How to count the number of lines in a JTextArea, include wrap?
there are another one, two different ways, but I used loop inside lines, . import java.awt.BorderLayout; import java.awt.Font; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; import java.util.logging.Level; import java.util.logging.Logger; import javax.swing.JButton; import javax.swing.JFrame; import javax.swing.JScrollPane; import javax.swing.JTextArea; import javax.swing.SwingUtilities; import javax.swing.text.BadLocationException; import javax.swing.text.Element; public class ResizeJTextArea { private JFrame frame = new JFrame(); private JScrollPane scrollPane = new JScrollPane(); private JTextArea textArea = new JTextArea(15, 15); private JButton button = new JButton("change"); private Font newFont = new Font("Courier", Font.PLAIN, 10

Categories : Java

Insert spaces in particular places on particular lines in .txt file
For Each x In InStr isn't valid in any way!!! You can use Split and Join: If Left(a, 5) = "C_PIN" Then va = Split(a, " ") va(4) = va(4) & " " 'Add extra space va(5) = va(4) & " " va(6) = va(4) & " " a = Join(va, " ") 'Join with extra spaces added End If Now you can write the string.

Categories : Excel

Trim white-spaces at the end of lines only before a specific tag
You want special treatment for text nodes that are followed by 'lb' elements with break="no". You want whitespace preserved in all other text nodes. So: Write an identity transform that preserves white space in content. Add a template to match text nodes immediately followed by an lb element with break="no". (Or alternatively in an existing template for text nodes, wrap the existing code in the xsl:otherwise clause of an xsl:choose element, and before it add an xsl:when element for the case where the text node is immediately followed by an appropriate lb element. We need a name for the text nodes selected by your test; let's call them the special-handling text nodes. If a special-handling text node ends with a newline, you want to strip it off. Use ends-with() to test the condition,

Categories : Xml

Remove all spaces in lines but not between double quotes
Can be done using perl: perl -pe 's{^s* $}{}; s/ +(?=(([^"]+"){2})*[^"]*$)//g' file This will delete all the blank line or lines with just 0 or more spaces and trim spaces when not between double quotes. Live Demo: http://ideone.com/xizPNI

Categories : Regex

ADF: Can't see long outputText without spaces in tooltips on rollover in firefox
This is a Firefox bug from years. A possible solution could be installing the Long Titles extension, which unfortunatelly is not available for the latest Firefox versions.

Categories : JSF

Good method to substitute end-lines ' ' into spaces in a string
Just use the replace method: >>> " a".replace(" ", " ") ' a' >>> It is the simplest solution. Using Regex is overkill and also means you have to import. translate is a little better, but still doesn't give anything that replace doesn't (except more typing of course). replace should run faster too.

Categories : Python

XSL-FO: PDF output: Text with a space is allowed to wrap lines inside a table column
One cheap thing to try: when you render the model names, change blanks to character U+00A0, non-breaking space. Something like this: <xsl:template match="model-name"> <xsl:value-of select="translate(.,' ','&#xA0;')"/> </xsl:template>

Categories : Xslt

which Uncrustify setting replaces blank lines with indenting spaces?
I had this same problem, and figured it out. It's not Uncrustify doing this, it's actually XCode. If you run Uncrustify outside of XCode, it will not insert the blank tab/spaces on the blank line (and if they are there it will actually remove them). Discovering this, I found out that it's the XCode preference "Automatically indent based on syntax" setting that when enabled (and it's enabled by default), will insert the spaces on blank lines after Uncrustify runs. To answer your question, I never figured out which Uncrustify setting removes the blank spaces, but I can tell you, that with my default Uncrustify config file, it did remove the indenting spaces on the blank lines. Here's the XCode setting in XCode (5.0.2)

Categories : Misc

I like to remove the empty lines and white-spaces from my query results compare two result?
It appears that you want to consider files to be equal even though one has blank lines added. My suggestion is that if you want blank lines to be ignored you should make a pass through the collections you're creating (lines1 and lines2) to eliminate zero-length lines. Share and enjoy.

Categories : C#

REGEX to cleanup Multiline String with Multiple Spaces, Tabs, Empty Lines (PHP Preg_Replace)
Use multiline mode, to anchor ^ and $ to the beginning and end of lines, respectively: $lineToOutput = preg_replace("/^[ ]+|[ ]+$/m", "", $lineToOutput); Using this you can also simplify your first expression: $lineToOutput = preg_replace("/^[s ]*[ ]+|[ ]+/m", " ", $lineToOutput); // remove all blank (empty lines) It's not shorter, but I think conceptually easier to understand. The second alternative is to catch a trailing empty line. Also note that you don't need to write [ ]. works just fine.

Categories : PHP

Resharper - wrapping long lines with continuation?
This isn't related to ReSharper. This is how Visual Studio handles wrapping long lines - it's still a single line of text, as you can see by the line number, but it's wrapped to all appear on the screen at once. If you want to reformat the text, you can simply enter a carriage return, e.g. after the if statement, and the text will then move to a new line and should be indented under your number 3. ReSharper can do this for you with code cleanup (ReSharper -> Tools -> Code cleanup)

Categories : Visual Studio 2010

Long lines overlap in Bash PS1 prompt
When using non-printing characters in a bash prompt, you have to specify non-printing sequences (e.g. color codes) as non-printing, using [...]: PS1=' [e[0;33m]☛ W[e[0m] [e[1;35m]⤷[e[0m] '

Categories : Bash

Using strtol() to Parse Long Values out of Lines of a File
It seems that strtol is out of range (0xffffffff or greater is ULONG_MAX according to limits.h and the definition of strtol). Although the passed value (8105b4a5) is smaller than 0xffffffff it is bigger than LONG_MAX (system dependent), which is somehow the biggest number strtol can deal with. Due to the fact that you are using unsigned longs the function strtoul (see definition) might be the more appropriate candidate. To ensure that it is because of this range problem, please check your local limit.h. Hope that works. *Jost

Categories : C

Adding New Lines / Breaks / Paragraphs into a Long NSString
You can split up your long string into an array of strings using componentsSeparatedByString:. Then for each element (paragraph) in the array, run the string through stringByConvertingHTMLToPlainText to strip out remaining html tags. You might want to do some more work on the contents or paragraphs after stripping the html tags. NSString *htmlString = @"<p>first paragraph</p><p>second paragraph</p><p>thrid paragraph</p>"; NSArray *paragraphs = [htmlString componentsSeparatedByString: @"<p>"]; // still includes </p> for (NSString *singleParagraph in paragraphs) { // strip out remaining html tags singleParagraph = [singleParagraph stringByConvertingHTMLToPlainText]; } // strip out empty or irrelevant indexes and paragraphs you don't

Categories : IOS

Extracting specific values from a from a text file with long lines
cut is always good and fast for these things: $ cut -d"*" -f3 file CP:53 msec CP:59 msec CP:21 msec Anyway, these awk ways can make it: $ awk -F"|" '{print $27}' file | sed 's/*//g' CP:53 msec CP:59 msec CP:21 msec or $ awk -F"||" '{print $14}' file | sed 's/*//g' CP:53 msec CP:59 msec CP:21 msec Or also $ awk -F"*" '{print $3}' file CP:53 msec CP:59 msec CP:21 msec In both, we set the field delimiter to split the string as some specific character | or *. Then we print a certain block of the split text.

Categories : Regex

linux gnu less: long lines in buffer broken down when copy+pasting
less has a -S option that tells it to break long lines. It's not on by default. Luckily, most less flags can be changed even while it runs. Just press -S to toggle long-line-mode / broken-line-mode

Categories : Bash

How to read long lines from child pocress' stdout in an efficient way?
I hope i understand your problem. the application hangs on Process.WaitForExit() because this is what Process.WaitForExit(): it waits for the process to exit. you might want to call it in a new thread: int your method that create the process: Thread trd = new Thread(new ParameterizedThreadStart(Start)); trd.Start(); and add this method: private void Start(object o) { ((Process)o).WaitForExit(); // your code after process ended }

Categories : C#

SQL Server: split long text into multiple lines with max # of characters per line
There's not a built in split function, but you can use multiple substrings/charindex, something like: DECLARE @FieldName VARCHAR(MAX) = 'Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industrys standard dummy text ever since the 1500s, when an unknown printer took a galley of type and scrambled it to make a type specimen book. It has survived not only five centuries, but also the leap into electronic typesetting, remaining essentially unchanged. It was popularised in the 1960s with the release of Letraset sheets containing Lorem Ipsum passages, and more recently with desktop publishing software like Aldus PageMaker including versions of Lorem Ipsum.' SELECT SUBSTRING(@FieldName,1,CHARINDEX(' ',@FieldName,70)-1) ,SUBSTRING(@Field

Categories : Sql Server

AIX (KSH) Dynamic Variable Assignment - Split long string into multiple lines and assign each line to variables
You can create an array and then assign values. Something like: $ TEXT='LINE 1 LINE 2 LINE 3 LINE 4 LINE 5' $ echo "$TEXT" | fmt -w7 > myfile $ while IFS=$' ' read -r line; do export msg_txt_line_$((++x))="$line"; done <myfile $ echo "$msg_txt_line_1" LINE 1 Update: $ TEXT='LINE 1 LINE 2 LINE 3 LINE 4 LINE 5' $ echo "$TEXT" | fmt -w7 > myfile $ while IFS=$' ' read -r line; do export msg_txt_line_$((++x))="$line"; done <myfile $ echo "$msg_txt_line_1" LINE 1

Categories : Shell

How to wrap dynamically created elements using jQuery wrap()?
Add parent() between wrap and appendTo: radio = $("<input />") .attr({ "name": "radio-" + this.uuid + "-" + i, "type": "radio" }) .wrap("<label></label>") .parent() .appendTo(someElement);

Categories : Javascript

jQuerys wrap function wrap works quite odd
that works as expected, your wrapper1 would be the main object that would be wrapped around content1 and as you haven't closed the innerwrapper1, jquery closes it for you. If you want to wrap with inner wrapper then make this an object, wrap content and then append the inner wrapper to wrapper: var wrapper1 = $('<div class="wrap1">something in between</div>'), innerWrapper = $('<div class="innerwrap1" />'); $('.content1').wrap(innerWrapper); wrapper1.append($('.innerwrap1')); Example

Categories : Javascript

Regex match when spaces are removed, how to delete the matched chars from the original string with spaces?
Non-Regex solution would be easier here, and this is how, I would do it legal_ids = """gmbh gesmbh""" def foo(name, legal_ids): #Remove all spaces from the string name_stream = name.replace(' ','') #Now iterate through the legal_ids for id in legal_ids: #Remove the legal ID's from the string name_stream = name_stream.replace(id, '') #Now Create an iterator of the modified string name_stream_it = iter(name_stream) #Fill in the missing/removed spaces return ''.join(next(name_stream_it) if e != ' ' else ' ' for e in name) foo(company_1, legal_ids.splitlines()) 'uber wien abcd ' foo(company_2, legal_ids.splitlines()) 'uber wien abcd ' foo(company_3, legal_ids.splitlines()) 'uber wien abcd '

Categories : Python

Split a string (stored in a variable) into multiple words using spaces but not the spaces within double quotes
$ grep -Eo '"[^"]*"|[^" ]*' <<< '2012 2013 "multiple words"' 2012 2013 "multiple words" That is, print only the strings matching either a quote followed by any number (even zero) non-quotes followed by a quote or a series of characters not containing a quote or space. Of course, this does not handle complicated cases like quotes spanning multiple lines or escaped quotes (using either double quotes like SQL or backslash like the shell).

Categories : Bash

How to remove only trailing spaces of a string in Java and keep leading spaces?
Using the regular expression s+$, you can replace all trailing space characters (includes space and tab characters) with nothing (""). final String text = " foo "; System.out.println(text.replaceFirst("\s+$", "")); Here's a breakdown of the regex: s – any whitespace character + – match one or more of the previous token; i.e., match one or more whitespace character $ – the end of the string Thus, the regular expression will match as much whitespace as it can that is followed directly by the end of the string: in other words, the trailing whitespace. The investment into learning regular expressions will become more valuable, if you need to extend your requirements later on.

Categories : Java

Removing leading and trailing spaces from a string while preserving spaces in between
You can try this simple UDF. The VBA version of Trim doesn't remove any internal spaces. In a regular module: Function VbaTrim(v) VbaTrim=Trim(v) End Function On the worksheet: =VbaTrim(A1)

Categories : Excel

Searching words without spaces for word with spaces in solr
You can use a solr.WordDelimiterFilterFactory with an option catenateAll="1". This will causes all subword parts to be catenated. Example: "wi-fi-4000" => "wifi4000" and this will fix your problem. About the viceversa you can use generateWordParts="1" (together with splitOnCaseChange="1" and maybe splitOnNumerics="1") option on the same filter. This causes parts of words to be generated. Example: "PowerShot" => "Power" "Shot" (if splitOnCaseChange=1) "Power-Shot" => "Power" "Shot" but you need the words to be at least camelcase or Solr has no way to understand where to split the word. remember also to set preserveOriginal="1" if you want your original work to be also tokenized as it is.

Categories : Search

Regex to match spaces except for spaces inside url pattern
Description This regex will find an replace all multiple spaces with a single space, and will bypass the url section. In a sequence of X number of spaces, the first space is placed into group 1 which is fed to the output as 1 and the additional spaces are ignored. The URL section is bypassed because if it is encountered as part of the | or statement, then it is captured into group 2 which is then injected back into the output by the 2 replacement. Regex: (s)s*|("url":"[^"]*"), Replace with: 12 Source String "startofjunk junkjunkjunkjunk","url":"https://x.com/a/C25/XPS - Connection - May 2013.docx","contentsource":"AX","returpath":null,"detailpath":"https://ax.sample.com/Rep>ositories/form.aspx?path=C25/96/99&mode=Read","detailspath2":"samplepath" PHP example This php

Categories : Regex

Searching words with spaces for word without spaces in solr
I think you should use the Shingle filter only at indexation in your schema. Try removing <filter class="solr.ShingleFilterFactory" maxShingleSize="2" outputUnigrams="true" tokenSeparator=""/> from the query part of your analyzer.

Categories : Search

How to search a string with no spaces from source where the same string might have spaces in between? (using regex)
You can generate a regex pattern depending on the string you want to search for: >>> import re >>> def search_with_spaces(what, where): ... return re.search(' *'.join(what), where) ... >>> search_with_spaces('cd', 'ab c d efg') <_sre.SRE_Match object at 0x00696A68> >>> search_with_spaces('cd', 'ab c d efg').group(0) 'c d' >>> search_with_spaces('cd', 'ab cd efg').group(0) 'cd' >>> search_with_spaces('cd', 'ab c d efg').group(0) 'c d' Probably won't be best efficiency if the amount of different strings you're searching for is large, but should do the trick.

Categories : Python



© Copyright 2017 w3hello.com Publishing Limited. All rights reserved.