Skip to content

New Blog URL!

I moved my blog onto my very own domain name, All of my new and old posts will be displayed there, none will be displayed on this blog.

Please go check it out!


Linux Gem Install Problem [Fixed]

If you’re trying to install gems on a Linux or Linux server distro, you may encounter an error like “ERROR: Failed to build gem native extension.” Luckily, this is very easy to fix.

apt-get install ruby1.8-dev

Replace the “1.8” with the version of Ruby you’d like to use.

That’s it!

Ruby on Rails (3.0) – Routing Error

For those of you who updated to Rails 3 and tried to access your controller actions through the GET method (:controller/:action/:id), then you probably found a “Routing Error”. There’s a very simple fix to this, and it was intentionally done by the Rails developers.

Within [YourApplication]/config/routes.rb, uncomment the last line of code directly before the “end” statement. The line should read:match ':controller(/:action(/:id(.:format)))'

Once that is completed, you may restart your WEBrick server by using rails server

That’s it!

Web and Mobile Development Podcast

Hey everybody,

I have now started a “Web and Mobile Development” podcast which has video shows, and eventually audio shows where I just talk about anything web or mobile. Soon I hope to have a co-host to add another perspective to the show.

The feed: feed://

The podcast is soon-to-be on iTunes, so stay tuned.

Apple SDK – NSTimer

NSTimer is important within the iPhone, iPad, and Mac OS X for making any kind of time separation between method calls. If you have worked with javascript’s setTimeOut() method, then the NSTimer methods will look very familiar.

The idea of the NSTimer is that you ‘schedule’ a method invocation either some set date/time in the future, or a certain time interval in the future. As an example, you might have an NSTimer checking a web page every 5 seconds for updated content; something like this would probably be done using NSTimer.

An example…

In your viewDidLoad method:

myTimer = [NSTimer scheduledTimerWithTimeInterval: 5 target:self selector:@selector(someMethod) userInfo:nil repeats:YES]; // make sure to define this variable in your .h file

- (void) someMethod {
NSLog(@"Inside the method!");
// do something here... (called every 5 seconds)

All we’re doing above is scheduling a timer to ‘fire’ every 5 seconds, calling “someMethod” each time.

There’s the basic usage of NSTimer, there are a few other methods within the class, but “scheduledTimerWithTimeInterval:” seems to be the most important. Here’s Apple’s reference page for NSTimer:

Rotation of CGImage (iPhone/iPad) – Improved

The code snippet I linked to in my last post essentially worked for rotating the CGImage, but as the user rotates the image more, the image gets cropped more and more. To stop that problem, I made some VERY slight adjustments, check it out:

NSCoriolisBlog » Blog Archive » Arbitrary rotation of a CGImage

NSCoriolisBlog » Blog Archive » Arbitrary rotation of a CGImage.