Tuesday, October 26, 2010

GIT and GitWeb Install


  • hope you already have apache2 installed and its conf are in
    /etc/apache2/
    copied from

  • Install Git packages as needed
    $ sudo apt-get install it git-core gitk gitweb
    if your apache www directory is pointing to ~/www
    $ cd ~/www/
    $ mkdir gitweb
    $ cd gitweb
    

  • copying gitwebfiles to local www
    $ cp /usr/share/gitweb/* ~/www/gitweb
    check the index.cgi has the cgi code in it
    

  • add gitweb directory to apache2 configuration by creating a “gitweb” file inside apache conf.d directory:
    $ nano /etc/apache/conf.d/gitweb
    Alias /gitweb /home/roger/www/gitweb
    
      Options FollowSymLinks +ExecCGI
      AddHandler cgi-script .cgi
    
    

  • $ nano /etc/gitweb.conf
    # path to git projects (.git)
    $projectroot = "/home/roger/z-git-repos";
    
    # directory to use for temp files
    $git_temp = "/tmp";
    
    # target of the home link on top of all pages
    #$home_link = $my_uri || "/";
    
    # html text to include at home page
    $home_text = "indextext.html";
    
    # file with project list; by default, simply scan the projectroot dir.
    $projects_list = $projectroot;
    ##$projects_list = "/home/git/projects.list";
    
    # stylesheet to use
    $stylesheet = "/gitweb/gitweb.css";
    
    # logo to use
    $logo = "/gitweb/git-logo.png";
    
    # the 'favicon'
    $favicon = "/gitweb/git-favicon.png";
    

  • restart apache2 web server:

    $ sudo /etc/init.d/apache2 restart
    
    Now you should be able to view gitweb listing all GIT projects under /home/roger/z-git-repos/
    http://localhost/gitweb


  • Your repo can be your shared local directory
    or you can have git-daemon running on local and pointing to /home/roger/z-git-repos/ as repo-root
    $git daemon --reuseaddr --base-path=/home/roger/z-git-repos --export-all --verbose --enable=receive-pack
    

  • Now steps to put a local project on this git-repo:
    say you have project which is Not in git (like bare local file system) as ~/projects-try/test-project
    with files in it like src/blah
    cd test-project
    test-project $ 
    test-project $ git init
    Initialized empty Git repository in /home/roger/projects-try/test-project/.git/
    test-project $ git add .
    test-project $ git commit -a -m 'Initial repo creation'
    test-project $ cd ..
    ## where ~/z-git-repos/ is repo' server's root dir , like www of apache :)
    projects-try $ git clone --bare ./test-project ~/z-git-repos/test-project.git
    Initialized empty Git repository in /home/roger/z-git-repos/test-project.git/
    projects-try $ cd ~/z-git-repos/test-project.git
    test-project.git $ git --bare update-server-info
    test-project.git $ mv hooks/post-update.sample hooks/post-update
    test-project.git $ chmod a+x hooks/post-update
    test-project.git $ touch git-daemon-export-ok
    test-project.git $ git config core.sharedRepository group
    test-project.git $ 
    
    ## then rename local ~/projects-try/test-project as ~/projects-try/test-project-junk
    then checkout the master, so that we continue the server's repo  as master
    cd ~/projects-try
    mv test-project test-project-junk
    git clone git://roger/test-project.git
    

  • now you have master's copy from repo's server which is shared by other users
    and you work on it as that is the master trunk
    now you can trash out the "test-project-junk"

Tuesday, September 21, 2010

linux tips

  • to mount windows share on linux (ubuntu 10.04)
  • sudo apt-get install samba smbfs (2 installs needed)
  • using smbmount


    sudo smbmount "//11.145.120.61/system" "/home/rxxxx/z-shares/chris-share" -o 'user=rxxxx,pass=15'
    //for Read with Write permission
    sudo smbmount "//11.145.161.9/Users/rxxxx" "/home/rxxxx/z-shares/vdi/raj" -o username=rxxxx,password=xxxxxxxx15,rw,uid=1000
    //make sure use "id" command to look for ur UID 
  • look for who is using port 8410

    netstat -tulpn | grep '8410'
  • look for details of process with 'jboss' in it

    ps -afew | grep jboss
  • ssh to a machine with jboss as user to machine devmachine, using ssh listening(telnet) port 8841 configured, default is 22

    ssh -P 8841 jboss@devmachine
    which prompts for password,
  • to prevent typing password (from chris machine) everytime you can copy public key to remote box as follows

    copy from local ~/.ssh/id_rsa.pub to remote machine


    using scp -P 8841 src destn
    scp -P 8841 ~/.ssh/id_rsa.pub jboss@devmachine:/home/jboss/chris_rsa.pub


    then add this key to authorized keys file in remote box as follows
    cat /home/jboss/chris_rsa.pub >> ~/.ssh/authorized_keys

  • if you do not have rsa (ssh keys) on you r local you can do as follows details about ssh
    gitosis

    ssh-keygen -t rsa

The defaults for the ssh-related commands can be altered for each account in a configuration file ~/.ssh/config (there is also a system-wide file, usually /etc/ssh/ssh_config). Each entry starts with a Host keyword.
Host *panix.com
User suominen
Compression no
Port 8841

If you want to run commands automatically when ssh login

just put this in ~/.bashrc or /etc/bash.bashrc if you want this for all users:
if [[ -n $SSH_CONNECTION ]] ; then
    echo "I'm logged in remotely"
fi

Saturday, August 14, 2010

Eclipse - Helios

Download eclipse helios version from eclipse.org
the plugins, I have installed is

  1. Helios
  2. The Eclipse Project Updates
  3. The Eclipse Web Tools Platform (WTP) software repository
  4. AJDT
  5. Mylyn for Eclipse Helios
  6. Maven plugin

    To Customize Eclipse FONT and Look and Feel use this link outside link or BEST LINK
  1. I did as follows:
    Somewhere on your home directory, create a gtkrc file (like: ~/.gtkrc-eclipse) with following content:
    style "eclipse" {
    font_name = "Sans Condensed 8"
    }
    class "GtkWidget" style "eclipse"
    Finally, to launch eclipse, use following command line:

    GTK2_RC_FILES=/usr/share/themes/Clearlooks/gtk-2.0/gtkrc:/home/rxxxxxx/.gtkrc-eclipse '/home/rxxxxxx/programs/eclipse-helios/eclipse'
  2. and launch through command line, make sure whole cmd in single line
  3. But to Customize the font size in Text editor (code region) and console etc
    it is saved under workspace, so try to stick with few same workspace always:
  4. goto windows - preferences - Appearences - colors and fonts - choose Basic text (this will apply for all)
  5. Banner Font = BOLD - 9
  6. Dialog Font = Regular - 9
  7. Header Font = Bold 10
  8. Text Editor Block Selection Font = REgular 9
  9. Text Font = Regular 9
  10. App Explorer/Outline View Font = Regular 9
  11. If you take a look in ECLIPSE_HOME/plugins/org.eclipse.platform_4.2.0.v201206081400/css, you will find the different CSS used. On Linux, if you use the GTK style (in the Preferences/Appearances), the e4_default_gtk.css is used.
    Edit this file and change the .MPartStack section :

    .MPartStack {
    font-size: 9;
    font-family: "Droid Sans";
    swt-simple: false;
    swt-mru-visible: false;
    }

    To Add Custom Builder (like my maven script to Eclipse)
  1. project->properties
  2. select builders
  3. uncheck "Maven Project Builder" let "Java Builder" be checked
  4. Create New Builder as follows:
  5. click new, and select "Program" from the list available
  6. key in "My Maven Builder" in Name
  7. inside "Main" tab for "Location" put ${project_loc}/my-mvn.sh
  8. make sure my-mvn.sh is available inside Project directory
  9. inside "Main" tab for "Working Directory" put ${project_loc}
  10. inside "Build Options" tab make sure these 3 options are checked
  11. After a Clean
  12. During Manual builds
  13. During auto Builds
  14. that's all, I see when I save a java file it compiles and pushes only edited java file
  15. But for me it runs the script twice, I have not found a way to fix this

    Maven war plugin for exploded deploy, in build/plugins pom.xml


  1. <plugin>
    <groupid>org.apache.maven.plugins</groupid>
    <artifactid>maven-war-plugin</artifactid>
    <version>2.1.1</version>
    <configuration>
    <warname>ATT</warname>
    <webappdirectory>/home/rxxxxx/programs/jboss-4.2.3.GA/server/default/deploy/myapp.war</webappdirectory>
    </configuration>
    </plugin>

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

Monday, June 21, 2010

SBT

SBT is a great tool, it is great like maven did to java and now SBT over maven
  • Making own repository for maven using SBT is at link (GOOD)
  • checkout and read more/build from
  • SBT commands ref
  • install scala from scala-lang.org download lzPak and use java -jar to install and setup bin in PATH install sbt
    java -Dhttp.proxyUser=username -Dhttp.proxyPassword=mypassword -Xmx512M -jar `dirname $0`/sbt-launch.jar "$@"
    $ chmod u+x ~/bin/sbt

creating Project and Plugin file to generate IDEA
SBT IDEA plugin
and Eclipse project files:
  • mkdir project/build
  • mkdir project/plugins
  • nano project/build/MyProject.scala

  • nano project/plugins/MyPlugins.scala

  • uncomment 2 lines in "MyProject.scala" for "Eclipse/Idea" plugin to get effective
  • sbt] reload
  • sbt] update
  • sbt] eclipse (this will generate .classpath and .project file for eclipse)
  • sbt] idea (this will generate .ipr and .iml file for IntelliJ Idea IDE)
  • rerun the eclipse/idea when there is change in dependencies in Project.scala this will regenerate the project files , then refresh project in IDE, all will be fine !

Sunday, June 20, 2010

ubuntu install

This is how I installed ubuntu for my dev machine

  1. if you ever get complain of installer about "dpkg" pakage installer
    run this as "sudo rm /var/lib/dpkg/lock"
  2. system = admin = update manager will take some 30+ mins, 
  3. to move window buttons to right
    run alt+E2 = gconf-editor = apps/metacity/general change buttons=menu:min,max,close
  4. install tree command: sudo apt-get install tree
  5. install "terminator" (MY FAVORITE) split-pane terminal like "PowerCmd" for Windows

    sudo add-apt-repository ppa:gnome-terminator
    sudo apt-get update
    sudo apt-get install terminator

  6. sudo apt-get install ubuntu-restricted-extras
    will get codecs too

    install "community-themes"
    install "ttf-droid" for Droid fonts
    install msttcorefonts

  7. install ubuntu-tweak as follows

    sudo add-apt-repository ppa:tualatrix/ppa
    sudo apt-get update
    sudo apt-get install ubuntu-tweak

  8. right-click desktop = appearance Prefs
    = fonts tab (set all to 9px from 10 px)
    = special effects tab (select 3rd option)
    (will work better for better drivers/video cards)
  9. (optional) awn-settings for fish-eye icons
    APT Line: ppa:kupfer-team/ppa kupfer
    APT Line: ppa:do-core/ppa gnome-do
  10. clipboard manager parcellite
  11. gedit plugins here
  12. APT Line: ppa:chromium-daily/beta chromium-browser
  13. (optional) desktop-webmail
  14. (optional)Time Tracking hamster-applet alarm-clock
  15. (optional)APT Line: ppa:inkscape.testers/ppa inkscape
  16. (optional)gimp or kolourPaint (is best like MSPaint)
  17. (optional)Backup tool - backintime-gnome
  18. (optional)DVD playback libdvdread4

    Then, within a Terminal window, enter:
    sudo /usr/share/doc/libdvdread4/install-css.sh
  19. sudo apt-get purge flashplugin-installer nspluginwrapper
  20. *ettercap = sniffer/logger/interceptor
  21. *shutter = screen capture program
  22. *luckybackup = backup and sync tool
  23. *DVD burner "BraSero" sudo apt-get install ubuntu-restricted-extras
    sudo /usr/share/doc/libdvdread4/install-css.sh