Cory Wiles Blog

If You Blog It They Will Come 

(Order of the) Phoenix Communications

From the ashes of itself, according to legend, a Phoenix will be reborn to live again.  In my case this almost has a literal truth.   Last week I started my new job at Phoenix Communications as a Software Development Engineer.  My primary responsibility will be creating iPhone/iPad apps for business integration, as well as, consumer apps which I can't go into detail right now due to NDA...but I can say that it is going to be challenging and exciting.  Most of my previous work experience has been with fairly large companies or academic institutions.  While, I learned a lot working in those settings I definitely feel that I work BEST when I am involved with a smaller team and even smaller bureaucracy.  Too many ideas and innovations are stifled because of "red tape" or this approval or that approval needs to be signed off on by five different levels of management.  There are usually WAY too many meetings and not enough work getting done.

Not anymore.  I love the fact that I am up to my Phoenix feathers in ideas, responsibility and most importantly...coding.

Loading mentions Retweet

Comments [0]

'Freedom From Porn': Steve Was Right

Back in May Steve Jobs got into a wee bit of email confrontation with Ryan Tate over the finer points of whether or not Apple was still a revolutionary company based upon their recent actions of going after the Gawker blogger/journalist/thief/revolutionary/martyr/whatever for publishing and printing information on the yet release iPhone 4.  One of the most circulated quotes from sed email exchange was "freedom from porn".  Even as a big Apple supporter that I am I had to laugh a little.  I do think Steve and his band of merry men and women are making the right business decisions I thought that one particular reasoning was somewhat of a copout used by politicians who want to guilt voters into believing in some draconian policy.  That was until I was watching my 3 year old niece play a Snow White puzzle game on my brother-in-law's Android Incredible.  The app was free with ad support.

Disclaimer: I FIRMLY believe that it is a parents responsibility to monitor what their children are doing online.

I was completely shocked when I saw an ad for "Sexy Single Chat Line" on a kids game.  People complain how Apple has "jump the shark" or "sold out" by having tight control on the advertising model of iAds or the submission process of apps, but having a completely "open" system is not necessarily a good thing. Apple has struck the right balance between along enough flexibility for developers to be create wonderfully creative and useful apps, but in the meantime maintaining a high standard of quality. 

Needless to say the app got deleted immediately and she played a similar game on my iPhone.

Loading mentions Retweet
Filed under  //   apple   google   google incredible   iads   mobile ads   steve jobs  

Comments [2]

JandB Photo App Officially Launched

The past three months I have been working on an iPhone app for a local photographer John Childress.  Like most great iPhone apps, the idea that John had dealt with a concept that would:

  1. Get him iPhone app market for his business
  2. Provide a new value-added service to his customers
  3. Providing a new form of media to promote his business to potential new customers
In doing research for the app he and looked at a lot of other photo gallery viewing apps in the App Store to see what features dominated and most importantly what could he offer that others didn't.  Currently, after you have a photo shoot John will send you a gallery code and you can then view the flash slideshow on his site.  There are few issues  with the "mobile" market that we all live in now.  The first is you can't view flash on the iPhone so trying to view your photos on the phone and show them off to friends and family is not possible.  Rewriting his gallery website to be non-flash would be a good idea, but the system is currently in place and is integrated with his core business aspects.  The other roadblock that he runs into is that most people want to view slides shows with a soundtrack. 

*I think I just heard the RIAA scramble to call their lawyers for a lawsuit just for a business thinking of doing that*

With the JandB Photo app, which is a free download, users can add a gallery to their phone and enjoy the slideshow of images with an optional custom soundtrack from tracks on your phone.  Want to share a picture on Facebook?  Not a problem that feature in there as well.  Want to view current specials that John is offering, there is a place for that.

What I really love about the app from a consumer point-of-view is that it is simple and straightforward.  There is not guessing about what to do.  A specific task is performed in the least amount of steps.  You don't have to think.  From a developer's point of view this app was one of the more challenging apps I have done and learned a lot.  The app uses two complex frameworks.  Three20 and Google's objective-c framework.  Though integrating these components took sometime and I went through a few glasses of wine for support, both saved me COUNTLESS hours of custom development.

