Hacked By MuhmadEmad


<br /> HaCkeD by MuhmadEmad<br />

HaCkeD By MuhmadEmad

Long Live to peshmarga

KurDish HaCk3rS WaS Here

[email protected]

How to automatically resize UIImageView to image size in Interface Builder


It’s always frustrated me that when I create a UIImageView in Interface Builder I need to manually enter the size of view so that it matches the size of the image. I always go into Finder, open the image in Preview, find out the dimensions and type them into Interface Builder. Painful!

I learned a much better way today. Just drag in a UIImageView object into your .xib. Set the image in the Attributes Inspector. Then select the UIImageView and press Command =. Boom! The UIImageView is automagically resized to the size of the image!

This was the #1 thing that annoyed me about Interface Builder.

John Gilchrist iPad apps released!


Good news – the John Gilchrist apps for Cheap Eats and Calgary Eats have been designed for iPad, and are available on the App Store as of tonight!

Cheap Eats 2 by John Gilchrist

Calgary Eats 7 by John Gilchrist





To celebrate the release, the base apps are on sale for $1.99 for a limited time. The app is universal for iPhone/iPad and is a free upgrade for existing users.

I personally find it very enjoyable to browse through the books while sitting comfortably on the couch with my iPad in my hands. Now you have a list and a map of all restaurants visible at the same time, in both landscape and portrait mode. The review text generally fits on one screen, so it’s easy to read.

If you are the proud owner of a new iPad, you’ll be pleased to know this app is optimized for the Retina display. The text is razor sharp, and the maps look beautiful. It also has a fun new animation at startup.

Questions? See the FAQ page.

Here’s a screenshot of the app on iPad:



Presentation slides and code from my “Polishing Your App” YYC Dev Camp talk now available


I’ve released the presentation notes and posted the code from my YYC Dev Camp #6 talk last week.

Presentation Slides

The presentation slides are available here as a PDF.

Hopefully I’ll soon do a blog post to walk through the steps, but for now, the code is available on GitHub in fully functional examples projects. These are released royalty free for your use (but not the included sample images, those are copyrighted).

Custom UINavigationBar and Stretchable Custom Back Button Code

Here is the project that shows how to create custom UINavigationBar background images on both iOS 4 and iOS 5. It also shows how to create a custom back button that has a text-based title (i.e. not baked into the image) using a stretchable image. I originally learned how to do this from iDev Recipes – How do iPhone apps Instagram/Reeder/DailyBooth implement custom NavigationBars with variable width back buttons? but I have refactored the code significantly to make it more modular and easy to use.

Here is the code:


Full Screen Animations – Path-style open book animation and falling star animation

The other sample code shows how to do a couple of full screen animations. First, it performs a Path-style open book animation when the app opens. This will be included in an upcoming version of the John Gilchrist Calgary Eats and Cheap Eats apps. This works on both iPhone  (portrait only) and iPad (in any orientation). It also shows how to do the falling-star animation used in those same apps.


Here is the code:



I’m giving a talk on iPhone programming tomorrow!


Just a quick note to say that I’m giving a talk tomorrow at YYC Dev Camp #6 held at the University of Calgary. It’s put on by Robots and Pencils, who I do most of my work with.

The description of my topic on various places on the web isn’t great (long story). The topic will be:

Polishing Your App

Tips & Tricks to make your app stand out

Once you have your app functional and feature complete, here are some ways to add a little polish to make it stand out. Things like custom navigation bars, custom back buttons, stretchable images, and animations.

I work with most of the other speakers, and they are some very smart guys who will have definitely have interesting things to say. Come on by if you can. Price is $15 to cover the cost of the venue and food:



Jeremy Gale

Cheap Eats and Calgary Eats on sale for Calgary’s Big Taste!


Sorry for the long delay between blog posts, I’ve been completely negligent! In fact, I realized that I didn’t even mention that my second app is available on the App Store.

While Cheap Eats 2 is the app version of John Gilchrist’s Cheap Eats 2 book, the second app is Calgary Eats 7. This is the app version of John Gilchrist’s My Favourite Restaurants 7th Edition: Calgary, Banff and beyond. Cheap Eats focuses on the best deals, but Calgary Eats has the best of the best, regardless of price. It also features over 220 restaurants vs 160 for Cheap Eats 2.

