Easier Android layouts with DroidDraw
Submitted by greg on Mon, 02/22/2010 - 01:22In picking up Android development, one thing I miss from the iPhone camp is Interface Builder. Coding up Android's XML files to handle all the UI screens is tedious even for one display type. Add on the different orientations, dimensions, and the rest makes it very un-fun.
Dalvik compilation problems with Android / Eclipse
Submitted by greg on Thu, 01/14/2010 - 23:54Started working on an Android version of an existing security tool. After setting up the basic screens, I started importing some of the existing Java code. I expected some issues, of course, but I ran into a maddening one. Eclipse started complaining of this:
[2010-01-14 22:41:43 - MyApp] trouble writing output: null [2010-01-14 22:41:43 - MyApp]Conversion to Dalvik format failed with error 2
Trying to Run or Debug would bomb with messages like:
Rails error: Errno::EIO (Input/output error)
Submitted by greg on Wed, 09/02/2009 - 22:10All of a sudden one of my apps (still under development) started throwing the error "Errno::EIO (Input/output error)", coming from different controllers, but always tripping on a 'write' command. No amount of googling turned up anything useful, but after a little digging, I realized that the offending line was using puts instead of logger.debug to spit out some tracing information. I guess Rails (2.3.2) doesn't like that and was blowing up.
Changing the appropriate lines to use logger.debug resolved it.
Flexible constant caching in Rails
Submitted by greg on Tue, 07/21/2009 - 17:48As outlined in By Patrick Reagan's Recipe 61 of the very helpful Advanced Rails Recipes book, it's easy to cache your constants when loading your Rails models, which can help with both performance and speed (and accuracy!) of development. I liked this solution because it's so easy to setup. However, some of my models are better keyed off a different field than name. So I made the below modification to give me the flexibility I needed:
</p>
Use apt-cacher for stripped down Debian and Ubuntu repositories
Submitted by greg on Thu, 07/09/2009 - 11:58I recently needed to upgrade a client's servers from Debian Sarge to Lenny. The client is not in the US, and has a low bandwidth (yet still high cost!) connection for their servers. So running the netinst upgrade isn't a viable option since it will take so long and eat up so much of their quota. On the other hand, Lenny is now up to 3 DVDs. Even if most of what is needed is on the first disc, the hassle of configuring the CD repos is a big pain, considering that these are servers with a very tightly controlled set of packages already installed. So I didn't want
Override Authlogic login error messages for better security
Submitted by greg on Sat, 05/02/2009 - 01:42Authlogic is a cool plugin that handles authentication for Rails (and Merb, etc). But I just ran into a problem with one of its assumptions (which more generally probably ties back to a Rails assumption): one error == one field == one message.
However, when dealing with authentication and other security mechanisms, the less information you leak out, the better the security. So error messages that distinguish an invalid username from an incorrect password may be friendly, but they can let a would-be attacker gather more intel. Better to hide it all behind a general "Invalid login" message.
Metro/JAX-WS uses hardcoded paths? WTF?!
Submitted by greg on Tue, 04/21/2009 - 01:19It's 2009, right? And Java is a write-once, run-anywhere platform, or at least purports to be such. And we have eons of experience that says "don't hardcode file path references" (seriously, BeOS knew this!)
Updating NSUserDefaults from Settings.bundle
Submitted by greg on Tue, 03/10/2009 - 01:42Trying to access parameters from Root.plist in your Settings.bundle using NSUserDefaults? Luckily NSUserDefaults will sync those values for you ... after the user opens the Settings preferences for your app first. As pointed out here, among a few other spots, that certainly seems like a bug, or at least yet another expectation gap. I know the first thing I do when I download an app is run over to the Settings to see what goodness I can configure....
malloc: unable to create stack log directory
Submitted by greg on Tue, 02/24/2009 - 07:38I was getting a lot of these errors when changing my xcode project's profile from Simulator to Device:
malloc: unable to create stack log directory /tmp/stack-logs.NNN.PROJECTNAME.XXXXXX
As noted in this post, the solution is to turn off MallocStackDebugging. Setting to "NO" doesn't work, you need to uncheck the option in the project's Execution target.
Asymmetric Encryption with the iPhone SDK and Security.framework
Submitted by greg on Sat, 01/17/2009 - 17:51As a complement to my post on symmetric encryption, here's an example of asymmetric encryption using the RSA algorithm. As before, it's based on the limited sample code I could find, but fleshed out to actually work. Check here for a little more background info. Any and all comments and criticisms are welcome. It's been a long time since I've worked in C (and even then I didn't enjoy it!).
