Tag Archives: coding

[JavaScript] parseInt() Quirks

Here’s a subtle little feature of JavaScript’s ‘parseInt()‘ function that I recently stumbled across. The radix used in the parse will default to 8 (octal) if the string you are parsing includes a leading zero. For instance: …will return 7, … Continue reading

Posted in coding, javascript | Tagged , | 3 Comments

[Objective-C + Cocoa] UIScrollView and contentSize

So here’s a simple one. For whatever reason, a UIScrollView instance only behaves correctly if you programmatically set its contentSize when you use it. This is fairly silly because in most cases the contentSize is simply the total size of … Continue reading

Posted in coding, objective-c | Tagged , , | 8 Comments

[Cocoa + iPhone] UITableViewCell: It’s Broken!

I present for your consideration the following screenshot: It shows a basic table-view, in which each cell has been assigned the same image (using its built-in ‘imageView‘ property). The source image is 20 pixels square, and the imageView’s ‘contentMode‘ property … Continue reading

Posted in coding, objective-c | Tagged , , , | Leave a comment

[Cocoa + iPhone] Unraveling Apple’s Pagecurl

First off, I encourage anyone that’s unfamiliar of this topic to read through this short but very sweet blog post on the subject (and to take a quick look at his sample code). We’ll be picking up where Steven left … Continue reading

Posted in coding, objective-c | Tagged , , , | 10 Comments

[Objective-C + Cocoa] NSAutoreleasePool and Threads

If you have a multithreaded iPhone/iPad/Cocoa application, you are probably aware that for each thread you create you need to set up an auto-release pool for that thread. If you don’t do this then you’ll get some nice messages in … Continue reading

Posted in coding, objective-c | Tagged , | 1 Comment

[C (and variants)] Pointer Declarations: You’re Doing it Wrong

It happens on occasion, in the programming world, that bad coding conventions become the norm. Consider for instance the following two lines of code: Both lines are equivalent as far as the compiler is concerned, but when a human being … Continue reading

Posted in c, coding | Tagged , | 5 Comments

[Objective-C + Cocoa] Object Inspection

I’m a big fan of reflection. Always have been since I was first exposed to it in Java. For those not familiar with the concept, reflection (or introspection as it is alternately called) allows one to inspect and/or access the … Continue reading

Posted in coding, objective-c | Tagged , | 3 Comments

[Java] Defeating CAPTCHA Images

Disclaimer: Depending upon the country you currently reside in, programmatically defeating CAPTCHA images may technically be illegal. Whether or not there is any merit behind such a law I leave as a matter for you to work out with your … Continue reading

Posted in coding, java | Tagged , , , | 30 Comments

How to Write Good Code

Xkcd probably ties for second with Penny Arcade in my list of favorite webcomics (the #1 spot goes to Questionable Content, despite my unending annoyance at the fact that the author has yet to have Marten hook up with Faye). … Continue reading

Posted in banter, coding, process, refactoring | Tagged , | Leave a comment