18 December 2012

Making applications go Full Screen in Mac OS X Lion

Like many other people I have a Mac machine at home. Mine is a MacBook Air. The form factor is nice but I'm not sure if the os is better than Linux yet. :-)

Anyway, one of the things I really like about OS X is the Full screen mode. On a laptop it is very helpful in using all of the screen real estate. So it is really annoying when some applications don't support this mode.

Google helped me find a solution. The web site osxdaily.com had a tip about a plugin called Maximizer that provides Full Screen mode to applications that doesn't normally support it. It's great.

What you need to do is the following. First you download SIMBL. This is a little helper program that allows cocoa bundles to be used as plugins. Just download the zip-file, open it and install the package inside.
Next you need to get Maximizer. This is a bundle that SIMBL can use. Download the zip-file and open it. Inside you should find the Maximizer.bundle. This bundle needs to be copied into the
 ~/Library/Application Support/SIMBL/Plugins directory. If you chose to install SIMBL for all users on the machine you have to use the directory /Library/Application Support/SIMBL/Plugins.

Restart the applications that don't support Full Screen mode and enjoy watching that sweet icon in the top right corner.



Images from wikipedia.org and osxdaily.com

13 September 2012

Pulling from Github behind a proxy

Pulling code from the outside when you're behind a proxy in the enterprise world is usually a simple matter. Since I'm using cygwin I just export my proxy like this:

export http_proxy=http://proxy:80/
export https_proxy=http://proxy:80/

Works on my machine.

Still, I just tried cloning a new repository and I got this error message:

> git clone git://github.com/chriskempson/base16-textmate.git Base16

Cloning into 'Base16'...
fatal: unable to connect to github.com:
github.com[0: 207.97.227.239]: errno=Connection timed out

That looked like the proxy didn't work. But that wasn't the case. The problem is that we are using the git-protocol which of course isn't routed through the http proxy. The solution is to change to the http protocol. Simple...

> git clone http://github.com/chriskempson/base16-textmate.git Base16

Cloning into 'Base16'...
remote: Counting objects: 36, done.
remote: Compressing objects: 100% (22/22), done.
remote: Total 36 (delta 24), reused 26 (delta 14)
Unpacking objects: 100% (36/36), done.

28 August 2012

Git branch in prompt

Just a quick tip about how to display the git branch currently checked out when using the bash prompt. Put this little routine in your .bash_profile or similar:

# Git branch in prompt
parse_git_branch() {
  git branch 2> /dev/null | sed -e '/^[^*]/d' -e 's/* \(.*\)/(\1)/'
}

export PS1="\[\e]0;\h - \w\a\]\n\[\e[32m\]\u@\h \[\e[36m\]\$(parse_git_branch) \[\e[33m\]\w\[\e[0m\]\n\$ "

This will give you a prompt like this when you are standing in a git directory:

user@host (master) /cygdrive/c/repos/project/
In addition to being useful, it is ansi color coded so it will look good, too.

25 August 2012

Adding jars to local repository with Leiningen

Last night I thought I should experiment a little with Enlive, an html library written in Clojure. Enlive makes it very easy to scrape web-pages, apparently.
However, I could not find a jar for Enlive in the central Maven repository, neither was there one in Clojars. I did find some that other people had built, but I never trust strangers on the net. ;) So I figured I should build it myself and put it in my local Maven repository. This is how I did it:

First clone the repository from Github

git clone https://github.com/cgrand/enlive.git
Then build it with Leiningen

cd enlive
lein install
Now, this install the pom-file to my local repository, but it won't put the jar in the repository. At this point I was contemplating using Maven to install the jar, or even manually renaming and copying the jar to the correct folder in the repository but I thought that surely Leiningen must have a way to do this.

So I found a plugin to do it. Shantanu Kumar has made a plugin (lein-localrepo) for exactly this purpose. I am using Leiningen 2 so I added lein-localrepo to my ~/.lein/profiles.clj:

{:user {:plugins [[lein-localrepo "0.4.0"]]}}
After that I could use the handy coords command pointed at my generated jar to find Maven coordinates for the jar and pipe them into the install command to put the jar at the correct position in my local repository.

> lein localrepo coords target/enlive-1.0.1.jar
target/enlive-1.0.1.jar enlive/enlive 1.0.1

> lein localrepo coords target/enlive-1.0.1.jar | xargs lein localrepo install

WARNING: using numeric exit values in plugins is deprecated.
Plugins should use leiningen.core.main/abort instead.
Support for this will be removed before the stable 2.0.0 release.
localrepo failed.
I do get an error message, but the install command completed successfully anyway. Now on to scraping some web pages.

10 May 2012

Regarding yesterdays post

I figured out why I got the problem with multiple branches and tags lines in the git config. The reason is that I had specified an authors file when I first initialized my repository from Subversion. There were several authors in the subversion repository that were missing from my authors file. So every time I got an error like that I just updated the authors file and did a new git svn clone ... I thought this did no harm since it has worked before but every time I cloned I got a new set of duplicated lines in the git config. Nice to know...

09 May 2012

Git Svn : Refspec glob conflict

At work we use Subversion as our current source control tool. Which is OK but I prefer using Git. So to get my fix while I wait for a conversion to Git at work I use git svn as my subversion client. Usually this is painless but sometimes, like today, problems show up.

I did a regular git svn rebase and got this problem in return:

$ git svn rebase
W: Refspec glob conflict (ref: refs/remotes/trunk):
expected path: path/to/app/branches/trunk
    real path: path/to/app/trunk
Continuing ahead with path/to/app/trunk
W: Refspec glob conflict (ref: refs/remotes/trunk):
expected path: path/to/app/branches/trunk
    real path: path/to/app/trunk
Continuing ahead with path/to/app/trunk
W: Refspec glob conflict (ref: refs/remotes/trunk):
expected path: path/to/app/branches/trunk
    real path: path/to/app/trunk
Continuing ahead with path/to/app/trunk
W: Refspec glob conflict (ref: refs/remotes/trunk):
expected path: path/to/app/branches/trunk
    real path: path/to/app/trunk
Continuing ahead with path/to/app/trunk
W: Refspec glob conflict (ref: refs/remotes/trunk):
expected path: path/to/app/branches/trunk
    real path: path/to/app/trunk
Continuing ahead with path/to/app/trunk
W: Refspec glob conflict (ref: refs/remotes/trunk):
expected path: path/to/app/branches/trunk
    real path: path/to/app/trunk
Continuing ahead with path/to/app/trunk
Current branch master is up to date.

I'm not the first to have this problem so I found an explanation (and solution) at CodeUtopia. The problem was that git had spontaneously duplicated lines in .git/config that points to the remote trunk, tags and branches in subversion. I removed the duplicates and everything was fine again.