Aug 29

This one is a must have! If you use IDEs like IntelliJ IDEA you are used to press magic keys. Here is how you add some magic to the usage of git from your bash terminal. You need the git bash completion. If you use Homebrew and installed git you can start immediately with modifying your bashrc. In my case I change /etc/bashrc.

Git Completion

# add git completion
source /usr/local/etc/bash_completion.d/git-completion.bash

That’s it! Now enjoy the power of the tab-key: Complete git commands, sub-commands, branch names, remotes, …

Git Prompt

The above defines a git prompt as well. You need to add $(__git_ps1 ” %s”) to your prompt.

PS1='\[\e[0;32m\][\w]$(__git_ps1 " %s")\n\u@\h$\[\e[m\] '

Everything between the double-quotes will be displayed in your prompt. The %s will be replaced with the current branch name. Some more information can be
added with flags (see comments in git-completion.bash). I like these:

GIT_PS1_SHOWDIRTYSTATE=true
GIT_PS1_SHOWUPSTREAM="auto"

GIT_PS1_SHOWDIRTYSTATE displays unstaged changes “*” or staged changes “+” next to the branch name. GIT_PS1_SHOWUPSTREAM=”auto” indicates if you are behind “<", ahead ">” or diverged “<>“.

Sample

KYPSTA-2902-hdnCode-for-SecurityProvider is the branch name, I have untracked files and I’m ahead. Cool.

To do a good job we should finish with coloring our terminal.

Tagged with:
Aug 29

Terminal Coloring
Here is what is necessary to achieve the above layout and coloring. I want these changes for all my accounts on my laptop, so I edit the /etc/bashrc.

# terminal coloring
export CLICOLOR=1
export LSCOLORS=dxfxxxxxbxegedbxbxdxdx

CLICOLOR=1 enables the coloring. LSCOLORS defines the coloring. There are 11 attributes that can be colored. Each attribute has a foreground and a background color. A color is represented by a single character, now we have our 22 character string: dxfxxxxxbxegedbxbxdxdx. See the manual of ls and search for LSCOLORS for details.

Prompt
I like to have the prompt always at the same spot and want to see the full path of the working directory. Therefore I change the default prompt:

# two line prompt with full path
PS1='\[\e[0;32m\][\w]\n\u@\h$\[\e[m\] '

Explained:

  '\[\e[0;32m\]     change font to green
  [\w]\n            current working directory + newline
  \u@\h$            user@host$
  \[\e[m\] '        stop the green coloring and add a trailing space

What else is possible? See enhance the system prompt.

Tagged with:
Mar 22

My IDE has a build-in history. Nevertheless I often use a “real” version control system for my sample projects. Today I setup a local subversion repository:

Install it: sudo apt-get install subversion

Create the repo: svnadmin create ~/svn

Tell your IDE where to find the repo: file:///home/struggy/svn

Connect your project and you are done.

Tagged with:
Mar 19

Today I’m finalizing my tax declaration. The program I use transfers the data to my tax office. Afterwards I need a print out that needs to be signed.

At home I have no printer, so I need a PDF-printer. Easy:

sudo apt-get install cups-pdf 

Nope, still no PDFs. After a Google search I found out that the directory ~/PDF must be manually created. Mmmh, still no PDFs. After another Google search:


sudo apt-get remove cups-pdf
mkdir ~/PDF
sudo apt-get install cups-pdf

Done.

Mar 15

The best windows tool ever is Total Commander. If I see colleagues using their explorer I get crazy ;) Total Commander is the ultimate productivity boost.

On my ubuntu I’m using gnome. Nautilus is as sick as the explorer. Next, I tried gnome-commander: nope. I wasted a couple of hours and tried mc, elmfm2, tuxcmd, .. No way to found s.th. that is good enough and integrates into gnome. Only way out: Krusader. This tool has nearly all I want. I have to accept the KDE dependencies.

sudo apt-get install krusader kompare xxdiff cfv md5deep p7zip kdebase krename

In order to let it look more like a gnome app I installed the systemsettings (former kcontrol)

sudo apt-get install systemsettings

Open it and go to General > Look&Feel > Appearence > Theme and select Human.

Finally, I started krusader and changed the default terminal and editor.

Done!

Tagged with:
Mar 11

I installed globalmenu to get more vertical space. Today, I optimized the horizontal space. Therefore, I right clicked on the top panel and click add to panel. I have choosen Gnome Main Menu. This one only shows the ubuntu icon on the panel without the Application, Places and System menus. These old menus I removed with a right click remove. Done.

If you want to see how it finally looks like check this out.

Tagged with:
Mar 11

Last time I talked about globalmenu. Today, I show you how you get even more space by replacing the bottom gnome panel with a dock like cairo-dock.

First you need to get the key of this unsigned package:

