Thursday, July 22, 2010

H2 Database

H2 Database is good one

  • the latest version is 1.2.139


    #!/bin/bash
    pre="-Dh2.bindAddress=0.0.0.0 -DwebAllowOthers=true" 
    postW="-web -webAllowOthers -webPort 8052" 
    postT="-tcp -tcpAllowOthers -tcpPort 8050" 
    
    echo jdbc:h2:tcp://localhost:8050/~/work/db/test
    echo  -Doracle.display.default.schema.only=false 
    
    echo 
    java -cp ~/bin/lib/h2-1.2.139.jar $pre org.h2.tools.Server $postW $postT
    
  • able to connect with Eclipse Sql Explorer
  • To enable Sql Completion in Sql Explorer do as
  • Files > Preferences > SQL Explorer. Tick the Tables and columns auto-completing assistance. Click OK and if it doesn’t work still, just restart SQL Explorer and will work.

Wednesday, July 21, 2010

Bash scripts to help with scala-console

  • alias nano 'nano EHimq' for better nano defaults in bashrc
  • mkdir ~/apps/scripts, cd  ~/apps/scripts
  • nano do-script
  • chmod u+x do-*
  • append to $Path in bashrc "~/apps/scripts"
  • run do-script to start appending the terminal to log file

  • run do-clean-log to clean the terminal log files to be cleaned

  • Custom prompt bash shell, edit /etc/bash.bashrc
    Append the code as follows
  • in ~/.bashrc file put this line at end export PS1="\\W \\$"
  • this will display prompt as "~ $ " (space is allowed anywhere, that is why double quotes :)



    # If id command returns zero, you’ve root access.
    if [ $(id -u) -eq 0 ];
    then # you are root, set red colour prompt
    PS1="\\[$(tput setaf 1)\\]\\u@\\h:\\w #\\[$(tput sgr0)\\]"
    else # normal
    PS1="[\\u@\\h:\\w] $"
    fi
    
  • to make the prompt setting permanent
    To have it set everytime you login to your workstation add above export command to your .bash_profile file or .bashrc file.


    $ cd
    $ vi .bash_profile
    OR
    $ vi .bashrc
    
    Append export line:
    export PS1="\e[0;31m[\u@\h \W]\$ \e[m"
    

    Save and close the file.

Squeryl try

Squeryl is a good ORM, it is not like anyother since the Compiled Query matches DB domain, not like Hibernate String queries.
My Steps:

cd ~/dev
git clone http://github.com/max-l/Squeryl.git

install intellij IDEA

  • if re-installing make sure to delete/rename the cache dir of IDEA~/.ideaxxx
  • cd ~/apps to create launcher follow
  • wget http://download.jetbrains.com/idea/ideaIU-95.413.tar.gz
  • tar xvfz ideaIU-95.413.tar.gz
  • rm -rf ideaIU-95.413.tar.gz
  • to install scala plugin download from
  •  cd ~/apps/idea-IU-95.413/plugins
  • wget http://download.jetbrains.com/scala/scala-intellij-bin-0.3.1888.zip
  • unzip scala-intellij-bin-0.3.1888.zip
  • nano ~/apps/idea-IU-95.413/bin/run-idea.sh

    #!/bin/bash
    
    export JDK_HOME=$JAVA_HOME 
    export IDEA_JDK=$JAVA_HOME
    export IDEA_HOME=~/apps/idea-IU-95.413
    
    export IDEA_VM_OPTIONS="$IDEA_HOME/bin/idea.vmoptions"
    export IDEA_PROPERTIES="$IDEA_HOME/bin/idea.properties"
    
    cd "$IDEA_HOME/bin"
    export LIBXCB_ALLOW_SLOPPY_LOCK=1
    
    ./idea.sh
  • chmod 755 ~/apps/idea-IU-95.413/bin/run-idea.sh
  • follow this blog entry to create a IDEA project in scala

dev install

