hi, i think the code for that book is no longer available as it’s discontinued. let me know if i can help with anything though. happy to assist.
//TODO: think of something to put here
Snippets of Smidgens: Twilio Pusher with Websockets & ZeroMQ
Recently, while building out a web application for RingDNA, I ran into a couple issues regarding websockets:
1) Amazon EC2 load-balancers do not support websockets (yet). I knew this, but had never implemented a solution.
2) Twilio applications point to webservice URLs, so developing locally…
Checking for <null> in Native iOS Force.com apps
Today, Salesforce moved the mobile framework to GA. We’ve been using this in RingDNA since it’s first beta release at Dreamforce.
A common issue w/ large native applications (connected to a remote datasource) is the amount of UI bindings you need to code.
Objective-c doesn’t like null values all that much… If you’re building a lot of simple read-only screens, it’ll take quite a bit of code to check for null values on every field. You can use obj-c blocks in your response callback to insert empty NSString objects in place of nulls to allow for auto-binding to UI elements.
So, using blocks we can do something like:
- (void)request:(SFRestRequest *)request didLoadResponse:(id)jsonResponse {
NSDictionary *dict = (NSDictionary *)jsonResponse;
NSLog(@"Response: %@", dict);
if ([[dict valueForKey:@"totalSize"] intValue] > 0) {
NSDictionary *firstResult = [[dict valueForKey:@"records"] objectAtIndex:0];
[firstResult enumerateKeysAndObjectsUsingBlock:^(id key, id obj, BOOL *stop) {
NSLog(@"KEY: %@", key);
if ([key isEqualToString:@"Account"]) {
[obj enumerateKeysAndObjectsUsingBlock:^(id accountKey, id accountObj, BOOL *accountStop) {
if ((NSNull *)accountObj == [NSNull null]) {
NSLog(@"NULL Found: %@", accountKey);
}
}];
}
}];
self.contactSFDC = firstResult;
[self setContactInfo:firstResult];
} else {
// Load alternate view? No contact was found
}
}
You can see that this is less code than looping over the allKeys NSArray (it has performance benefits as well). I’m showing the nested Account relation in this response so you can see how to traverse two levels from the SOQL query. Also, notice the casting of the obj to NSNull so we can properly check if the field is null.
Yesterday we did a historic thing. We generated 87,834 phone calls to U.S. Representatives in a concerted effort to protect the Internet. Extraordinary. There’s no doubt that we’ve been heard.
So just to keep you updated: The well-intentioned, but immensely flawed “Stop Online Piracy Act” is still in the House Judiciary Committee. The hearing was yesterday and now members will debate and bring amendments to the bill. The Committee will reconvene in a few weeks — the date has yet to be scheduled. Nothing has been brought to a final vote. Everything is still very much in play. We’ll keep you posted on what’s going on and what you can do to help. But for now, we want to thank you.
One encouraging thing we heard yesterday:
I don’t believe this bill has any chance on the House floor. I think it’s way too extreme, it infringes on too many areas that our leadership will know is simply too dangerous to do in its current form.
— Representative Darrell Issa
We also want to express our tremendous gratitude to our friends at Mobile Commons who, on 30 minutes notice, hooked us up with their amazing platform (and provided their expertise) to automatically connect callers with their Representatives.
F15 News (My kids' news channel)
Aodhan and Avery started their own news channel this week. They are calling it F15 news (F15 is the name of the park/pool we live on in Denver). Aodhan went to an Apple iMovie camp this summer. He’s handling most of the filming… Avery, no surprise, prefers to be in front of the camera. They write their own content in the morning and are filming as part of their home school project for November.
Inspiring The Internet Of Things: A Comic Book
The Internet of Things is one of our favorite trends at RWW. When it finally becomes ubiquitous, we’ll be that hipster blog that liked IoT before it was cool. To help usher in the future, the Danish Alexandra Institute has just released a comic book called “Inspiring the Internet of Things,” which explains the benefits of networking everyday objects - as well as the ethical issues - through 15 illustrated scenarios. The PDF version is available for free download.
“We need a new medium to communicate the idea of the Internet of Things, its challenges, its problems and its benefits; encouraging people to think about this new disruptive technology,” writes Mirko Presser of the Alexandra Institute. “This ‘comic book’ is aimed at everybody.”
Final Chapter - Attack of the Alien Jack-o-lanterns
I’m finishing the final chapter of my book this afternoon.
Yeah, not sure if this was just Halloween spirit or what… the last chapter is a cocos2D / Augmented Reality game called Attack of the Alien Jack-o-lanterns. I’m also not sure why they are alien… but, they came from somewhere to take over our human bodies.
In this chapter, we create a basic cocos2D game where pumpkins are taking over our faces. Random people in the camera view have a pumpkin (some people aren’t affected) taking over their head… like you see here:
Doesn’t that kind of make you want to shoot the pumpkin?…well, good thing. When you tap the pumpkins they explode. Not sure if there’s any business value here… but, gaming was one of the topics we had to cover in the text.
I’ll see if I can clean this up enough to get it on iTunes around Halloween.
Facial Recognition Approaches
I’m working on the final edits for my upcoming Professional iOS 5 Augmented Reality book. I posted a few screenshots from the facial recognition tutorial chapter already. I got the kids help with that chapter. I covered two other approaches to facial recognition in the book as well, with some help from Elvis.
Chapter 12 covers three approaches to facial recognition from iOS applications with sample code. I discuss OpenCV, the more traditional approach as well as a more web friendly REST API from face.com. Lastly, we discuss the new CIDetector classes that shipped with iOS 5.
With some help from the moriarty library, we measured the performance of the different approaches. CIDetector came out on top for native analytics. Outperforming OpenCV and face.com. Of course, face.com also includes a full round trip to a REST API. The fact that it even comes close to the performance of a full native API is impressive on its own.
Automatic Reference Counting in iOS 5
I got some help from the kids last night on the iOS Augmented Reality book. Chapter 13 analyzes the screen buffer and performs some basic facial recognition to determine the target’s position on the screen and mood.
Aodhan could only do happy. He tried Angry, but couldn’t stop laughing. Avery was able to do all the different moods. Quite the actress.
The 