Debug Logging in iOS Objective-C Apps

So recently I’ve been working on Veteris (My App Store client/server) and YewTube (My YouTube client) and needed a better way to add logging to my apps without it logging on release builds.

Whilst searching for a solution I found a ancient Ars Technica article pointing to this link, Of course the links on the article are dead but I was able to extract enough information to get it working for me. Here’s how I implemented it.

So first, in a class you’d like to use, I used the AppDelegate you just need to add these lines to your header.

#ifdef DEBUG
#define DebugLog(args...) _DebugLog(__FILE__,__LINE__,args);
#define DebugLog(x...)

@interface YourClass: NSObject
void _DebugLog(const char *file, int lineNumber, NSString *format,...);

And you need to add these lines to the implementation.

void _DebugLog(const char *file, int lineNumber, NSString *message,...) {
  NSString *string = [[NSString alloc] initWithUTF8String:file];
  NSLog(@"%@:%d: %@", string, lineNumber, message);

Of course, there is probably a better way to write this implementation but I’m content with this. You can call the function like so.

DebugLog([NSString stringWithFormat:@"VAPIDeviceString = %@", [VAPIHelper getVAPIDeviceString]]);

Thank you for coming to my TED Talk and I hope someone finds this useful now, or in the future.

Posted in Uncategorized | Leave a comment

The ThinkPad R51 Mandrake Experience – Part 2


First let me start off by saying, Thank You to all who have read Part 1 and visited my websites since the time of publish! School has me busy and stressed over finals, I haven’t been able to work on much and the blog included. However I do have a break coming up, so I should be able to write more posts :smiling:.

WiFi Chip Pain

Before my friend shipped me the ThinkPad the WiFi chip was replace with a 5Ghz Intel 4965agn. The issue with this is that IBM like all other laptop OEMs at that time enforces restrictions on which specific chips you can use in their laptops. Simply put, the ThinkPad will NOT boot at all when the incorrect WiFi chips is inserted. Luckily there is a hacky way to bypass this restriction by writing to a BIOS variable stored in CMOS from Linux. You can find instructions here. After booting into Linux without the chip inserted you can compile and run this program and break free from IBM’s shackles. I only needed to do this again because I was stupid and let the battery run dry.

MultiMedia Playback

Since I’ll be using this laptop for a week I need to find a way to play my music obviously. After some scouring on Google I found some old repositories and took the liberty to mirror them. You can find the mirror here. I have also mirrored other repositories such as the PLF repos, you can find them in the root websites directory. I installed xmms + the flac plugin and was up in running in about 5 minutes. I usually use a media server to stream my music but the old browser cannot handle it. I rsync’d my whole library onto a flash drive and all was well.


In order to be able to talk to my friend and share my pain, I needed a way to speak to him without using my phone or other devices. I decided to find something age appropriate, 2 programs fit this bill. Mumble and Teamspeak, I had used Mumble before so I decided on Teamspeak for the sake of trying something new. Using the Wayback Machine I was able to download the old Linux server and client binaries. Having that old piece of software running on my modern server probably wasn’t such a good idea security wise but I had to do what I had to do (it’s no longer up don’t bother). Setting it up was rather easy, just port forward its ports and edit the self-explanatory configuration file and done! We had some troubling connecting to it but it turned out to be firewall issues. Speaking to each other with potato microphones and in 64kbps was great.


At the end of week we were freed from 2006 and were able to use our main machines again. I honestly loved every bit of time traveling back into 2006 except for the weight of the machine. This things a brick, my friend on the other hand complained every day about something new. I, however do not recommend this to anyone because of the browser situation and many other factors that will require you to be content with limited internet connectivity.

Posted in Uncategorized | Leave a comment


This is a test from Windows Server 2008 R2, sent over the internet via BlogDesk to this WordPress Instance!


Posted in Uncategorized | Leave a comment

The ThinkPad R51 Mandrake Experience

A very “gracious” friend forcefully donated me an upgraded ThinkPad R51 and then made ME pay for the shipping along with some of the upgrades. So for my first blog post, I decided that I’d review this laptop and write about my experiences with a fully setup time period correct Linux install on it.

First, let’s get into what the ThinkPad R51 is,The ThinkPad R51 can be best described as a brick with an amazing cover…
ThinkPad R51 Lid
It is quite literally a brick and those were my honest first impressions. However, is it a very peculiar brick once you open it up.

The lid is held on by a single latch, I thought it would be a weak latch but it was a pretty nice feeling. The switch is even recessed and has a nice texture to it.
Laptop Keyboard with trackpad at the bottom
Inside the laptop, you will find the gorgeous and massive IPS display. For a laptop from 2005, it’s crazy I know. It has a resolution of 1400×1050.

At the top of the LCD panel there is a bump that houses the “ThinkLight”, with the press of Fn + PgUp you can have your own 1980s CRT flavored light illuminating your keyboard! Below the display is of course the keyboard in all its clicky glory. (seriously if you have one of these give it a nice click for me!) This thing is what dreams are made of for a membrane keyboard. I can forgive it for not having a Numpad because of how compact it is.
In the lower middle of the keyboard is the “TrackPoint IV”. What’s new with the IV model is that you can tap it for a left click. Although I’ve never used the TrackPoint as I find it to be inaccurate. That’s probably my excuse for not even attempting to use it.
If you could tap to click it I’m not sure why there are dedicated buttons to be used with it above the trackpad. And about that trackpad, for today’s standards, it’s comically small lol.
Above the keyboard is the nice and shiny power button, it’s only shiny to entice you to click it, don’t do it, or at least save your work before you do. Next to that are the media keys and the “ACCESS IBM” key. I’m sure it had a purpose under Windows, it’s most probably useless though. Of course, we can’t forget the retro RGB IBM logo at the bottom right corner.

Now on to the plethora of ports, it has everything you could need in 2005.

1x VGA port
1x S-Video port
2x USB 2.0 ports
1x IEEE 1394/FireWire 400 port
1x pcmcia card slot \
In the same slot!
1x express card slot /
1x 3.5mm headphone jack
1x 3.5mm microphone jack – Connected via the AC’97 codec
1x Gigabit Ethernet jack
1x Modem jack
1x IrDA 1.1 port
1x Kensington Lock slot
Mine came equipped with the DVD + CD combo drive.

Here is the slightly disappointing part, it comes with a Pentium M (Banias or Dothan). Make sure you get the Dothan version, the Banias Pentium M’s have
1. Less L2 Cache
2. Slower Front Side Bus Speed
3. Less efficient
4. No PAE, PAE is required for running more modern operating systems
There is like 10 different model configurations for this laptop so be sure you are getting what you want before you buy. Contact your seller, etc.
The best part about my model is the screen and the Radeon 7500 card connected via the AGP interface, there is no way I will have issues with a fglrx card 🙂

Upon first boot you are greeted with IBM’s bloated XP install, sure the themes look cool but they get old seriously quick. I’m not much of a Windows user so I’ll be installing Linux on it with a fresh copy of XP on the first partiton.

I have a 60GB hard drive to work with, here’s my setup.

First Partition: Windows XP 29GB
Rest: Let Linux handle it

If we are going to install Linux the first thing to do is choose what distro. My goal is to have a time appropriate installation, so I choose the Ubuntu of 2005, Mandrake Linux 10.2 or as it was going to be known as Mandriva Linux 2005 Limited Edition. A mouthful for the Mandriva name.

I proceeded to firstly install a fresh copy of Windows XP. I had a Windows XP SP1a reinstallation disc for a old Dell machine that I used. Everything went smoothly except for the part where upon first boot it had literally no drivers whatsoever. I don’t know what I expected but I at least needed working ethernet.
I had to use a flash drive to copy over the drivers, after that, THEN it went smoothly. I installed WinAMP and all the other classic programs. Finally it was time to burn my Mandrake ISOs, provided here: My first instinct was to download the DVD and save myself some time but it doesn’t work like that apparently because when I put in my DVD all I heard was a whirring noise followed by it stalling. It constantly trying to respin up but failing.
1. My DVD combo drive is a sham or
2. My DVDs are too new lmao
I wasn’t going to fish out a external DVD drive just to have more problems so I downloaded the 3 ISO CD set and burned away.

Now we are off to the races, we won’t be coming in first place though.

Installation was your average affair, choosing software selection (I chose everything but server stuff), waiting for it to install the packages and setting up users.
Only issues I had was supertuxkart and tkinter failing to install. I just selected the option to ignore it and continue.
At the hardware configuration page I chose to use the proprietary fglrx drivers and setup my monitor resolution.

Upon first boot up, it was breathtaking. On my modern systems I use trinity desktop sometimes because of how much I love KDE 3 and the integration it had compared to gnome which always tended to break and crack under pressure (applying gtk themes and what not). KDE 3 had none of these issues that I’ve encountered. The boot up experience and the intro to the desktop is truly an artifact of its time. You won’t be finding any flat icons here, only icons that make sense as to what it represents.
I wasn’t even sure what to do first, I ended up poking around the main menu and finding my favorite Linux game of this time period.
Meet frozen-bubble

Everyone’s favorite bubble tossing game? I don’t know how you would describe it but the music is amazing and the gameplay and altogether its an experience you can easily sink hours into trying to beat your high score. If you haven’t tried it before I recommend you install it now.

Everything (almost) just worked, which is surprising for 2005 Linux. I’ll go over my goals/plans in the next blog post, how I ended up using this thing as my main computer for a week and how I fixed one pesky issue 😉

Until next time, adieu.

Posted in Uncategorized | 2 Comments

Hello world!

Welcome to WordPress. This is your first post. Edit or delete it, then start writing!

Posted in Uncategorized | 4 Comments