14
Dec 11

iOS Find the current first responder

Quite often you need to know which control is currently the first responder, for ages i have been rolling the same solution over and over again and I thought it about time that i shared it.

Its basically a category on UIView so you can call:

[self.view findFirstResponder];

Imagine you wanted to make sure the keyboard (or any other editor view) was closed you could:

UIView *firstResponder = [self.view findFirstResponder];
[firstResponder resignFirstResponder];

The code is stupid simple:

UIView+AblebotsAdditions.h

#import 
 
@interface UIView (Ablebots)
 
- (UIView *)findFirstResponder;
 
@end

UIView+AblebotsAdditions.m

#import "UIView+AblebotsAdditions.h"
@implementation UIView (Ablebots)
 
- (UIView *)findFirstResponder
{
    if (self.isFirstResponder) {
        return self;
    }
    for (UIView *subView in self.subviews) {
        if ([subView isFirstResponder]){
            return subView;
        }
        if ([subView findFirstResponder]){
            return [subView findFirstResponder];
        }
    }
    return nil;
}
 
@end

12
Dec 11

.GitIgnore for xCode 4 projects.

xCode git support is great, but if your working in a team or on multiple machines you will want to ignore any user/machine specific files.

In my .gitinore I have:

.DS_Store
*.swp
*~.nib
build/
*.pbxuser
*.perspective
*.perspectivev3
xcuserdata/

Seems to work pretty well.


08
Dec 11

Collabable OSX Notifications

This is a small OSX application I wrote for Collabable.com


08
Dec 11

Adding Growl support to your OSX application

I recently built a small OSX utility that sits in the menu bar and polls your Collabable account for new discussions, one of the final feature i needed to implement was Growl support.

The brief was simple enough, two type of growl notification were required, a simple digest of all discussions when you first logged in and then a specific “New Discussion” notification when a new discussion came in.

Continue reading →


22
Nov 11

Choosing the right Business Partner

I while back i wrote this post on the ablebots.com blog, its a pretty interesting piece even if i do say so myself, and as time has past since i wrote the post, the message has matured like a good wine.

I really encourage you take a moment to read:
http://www.ablebots.com/2011/04/24/choosing-a-business-partner/

 


14
Oct 11

2 new websites released this week!

The company I work for (Ablebots LLC) have released 2 new website this week, pretty exciting times!

Check out:

CodeSpaces.com 

Ablebots.com

Love It!

 


19
Jan 11

Great Customer Service

Twitter profile image for spreedly
@spreedly 01/18/2011 Outage Details: http://bit.ly/hyNBsa
Favorited by @floydyboy on Tuesday 18 January 2011

Published via TweetPress


07
Sep 10

Adding touch support to jQueryUI

I needed a quick and dirty way of getting the jQueryUI Slider component to work with the touch events on the iPhone and iPad (iOS) so after a little thinking I started writing a few lines of jQuery that would listed to the touch events and pass them on to the relevant jQuery core classes so that any components based on jQuery would get the events for Free.

 

About 10 minutes in it occured to me that this must have been done before and while i like hacking with touch events, I did a quick Google and found the exact script i was about to write.

If your looking to add  touch support to jQueryUI components look no further than this Google Code project

 


05
Sep 10

iPad Multi-Touch – in Javascript.

ipad_touches_small.jpg

I recently came across a nice article/experiment from Matt Gemmell (@mattgemmell) where he decided to test how many simultaneous touches the iPad Multi Touch display would register, it turns out its 11 and he put together a pretty impressive demo app to prove it (see the Screen Shot).

At first sight you would think its a pretty complex application to achieve this, i mean all the multi touch stuff and the animation seems quite complex, however anybody who knows the iOS SDK will tell you that this stuff is trivial at best, and while Matt has done a great job of pulling it all together its far from complex.

The SDK that wasn’t mean’t to be

This application got me thinking about the iOS SDK and the fact that Apple originally didn’t want us writing native applications and in fact they wanted us to write Browser based applications in Javascript, HTML5 and CSS3.

Now its pretty clear to me that the native apps we see (in abundance) on the app store like Angry Birds, Twitterific, Pulse, Things, Pages, etc… could be written using JS, HTML5 and CSS3 but they would most definitely be poorer for it, come on, the runtime performance, the slick User Experience, simply can’t be replecated to the same level with an app running inside a Browser! (let the flame war begin)

So on that note i decided to replicate Matt’s Multi Touch application in Javascript, HTML5 and CSS3, so with a little digging around in Apples documentation I found all the Javascript events that expose touches (touchstart, touchend and touchmove) and began hacking!

Now let me say right now that this is one hours worth of hacking and the end goal was to build an application that was comparable to Matt’s, I suspect some of the code could be optimised, in fact I really hope that is the case when it comes to the Canvas drawing methods (but that is another story for another post).

multitouchtest.pngNow for some reason I fully expected the JS version to respond to less touches than the native version but in fact its 11 just like Matt’s Version, I also expected the animation to be less “smooth” and jerky when I was moving my fingers around, and I was spot on. The iPad benefits from multithreading and a graphics rendering pipeline, where the Browser that my app is running in does not so any processing I do to draw, calculate or respond to touch events all happens in the same thread as well as the browsers rendering code, this in a nut shell is the reason why these apps will not compete with Naive apps, I may in the near future re visit this topic and look at using HTML5 Web-Workers which in theory would give me the ability to run background threads, but i suspect that even that wouldn’t help too much for applications that are so closely coupled to the rendering engine.

Anyway, here is the application I wrote (visit it on an iOS device) it works almost exactly like the Original albeit its not as smooth. The source code is all inline (for your convenience) so feel free to take a look (lift, steal, optimise, laugh at, etc…) and let me know what you think.

My Conclusion

The iPad really is a “Magical” device, and with Great tools like Sencha Touch web developers are better placed than ever before when it comes to building native-ish applications, but I really believe that these apps will be the poorer relations to their native cousins. So keep learning Obj-C folks!


18
Jun 10

Rails can’t scale!

I’m not sure who coined the phrase “Rails can’t scale”? but its on of those things that amazingly keeps coming up, particularly when you talk to people in the corporate world who for some reason have it as the stock answer to any rails related discussions.

Anyway this is my Open Source answer to that statement, so please if anybody asks you “can rails scale” or makes the statement “Rails can’t scale!” please feel free to use this answer…

Applications built in rails are actually as capable of scaling as apps built in any other language (or on top of any other framework), in fact rails out-of-the-box is good enough for 99.9% of the applications you will ever write, and that tiny amount of apps that will have problems would have the same problems in ANY other language or framework. The benefits of Rails as a framework and Ruby as a language (Like Productivity, Maintainability, Developer Engagement, Mapping to an Agile Process) should in every case be considered over any notion of scaling issues. In fact if your app doesn’t have 8 million concurrent users right now, don’t worry about scaling at all, your wasting time that could be better spent getting 8 million users.

Now this answer doesn’t touch the real issue with this question but in my experience it is good enough to satisfy the type of people who ask this question.

The only exception where i wouldn’t use this answer is if the question (or statement) comes from a “Technical Architect” in a large corperate who is paid 6 figures a year to keep a development team of 100+ moving forward, if he says “Rails can’t scale” Punch him between the fucking eyes, because he should know better.

The truth, is of course that, anybody who says this knows f-all about software architecture and in fact shouldn’t be in a position where they have an audience to spout their nonsense.