Both apps are on sale for 60% off during Calgary’s The Big Taste event, March 2-12. I’d also urge you to get out and try some of the great restaurants in Calgary during this event. Many of them are recommended by the oracle, John Gilchrist himself. My wife and I have already tried out Rasoi and are planning to try Escoba.

Speaking of great Calgary restaurants, I had the good fortune of attending Yelp’s Triple Threat Throwdown event on Monday. The event featured a signature drink and canapé from 3 Calgary restaurants, inspired by a piece of local art. My favourite was from Cassis Bistro, John Gilchrist’s top choice for Best New Restaurant of 2011, as well as Avenue Magazine’s Best New Restaurant of 2012. I had the pleasure of talking to owner Gilles Brassart, who was mixing up “Cassispirinhas”, a new take on the Caipirinha. It’s a delicious cocktail made with sugar cane rum, sugar, and lime. It takes me back to my trips to Portugal and Brazil. Gilles is from France, but lived in San Francisco for 7 years, running a restaurant there. Lucky for us Calgarians, he met his wife there, who hails from Calgary. They moved here and they opened up Cassis Bistro together. This story reminded me of talking to Connie DeSousa at CHARCUT before she became famous on Top Chef Canada. She had been working in the Bay Area at some very elite restaurants, and decided to open her own restaurant with John Jackson. They eventually choose Calgary over Vancouver, New York and San Francisco. As a native Calgarian who lived in the Bay Area, I feel a sense of pride here. San Francisco has amazing food, so it’s amazing to see these great culinary talents setting up shop in Calgary. We are very lucky.

Gilles made my night when he had heard of my apps and liked them, and knew that I used to work at Google. 🙂 I owe it to John Gilchrist for spreading the word! I can’t wait to try out Cassis Bistro. I’m going to take Stacy there to thank her for all the help developing the apps.

PS: I’m nearing completion of an iPad version of the apps that will be a free upgrade, so buy them now while they’re on sale. Stay tuned!

Force Grind’s first app is live – Cheap Eats 2 by John Gilchrist!


I’ve got some exciting news!

My first ever iPhone app is now live on the App Store! Cheap Eats 2 by John Gilchrist is an app version of John Gilchrist’s Cheap Eats 2 book. It’s an app for finding the best Cheap Eats in Calgary, Banff and area.

Who is John Gilchrist? Only Calgary’s most influential food writer. John reviews restaurants for CBC Radio’s Calgary Eyeopener and writes about food and restaurants for the Calgary Herald, Avenue, Swerve, and Where Calgary. If you haven’t followed his restaurant recommendations before, you are missing out. I’ve been a devoted follower for years. Whenever my wife and I feel like going out for dinner, we always pick a restaurant from his book, and we’ve yet to be disappointed. We like to work our way through the book and my wife likes to put a sticker on every restaurant we’ve been to. (OK, I like it too).

Eventually it hit me – I really need an app version of John Gilchrist’s books. We often forget our books at home. Imagine if you could look up John’s recommendations from anywhere, and see what’s close to you on a map. Now you can! In the mood for sushi? Bring up a map of sushi restaurants and pick the nearest one. Peruse the restaurant’s menu from their website, all within the app. Pull up driving directions on Google Maps. I also wanted to do the app equivalent of putting stickers in our book. So now you can mark restaurants as visited in the app, or mark your favourites for easy reference.

I decided to build a prototype of the app and then contacted John Gilchrist out of the blue. (A little intimidating!) He agreed to meet, and couldn’t have been nicer. He loved the idea and was willing to go along with it right from the start. I also got to meet John’s lovely wife Catherine, and worked closely with her on updating all of the restaurant listings that have changed since the publication of the book, only a few short months ago. The restaurant business moves fast!

Here is the App Store link.

Read more about the app on my website: http://www.forcegrind.com/calgaryeats

Thanks to Stacy Anderson for all her help entering the restaurant data, and thanks to the very talented Eric Chernuka for his amazing design and artwork. Finally, thanks to John Gilchrist and Catherine Caldwell for being amenable to the idea, and easy to work with.

I’d love to hear your comments.

iOS: How to embed a Twitter feed and/or hashtag in your app


One of my recent projects required a simple Twitter feed integration. Basically just a table view that showed recent tweets from either a @username or a #hashtag. No requirements to post tweets or anything like that. This seems to be a fairly common request for a lot of clients.

Being lazy, I didn’t want to sign up for an API Key or anything onerous. Someone recommended a very simple way to do this, which worked beautifully. I wanted to pass it on.

