Google Dorking with Ruby

Today i’ve written a little script which helps you dorks out there googling. ;)

It’s nothing fancy, but it might help you beginners get started and maybe some of you advanced dorks save some time.

Check it out, it’s free so grab it while it’s hot.

iOS/iPhoneOS Equalizer with libsox - doing some effects

Today i will show you how to do sound effects from within iOS using libsox.

It is pretty straight forward, the code is here:

I’ve added a variable (int)tprofile which can be used for different effects without having to rewrite or copy everything. Simply apply your effects in an if-clause and be the king of the hill! At least know i am! :)

best regards fellow Apple survivors

iOS/iPhoneOS Equalizer with libsox - making it a .framework

So i’ve spent the past few weeks with an issue i’ve been having for quite a while now: Equalization on iOS.

I’ve tried everything, from AudioUnit, OpenAL and FMod. None of which worked.

  • AudioUnit needs formulas which look like they’ve found on a ship at Roswell..
  • OpenAL seems to have all of it’s effects ripped out by Apple..
  • FMod requires you to know it’s own language..

Frustrating.. i even thought about having a Webservice do the job, but that seemed useless for offline usage.

I once again checked out all available options when one thing seemed ideal, sox! You may know sox if you’ve played around with Audiofile conversion on Linux, especially PBX Setups which require you to convert you favorite MP3s into something your PBX can play.

Anyway, i checked out all libraries, ffmpeg, libav and libsox. Since the command line version of sox delivered nice test results with my equalization attempts, i started to try to get the current release to compile on SDK 4.3. I had massive troubles at first, but then i found this post.

I have modified the script to make it work plus have it create you a SOX.framework:

Please excuse my lazyness, i didn’t cleanup the script, but it works. ;)

It autocompiles the lib for armv6, armv7 and i386, therefore making one big massive framework for all 3 architectures using Apple’s lipo utility (which is included in xcode).

With this script placed in your sox source folder you simply have to run it.

What you finally need to do is to add the SOX.framework and two headerfiles sox.h and soxstdint.h to your Xcode Project.

If you want all files seperately, i took the liberty to adjust the script’s output path to $sox-srcdir/iOS-<Version>-<arch>. Every file needed will be in those folders from withint your sox sourcedir:

  • iOS-4.3-i386/
  • iOS-4.3-armv6/
  • iOS-4.3-armv7/

Having that done, you can do an #import “sox.h” in your project and start working on some effects.

In my next post i will be covering how to do those effects.

My absence

I want to apologize for my absence in the past few months, but there have been some decision i had to make.
One being that i quit my full-time job being an Objective-C/iOS Developer, since my contract says that i am not allowed to perform commercial iOS Coding, i will be doing something else for a while. That does not mean that i won’t blog anymore, i will just alter my focus from iOS to something else.

Another decision is, that i want to leave my workspace as clear as possible, meaning that i want to introduce and guide my fellow coders (currently being 1 apprentice) into my code, so they can go on. So far i’ve gotten very good feedback that my code is wonderful to read. Although i don’t seem to make much comments (i’ve been told), my code is pretty much self explaining. Who doesn’t love to hear that?

I don’t know what the future holds for me, i hope it has better plans than it had in 2009 and 2010 for me. My biggest customer going broke which lead to the unemployment of 5 people (which still bugs me) and the closure of my company and of course my biggest loss, my favorite grandma passing.

At this point, i want to write a few lines about my grandmother. She was and will ever be the most inspiring person to me, she knew everything. She was the first one who stressed me how important it was to learn english while she herself spoke and understood 5 or 6 languages fluently. I only know about German, French, English and Italian, but she also has a lot of cookbooks in alot of different languages. The thing i loved so much about her was, that she cooked the shit out of any kitchen. Although her food might have been a bit exotic for a little boy, but that’s how she tought me to always try food first before saying “eww”. “Only dumb kids judge food by the way it looks, the smart kids judge by the taste!” was what she used to say to me. And today? I eat almost anything, tho i have my problems with worms, bugs and other creepy stuff. But really, who likes that?

Looking into the future, i am currently thinking about developing for Android, since i have gained a very good insight on how to work with mobile devices during my almost two years it iOS development now.

