Showing posts with label IDE. Show all posts
Showing posts with label IDE. Show all posts

Saturday, 9 August 2014

[Vim] open VOom outliner automatically for specific file type

VOom (Vim Outliner of Markups) is a very useful outline plugin for Vim. It can support many markup modes, such as popular markdown, latex, pandoc, html and python. For me,
  • markdown - used to write notes, and it can be easily converted into html or pdf by markdown2.py, pandoc or Mou, then paste html to blog
  • latex - used to write research paper

Typical Usage of VOom

  • Use Vim to open Latex file
  • Type :Voom latex to open VOom outline window in left panel
  • Use the section tree in VOom for jumping to desired section of paper

The Problems

However sometimes I have to open up to ten Latex files for editing at the same time, I need typing :Voom latex for ten times. It's not productive and boring.

Solution

Vim has an autocmd feature to open a command automatically depending on the events. More detials see vimdoc (:help autocmd).
  • Add the following lines in .vimrc

    " after read in tex file and then execute Voom latex 
    autocmd BufRead *.tex :Voom latex 
    autocmd BufRead *.mkd :Voom markdown
    
  • It will execute :Voom latex when opening a Latex file and :Voom markdown for mkd file

Tuesday, 10 June 2014

[IDE] Source Code Syntax Highlight in Blogger

How to enable the source code syntax hightlighter for google blogger

SyntaxHighlighter

  • Go to Blogger's template
  • Click "Backup/Restore" in the upright of page to backup current template at first
  • Then "Edit Template"
  • Add the following lines just before the </head> line
        
        
        

Examples

js


<pre class="brush: js"> int function(int i) { return i; } </pre> <br />

int function(int i)
{
    return i;
}

C/C++


<pre class="brush: c"> int function(int i) { return i; } </pre> <br />

int function(int i)
{
    return i;
}

Friday, 2 May 2014

SVN "local unversioned, incoming add upon update"

Problem
$ svn st -q
D     C dir
      >   local unversioned, incoming add upon update
D       dir/file
 
Solution
$ svn resolve --accept working dir
Resolved conflicted state of 'dir'
$ svn revert dir
Reverted 'dir'
$ svn status
D       dir/file
$ svn revert dir/file
Reverted 'dir/file'
$ svn st -q 
Reference
  • http://tomhennigan.blogspot.co.uk/2012/01/resolve-tree-conflict-svn-local.html 

Thursday, 5 December 2013

Source Code Syntax Highlight in Blogger

How to enable the source code syntax hightlighter for google blogger

SyntaxHighlighter

  • Go to Blogger's template
  • Click "Backup/Restore" in the upright of page to backup current template at first
  • Then "Edit Template"
  • Add the following lines just before the line
        
        
        

Examples

js

int function(int i)
{
    return i;
}

C/C++

int function(int i)
{
    return i;
}

References

Tuesday, 15 October 2013

[git] usage (1)


Authors: - Kangfeng Ye
Title: Git Usage ...
Keywords: Git

Git Introduction

Git is a distributed version control system.

Understanding the key Terminologies

Commands

git add

  • add changes in the working tree to the staging area or called staging
  • allows you to incrementally modify files, stage them, modify and stage them again until you are satisfied with your changes

An example

  • show current working tree status
$ git status -s
  • add a new file, and edit it to add contents
$ echo "git add test" > readme.txt
  • query status and it is untracked
$ git status -s
?? readme
  • staging it and query status again. A - staged
$ git add readme
$ git status -s
A readme
  • modify it and query status again. AM - the file has been changed but the change is not staged
$ echo "staging, then modify again" >> readme
$ git status -s
AM readme
  • staging it again. It comes back to staged again.
$ git add readme; git status -s
A readme

Another example to test

  • query current status
$ git status -s
A readme
  • show file and it's staged content
$ cat readme
git add test
staging, then modify again
  • modify it, but no staging
$ echo "no staging" >> readme
$ git status -s
AM readme
  • commit it
$ git commit -m

Troubleshooting

A scenario

  • create a local git repository
$cd /mnt/share/rfid_tracker
$ git init
$ touch readme.txt
  • clone from repository