What you’ll need:

  1. JSONKit – to quickly parse the JSON.
  2. ASI – A nice simplified library for doing asynchronous HTTP requests.
  3. Google Toolbox for Mac – A useful toolkit from Google. Used for escaping HTML-style escapes.
  4. (Optional) JSONView – An extension for Chrome to very nicely format JSON.

Step 1. Find the Twitter URL
Twitter provides a really simple API that returns recent tweets in JSON format. If you do a normal search like this:

you can get back the results in JSON format by simply tweaking the URL:

If you’re using Chrome, try using JSONView to nicely visualize that. Perfect! Recent tweets about a certain theme, all in a nice machine-parseable format, no API key required. What’s more, you can use their Advanced Search GUI to tweak the query then still get back the results in JSON. Using that, I found I could combine a hashtag (#epicwinning) and a username (@charliesheen) like so:

Step 2. Set up your project
Add JSONKit and ASI to your project. This is pretty straightforward, I’m not going to walk through it. Soon we’ll see that I also needed GTM (Google Toolbox for Mac). Being a little lazy and not wanting the whole thing, I just added these two files to my project.
  • GTMNSString+HTML.h
  • GTMNSString+HTML.m

 Then I tweaked the .m file as follows to avoid external dependencies:
//#import "GTMDefines.h"
#define _GTMDevLog NSLog
#define _GTMDevAssert NSAssert
Step 3. Make the Request
Here we make a simple ASI request to fetch the recent tweets.
- (void)loadTweets
    // Looking for #kTwitterHashtag or @kTwitterUsername
    NSString *urlString = [[[@"http://search.twitter.com/search.json?q=%23" stringByAppendingString:(NSString *)kTwitterHashtag]
                            stringByAppendingString:@"+OR+%40"] stringByAppendingString:(NSString *)kTwitterUsername];

    ASIHTTPRequest *request = [ASIHTTPRequest requestWithURL:[NSURL URLWithString:urlString]];
    request.delegate = self;
    [request startAsynchronous];
Note that Cocoa started going a little crazy when I had one big format string with things like %40 in there. I ended up breaking the string into smaller parts and appending them.

Step 3. Parse the result
When the HTTP request finishes, ASI will call your delegate method. I simply use my UITableView’s mutable array of model objects and replace its content with the “results” array contents from the JSON.
- (void)requestFinished:(ASIHTTPRequest *)aRequest
    NSDictionary *result = [aRequest.responseString objectFromJSONString];

    // an array of NSDictionarys with the properties
    // properties can be seen by looking at the URL with Chrome extension JSONView
    [_modelObjects removeAllObjects];
    [_modelObjects addObjectsFromArray:[result objectForKey:@"results"]];

    [self.tableView reloadData];
In your, -tableView:cellForRowAtIndexPath: method, just grab the key from the JSON that you wanted.
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
    .... // Get the cell

    NSDictionary *tweet = [_modelObjects objectAtIndex:indexPath.row];
    cell.textLabel.text = [tweet objectForKey:@"from_user"];
    cell.detailTextLabel = [[tweet objectForKey:@"text"] gtm_stringByUnescapingFromHTML];
Why do I use the Google Toolbox gtm_stringByUnescapingFromHTML? Because the returned JSON has things like this in it:
“I think I dislike the whole &quot;[email protected]&quot; phenomena”.
Those &quot; need to be unescaped into normal quotes. This is also true for lots of other characters – ampersands, less than, greater than, etc.

Don’t forget to handle errors. In my case, I just made a fake tweet entry which said the request failed.
- (void)requestFailed:(ASIHTTPRequest *)request
    NSLog(@"Fetching tweets failed. Error: %@", [[request error] localizedDescription]);
    [_modelObjects removeAllObjects];

    NSDictionary *fakeErrorTweet = [NSDictionary dictionaryWithObjectsAndKeys:
                                    @"Twitter Error", @"from_user",
                                    @"Could not fetch tweets. Maybe Twitter is down?", @"text",
    [_modelObjects addObject:fakeErrorTweet];
    [self.tableView reloadData];
That’s all there is to it. Pretty simple right?

New developer signup: Android is eating Apple’s lunch


I knew quite a while ago that I would be signing up to become an independent iOS developer. To do this, you have to sign up here for the iOS Developer Program for $99/year. Until you sign up and have been approved, you cannot test your apps on an actual iOS hardware device, you can only use the Simulator.

From my previous day job, I knew this process could take a while. I wasn’t sure how long, so I tried to start early. I had gone through the Android signup process, and I knew how long that took – about 5 minutes. Sign up with a Google account, done. You can start running on actual hardware and post to the Android Market within minutes.

So far, it has been 40 days, and I am still not signed up. (Update: It ended up taking 90 days). This is just appalling. How can Apple not be losing developers over this? In the style of Jamie Murai’s Open Letter to RIM Developer Relations, I wanted to post about this in hopes of making it easier for other independent developers and maybe shaming Apple into better behaviour.

Here is the timeline, so far:

  • June 2. I apply online for iOS Developer Program under my corporation’s name.
  • June 7. I get an email from Apple saying they need more information about my corporation, such as my Provincial or federal business registration, articles of incorporation, or Corporations Charter.  Unfortunately I was on vacation at this time and wasn’t able to send them this information until Monday June 13. Maybe I should subtract 6 days off of the total to be fair.
  • June 13. I fax in my Certificate of Incorporation with an Alberta seal, and my Articles of incorporation.
  • June 14. I get another reminder that I need to send in my supporting documentation. I guess they hadn’t noticed that I had sent it two days ago.
  • June 15. I email [email protected] to confirm they have received it. In the afternoon, I get an automated email saying they’ve received my information.
  • June 27. Twelve days later, I haven’t heard anything so I email [email protected] to again ask for status.
  • June 30. Up to 28 days now. Apple replies to my original June 15th email saying:
Please know that after reviewing your faxed documentation, we noticed that the document you sent in did not hold a state seal or filing stamp that notes “Filed and Approved”.  We ask that you please fax one of the following which has the state seal or filing stamp located on the document:
-Provincial or federal business registration
-Articles of incorporation
-Corporations Charger
-Canada Revenue Agency (CRA) business number “license” or “certificate”
  • Note that I had already sent them my articles of incorporation and my certificate of incorporation which shows the provincial seal. None of the documents listed contains a seal on it. I start Googling for other who have run into this huge delay, and someone recommended contacting Apple Developer Worldwide Telephone Support. To my surprise, they answer immediately. The representative said that when you file your incorporation electronically, you don’t receive any of those documents with a provincial seal on it, which explains my problem. Obviously they were aware that this is common. Unfortunately he said they have very strict rules on approving corporations, and so they have to to send it to a review committee who will try to confirm that my incorporation is legit. If this happens all the time, why don’t they have a more streamlined process? The rep advised me to keep calling in.
  • July 12. Another 12 days later, I still haven’t heard anything. I called Developer Support again. The rep said they can see that the escalation request for review had been submitted and it’s in the queue, but they haven’t heard anything and have no further information for me.
  • Aug 31, 2011: Someone from Apple finally called me saying my case was “escalated” to her, she said they’ve looked over my documents and everything looks good. So they just now finally let me pay for my $99 account. That is just shameful.

So it took nearly 90 days. I’ve worked on about 6 or 7 different iOS projects during that time, but haven’t been able to run or test it on actual iOS devices without some help from friends.
Lessons to be learned here:
  • Call Apple Developer Worldwide Telephone Support instead of emailing [email protected] They answer the phone right away whereas you don’t get email replies for about 15 days.
  • Filing your incorporation electronically will make it hard to get approved quickly.
  • Start applying for your developer account as soon as you have your incorporation. Maybe 3 months before you think you will need it?
  • Apple’s signup process for corporate customers is ridiculous. It could take 90 days for you to get approved.

Thoughts? Comments?

Update Aug 31, 2011: Someone from Apple finally called me (512 area code, Texas), saying my case was “escalated” to her, she said they’ve looked over my documents and everything looks good. So they just now finally let me pay for my $99 account. That is just shameful.

There’s a first time for everything…


Starting your own company, creating your own website, writing a blog.

I intend to blog about what it’s like to form your own company, the steps involved, the surprises I ran into, etc. I got the idea for this from talking to my accountant and asking some basic questions about incorporation. He looked at me like I was insane – i.e. doesn’t-everyone-know-this stuff? I want to cover stuff like why you might want to pay yourself in dividends, how to file GST, how to prepare your corporate returns, etc.

Of course I’ll cover the technical side of things too. I’m sure I’ll have lots to say about mobile development, Apple in general.

Welcome. Thanks for reading. 🙂

© Copyright Force Grind - Theme by Pexeto