java default encoding toString UTF8

The default is the derived from the underlying OS. It can be overridden by a system property (file.encoding). Since both of these are kind of outside of your control, it is probably better to explicitly specify an encoding for all the files your program writes and read. UTF-8 should work in most cases. Stream tostring()…

JBPM 4.4 Notes

  Starts with <Start> Node, Common example: <?xml version=”1.0″ encoding=”UTF-8″?> <process name=”Purchase order” xmlns=”http://jbpm.org/4.4/jpdl”&gt; <start> <transition to=”Verify supplier” /> </start> <state name=”Verify supplier”> //choice is triggered by external input. <transition name=”Supplier ok” to=”Check supplier data” /> <transition name=”Supplier not ok” to=”Error” /> </state> <decision name=”Check supplier data”> <transition name=”nok” to=”Error” /> <transition name=”ok” to=”Completed” />…

inputstream from/to string

Fast way I can think of is using the apache common api: StringWriter writer = new StringWriter(); IOUtils.copy(inputStream, writer, encoding); String theString = writer.toString(); Copy method can either use Charset.forName(“UTF-8”) or take String “UTF-8” directly. Or Even easier: String myString = IOUtils.toString(myInputStream, “UTF-8”);     Opposite: public class StringToStream {     public static void main(String[] args)…

Java: a rough guide to character encoding

 A very nice article about encoding.  Unicode in source files Java source files include support for Unicode. There are two common mechanisms for writing code that includes a range of Unicode characters. One choice is to encode the source files as Unicode, write the characters and inform the compiler at compile time. javac provides the -encoding <encoding> option for…

DOM and BOM in JavaScript

They’re just different objects you’re dealing with: The DOM is the Document Object Model, which deals with the document, the HTML elements themselves, e.g. document and all traversal you would do in it, events, etc. The BOM is the Browser Object Model, which deals with browser components aside from the document, like history, location, navigator and screen (as well as some others that vary by browser).

intellij breakpoint check mark cross

no additional marks on a breakpoint mean that either the class in question was not loaded at all or that the debugger is not attached to the VM. When the class is loaded and there are executable instructions at the breakpoint’s line, a checkmark appears on the breakpoint icon. If the class is loaded, but…

xml parse line break, line feed lost

\n or line break or line feed in a string would be stripped by xml parser and replaced by space. According to XML specification, any white space will be normalized into #xA; In order to preserve the line feed, we can just replace all the \n with which is the legal line feed in…

IntelliJ maven out of memory

When I was trying to do mvn clean tomcat:redeploy -DskipTests -Plocal, it always prompt with out of memory exception. However if I do it in cmd, it would be fine. It turns out: IntelliJ’s GWT plugin will do the build using its own settings and won’t use the ones in the Maven plugin. You need to…

netstat command show listening ports

Netstat is a useful tool for checking network and Internet connections. Some useful applications for the average PC user are considered, including checking for malware connections.   Syntax and switches The command syntax isnetstat [-a] [-b] [-e] [-f] [-n] [-o] [-p proto] [-r] [-s] [-t] [-v] [interval]A brief description of the switches is given in…

IntelliJ dark color theme

https://github.com/sirthias/BlueForest   download the BlueForest.xml   Installation Copy the BlueForest.xml file into the /colors directory underneath your IDEA installation folder. If you are on OSX/linux or using cygwin on Windows, you can also clone this git repository into a directory of your choice and use the deploy.sh script to installBlueForest and the update.sh script to copy back changes you made in IDEA. After you have…

IntelliJ tomcat context

IntelliJ use its own tomcat base under user/yourname/intellij… To get around this big mess and just use your Tomcat as if you ran it outside of IDEA you simply add a CATALINA_BASE environment variable to the configuration of Tomcat (within IDEA) pointing to your Tomcat directory:   Now when you start Tomcat within IDEA you…