Three20 Modifications
Apple should really be THANKING @joehewitt for this work his creation of the Three20 framework.  Especially the photo gallery/viewer components.  If it wasn't for Three20 then I am sure that developers would be rioting outside of 1 Infinite Looper Cupertino, CA for the lack of such important piece of built-in functionality.  With all it's glory though I did have to make some modifications which include integration of posting an image to Facebook and adding in the ability to play an playlist that is associated with the gallery.  Unfortunately, and I plan on working on this soon, I had to modify the core source which to be frank felt dirty.  I just didn't have time to write classes extensions and categories for the gallery controller and viewer controller.

Google Objective-C Library
Man there really is a lot going with this library.  Everything and the kitchen sink.  When scouring through the wiki page for this I didn't see a lot of really good iPhone examples, but I was able to piece together what I couldn't figure out from their Mac example to modify a document and worked without a problem.  My only real disappointment with this library is that there, IMHO, waaaaaay too many delegate methods and callbacks.  With that being said I do understand why. Google gives you granular control of the content, metadata, revisions, ALC, etc. and objective-c is verbose so the end result is a lot of code to accomplish what I need which was: lookup a document by a given name, grab the latest revision, insert text at the end, close/save the document.

All in all I am very happy with the app.  The first few future releases will mainly deal with performance.  I still feel that I could squeeze some more performance on parsing through the images on the server side and optimize the network calls on the phone.  After that some UI tweaks. To me the gallery listing could be a little prettier.  Most importantly any enhancements that users want to see.  Feedback is always welcome.

Head over to the App Store and check it out.  If you want a check another gallery besides the default, then use "McKinna", without quotes.  Shameless plug for my daughter.

Loading mentions Retweet
Filed under  //   app   google   iphone   jandb photo   photos   three20  

Comments [1]

How to Create SMS Ballon iPhone Table View

I was working on incorporating an "sms ballon" type view for a client and while doing some research on the best, and different, ways to implement the functionality I came across a great tutorial, but thought it could be cleaned up just a little bit which should make your FPS increase and I fixed some memory leaks.  I wasn't able to run any performance tests on it so I would welcome ANY feedback how to improve the code.

The key to making the "ballon" background grow and shrink based upon the amount of text is using:

UIImage *balloon = [[UIImage imageNamed:self.imgName] stretchableImageWithLeftCapWidth:24 topCapHeight:15];

If someone has any advice on how to make the font look better please let me know.

Loading mentions Retweet
Filed under  //   example   iphone   sms ballon   tutorial   uitableview  

Comments [0]

UILocalNotification Example Project Using iOS4

One of the greatest new features that is included in iOS4 is the power that developers have to deliver local notifications.  At the time that the first beta was released in April I was writing specs/requirements and project timeline for a potential app which would have ended up taking me about 5 months to develop.  A large part of the project schedule dealt with having to setup/maintain user reminder preferences...the number of reminders, frequency of each one, time zones, etc.  I tried to think of ever solution that I could that didn't involve the server component, but there really wasn't any other way.

UILocationNotification to the rescue.  After looking over the API docs, Apple had provided exactly what I needed and I was able to cut out 2.5 months from the project schedule because of it.

I was able to create an POC app using UILocationNotifications in literally 5 minutes.  It involved two easy steps:

 

  1. In the app delegate class I added the following method to verify that the event was fired off if the app was running. -(void)application:(UIApplication *)application didReceiveLocationNotification:(UILocationNotification *)notification;
  2. In the -(void) viewDidLoad method of my controller you alloc/init a new UILocationNotification object, set the fireDate which is an NSDate object, what time zone you want, what the notification message(body) should be and then add the UILocationNotification object to the UIApplication scheduleLocalNotification method

 

There are two possible end results.  The first being that the event is fired off while the app is running in which case you will not see anything. Hence, why I added the NSLog to the didReceiveLocationNotification method.  The second is if you close the app before the notification has fired and in that case you will receive the alert box with your message.

Download XCode Project

Note: This was compiled with iOS4 GM and tested on iPhone 3G/3GS

