Posts Tagged ‘Geeky’

Colored output for gcc and friends

Tired of using search to find the errors in your GCC output?

Hunting down errors in C and C++ is hard enough and so is hunting down the error message in the compiler output. A few years ago (actually more than ten) Jamie Moyer sat down and wrote a nice Perl script that parses the output so that it creates colored output on a colored terminal.

Unfortunately the only location where to get this script right now is from Johannes Schlüter’s website.

Terminal with colored gcc output

And what should I say more – this looks very pretty. By the way the nice Terminal theme came from InfiniteRed – readable black theme, nice.

WhereIsMyCar for iPhone out now

It has been little bit more than two month since I bought the books about Objective-C and Cocoa and now it is tome to speak a little bit more about this. As you might know the basic idea was to develop iPhone applications and to get rich and famous with it, but … I think both wont happen, so I will release at least one of them now into public.

Where is my car is the first application to be seen in the wild and it tackles a typical day-to-day problem of anybody owning a car and living in a bigger city. If you take your car to work and you park it in the evening and you don’t have the luxury of owning a parking space you need to remember where you parked your car.

With Where is my car you can simply store the location of you car with a single touch and the next morning you only click the locate your car, view the map and you are there!

To install where is my car, please add the following source to your Cydia installer: http://www.delivr.at/cydia and search for WhereIsMyCar. Bugs and Feedback welcome

A new objective: Learn Objective-C

There are some rumors that say, you should learn a new programming language a year to stay fit and … Well for me, with the rise of the iPhone and my steady Mac usage it was clear that someday I must learn Objective C.

I tried it once a few month ago, but it was pain, really pain. So I left it until last week when I ordered two books on Objective C.


Programming Objective C

and


Cocoa

The first one is a complete introduction into programming including object oriented programming etc. This is a nice study to get the concepts and takes you about half a day to get through the first half of the book if you are an experienced programmer. The second half of the book is on the foundation framework in objective c which is the core library you normally use. It covers the most important topics and is quite usefull. The latter book is only on programming Cocoa und here mostly on programming graphical user interfaces than a more or less complete reference on the topic. The writing style is ok but not to expressive.

Cool Things

poseAs: allows you to somehow monkey patch a given class by subclassing it, overriding the wished method and posing as the super class. Other languages do open classes objective-c does poseAs:

Objective-C is dynamically typed – somehow. It allows you to pass the generic Id type to methods and functions, but dont expect the compiler to like this. Her will spit out a whole lot of warnings that things can go wrong.

Method missing is called forward and works as expected in Ruby or Python.

A Command Line Twitter

The question is how do you learn a language but without speeking it? Well you cant. So I needed a project that seems suitable to cope with the default API and is still easy enough to finish in a short time frame. The result was, that I started to develop a Twitter command line utility that allows you to post Twitter tweets directly from your favorite place to live.

Over all this worked quite well. Once you get used to XCode you can write code quite fast. But what stays with a wierd taste in your mouth is that it seems that you need your mouse to often and cant access the most actions via keyboard. For me as a heavy keyboard user this is bad.

The documentation is good, again once you get used to it. The way it is written directly reflects the categories defined in the protocols of the implementing classes. More example code is appreciated.

Conclusion

Objective-C is a nice language once you get used to writing lines as

 unarchiver = [[NSKeyedUnarchiver alloc] initForReadingWithData:
                    [NSData dataWithContentsOfFile:  [path stringByExpandingTildeInPath] ]];

with too much [ and ] on the road. But the way it is integrated in C is pretty neat and leaves you all your memory-optimization-pointer-role-play-games-in-the-dark possibilities. The other thin is the documentation problem. Coming from the Ruby side, you would expect things to work, which it does as well in the core libraries, but when it comes to simple tasks as opening a URL and posting data with Basic HTTP auth, it took me hours to get through the whole thing.

On the other hand the cool thing is that NSURLConnection uses in synchronous mode you current login keychain to see if you already have a basic auth stored and uses this. Unfortunatly this is not docuemented (at least I did not find it).

I will definitley develop further with Objective-C and Cocoa to build my first iPhone app and distribute it through the App store. ;) If I am further on the road I will write a new conclusion on the new things I learned.