Category Archives: Uncategorized

Fast Enumeration of NSDictionary: “for in” loop returns NSCFString

People ask, and I see questions, and… Ok I admit it, this has gotten me too. If you use the for … in syntax in Objective-C to iterate through an NSDictionary, the result is different than if you were iterating through and NSArray. (Yes I know, they totally warn you of this in the documentation). [...]

Posted in Uncategorized | Leave a comment

Moodle: Set a quiz to email teacher when a student completes it

When you want to know each time a student attempts a quiz in moodle: http://docs.moodle.org/20/en/Quiz_submission_email_notification

Posted in Uncategorized | Leave a comment

Set the DEBUG flag in XCode 4

Most of us use something like “#ifdef DEBUG” to log things in debug mode. In XCode 4, the way to set this flag is in the Build Settings, under LLVM GCC 4.2 – Preprocessing. (If you’re using another compiler, adjust accordingly). Screenshot: You also need to make sure you are building in debug mode. That [...]

Posted in Uncategorized | Leave a comment

When you add files to git before creating .gitignore

You just added filesfor git to track. Suddenly you remember there are 77 files used by your IDE to track where your mouse cursor last rested (or something equally baffling). These files are useless to you. Yes, you are probably using XCode. Here’s how to reset the repository so that it only tracks files that [...]

Posted in Uncategorized | Leave a comment

Hide status bar on iOS app – moments of amnesia

In info.plist make an entry UIStatusBarHidden and check it for YES. Or in code, do [[UIApplication sharedApplication] setStatusBarHidden:YES animated:NO];

Posted in Uncategorized | Leave a comment

Firefox for web cams in 64 bit Linux

If you have pixelated, grainy or boxy video using 64 bit Flash, here’s a command to start Firefox that should do much better: bash -c “LD_PRELOAD=/usr/lib32/libv4l/v4l1compat.so firefox” Then configure a launcher to use the better settings.

Posted in Uncategorized | Leave a comment

XCode Template Macros Cheat Sheet

The default XCode templates are in /Developer/Platforms/iPhoneOS.platform/Developer/Library/Xcode/Project Templates/ Substitute /MacOSX.Platform/ for the OSX templates. Your own custom templates can be put in (notice tilde) ~/Library/Application Support/Shared/Xcode/ProjectTemplates/ Just create the directory if it’s not there, and copy/imitate the structure of the default templates (there are plists and such for configuration). Now here’s a cheat sheet for [...]

Posted in Uncategorized | Leave a comment

XCode Renaming Detritus

This pertains to XCode 3.x., which I just rolled back to because XCode 4 has been disasterous for me. Today I converted a project into a template project and that required changing all the names to something like ___PROJECTNAME__. More about that in another post. But I discovered that even when you’re careful, there are [...]

Posted in Uncategorized | Leave a comment

OH… architecture matters

The OS X migration assistant is OK, really. But it’s good to remember that when you upgrade from an i386 to an i686 (or any other architecture), some of your stuff will get transferred but not work. If you have a lot of *nix dev tools, some of them are probably present but broken. If [...]

Posted in Uncategorized | Leave a comment

Building a list of resource filenames programmatically

Here is a simple way to index art and sound resources for your application. Use case: I find myself manually typing file names into a plist, so that the app can load certain images/sounds into memory.  Also, when I add files in the future, I don’t want to add them manually to the plist (or [...]

Posted in Uncategorized | Leave a comment