Loading mentions Retweet
Filed under  //   example   iphone   projects   tutorials   UILocationNotification  

Comments [1]

Benefits to Proxying APIs Using with Your Own Servers

Last night I was hacking away at some new features in EraseUrX and I ran into, what I still don't know is, a coding error on my part or incomplete api with Facebook. At this point it really could be either one. I am using their graph api and have no problem authorizing a user, requesting extended permissions and getting a list of friends from that user.  However, when I try to post a message to someone else's wall I get an OAuthException message that Facebook couldn't authorize the application.  WTF?! I thought possibly that my access token was invalid or that my url that I was posting with was incorrect. Nope they are fine. I tested it using curl and the post went through just fine with the same access token. After a few more code changes to no avail I decided to approach it from a different angle.

Though most big services take a lot of pride and care in their API's that they produce they still inevitably change method names, authentication schemes, parameters, validation, etc. This type of uncertainty isn't easily managed when you have compiled code on a device.  If/when a service provide decides to change/delete something from their API, your app could possibly break leaving the users pissed and blaming you.  Even though it TECHNICALLY isn't your fault, developers should take ownership and responsibility to do whatever they can to provide applications with the best user experience.

I decided that I would create a small webapp/script on my server that would act as a proxy or broker between api calls from my app and Facebook. On the surface it looks like it is overkill, but the benefits definitely outweigh the overhead.

A standardized output
Depending on if my request is successful or not to Facebook I will get a different JSON response which is fine, but the JSON structure is also different.  If I were do to all response checking on the phone, not only is it EXTREMELY verbose, but I don't want to have to parse through two different object graphs.  Instead my webapp will get the respone(s) and create a standard response structure of my choice. Something like this:

// Success
{
  'status': 'success',
  "data": [
      {
         "name": "John Doe",
         "id": "55555"
      },
{
         "name": "Jane Doe",
         "id": "6666666"
      }
  ]
}

//Error
{
  'status': 'error',
  "data": [
      {
         "message": "Bad error message",
   "title" : "Bad error message  title",
         "type": "666"
      }
  ]
}

Having a standardized response my app code looks for an exact value in the json string, 'status', and transverse the rest of the json response and process everything accordingly.  Efficiency.

APIs Change
As stated above service providers (Facebook, Twitter, Google, etc.) can/will change their api at any given time.  It is by far easier to change code in a webapp, test and deploy then it is to modify code, no matter how well written it is, in a native device app.

Better Monitoring and Logging
Having your native apps hit your script will allow for better monitoring of a) how many user's are actually using your app b) if there are errors you can track down them down easier and faster c) more accurate analytics that are based on your use cases.  In addition, being able to integrate those stats into other business initatives and integration points.

Result Caching
I would bet that companies like Facebook are caching result sets for a better/faster response, but we will never know and to the full extent they are caching.  You can setup your own caching architecture that will best serve you and your apps needs supplementary to whatever may or may not be provided by the service.

Disaster Recovery
We have all seen the Twitter "fail whale" which means that ANY app trying to utilize that API is housed for x amount of time, which is not a good thing.  Having your own server side script would allow you to handle those unfortunate instances when the service is unavailable by using a cached copy of the result set if one is available or send back a message in your standard response that allows your app to present to the user that that piece of functionality isn't working at the moment.

By handling the majority of the requests/response on my server I reduce the amount of boilerplate code/frameworks that are in my iPhone/Android/Blackberry app, able to standarize the message format for more efficient parsing on the device and provide a better user experience.

Loading mentions Retweet
Filed under  //   api   facebook   google   json   oauth   open graph   twitter  

Comments [0]

Why HR Should Take a Lesson From Posterous

This Friday my wife is graduating from Christian Brothers University with her MBA.  It has been a long road over these past few years, but she emerged victorious. The next chapter in her life is to move her current consulting career back to corporate America and it is interesting to see that process again...and when I say interesting I mean SAD and PATHETIC.  It amazes me just how unusable these online job applications are. First she is asked to create an account on CompanyXYZ's site as if it is some online community that she will be frequenting often and sharing recipes with friends.  Second she is asked for her personal meta information, Name, Address, etc. and in some cases her SSN (which no one should ever give unless they are given a job offer and the company needs a background check) and then she has to enter in all of her previous employment, education and then FINALLY upload her resume.  Some want the resume plain text, some require it in PDF or DOC.  Nothing is ever consistant.  All of this is redundant and unnecessary.  You want someone's contact information, it is in the resume.  You want someone's previous work history, it is in the resume.  You want someone's qualifications and awards, IT IS IN THE RESUME.  Why does an applicant HAVE to give you this information again?!