Installing Development Files:
  1. copy install files from usb to ~/Downloads/my/install tree structure
  2. copy backup files from usb to ~/Downloads/my/backup
  3. installing java jdk in /usr/local/java/jdk-sun-1.6.21 refer this or this
    cd /usr/local/bin
    sudo mkdir java
    cd java
    sudo mv ~/Downloads/ubuntu/java/jdk-6u21-linux-i586.bin .
    sudo chmod 755 jdk-6u21-linux-i586.bin download
    sudo ./jdk-6u21-linux-i586.bin
    pwd
    sudo update-alternatives --install "/usr/bin/java" "java" "/usr/local/bin/java/jdk1.6.0_21/bin/java" 1
    (remember priority as 1)!
    (run above twice)
    sudo update-alternatives --set java "/usr/local/bin/java/jdk1.6.0_21/bin/java"

  4. install jrockit_16 too but do not set java for it in run.sh of jboss/bin
    (jboss will use it)
    [put export JAVA_HOME, JDK_HOME in sudo /etc/bash.bashrc]
  5. scala install using scala-lang.org under /usr/local/scala/scala-280-final [put export SCALA_HOME] and do default setting like above for scala exec
    cd ~/Downloads/ubuntu/scala/
    cd /usr/local/bin
    sudo mkdir scala
    cd scala
    sudo mv ~/Downloads/ubuntu/scala/scala-2.8.0.final.tgz .
    sudo tar xvfz scala-2.8.0.final.tgz
    sudo update-alternatives –install “/usr/bin/scala” “scala” “/usr/local/bin/scala/scala-2.8.0.final/bin/scala” 1
    (remember priority as 1)!
    (run above twice)
    sudo update-alternatives –set scala “/usr/local/bin/scala/scala-2.8.0.final/bin/scala”

    export JAVA_HOME=/usr/local/bin/java/jdk1.6.0_21
    export SCALA_HOME=/usr/local/bin/scala/scala-2.8.0.final
    export PATH=$JAVA_HOME/bin:$SCALA_HOME/bin:$PATH

  6. download and unzip ant into ~/apps/apache-ant-xxx [put export ANT_HOME]
    mkdir ~/apps
    cd ~/apps
    cp ~/Downloads/ubuntu/ant/apache-ant-1.8.1-bin.zip .
    unzip apache-ant-1.8.1-bin.zip
    rm apache-ant-1.8.1-bin.zip
    export ANT_HOME=~/apps/apache-ant-1.8.1
    export PATH=$JAVA_HOME/bin:$SCALA_HOME/bin:$ANT_HOME/bin:$PATH

  7. download and unzip maven 2.2.1 into ~/apps/maven-xxx [put export M2_HOME, MAVEN_HOME]
    cd ~/apps
    cp ~/Downloads/ubuntu/maven/apache-maven-2.2.1-bin.zip .
    unzip apache-maven-2.2.1-bin.zip
    rm apache-maven-2.2.1-bin.zip
    export M2_HOME=~/apps/apache-maven-2.2.1
    export PATH=$JAVA_HOME/bin:$SCALA_HOME/bin:$ANT_HOME/bin:$M2_HOME/bin:$PATH

  8. test all installs as
    cd ~
    scala
    java -version
    ant -version
    mvn -version

  9. download and unzip eclipse helios and galelio into user local dir (Not in ROOT privileges)
    mkdir -p ~/apps/eclipse/eclipse-36
    cd ~/apps/eclipse/eclipse-36
    cp ~/Downloads/ubuntu/eclipse/eclipse-jee-helios-linux-gtk.tar .
    tar xvf eclipse-jee-helios-linux-gtk.tar
    rm eclipse-jee-helios-linux-gtk.tar
    create app launcher for “~/apps/eclipse/e4clipse-36/eclipse/eclipse”

  10. download and install idea 9.0.3 from and scala plugin for it follow this
  11. install sbt in ~/apps/sbt/ and any local scripts in ~/apps/scripts/ and jrebel in ~/apps/jrebel/
  12. mkdirs as
    mkdir ~/projects (where all real projects go)
    mkdir ~/dev (where all dev/test projects go)
    mkdir ~/work/eclipse-workspace (where all projects go)
    mkdir ~/work/idea-workspace (where all projects go)

  13. install ExecuteQuery java SqlEditor into ~/apps/executeQuery/ from ~/install/misc/executequery-installer-v3.2.2.jar
  14. For Column Edit and find list lines UltraEdit
  15. Oracle Developer (java Sql Editor Client for Oracle DB)
  16. Eclipse SQL Explorer (is great too)
  17. misc optional as needed
    Istanbul
    shutter
    KGrab
    Screenie
    ssvnc

  18. creating desktop short cuts:
    create icon for eclipse 3.6, idea 9.0.3, gedit, KolourPaint, Tomboy, applications->Computer (file browser), Chrome browser