wget -q http://repository.cairo-dock.org/ubuntu/cairo-dock.gpg -O- | sudo apt-key add -

Next, add

deb http://repository.cairo-dock.org/ubuntu intrepid cairo-dock

to your sources.list

Install it:

sudo apt-get install cairo-dock cairo-dock-plug-ins

Choose your desired theme (e.g. Clear) and you are almost done.

To start cairo-dock automatically opening System > Preferences > Sessions and at an entry with the command cairo-dock.

Log off and on and your cairo-dock should be available at the bottom of your screen. Now, the former bottom panel is of no value anymore so I removed it.

desktop

Tagged with:
Mar 09

Do you want to have more vertical space on your desktop, than take a look at globalmenu.

Add deb http://ppa.launchpad.net/globalmenu-team/ppa/ubuntu intrepid main to your package sources.

Next, add the pgp signature of this package: gpg --no-default-keyring --keyring /tmp/awn.keyring --keyserver keyserver.ubuntu.com --recv E97F4DB8F1F0EC20FF792CA37889D725DA6DEEAA && gpg --no-default-keyring --keyring /tmp/awn.keyring --export --armor E97F4DB8F1F0EC20FF792CA37889D725DA6DEEAA | sudo apt-key add - && rm /tmp/awn.keyring

Install it: sudo apt-get install gnome-globalmenu

Set it up: killall gnome-panel, then right click on the upper gnome panel and choose add to panel. Select Global Menu Applet. Next, right click on this one and choose Preferences. Next, click Enable Gnome Globalmenu and you are done.

Tagged with:
Mar 08

At work I use my netbook to write down meeting minutes, notes, mindmaps and tasks (gtd) . Therefore I use freemind and thinkingrock.

Now I want a tool for writing a diary. Why? I want to optimize the preparation for my annual performance review. So fare I used a mindmap, but this was way off perfect.

Today I reorganized myself :) and looked for a desktop diary tool. There are a lot of tools outside. I tried rednotebook. No thanks. I thought about my requirements and than I got it. Why not using WordPress. WordPress allow me to enter multiple notes a day, I can categorize and I can tag my content. Perfect.

So here we go:

First turn on the LAMP:

L: Linux

I think you got it already

A: Apache


sudo apt-get install apache2

M: mySQL

sudo apt-get install mysql-server

Maybe you want mysql-admin, too.

sudo apt-get install mysql-admin
killall gnome-panel

P: PHP

sudo apt-get install php5 libapache2-mod-php5
sudo apt-get install libapache2-mod-auth-mysql php5-mysql phpmyadmin

To get PHP to work with MySQL, uncomment the “;extension=mysql.so” line in

sudo gedit /etc/php5/apache2/php.ini

Finally, restart apache

sudo /etc/init.d/apache2 restart

Now the LAMP should be on.

Next, install WordPress

Extract WordPress

Extract your WordPress archieve

sudo tar zxvf wordpress-x.x.x.tar.gz --directory=/var/www/

Create Database

Open http://localhost/phpmyadmin and go to permissions.
Create a user wordpress and check the box to create a database with the name of the user as well.

Config WordPress

Goto /var/www/wordpress/ and copy the wp-config-sample.php file to wp-config.php and edit wp-config.php:

// ** MySQL settings ** //
define('DB_NAME', 'wordpress');
define('DB_USER', 'wordpress');
define('DB_PASSWORD', 'yourPassword');
define('DB_HOST', 'localhost');

Run the Installation Script

http://localhost/wordpress/wp-admin/install.php

Open http://localhost/wordpress and start your private desktop blog.

Thanks to supriyadisw:
Install LAMP
Install WordPress

Feb 22

On my Ubuntu I’m facing this JVM Bug which suddenly freezes the keyboard of IDEA. Now I’m trying Anils suggestion. Therefore I need to install a Java 7 snapshot:

  1. download self-extracting binary file of java 7 snapshot
  2. run chmod +x jdk-7-ea-bin-b48-linux-i586-19_feb_2009.bin to make it executable
  3. run ./jdk-7-ea-bin-b48-linux-i586-19_feb_2009.bin to extract the archive
  4. run sudo mv ./jdk1.7.0 /usr/lib/jvm to move it to the other JVMs
  5. run update-alternatives --config java to check how many JVMs you already installed
  6. run sudo update-alternatives --install /usr/bin/java java /usr/lib/jvm/jdk1.7.0/jre/bin/java 3
    I got 2 installations, so I need to specify a 3
  7. run sudo update-alternatives --config java to chance your java version.
  8. run java -version to validate everything is fine

To tell IDEA 8.1 to run with Java 7 you need to add -Didea.no.jdk.check=true in idea.vmoptions.

Keep your fingers crossed for me that this will fix that problem;)

Tagged with:
preload preload preload