Menu

Dealing with Missing Data on the Frontend

March 21, 2011

What if you got an unexpected result from an ActiveRecord query? If it’s important for the current page, rendering a 500 is a good idea. If the data is being used for a non-vital section, it’s best to render the page without the section: @manager = Manager.find(params[:id]) rescue nil <div id=”sidebar”> <% if @manager.nil? %>… Read more

Ruby Modules

January 17, 2011

There are two common usages for modules in Ruby: namespacing and mixing in. An example of namespacing can be seen in the Math module: Math::PI # 3.14159…. Math.log10(100) # 2.0 Mixing in a module will extend that class with additional constants and methods. Here’s an example where we’ll create our own module and mix it… Read more

Mimicking Abstract Classes with Objective-C

July 03, 2010

Objective-C doesn’t have the abstract class construct. The common approach to mimic it is to use NSObject’s doesNotRecognizeSelector: @interface ShapeBase : NSObject {} – (void)draw { [self doesNotRecognizeSelector:_cmd]; } @end @interface Circle : ShapeBase {} // missing draw method @end This forces subclasses to override, otherwise you get a runtime exception. There’s also another approach… Read more

Konami kaChing

April 01, 2010

Happy April Fools’ Day from everyone at kaChing! If you’re looking for a treat, try entering a certain code on the kaChing homepage.

Z-Index and Local Stacking Contexts

March 27, 2010

z-index is a CSS property that specifies the order of your elements on the z-axis. The higher the z-index value, the closer the element is to the user. Using z-index is handy to make sure elements like modal dialogs show up above everything else on the page. div#red { z-index: 1; } div#green { z-index:… Read more

iPhone Authentication with Facebook Connect

November 02, 2009

Here at kaChing, we have multiple platforms to access your Virtual Portfolio. Two of those are the iPhone and Facebook. When we released our iPhone app, we wanted Facebook users to easily login using their Facebook credentials. Facebook provides an iPhone library that handles sessions/authentication. To show a login dialog: FBSession *session = [FBSession sessionForApplication:myApiKey… Read more