Normalizing line endings in Ruby

Since ruby 1.9 you can use String::encode with universal_newline: true to get all of your new lines into \n while keeping your encoding unchanged: s.encode(s.encoding, universal_newline: true) Once in a known newline state you can freely convert back to CRLF using :crlf_newline. eg: to convert a file of unknown (possibly mixed) ending to CRLF (for … Read more

use xsl to output plain text

You can define a template to match on script/command and eliminate the xsl:for-each concat() can be used to shorten the expression and save you from explicitly inserting so many <xsl:text> and <xsl:value-of> elements. The use of an entity reference &#xA; for the carriage return, rather than relying on preserving the line-break between your <xsl:text> element … Read more

How to prevent YAML to dump long line without new line

Thanks @MathieuMarques for suggesting to look @ dump options and link provided, YAML documentation was not good enough to find it out. Anyways solution is to specify width parameter for dump function. i.e. yaml.dump(data, width=1000) A better approach suggested by @RandomCoder to use yaml.dump(data, width=float(“inf”)) for a permanent solution.

How do I add a line break / blank line after my LOG statement?

Simply add \n at the end of the string to log. LOGGER.info(“Person’s name is {} .\n”, person.getName()); If you are in a windows environment use \r\n To get the right value of new line if you don’t know the end operating system of your application you can use the property line.separator String lineSeparator = System.getProperty(“line.separator”); … Read more

Vim auto line-break

You can limit the width of a line with the textwidth option (see :help tw). For example, if you want to limit the width to 80 columns, you can use: :set tw=80 With this option, when you will type something longer than 80 columns, Vim will automatically insert a newline character.

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)