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:
Jun 25

Visor is an extension of the Mac Terminal.app that allows you to define a hot-key for quickly toggle a terminal window. The terminal has focus and is always at the same place. You can define where this place should be. All settings of a standard terminal like fonts, colors, opacity are applicable. You can use tabs but window groups don’t work. The installation is straight forward. Give it a try!

Tagged with:
Jun 19

A couple of days ago I bought a MacBookPro and so I switched from Ubuntu to MacOS. Unfortunately Apple did not ship their unix-version with a package-manager. After a google search I found two alternatives. MacPorts and Homebrew. The press for MacPorts seems not as good as for Homebrew, so I gave Homebrew a try.

For both you need Xcode to be installed:(

sudo curl -L http://github.com/mxcl/homebrew/tarball/master | sudo tar xz --strip 1 -C /usr/local

Done! This commands will download homebrew and extract it into /usr/local. Some advise you to change the owner of /usr/local. I don’t and add a sudo when I install something. Time to demonstrate it:

sudo brew install maven

Maven is installed. Try mvn --version. If you want to know what is extracted and installed use the verbose mode:

sudo brew -v install maven

The most common things you will need are available: maven, gradle, git, groovy, all there. If s.th. is missing the support reacts quiet fast. Check the so called formulas if your required package is available.

Next, I tried to uninstall a package. Works as it should.

So far I’m happy and recommend it.

Tagged with:
Jun 11

Spent to much time but finally Inkscape works! You need to set the python version to 2.5:

defaults write /Library/Preferences/com.apple.versioner.python Version 2.5

See Inkscape forum for the complete thread.

Tagged with:
Jun 08

A German software developer should think about using a US keyboard because:

  • IDE shortcuts are based on a US keyboard layout, so that some shortcuts can’t be used. E.g. Ctrl-Shift-/ won’t work because / is Shift-7 on are German keyboard
  • Important characters like {,},[,],@,=,? are easily reachable
  • Only the alphabet letters z and y are switched
  • There are ways to type German umlaute more easily than on a German keyboard (cont. reading!).

Mac
Developer who can call a Mac their own should use the modified US keyboard from Jan Borchers. It allows you to press option-a instead of option-u-a for the letter รค. I think this is even better then the layout on a German keyboard. The installation is done quickly:

  • download
  • unzip
  • move Roman.bundle to /Library/Keyboard Layouts
  • add and select keyboard “U.S. With Umlauts via Option Key”

For a detailed instruction visit the above link.

Linux and Windows
Bernd Schoeller has created similar layouts for Linux and Windows

Tagged with:
Mar 16

Do you use Mac OS X Leopard or above? Do you know the shortcut Apple-? (Command-?)
Give it a try. It will increase your productivity for sure.

Currently I’m using a windows system at work and think about switching to a Mac. Some peers are using Macs already. In a pair programming session I stumbled about the fact, that you can not navigate directly to the menu entries. Pressing Ctrl-F2 and then using the cursor keys or start typing isn’t to best choice. I remembered that Neal Ford told me (The Productive Programmer) that you can reach any menu entry by pressing Apple-?. Next start typing the name (or parts) of the entry you are looking for. Select the one you’re looking for. Press Enter and you’re done.

Screenshots will follow after I bought me a Mac:)

Tagged with:
Feb 13

Lets say you earn 1200 gummy bears a year and get a bonus of 100 gummy bears. What would you say is your salary?

a) 1200
b) 1300

Probably you would answer a). If the bonus is paid for the extra effort and your personal engagement, i.e. something that you can control, what will be your answer? I guess still a), right? Why? Because even if you got in previous years a bonus, your manager can reject the bonus. Either in case of your under-performance – a thing that you can control or in case of a struggling company – a thing that you can’t control.

Now lets say you get several years a bonus of 100 gummy bears? What is your expectation of the next performance review? Let me guess, your answer will be 100 or more.

To sum it up: You expect the bonus each year but you do not account it into your salary. Mmh, not the best investment a company could make with that extra money.

What solution do I have? Flip the system!

Give the new developer a salary with a bonus. When you know the developer and her potential, turn it into a fix salary without a bonus.

Tagged with:
Sep 13

Before I have found this little cool tool, my process of creating a screen-shot was very annoying. I used the Windows print key, opened MS Paint, inserted my screen-shot, selected the desired region, selected the “save as” dialog, chose the jpeg format, named the file and yes, process finished.

With Greenshot it is really just a key stroke. Greenshot is a tool that concentrates on making screen-shots easy.

Greenshot is a perfect utility. Installation is as easy as copying the files into a folder and running Greenshot. No Admin rights necessary. It hooks itself at the print key. After you configured it, you only need to remember to press the print key. No intrusive application windows, just an tray icon. Here are the combination you have to learn:

  • print: Left-click and drag to define your screen-shot region
  • alt+print: Screen-shot of the active window
  • ctrl+print: Fullscreen screen-shot

I like it. What tool do you like?

Tagged with:
Sep 13

When you work with Windows XP there are some tweaks that can increase your productivity a lot. In a little series I will talk about them:

Tagged with:
preload preload preload