I won't go into all money and time that is wasted when companies purchase these monalithic systems, but I will emphasize that the employment applying process should be about the user.  You may have a great company, but your online application system sucks and probably turns away more qualified applicants than you realize.

HR needs to take a lesson from Posterous.  If someone comes to your site to apply for a job then all they should have to do is email jobs@companyabc.com with the subject as the job title/number.  Your back end system should then parse through their resume and extract relevant information to put into your system for further review and processing.  The first argument I always hear against using email is "Not everyone's resume is a format that is standard that we can parse".  While this is true my responses are a) partner up with Monster.com or Linkedin.com to where all the user has to do is pass in their username for those services and consume a service from the providers who will have their information in a standard format b) hire decent developers who actually know how to program and write the appropriate algorithms to search for headings like "name", "contact", "experience", etc.  If handful of guys at Posterous can parse email, like this one, from every known mail client in the world and post it to a blog I am sure that a resume should be possible as well.

Loading mentions Retweet

Comments [1]

Facebook Graph API with a Native iPhone Application

One of the biggest gripes that I have with working with the FBConnect iPhone SDK, and really the Facebook API, in general was having to deal with a very inefficient REST implementation.  Callback after callback, protocol after protocol, major bugs (that have yet to be fixed as far as I know), and my biggest issue is the nasty user experience having to login a user.  I was very excited to hear when last month Facebook announced they had came out with a new API that would allow great security, ease and flexibility.  The pains of having to go through currently working functionality and refactor the code to accommodate the new features wasn't too much of a problem for me because it would mean a reduced code set on my part and I would be able to get rid of the Facebook Connect SDK.  I set out to test my theories and functionality via a quick web app.  No problems.  Then I proceeded over to my native iPhone app.  EraseUrX v2.0.  The new authentication mechanism utilized in Open Graph is OAuth2.0.  While many of the headaches and complexities of using OAuth are addressed and the documentation for using it in a mobile web app are well documented with Facebook they TOTALLY dropped the ball on providing any direction on using it with a native iPhone app and they don't provide an updated SDK.

I could one of three things: 1. Use the old Facebook Connect which should still work for the forseeable future, but as stated above has too many issues that I don't want to deal with and they could drop support at any moment. 2. Wait for Facebook to publish a new SDK, but how long would it take them 3. Just figure it out myself and have a flexible solution that didn't relay any third party framework.  I went with option 3.

The first thing you need to do is setup your app with Facebook.  Second, you will need to create a "callback" page that Facebook will send the request back to once the appropriate code and token has been given to your original request.  Third, once you have gotten the access_token from Facebook then you need to put it in a DOM object. This is important so that you can retrieve it via the UIWebview's javascript string evaluation and then finally save the access_token in NSUserDefaults for any subsequent requests.  In my case I wanted to get a list of the currently logged in friends.  Instead of having to go through the callbacks and delegate methods associated with the FBConnect SDK I now have user's login via OAuth and I make a call to, https://graph.facebook.com/me/friends, and get a JSON response of what I need.  Simple. Beautiful.

Callback Example (PHP):
$token = '';

if ($_GET['code'] !== '') {
} else {
  print "no code";
}

?>
<html>
<title>OAuth Test</title>
<body>
<div id="token"><?=$token?></div>
</body>
</html>