Since i am still working until end of March, i will be busy until then after that i have planned some months of vacation. I guess i’ll be off the grid from April to June to rearrange a few of my thoughts and priorities.

Maybe i will blog from where i am or where i’ve been, depending on the WiFi and 3G coverage of that particular area i am in. Since i don’t know where i will go, i won’t be able to answer this upfront. :)

So wish me luck for the future, i’ll be back in a couple of months.

cheers

Beware of upper()/lower() in PostgreSQL

Happy new year to all of you.

Today i’m going into performance impacts which can come from upper()/lower(). If you were already aware of these things, you won’t be impressed, but if you’re like me, optimizing your setup which is 5 years old, you will be amazed.

So i was upgrading my PowerDNS setup for my new customer interface, when i stumpled upon this:

This query is performed on a view which is mapping my ruby DataMapper Models into one that is by default usable by PowerDNS. After i’ve killed the upper() (god know’s why i’ve placed it there 5 years ago), the query looks like this:

Seem’s like i’ve just made a timewarp from 3.5ms to 0.3ms querytime.

What did we learn? Audit and Benchmark old stuff once in a while, or at least when you’ve learned a lot since you’ve last touched it.

ArchLinux domU - Setup Script

Today i played around with ArchLinux, a very neat distro!

I am always trying to keep my software as minimalistic as possible, so i can easily reproduce my setups. Having similar setups helps you to keep administrative tasks to a minimum.

For the past 8 years since the first official release, i was a Gentoo fan. Sure, i used some Debian boxes for this and had BSD boxes for my most precious tasks. Gentoo was always this comfortable distribution that didn’t dictate which features i had in my default packages, since i could choose “USE”-Flags myself.

These days, having over 55 Gentoo domUs, i managed to get around with a bindist host and some custom scripts, but that’s over.

ArchLinux

ArchLinux gives me that extra “slickness” i wanted, by removing compile-time depedencies on the core-system. In Gentoo i hardly customized settings there, except build flags, but hey.. Anyway, the ArchLinux base seemed slick enough to beat Gentoo’s, so i gave it a shot.

The first thing i do when i try a new distro is to reproduce existing setups, because i mostly have the config files for the service i want to have running. I had chosen to replace my primary nameserver, which i had replaced in under an hour.

The biggest problem for a distro like ArchLinux is, that they have still a bit too much packages in the base, so i found my self removing usbutils, rp-pppoe and some mkcpio-crap for creating kernel images. Anyway, i found that instead of installing it from the dom0 with -S base, i could specify my own packages.

Before you run this script, you need to install pacman. On gentoo i could emerge it, otherwise check archlinux.org.

So i thought that i could customize that script, but i ended up only stealing the “echo” lines. It looks like this:

Please read and customize it before using it!

I am NOT responsible for any data-loss, corruption or alien invasions!

It downloads the latest version of packer from github, which is by far the niftiest client to xmlrpc which wraps makepkg and pacman i’ve ever used. Wait what? Yeah, that’s right! It’s a shell-script which helps you install custom PKGBUILD scripts. ;)

So, i consider this my Christmas present to you all, so have fun trying out an ArchLinux domU!

git lol - the other git log

So i got tired of the git log default output, since it was simply too bloated for my Macbook Pro Terminal. It’s ok my 30” Apple Cinema Display (or one of the other 22” surrounding it), but even there it doesn’t show me enough for my taste.

The default output looks something like this:

Imagine this for 300+ commits, you literally will never see the end of it.

After diddling around with git log parameters, i’ve come up with this neat constellation.

Enjoy

Ever forgot to sync one of your hundred git repositories?

I guess it happens to all of us, you sit at work, you commit your changes, then you go home. While driving in your car, you might come across the thought “darn, did i push my changes?”. If you are one of those people who have so much repositories, you cannot track in your head which one needs a pull or push, then git-sync might be your solution.

It is by no means perfect, it’s just a little script i hacked up this morning:

Now when you run “git sync”, it will sync all your repos found in $REPODIR. Crontab it to like 6pm, so when you get home, you can be sure everything is pushed. Also you could do this in the morning to ensure your nightly changes you might have made at home are on your workstation.