$cd ~/src/
$ git clone /mnt/share/rfid_tracker rfid_tracker - a clone is in rfid_tracker folder
  • modify the readme.txt file and commit in clone
$ git commit -m "change" readme.txt
  • push to original repository
$ git push
  • an error occurs
remote: error: refusing to update checked out branch: refs/heads/master
error: failed to push some refs to /mnt/share/rfid_tracker
  • solution (make original reposity as bare)
$ cd /mnt/share/rfid_tracker
$ mv .git .. && rm -fr *
$ mv ../.git .
$ mv .git/* .
$ rmdir .git
$ $ git config --bool core.bare true

Thursday, 15 August 2013

[VIM] Insert the content of a file into current opened file


read a file and insert it into the position below the cursor of the current file

:read /path/to/file
:re /path/to/file
:r /path/to/file
  • insert into the beginning of the file
:0r /path/to/file
  • insert into the end of the file
:$r /path/to/file

read the output of system command and insert into the position below the cursor of the current file

  • read in the file list by ls command
      :r !ls
    
      :r !ls ~
  • read in the dir tree by tree command
      :r !tree

read a specific lines from a file and insert it into the position below the cursor of the current file

  • read the line no.10 to 20 into current file
:r !sed -n 10,20p /path/to/file

Friday, 26 July 2013

Match two marks in one line or two successive lines by grep or awk

Sometime we may need to check if a text file contains the wanted information which can be in one line or two sequential lines, but not others. For example we may check if a file contains the "operation system" and "Linux". It limits to the following format:

In one line:
        "operation system Linux" or "operation systems such as Unix, Linux, Windows..."
or
        "operation system
        Linux"
or
         "operation systems such
          as Unix, Linux, Windows... "
but not
         "Linux operation system"
not
         "Linux
          operation system"
not
         "operation system
         ......
         Linux"

pcregrep
pcregrep -M 'operation system.*(\n|.).*Linux' test.txt
awk
awk '/operation system/{k=1; ln=$0}  /Linux/{if(k == 1){print "--------"; print ;} if(k == 2){print "---------"; print ln; print;}} {if(k > 0){k++}}' test.txt
Problem: this awk will match the "Linux operation system"? How to avoid it?

Improvement: 
./match.awk test.txt
match.awk
#!/usr/bin/awk -f

BEGIN \
{
        print " - BEGIN - "
        m1 = 0; # mark1
        m2 = 0; # mark2
        ln = ""; # last line
}
{
        # two marks in one line
        if ($0 ~ /operation system.*Linux/) {
                        print "----1----";
                        print $0;
        }
        else {
                if ($0 ~ /operation system/) {
                        m1 = 1;
                        ln = $0;
                }
                else if ($0 ~ /Linux/ && m1 == 1) {
                # two marks in adjacent lines
                        m2 = 1;
                        print "----2----";
                        print ln;
                        print $0;
                }
                else {
                # clear all variables for unmatched line
                        m1 = 0;
                        m2 = 0;
                        ln = "";
                }
        }
}
END { print " - DONE - " }
Test Output
 - BEGIN -
----1----
operation system Linux
----2----
operation system
Linux
----1----
operation system such as Linux
----2----
operation system
such as Linux
 - DONE -
Test Input: test.txt
operation system Linux

operation system
Linux

operation system such as Linux

operation system
such as Linux

Linux
operation system

Linux operation system

operation system

Linux

operation system
such as
Linux

Thursday, 11 July 2013

R: basics - installastion, environment and debug

Install R

  • $sudo apt-get install r-base

R edit environment

R basics

  • Install extra package
    • > install.packages("ismev")
  • Source R script
    • > source("fit-gumbel.r")
  • Call function provided by fit-gumbel.r
    • > fit-gumbel("in.dat")

R debug

take optim function as an example

  • display source code of optim
    • > edit(optim)
  • set debug mode
    • > debug(optim)
  • check debug mode
    • > isdebugged(optim)
  • cancel debug mode
    • > undebug(optim)
  • debug optim (R source code src/library/stats/R/optim.R)
    • > debug(optim)
    • > out <- gumbel(dat)
    • Browser[2]> where
    • Browser[2]> [RET] - next step
    • Browser[2]> c - continue
    • Browser[2]> n
    • Browser[2]> Q
    • Browser[2]>

tmux usage

  • tmux quick set
    • tmux to take out the tmux terminal environment
    • C-b % to split window into two panes (vertically)
    • C-b :split-window to split window into two panes (horizontally)
    • C-b o switch to next pane
    • C-b x kill current pane
  • C-b has change to C-a
    • download a tmux.conf file
    • tmux source-file /devt/dev-rye/tmux-conf/tmux.conf
    • C-a | split vertically
    • C-a - split horizontally

Friday, 26 April 2013

Set up Java Development Environment for CZT (Community Z Tool) On Windows

Set up Java Development Environment for CZT (Community Z Tool) On Windows

Windows

Install JDK-1.7.0

  1. Install Directory
    • c:\Program Files\Java\jdk1.7.0_03
    • c:\Program Files\Java\jre7
  2. Set environment variables
    • Path=c:\Program Files\Java\jdk1.7.0_03\bin\;c:\Program Files\Java\jre7\bin\;
    • JAVA_HOME=c:\Program Files\Java\jre7\

Install maven-3.0.5 (>= 3.0.4)

  1. Download maven for Windows from http://maven.apache.org/download.cgi
  2. Unpack the tar package under d:\programs
  3. Add maven bin to environment variable PATH
    • PATH=d:\randall\Programs\apache-maven-3.0.5\bin\

Git clone czt code

    git clone git://git.code.sf.net/p/czt/code czt_code

Build CZT

  • Execute buildall.bat

Build Error

  1. Compilation Error #1
    ------- Error Log ------
    [INFO] -------------------------------------------------------------  
    [ERROR] COMPILATION ERROR :  
    [INFO] -------------------------------------------------------------  
    [ERROR] Unable to locate the Javac Compiler in:  
    c:\Program Files\Java\jre7\..\lib\tools.jar  
    Please ensure you are using JDK 1.4 or above and  
    not a JRE (the com.sun.tools.javac.Main class is required).  
    In most cases you can change the location of your Java  
    installation by setting the JAVA_HOME environment variable.  
    [INFO] 1 error  
    [INFO] -------------------------------------------------------------
    
    Solution: change JAVA_HOME to c:\Program Files\Java\jdk1.7.0_03\
  2. Build failed
    Line breaks (Windows only)
    On Windows, CZT expects Windows-style line breaks (CR+LF). The conversion is usually set by default (e.g. using msysgit) and nothing else is necessary. If, however, you encounter build problems with some CZT modules, try forcing the Windows line breaks using the following Git command in your repository:
    git config core.autocrlf true
    
    Then reset your Git repository to checkout correct line breaks:
    git rm --cached -r .
    git reset --hard
    
  3. Build Error

    [INFO] ------------------------------------------------------------------------
    [INFO] BUILD SUCCESS
    [INFO] ------------------------------------------------------------------------
    [INFO] Total time: 7:23.874s
    [INFO] Finished at: Tue Apr 23 10:45:24 BST 2013
    [INFO] Final Memory: 291M/784M
    [INFO] ------------------------------------------------------------------------
    [INFO] Scanning for projects...
    [WARNING] Error initializing: org.eclipse.tycho.p2.resolver.P2TargetPlatformReso lver@646d5273
    java.lang.RuntimeException: java.lang.IllegalStateException: Service is not regi
    stered class='interface org.eclipse.tycho.core.facade.ProxyServiceFacade'
            at org.eclipse.sisu.equinox.embedder.internal.DefaultEquinoxEmbedder.che
    ckStarted(DefaultEquinoxEmbedder.java:301)
            at org.eclipse.sisu.equinox.embedder.internal.DefaultEquinoxEmbedder.get
    Service(DefaultEquinoxEmbedder.java:275)
            at org.eclipse.sisu.equinox.embedder.internal.DefaultEquinoxEmbedder.get
    Service(DefaultEquinoxEmbedder.java:270)
            at org.eclipse.tycho.p2.resolver.P2TargetPlatformResolver.initialize(P2T
    argetPlatformResolver.java:433)
            at org.sonatype.guice.plexus.lifecycles.PlexusLifecycleManager.initializ
    e(PlexusLifecycleManager.java:338)
            at org.sonatype.guice.plexus.lifecycles.PlexusLifecycleManager.manageLif
    ecycle(PlexusLifecycleManager.java:296)
            at org.sonatype.guice.plexus.lifecycles.PlexusLifecycleManager.onProvisi
    on(PlexusLifecycleManager.java:148)
            at com.google.inject.internal.ProvisionListenerStackCallback$Provision.p
    rovision(ProvisionListenerStackCallback.java:108)
            at com.google.inject.internal.ProvisionListenerStackCallback.provision(P
    rovisionListenerStackCallback.java:55)
            at com.google.inject.internal.ProviderInternalFactory.circularGet(Provid
    erInternalFactory.java:68)
            at com.google.inject.internal.InternalFactoryToInitializableAdapter.get(
    InternalFactoryToInitializableAdapter.java:45)
            at com.google.inject.internal.InjectorImpl$3$1.call(InjectorImpl.java:96
    5)
            at com.google.inject.internal.InjectorImpl.callInContext(InjectorImpl.ja
    va:1011)
            at com.google.inject.internal.InjectorImpl$3.get(InjectorImpl.java:961)
            at com.google.inject.Scopes$1$1.get(Scopes.java:59)
            at org.sonatype.guice.bean.locators.LazyBeanEntry.getValue(LazyBeanEntry
    .java:83)
            at org.sonatype.guice.plexus.locators.LazyPlexusBean.getValue(LazyPlexus
    Bean.java:49)
            at org.codehaus.plexus.DefaultPlexusContainer.lookup(DefaultPlexusContai
    ner.java:253)
            at org.codehaus.plexus.DefaultPlexusContainer.lookup(DefaultPlexusContai
    ner.java:245)
            at org.eclipse.tycho.core.resolver.DefaultTargetPlatformResolverFactory.
    lookupPlatformResolver(DefaultTargetPlatformResolverFactory.java:74)
            at org.eclipse.tycho.core.resolver.DefaultTychoDependencyResolver.setupP
    roject(DefaultTychoDependencyResolver.java:86)
            at org.eclipse.tycho.core.maven.TychoMavenLifecycleParticipant.afterProj
    ectsRead(TychoMavenLifecycleParticipant.java:77)
            at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:274)
            at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:156)
            at org.apache.maven.cli.MavenCli.execute(MavenCli.java:537)
            at org.apache.maven.cli.MavenCli.doMain(MavenCli.java:196)
            at org.apache.maven.cli.MavenCli.main(MavenCli.java:141)
            at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
            at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.
    java:57)
            at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAcces
    sorImpl.java:43)
            at java.lang.reflect.Method.invoke(Method.java:601)
            at org.codehaus.plexus.classworlds.launcher.Launcher.launchEnhanced(Laun
    cher.java:290)
            at org.codehaus.plexus.classworlds.launcher.Launcher.launch(Launcher.jav
    a:230)
            at org.codehaus.plexus.classworlds.launcher.Launcher.mainWithExitCode(La
    uncher.java:409)
            at org.codehaus.plexus.classworlds.launcher.Launcher.main(Launcher.java:
    352)
    Caused by: java.lang.IllegalStateException: Service is not registered class='int
    erface org.eclipse.tycho.core.facade.ProxyServiceFacade'
            at org.eclipse.sisu.equinox.embedder.internal.DefaultEquinoxEmbedder.get
    Service(DefaultEquinoxEmbedder.java:291)
            at org.eclipse.sisu.equinox.embedder.internal.DefaultEquinoxEmbedder.get
    Service(DefaultEquinoxEmbedder.java:270)
            at org.eclipse.tycho.osgi.configuration.OSGiProxyConfigurator.afterFrame
    workStarted(OSGiProxyConfigurator.java:30)
            at org.eclipse.sisu.equinox.embedder.internal.DefaultEquinoxEmbedder.doS
    tart(DefaultEquinoxEmbedder.java:180)
            at org.eclipse.sisu.equinox.embedder.internal.DefaultEquinoxEmbedder.sta
    rt(DefaultEquinoxEmbedder.java:67)
            at org.eclipse.sisu.equinox.embedder.internal.DefaultEquinoxEmbedder.che
    ckStarted(DefaultEquinoxEmbedder.java:299)
            ... 34 more
    [ERROR] Internal error: java.lang.RuntimeException: Could not instantiate requir
    ed component: com.google.inject.ProvisionException: Guice provision errors:
    [ERROR]
    [ERROR] 1) Error notifying ProvisionListener org.sonatype.guice.plexus.lifecycle
    s.PlexusLifecycleManager of org.eclipse.tycho.core.TargetPlatformResolver annota
    ted with @com.google.inject.name.Named(value=p2).
    [ERROR] Reason: java.lang.RuntimeException: java.lang.IllegalStateException: Ser
    vice is not registered class='interface org.eclipse.tycho.core.facade.ProxyServi
    ceFacade'
    [ERROR] while locating org.eclipse.tycho.core.TargetPlatformResolver annotated w
    ith @com.google.inject.name.Named(value=p2)
    [ERROR]
    [ERROR] 1 error
    [ERROR] role: org.eclipse.tycho.core.TargetPlatformResolver
    [ERROR] roleHint: p2
    [ERROR] -> [Help 1]
    org.apache.maven.InternalErrorException: Internal error: java.lang.RuntimeExcept
    ion: Could not instantiate required component
            at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:168)
            at org.apache.maven.cli.MavenCli.execute(MavenCli.java:537)
            at org.apache.maven.cli.MavenCli.doMain(MavenCli.java:196)
            at org.apache.maven.cli.MavenCli.main(MavenCli.java:141)
            at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
            at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.
    java:57)
            at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAcces
    sorImpl.java:43)
            at java.lang.reflect.Method.invoke(Method.java:601)
            at org.codehaus.plexus.classworlds.launcher.Launcher.launchEnhanced(Laun
    cher.java:290)
            at org.codehaus.plexus.classworlds.launcher.Launcher.launch(Launcher.jav
    a:230)
            at org.codehaus.plexus.classworlds.launcher.Launcher.mainWithExitCode(La
    uncher.java:409)
            at org.codehaus.plexus.classworlds.launcher.Launcher.main(Launcher.java:
    352)
    Caused by: java.lang.RuntimeException: Could not instantiate required component
            at org.eclipse.tycho.core.resolver.DefaultTargetPlatformResolverFactory.
    lookupPlatformResolver(DefaultTargetPlatformResolverFactory.java:76)
            at org.eclipse.tycho.core.resolver.DefaultTychoDependencyResolver.setupP
    roject(DefaultTychoDependencyResolver.java:86)
            at org.eclipse.tycho.core.maven.TychoMavenLifecycleParticipant.afterProj
    ectsRead(TychoMavenLifecycleParticipant.java:77)
            at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:274)
            at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:156)
            ... 11 more
    Caused by: org.codehaus.plexus.component.repository.exception.ComponentLookupExc
    eption: com.google.inject.ProvisionException: Guice provision errors:

    1) Error notifying ProvisionListener org.sonatype.guice.plexus.lifecycles.Plexus
    LifecycleManager of org.eclipse.tycho.core.TargetPlatformResolver annotated with
     @com.google.inject.name.Named(value=p2).
     Reason: java.lang.RuntimeException: java.lang.IllegalStateException: Service is
     not registered class='interface org.eclipse.tycho.core.facade.ProxyServiceFacad
    e'
      while locating org.eclipse.tycho.core.TargetPlatformResolver annotated with @c
    om.google.inject.name.Named(value=p2)

    1 error
          role: org.eclipse.tycho.core.TargetPlatformResolver
      roleHint: p2
            at org.codehaus.plexus.DefaultPlexusContainer.lookup(DefaultPlexusContai
    ner.java:257)
            at org.codehaus.plexus.DefaultPlexusContainer.lookup(DefaultPlexusContai
    ner.java:245)
            at org.eclipse.tycho.core.resolver.DefaultTargetPlatformResolverFactory.
    lookupPlatformResolver(DefaultTargetPlatformResolverFactory.java:74)
            ... 15 more
    Caused by: com.google.inject.ProvisionException: Guice provision errors:

    1) Error notifying ProvisionListener org.sonatype.guice.plexus.lifecycles.Plexus
    LifecycleManager of org.eclipse.tycho.core.TargetPlatformResolver annotated with
     @com.google.inject.name.Named(value=p2).
     Reason: java.lang.RuntimeException: java.lang.IllegalStateException: Service is
     not registered class='interface org.eclipse.tycho.core.facade.ProxyServiceFacad
    e'
      while locating org.eclipse.tycho.core.TargetPlatformResolver annotated with @c
    om.google.inject.name.Named(value=p2)

    1 error
            at com.google.inject.internal.InjectorImpl$3.get(InjectorImpl.java:974)
            at com.google.inject.Scopes$1$1.get(Scopes.java:59)
            at org.sonatype.guice.bean.locators.LazyBeanEntry.getValue(LazyBeanEntry
    .java:83)
            at org.sonatype.guice.plexus.locators.LazyPlexusBean.getValue(LazyPlexus
    Bean.java:49)
            at org.codehaus.plexus.DefaultPlexusContainer.lookup(DefaultPlexusContai
    ner.java:253)
            ... 17 more
    Caused by: java.lang.RuntimeException: java.lang.IllegalStateException: Service
    is not registered class='interface org.eclipse.tycho.core.facade.ProxyServiceFac
    ade'
            at org.eclipse.sisu.equinox.embedder.internal.DefaultEquinoxEmbedder.che
    ckStarted(DefaultEquinoxEmbedder.java:301)
            at org.eclipse.sisu.equinox.embedder.internal.DefaultEquinoxEmbedder.get
    Service(DefaultEquinoxEmbedder.java:275)
            at org.eclipse.sisu.equinox.embedder.internal.DefaultEquinoxEmbedder.get
    Service(DefaultEquinoxEmbedder.java:270)
            at org.eclipse.tycho.p2.resolver.P2TargetPlatformResolver.initialize(P2T
    argetPlatformResolver.java:433)
            at org.sonatype.guice.plexus.lifecycles.PlexusLifecycleManager.initializ
    e(PlexusLifecycleManager.java:338)
            at org.sonatype.guice.plexus.lifecycles.PlexusLifecycleManager.manageLif
    ecycle(PlexusLifecycleManager.java:296)
            at org.sonatype.guice.plexus.lifecycles.PlexusLifecycleManager.onProvisi
    on(PlexusLifecycleManager.java:148)
            at com.google.inject.internal.ProvisionListenerStackCallback$Provision.p
    rovision(ProvisionListenerStackCallback.java:108)
            at com.google.inject.internal.ProvisionListenerStackCallback.provision(P
    rovisionListenerStackCallback.java:55)
            at com.google.inject.internal.ProviderInternalFactory.circularGet(Provid
    erInternalFactory.java:68)
            at com.google.inject.internal.InternalFactoryToInitializableAdapter.get(
    InternalFactoryToInitializableAdapter.java:45)
            at com.google.inject.internal.InjectorImpl$3$1.call(InjectorImpl.java:96
    5)
            at com.google.inject.internal.InjectorImpl.callInContext(InjectorImpl.ja
    va:1011)
            at com.google.inject.internal.InjectorImpl$3.get(InjectorImpl.java:961)
            ... 21 more
    Caused by: java.lang.IllegalStateException: Service is not registered class='int
    erface org.eclipse.tycho.core.facade.ProxyServiceFacade'
            at org.eclipse.sisu.equinox.embedder.internal.DefaultEquinoxEmbedder.get
    Service(DefaultEquinoxEmbedder.java:291)
            at org.eclipse.sisu.equinox.embedder.internal.DefaultEquinoxEmbedder.get
    Service(DefaultEquinoxEmbedder.java:270)
            at org.eclipse.tycho.osgi.configuration.OSGiProxyConfigurator.afterFrame
    workStarted(OSGiProxyConfigurator.java:30)
            at org.eclipse.sisu.equinox.embedder.internal.DefaultEquinoxEmbedder.doS
    tart(DefaultEquinoxEmbedder.java:180)
            at org.eclipse.sisu.equinox.embedder.internal.DefaultEquinoxEmbedder.sta
    rt(DefaultEquinoxEmbedder.java:67)
            at org.eclipse.sisu.equinox.embedder.internal.DefaultEquinoxEmbedder.che
    ckStarted(DefaultEquinoxEmbedder.java:299)
            ... 34 more
    [ERROR]
    [ERROR] To see the full stack trace of the errors, re-run Maven with the -e swit
    ch.
    [ERROR] Re-run Maven using the -X switch to enable full debug logging.
    [ERROR]
    [ERROR] For more information about the errors and possible solutions, please rea
    d the following articles:
    [ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/InternalErrorE
    xception
    Press any key to continue . . .


Solution: ignore this error at that moment since all builds are successful

Import project into Eclipse

Reference: http://czt.sourceforge.net/dev/eclipse/index.html
  1. Download Eclipse Classic 4.2.0
  2. Install m2e connectors
    • install maven-jflex-plugin and xml-maven-plugin from http://czt.sourceforge.net/dev/eclipse/updates/
  3. Install m2e release for Eclipse
    • from http://download.eclipse.org/technology/m2e/releases
  4. Select the m2e repository cache directory. m2e has caches lucene index in two places
    • Per-workspace indexes are stored under .metadata/.plugins/org.eclipse.m2e.core/nexus
    • and there is also global cache in ~/.m2/repository/.cache/m2e/${m2e.version}
  5. The default cache directory on Windows in the department is the home directory h:\.WindowsProfile\.m2\. However, this folder has very strict limitation of disk volumn. Thus the cache directory has to be changed.
    • Open Eclipse preference, click Maven/Installation. Add external Maven d:\randall\Programs\apache-maven-3.0.5, and unselect the Embedded 3.0.4
    • The settings.xml file will be in d:\randall\Programs\apache-maven-3.0.5\conf. Open settings.xml, and change <localRepository> to <localRepository>d:\.m2\repository</localRepository>
    • Save the changes in Eclipse
  6. Open a command prompt window and rebuild the czt-code again
    • buildall.bat
    • Now all cached files are saved in the specified directory, and can build successfully
    • Thus the previous Build Error with long error log is due to the limited size of cache repository
  7. After the build, open Eclipse and import the czt projects into the Eclipse by File > Import > Existing Maven Projects
    • Select the czt-code root directory and import all necessary projects
    • After import, workspace will build automatically
    • Set CZT target platform
      • Open target definition file at /net.sourceforge.czt.eclipse.target/net.sourceforge.czt.eclipse.target.target within Eclipse and clock Set as Target Platform
    • If necessary, right click the project and Maven > Update Projects to update Maven projects
    • If necessary, clean all projects and build again

Wednesday, 24 April 2013

Setup of a notes writing environment (markdown + Voom + markdown2.py) on Windows

This is a note to write down how to set up a working environment for notes writing efficiently on Windows

Environment Requirement

  • VIM editor
  • markdown syntax
  • Voom outline
  • markdown2.py to convert from mkd to html for easily publishing on blog

Install markdown syntax

Install Voom

Install python27 on Windows

  • Install python27 to C:\python27
  • Add this directory to the PATH environment variable

Install distribute package to have the packages installation capability (such as pip, easy_install )

Install markdown2

markdown2.py is used to convert the mkd file to html file - Open a command prompt window, and type
easy_install markdown2 - Then markdown2.py is installed in the c:/python27/scripts

Test it

  • Create a mkd file and write a sample markdown note by VIM
  • You should see the syntax works for this file. If not, add "syntax on" vimrc file
  • Type command ":Voom markdown" within VIM, and another outline window is opened
  • Quit Vim and open a command prompt window, and type
    markdown2.py hello.mkd
  • Error
    close failed in file object destructor: sys.excepthook is missing lost sys.stderr
  • Solution: use "python c:\python27\Scripts\markdown2.py hello.mkd > hello.html" instead of "markdown2.py hello.mkd > hello.html"