Nov 22

Every single morning I wake up to a huge amount of posts in my feed reader. Here is how I manage it.

First, I make use of Google Reader and NetNewsWire. NetNewsWire hooks into my Google Reader account and keeps it in sync. Google Reader is great, but NetNewsWire adds a level of polish to my primary computer.

Secondly, I have an Instapaper account that saves web pages to “Read Later”.

My morning ritual involves me quickly scanning through my NetNewsReader. If I see an article that is long and in-depth that I’m interested in, I don’t read it then, I instead hit the keyboard shortcut to “Add to Instapaper” (or use a bookmarklet if I’m not on my primary computer).

The only articles I read in the a feed reader are short blurbs or equally quick reads. Everything else goes into Instapaper.

Periodically, when I have 15 minutes free, I’ll check for something to read in my instapaper account.

Doing this prevents me from spending 2 hours in the morning getting caught up with RSS feeds or, alternatively, missing a great article.

Tagged with:
Nov 21

In Predictably Irrational, Dan Ariely discusses Procrastination and a human beings tendency to under estimate their resolve and ability to stay ahead of the game. During an experiement he took three of his classes and gave them an assignment to write three papers over the course of the term.

“As they settled into their chairs that first morning, full of anticipation (and, no doubt, with resolutions to stay on top of their class assignments), the students listened to me review the syllabus for the course. There would be three main papers over the 12-week semester, I explained. Together, these papers would constitute much of their final grade.”

From the outset the students understood the importance of these papers, they would pretty much amount to their final grade. Each class was given a different schedule, the first was given three due dates (4th week, 8th and 12th), the second class was given a sheet (a tool) with which they were to set their own deadlines and turn that in. They would be held to these deadlines. The third class was told to turn all three in at the end of the semester, they could turn papers in early, but there would be no extra credit doing so. The class that had the equal due dates set for them did the best, those that set their own due dates were second and those that turned them in at the end of the semester did the worst, by far.

“What do these results suggest? First, that students do procrastinate (big news); and second, that tightly restricting their freedom (equally spaced deadlines, imposed from above) is the best cure for procrastination. But the biggest revelation is that simply offering the students a tool by which they could precommit to deadlines helped them achieve better grades.”

So, the best way to achieve your goals is to have some Draconian force from above giving you hard but reasonable deadlines. Failing that, give people the tools they need to combat the need to procrastinate.

Agile Development has had a huge surge in the last 5 years or so, to which I believe owes its success by helping people fight off the tendency to procrastinate. Scrum and other Agile methods give developers the tools to set the appropriate deadlines and meet them. Imagine if Agile is the second class in Ariely’s study with Waterfall being the third.

Waterfall development defines a rigid structure of Gather Requirements, Design, Implement, Test, Maintain. However, it doesn’t provide a good mechanism for applying appropriate deadlines (that is up to the higher level management, who typically just want to see the finished product by a certain date.) Therefore, the development team may have a couple months before they have to show anyone anything. Making it that much easier to put things off early in the development cycle.

While, Scrum instill shorter milestones (one month or less, typically three weeks) with something demonstrable at the end. There is the first tool to fighting procrastination, there is less time to do so. Secondly, every developer is given a larger task (Story) and breaks them up into smaller tasks, typically a day or less. With this, it has given each developer the tools they need to set their own deadlines with daily tasks, further reducing the time to procrastinate. Thirdly, daily meetings with peers are used to update the entire team, quickly exposing any potential procrastinators out there.

Agile has a multitude of benefits, helping people understand their work habits and tendency to procrastinate being only a small part.

Tagged with:
Nov 17

It’s cool to see people continuing to use jME and do some really cool things with it. Grappling Hook is a very cool game similar to Portal.

Tagged with:
Nov 14

I’m writing this quick little tutorial because I could not find a single source for what I wanted to do, but found myself reading multiple docs and putting it together. So, here we go:

Having Return Execute an Action for an NSTextField

Part 1: Quick Setup

  1. Create a new Cocoa Application named TextFieldTutorial. (I am not going to go into much detail about this, as there are better beginning tutorials out there if you need it).
  2. Open your MainMenu.xib and create your UI. Create two NSTextFields one for input and the other for output. Set these up visually however you’d like.
  3. Add a new File that extends NSObject and name it TextFieldTutorialController (be sure to generate the .h file as well).

Part Two: Writing the Code

There are a couple set-up things we need to add to the code. We’ll need to add the references to the two NSTextFields in our controller’s header file. Make sure these are tagged by IBOutlet to allow Interface Builder to know that it can hook into it.

Additionally, create the method definition for hitting enter. You code should look something like:

#import <Cocoa/Cocoa.h>

@interface TextFieldTutorialController : NSObject {

IBOutlet NSTextField* inputField;

IBOutlet NSTextField* outputField;

}

-(IBAction)userHitEnter:(id)sender;

@end


Next, all we have to do is fill in the body for userHitEnter. It will be a rather simplistic method:

@implementation TextFieldTutorialController