Enjoy.

Why Symbian will go down and Android/iOS will rise

Probably everyone has used, or at least seen a Symbian based phone.
If you’re a normal user and don’t know what i mean by “Bluetooth Stack”, please stop reading or you just might not understand what i am talking about and get angry at me for no real reason.
For myself, i’ve used Symbian based phones for ages. The first time i realized that i have a Symbian phone was when i got my Sony Ericsson P990i.

This mobile device sucked so hard, i got nosebleeds because i got agitated that much. Once i reached about 100 short-messages (SMS), the whole Phone got unresponsive without even having the SMS-Applicaiton open.

That was almost 5 years ago.

A lot has changed since

but nothing good for Symbian happend. Why do i say that? It’s easy to find out yourself. Go into a store that has one or the other and compare the usability.

Symbian still follows the design-concepts from the past decade, while Android and iPhone both have their pros and cons, but none of them has as many cons as Symbian. While using a Symbian device, i constantly have the feeling that something is somehow missing.

So what mobile device makes me comfortable using? Nowadays we got mobile operating systems that rule by far over Symbian: Android and iPhoneOS/iOS! And yes, they’re both worthy (dominating) opponents compared to Symbian.

Both are better to develop for and both are more user friendly. J2ME vs Android SDK or iPhone SDK, i don’t really have to explain anything, do i?

What’s the difference between iOS and Android?

Google Android is an open environment where you have a variety of mobile devices/smartphones which can run on. I personally ported a pretty early alpha of Android to the HTC BlueAngel. Nothing fancy happened but i got it booting!

iOS on the other hand is just for Apple Devices. No third party vendor is allowed (yet) to use iOS on their devices. But that’s just Apple’s concept. They write operating systems that run (mostly) seamlessly with the devices they produce (and only them). Those are the ingredients and a lot of people love the soup.

What about the development?

First we got Xcode which encourages People who already code for OSX through its Apple-ish structure. The problem is, you can only code iPhone Software on a x86 Mac, but if you’ve worked with Objective-C and Xcode before, developing iPhone Apps mainly differs in layouting and memory management (Garbage Collection). Some people might say that it’s bad to manage the memory of your device all by yourself without having a garbage collector, but in my humble opinion, it’s just not that bad! Finding memory leaks is a piece of cake and therefor no problem at all. Sure, if you come from a Java background, you might have your typical complains ;)

Developing for Android on the other Hand is alot sweeter. The only problem is, that you really notice the garbage collection in performance on most devices. Using Eclipse, NetBeans or IntelliJ for development is nice, at least one philosophy that Apple could have adopted, since no one really needs the Interface Builder and the hard-boiled environment. If you come from a Java-background, it’s just a matter of minutes to get your first App running in either of the named IDEs.

Conclusion

Well, it really depends on your taste what to favor over the other, but for non-developers/non-hackers i’d recommend an iPhone while techies who need their freedom would be better of with an Android based phone.

And if “why will Symbian go down?” is still your question, you didn’t understand anything i just wrote.

iPhone SDK and FlowCover (CoverFlow clone)

I got to play around with CoverFlow for the past few days since i need it in an application of mine.

Sadly you are not allowed to use Apple’s API, otherwise i could just use the iPod-App API. At first i implemented the whole shebang myself. OpenGL ES is neat and is fun to code with, especially if you’ve prior knowledge of OpenGL.

I won’t bother you with the code i made, since it still has bugs and doesn’t have Caching.

So i found this Library (based on SDK 2.1) called FlowCover.

FlowCover

FlowCover is an OpenSource Library released under a BSD-license. The Sampleproject contains a solution done with a xib-File which is for Interface Builder. Since i don’t like that, i’ve quickly wrote the code needed and made the sample a lot shorter.

You only need the following files out of the sample-project:

  • FlowCoverView.h and .m
  • DataCache.h and .m

Since the sample contains an ugly view with a “done”-Button, i’ve complete left that part out so you can use it cleanly anywhere you want.

My ViewController is named FlowCoverViewController and is attached to the AppDelegate:

This saves you about 10KB in size and works nicely!