avp::ptr weblog

Everything that is in our mind.

Archive for October, 2011

Custom NSLog for Xcode 4

without comments

This post describes how you can to setup a custom NSLog snippet in Xcode 4. By default, this custom NSLog prints the class and method name of the position it is inserted.

NSLog auto completion

NSLog auto completion

Please follow these steps to add the code snippet to the scripts in Xcode 4.

  1. Copy and paste the following code into your editor. Anywhere.
    NSLog(@"%@ %@", self.className, NSStringFromSelector(_cmd)); /* DEBUG LOG */
  2. Open up the code snippets library which sits in the utility pane on the right side. Look for the curly braces {}.
  3. Highlight the above mentioned code – click and hold the mouse over the text  (for a short while) – drag them into the code snippet library.
  4. Afterwards you can edit the snippet and add a title, summary and a completion shortcut. I used the following settings:
                  Title: Custom NSLog (Class & method name)
                Summary: NSLog prints the class and method name
               Platform: All
               Language: Objective-C
    Completion Shortcut: NSLog
      Completion Scopes: All
Custom NSLog snippet

Custom NSLog snippet

You are welcome to comment and post your custom code snippets!
This article is inspired by the post “Easy Doxygen code snippets for Xcode 4” by Chris Powell.

Written by tobi

October 26th, 2011 at 9:06 pm

How to create an independent branch in git?

without comments

While working with a version control system like git it is sometimes a good idea to create an independent branch. This article shows how to accomplish that. In this example I want to hold onto the documentation in a separate branch.
I assume, that you already created a repository and added various commits onto you master branch.

Prepare your ignore list
Now its time to prepare for the repository. First, edit your .gitignore file and exclude the doc/ folder which you will be creating in the next step.

Create an orphan branch
Create a new independent branch with the git checkout option --orphan. The option is available since Git 1.7.2. Initially, you will have to remove the files that have been created in the working directory, but right after the branch is independent.
Now you can create a doc/ folder and create documentation files. In the end you can commit them to the repository as usual.

git checkout --orphan documentation
git rm -rf .
mkdir doc
cd doc
// Do work.
// git add your files to the doc/ folder
git commit -m "Added documentation files."

Checkout the master branch
To checkout the master branch while still being able to list the documentation files do the following.

git checkout master && git merge --no-commit documentation
git reset master

The files added to the documentation branch earlier will appear in the working directory visible to the master branch. Thanks to the .gitgnore file they will not be listed as untracked files.

The initial discussion on an unrelated branch can be found on stackoverflow.com. Thanks to hillutcovo and phord for their input!

Written by tobi

October 9th, 2011 at 5:16 pm

Posted in Uncategorized

Tagged with , , ,

How to manually install TeX Live 2011 and Kile 2.1.0

without comments

It took me a while to find out how to install the latest TeX Live 2011 package on my Ubuntu 10.10 system. So this is a short summary of my success story.

First of all, it is worth mentioning that the default PPA installs TeX Live 2009.

As of July 2011 the texlive package that ships with Ubuntu (TeX Live 2009) is lagging two years behind the current TeX Live release (TeX Live 2011). If you want the latest version of TeX Live, you can install it directly from the TeX Live website (this does not interfere with the packages in Ubuntu).

Though, it is not too difficult to manually install TeX Live 2011 from the sources following these instructions. In this process, I decided to download the TexLive package via rsync since it can be a rather big installation.

After successfully installing TeX Live itself, I set up the latest version of Kile (which is 2.1.0 as of today) following this description.


Please mind that there is TexLive 2012 as described in a follow up article. There is also a PPA available to avoid the manual setup.

Written by tobi

October 8th, 2011 at 5:00 pm

Fixed permissions issue with redmine and gitosis

without comments

Some days ago I discovered that our gitosis install did not work with redmine anymore. I could push and pull changes but could not add a new ssh key. I thought it might be caused by the redmine upgrade I did, but it was some months ago and I haven’t had any problems. The redmine logs didn’t tell me anything either.
Yesterday, I started a new project. No problems with creating it in redmine and also no problems creating a git repository.
When I tried to push, gitosis gave an error. “Permission denied..” on some file.
I connected to the the gitosis server and checked the repository folder. There was a folder backup I made and it was not owend by the gitosis user. That was causing the error. After fixing ownership of that folder, everything works again as it should.

Written by peter

October 2nd, 2011 at 7:51 pm