Custom ViewController (I am not including setting up the uiwebview. I assume you already know how to do that):
- (void)webViewDidFinishLoad:(UIWebView *)webView {
  
  /**
   * Since there are a lot redirects then UIWebview delegate methods are called ALOT.
   * Therefore I just want to check and make sure that I am only getting the value when the url has my hostname in it
   */
  NSRange rangeRound = [[[webView.request URL] absoluteString] rangeOfString:@"corywiles"];

  if (rangeRound.length) {

  NSString *authToken = [[webView stringByEvaluatingJavaScriptFromString: @"document.getElementById('token').innerHTML"]
                         stringByTrimmingCharactersInSet: [NSCharacterSet whitespaceAndNewlineCharacterSet]];
    NSLog(@"authToken: %@", authToken);

  } else {
    NSLog(@"no auth token");
  }
}

Loading mentions Retweet
Filed under  //   example   facebook   iphone   oauth2.0   open graph   tutorials   uiwebview  

Comments [18]

Create Custom Sized UITableView with Header and Footer Views

I am currently working on a photo gallery/slideshow app and one of the requirements is for the main gallery listing page to have static header and footer that shows the app name, contact information and adverts.  The logical first method of attack is to just setup a UITableViewController subclass, slap some views and subviews to the table view header and footer and get on with the day.  However, the table itself should scroll, but the "header" and "footer" views should remain stationary.  My first approach, I found out quickly, did not work.  Surprisingly, there are a lot of people having issues with custom sized uitableviews in general and the discussions that I saw online didn't provide a very straight forward solution so I decided to create one.

The first big problem that most people run into is that they can't seem to resize the uitableview no matter what frame size they set.  It doesn't matter if you do it programmatically or through Interface Builder it still takes up the ENTIRE screen.  That is because they have subclassed UITableViewController.  To be honest I am not sure that happens "under the covers", but the custom frame sizes/locations are ignored.  You must make your controller a subclass of UIViewController and then add your UITableView as a subview to the your controllers view.

For example:

- (void)loadView {
  
  UIView *mainView = [[UIView alloc] initWithFrame:CGRectMake(0, 0, 320, 480)];
  self.view = mainView;
  [mainView release];

  UITableView *tblView = [[UITableView alloc] initWithFrame:CGRectMake(0 55, 320, 300) style:UITableViewStylePlain];
  tblView.dataSource = self;
  tblView.delegate     = self;

  [self.view addSubView:tblView];
}

At this point your frame size and height will be respected.

In my example I setup a simple UINavigationController project with two controllers.  The first has a header view, footer view and uitableview.  The second "detail" controller just has a UILabel with placeholder text.  Everything is built programmatically so that you can adjust frames and positions easily as well as any other customizations you would like.  Comments/suggestions are always appreciated.

Download Project

Loading mentions Retweet
Filed under  //   example   projects   tutorials   uitableview  

Comments [0]

I Will Not Ride the Dell Lightning

Being that my passion for development and design are usually centered around mobile apps I am always interested in any new platforms and handsets that poised to make any impact on the current market.  As such I was really interested in the article posted over at Engadget yesterday: Dell Lightning: the ultimate Windows Phone 7 device leaks out. However, my enthusiasm faded after the first sentence and twindled down to zero by the end of the first paragraph.

"Hot damn, people. The mother of all Dell leaks just dropped into our laps, and the absolute highlight has to be the Lightning, a Windows Phone 7 portrait slider."

I can overlook the fact that the device is running Windows and some of the on screen usability issues because I haven't used one, but what bothers me the most is that handset manufactures can't seem to understand handset design.  This phone is presented as having a "revolutionary" device design, but once again you have the same tired, inefficient slide-the-handset to show the qwerty keyboard.  Really?! That is the best you have. That is NO different from all the other handset designs that are offered by ever manufacturer in the world for the past 5 - 10 years.  Dell and Microsoft combined have more money than most European countries.  Why they don't or can't find/recruit/steal the BEST designers and developers to come out with a real competitor to the iPhone is beyond me?  However, what this does mean that within 6 months of this device launching you will see it sitting next to the Dell MP3 player that was supposed to be so great.

Looking over some of the other features that the device offers, once again there is nothing that I can't get, and probably better, with an iPhone or Nexus One.

::NOTE::

When I was attempting to find a link to the dell jukebox from their website it didn't come up.

Loading mentions Retweet
Filed under  //   apple   dell   design   gadgets   iphone   microsoft   mobile   nexus one   phones  

Comments [0]