-(IBAction)userHitEnter:(id)sender {

[outputField setStringValue:[inputField stringValue]];

}

@end

Yep, that’s it. This is easy.

Part Three: Hooking Everything Together

Now, that our code is ready, we need to hook the UI to the controller. Go back to Interface Builder and add a new Object to your NIB file.

Interface BuilderScreenSnapz001

Change the type of NSObject to TextViewTutorialController:

Interface BuilderScreenSnapz002

Now, hook up the outlets of TextViewTutorialController to the two NSTextViews. Do this for both inputText and outputText.

Interface BuilderScreenSnapz003

Next, we need to set up our inputText object. First, we will set it to only call an action on Enter. Otherwise, we would be making a message call on every press of the keyboard (feel free to leave it like this if you want to experiment).

Interface BuilderScreenSnapz004

Then the last thing we need to do it set the Sent Actions selector of the Input NSTextField to our controller and select the userHitEnter method.

Interface BuilderScreenSnapz005

Interface BuilderScreenSnapz006

That’s it! Build and Run, and you should be able to type anything in the inputText area and hit enter, this will update the outputText.

TextFieldTutorialScreenSnapz001

Tagged with:
Nov 13

Yet another big developer has abandoned the platform.

Tagged with:
Nov 13

One issue with JSON that has caused problems both here at work and with Celery is the fact that a list of elements is defined by the number of elements. That is, if there are no elements it will be a NIL entry in the Dictionary, one element will return a Dictionary and multiple entries will return an Array. So, programmatically, you don’t know what you are going to get at compile time.

Fortunately, the WebService you are using is will documented… right? Secondly, you are only ever going to get 3 possible results: NIL, NSDictionary or NSArray. As such, you know when something is a list, and can handle these special cases. This is how I am managing it in Celery. If there are better ways, please, let me know.

If the WebService Specification says something might be an Array, I will also treat it as an array. If it’s a single element, I create an array and put that element into it. That way, my business logic only ever has to deal with one type (array).

id object = [dictionary objectForKey:@"key"];
NSArray* myArray = nil;
if([object isKindOfClass:[NSDictionary class]]) {
    myArray = [[[NSArray alloc] initWithObjects: object,nil] autorelease];
} else {
    myArray = (NSArray*)object;
}

Tagged with:
Nov 11

Joe Hewitt, the creator of the iPhone Facebook app has stopped developing for the iPhone blaming the App Store review process as the reasoning. He was quite a high-profile developer releasing lots of tools with the Three20 project. Joe has continually complained about the pain of the review process on his blog, and it seems that he has finally had enough.

“Time for me to try something new. I’ve handed the Facebook iPhone app off to another engineer, and I’m onto a new project.”

What is it going to take before Apple realizes they are blowing it?

Tagged with:
Nov 11

Xcode introduced Clang LLVM compiler integrated into the IDE. By default, these only run via Build and Analyze. However, this static analysis is insanely useful, and can catch “retain leaks” quickly. Therefore, I always analyze on every build.

If you wish to do the same, simple Get Info on the Project. Under the Build Options, check the “Run Static Analyzer” option.

Tagged with:
Nov 10

I decided that I needed to go ahead and keep my hobby code in a repository. This will help with back-ups, reminding myself what I was doing and getting up to speed with a new VCS. I’ve used RCS, CVS, Perforce and Subversion. The newest kids on the block (and thus, most popular right now) are Git and Mercurial. So, I figured I should learn one of them, and chose Git. So, all the Celery code is now in a local Git repo with a Github origin.

There are a couple concepts about Git that I find interesting, and a bit difficult to learn. This difficulty is largely due to “old dog, new tricks”. Firstly, locally you have your own repo. This means you do your adds/deletes/commits all locally. You maintain history locally as well. So, if you are unconnected, it’s not that big of a deal as you are still using the repo. For the “collaborative” part, a user can “pull” from your repo (when you are connected to the network) or you can “push” your repo up to the central server (github). This is where my confusion lies, as to when to know to push vs. pull. Fortunately, it will only be myself for the foreseeable future. So, I’ll have plenty of time to understand this.

Secondly, one of the primary focuses of Git is ease of branching. Subversion’s branching has caused no end of trouble here for us. So, not having to deal with merging a branch back into trunk sound’s quite nice.

You’ll also notice I did not explicitly point to my project, this is because the code is not yet at the point where I’m comfortable advertising it. However, I’m sure you could find it if you wanted to.

Tagged with:
Nov 08

Once I started obtaining data from FatSecret via MPOAuthConnect (see previous posts), I had a large JSON string to deal with. I did a quick Google search for a JSON library for Cocoa. I came across json-framework, which is a very simple library. It attaches a Category to NSString to provide a method called JSONValue. Calling JSONValue returns either NSDictionary or NSArray. Yet, another beauty of the langugage, Categories allow you to extend the functionality of an existing Object at runtime.

Once, I called JSONValue on the JSON string, I was able to obtain all the values needed to display the nutritional information for a particular food, and display a list of foods on a search query. This was particularly easy, and a great library.

Tagged with:
preload preload preload