Friday, February 22, 2013

Javascript highlighter, markup editor, WYSIWYG editor plugins

Depends on what you need, but the following plugins are available in terms of markup presenting/editing plugins

I would divide into three main types,
  • Syntax Highlighter plugins - it highlights a code so that it is easier to read
  • Markup editor plugins - turns textareas into rich and powerful markup editors
  • WYSIWYG editor plugins - high level editors for end-users

Syntax Highlighter plugins

 So far, I have seen several of them:
  1. SyntaxHighlighter plugin [demo] [github]
  2. Snippet [link]
  3. Google Prettify [link] 
  4. Hightlight.js [link] 
  5. SHJS [link] 
  6. Chilli JS [link] 
  7. beautyOfCode [link]
  8. Lighter.js [link]
  9. DlHighlight [link]
  10. JUSH [link]

Markup editor plugins

  1. CodeMirror [link] along with CodeMirror UI [link] 
  2. MarkItUp! [link]
  3. SmartMarkUP [link] 

WYSIWYG editor plugins 

I personally really like those inline-smooth editors, so in that regard I have places a little star on those that cought my attention.
  1. redactor [link]  *
  2. ckedit [link] - has a huge amount of options, but is very slow on netbook, even the minimized version without any plugins
  3. wysihtml5 [link]
  4. mercury editor [link]  *
  5. Tiny Editor [link]
  6. elRTE [link]
  7. Aloha editor  [link] *
  8. CLEditor [link]
  9. bootstrap-wysiwyg [link]
  10. NicEdit [demo] [link]
  11. TinyMCE [link]

Tuesday, February 19, 2013

Customizing the JAXB marshalling/unmarshalling

The following example is used for customizing the way how the dates are being parsed, but it could be used for any other specific customizing

import java.text.SimpleDateFormat;
import java.util.Date;

import javax.xml.bind.annotation.adapters.XmlAdapter;

public class DateAdapter extends XmlAdapter<String, Date> {

    private SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");

    public String marshal(Date v) throws Exception {
        return dateFormat.format(v);

    public Date unmarshal(String v) throws Exception {
        return dateFormat.parse(v);

which then as adapter can be used to customize marshalling/unmarshalling...

import java.util.Date;

import javax.xml.bind.annotation.XmlAccessorType;
import javax.xml.bind.annotation.XmlAccessType;
import javax.xml.bind.annotation.XmlElement;
import javax.xml.bind.annotation.XmlRootElement;
import javax.xml.bind.annotation.adapters.XmlJavaTypeAdapter;

@XmlRootElement(name = "foo") 
public final class Foo { 
    // Other fields omitted 

    @XmlElement(name = "timestamp", required = true) 
    protected Date timestamp; 

    public Foo() {} 

    public Date getTimestamp() { 
        return timestamp; 

    public void setTimestamp(final Date timestamp) { 
        this.timestamp = timestamp; 


Seven habits of highly effective programmers