Home

Posts tagged with iphone

Another job opening :-) iPhone developer — learn on the job

Posted by Simon on May 04, 2010 at 04:32 PM

Categories: code, business, iphone, jobs

My iPhone custom software development business is expanding yet again and we need more part-time programmers. The last round I hired two people, now we need more. Our recent apps include Unitron's uHear to test your hearing, OurKids, the Kik chat app, and others.

You must:

  • know C, C++, pointers, object and object-relational patterns already
  • be ready to learn the iPhone SDK fast (we'll help)

I've personally been programming on the Cocoa SDK since 1998 back when it was called OpenStep, so if you can pick things up, we can get you up to speed in a few weeks.

Demonstrate your qualifications by answering 2 out of these 3 tricky questions:

[Question 1] (C Pointers) Here is some slightly odd C code, but it will produce an (int) result, provided that you make some small changes in order to make it compile. What is the result going to be, and why?

int * a = 1990;
int result = &5[a];

[Question 2] (Database design) Create an entity-relationship diagram for a small subset of the Facebook database. In particular, include in your diagram:

  • User
  • Photo (including who is tagged in the photo)
  • Wall Post

Focus on the relationships/associations between these three objects, and only include one or two of the most important static fields (like a person's name). Make sure to indicate the cardinality of a relationship e.g. one-to-one/one-to-many/etc.

To get an idea of what I'm looking for see: http://en.wikipedia.org/wiki/Entity-relationship_model

Here's a tool you can use to draw it online: Gliffy. Then just send me a screenshot. Or feel free to use ASCII art or draw on a piece of paper and photograph/scan, as long as it's very clear.

[Question 3] (C++ Objects) The C++ program below has just 2 compile time errors, 1 runtime error, and there is 1 single line missing. Send us a fixed version that compiles and runs correctly. The errors will test your knowledge of object use and management in C++, and the missing line will test you on abstract/virtual inheritance.

SEND TO: simon@semacode.com. Include your answer(s) and some source code that you have written, whether it's open source, for assignments, for fun, or whatever.

REMUNERATION: Competitive.

MORE INFO: http://simonwoodside.com/pages/consulting

(PS Please keep the answers to yourself)

//// File: futurama.cpp ////
#include <iostream>

class Drinker {
public: Drinker(); void drink( int potency ); int _numberOfDrinksSoFar;
private: virtual int cantDrinkAnyMoreThan() = 0;
}; Drinker::Drinker() { _numberOfDrinksSoFar = 0; }
class Robot : public Drinker { int cantDrinkAnyMoreThan() { return INT_MAX; } };
class Human : public Drinker {
};
void Drinker::drink( int potency ) {
  _numberOfDrinksSoFar += potency;
  if( _numberOfDrinksSoFar > cantDrinkAnyMoreThan() ) { std::cout << "I'm all done." << endl; }
}

int main (int argc, char * const argv[]) {
  int beer = 5, coffee = 3;
  Human fry;
  Robot * bender;
  for( int i=0; i<6283; i++ ) { bender.drink(beer); }
  for( int i=0; i<100; i++ ) { fry.drink(coffee); }
  std::cout << "Bender: " << bender->_numberOfDrinksSoFar << "  Fry: " << fry._numberOfDrinksSoFar << std::endl;
  fry.drink(1);
  return 0;
}

Job Opening: iPhone part-time / contract coder wanted -- we'll teach you

Posted by Simon on February 11, 2010 at 03:07 AM

Categories: code, business, iphone, jobs

My iPhone custom software development business is expanding and we need more part-time programmers. Our recent apps include Unitron's uHear to test your hearing, OurKids, an upcoming app for Kik, and others.

You must:

  • know C, C++, pointers, object and object-relational patterns already
  • be ready to learn the iPhone SDK fast (we'll help)

I've personally been programming on the Cocoa SDK since 1998 back when it was called OpenStep, so if you can pick things up, we can get you up to speed in a few weeks.

Demonstrate your qualifications by answering 2 out of these 3 tricky questions:

[Question 1] (C Pointers) Here is some slightly odd C code, but it will produce an (int) result, provided that you make some small changes in order to make it compile. What is the result going to be, and why?

int * a = 1990;
int result = &5[a];

[Question 2] (ORM) Draw an relational/DB model that would work for the Twitter database or the Facebook database. You don't have to cover all of the features, just the basics. You can use ascii art if you like.

[Question 3] (C++ Objects) The C++ program below has just 2 compile time errors, 1 runtime error, and there is 1 single line missing. Send us a fixed version that compiles and runs correctly. The errors will test your knowledge of object use and management in C++, and the missing line will test you on abstract/virtual inheritance.

SEND TO: simon@semacode.com. Include your answer(s) and some source code that you have written, whether it's open source, for assignments, for fun, or whatever.

REMUNERATION: Competitive.

MORE INFO: http://simonwoodside.com/pages/consulting

(PS Please keep the answers to yourself)

//// File: futurama.cpp ////
#include <iostream>

class Drinker {
public: Drinker(); void drink( int potency ); int _numberOfDrinksSoFar;
private: virtual int cantDrinkAnyMoreThan() = 0;
}; Drinker::Drinker() { _numberOfDrinksSoFar = 0; }
class Robot : public Drinker { int cantDrinkAnyMoreThan() { return INT_MAX; } };
class Human : public Drinker {
};
void Drinker::drink( int potency ) {
  _numberOfDrinksSoFar += potency;
  if( _numberOfDrinksSoFar > cantDrinkAnyMoreThan() ) { std::cout << "I'm all done." << endl; }
}

int main (int argc, char * const argv[]) {
  int beer = 5, coffee = 3;
  Human fry;
  Robot * bender;
  for( int i=0; i<6283; i++ ) { bender.drink(beer); }
  for( int i=0; i<100; i++ ) { fry.drink(coffee); }
  std::cout << "Bender: " << bender->_numberOfDrinksSoFar << "  Fry: " << fry._numberOfDrinksSoFar << std::endl;
  fry.drink(1);
  return 0;
}

(Update Feb 14: updated code to make my intentions clearer)

A little ToneMatrix Music

Posted by Simon on December 05, 2009 at 10:45 PM

Categories: graphics, tech, links, art, infographics, film, iphone

André Michelle, inspired by the TENORI-ON, created a grid-sequencer called ToneMatrix. It's an interactive experience written in Flash 10 that merges graphics, visualization, interactivity, and music. There are also iPhone knock-offs such as the free TonePad. As for ToneMatrix, click here to check it out and create your own tunes. Here's one of mine.

Eine Kleine ToneMatrixMusik from S Woodside on Vimeo.

You can also right-click on the ToneMatrix flash app and copy/paste numerical sequences to load and save your music. The sequence for the above is:

98386,1024,4096,1024,67474,96,65540,32768,65618,1024,64,0,65618,4,65600,0

Share and enjoy.

How to prepare a build for distribution in the App Store using the Program Portal, XCode, and iTunes Connect

Posted by Simon on September 28, 2009 at 04:59 PM

Categories: code, iphone

Apple does a pretty good job of explaining how to prepare the meta-data for an app submission in iTunes Connect, but it's not completely obvious how to prepare your actual build in XCode.

Assuming that you've already got Ad Hoc distribution working, it's not too hard. I was looking for advice and didn't find it, but I did find a question on StackOverflow that people had actually downrated and not really answered. So I figured out how to do it and added a proper answer. So without further adieu, rate me up on StackOverflow to give me wonderful wonderful karma, and view,

How to prepare a build for distribution in the App Store using the Program Portal, XCode, and iTunes Connect on StackOverflow

Praise for uHear

Posted by Simon on July 22, 2009 at 05:37 PM

Categories: iphone

Picture_1

I still think that the uHear application I made for Unitron is pretty cool. So do some other people.

Can't believe it's free *****

by DancingRomantic - Version 1.0 - Jul 22, 2009

It's apps like this that make the iphone the most powerful of all smartphones. Great work!

It's amazing how much app crap there is out there.

uHear -- test your hearing with an iPhone

Posted by Simon on June 04, 2009 at 11:39 PM

Categories: code, mobile, iphone

Here's a little movie I made of an iPhone app called uHear I developed for Unitron. This is also a bit of an experiment because I've uploaded the movie to Amazon S3 and you're watching it from AWS.

Anyway, the video is short, and shows you four parts of the app:

  1. The standard hearing sensitivity test, which finds out how quiet you can hear at various pitches in each ear,
  2. the speech & noise test, which tests if you might have trouble hearing over noise like in a restaurant,
  3. lots of hearing-related info, and finally,
  4. a live audiologist lookup based on your current location, powered by google maps API.

You'll want to turn your speakers up or the first bit might seem a bit pointless.

Making this app was pretty cool, my client was excellent, I worked closely with their audiologist in charge of this project and really pushed the boundaries of playing back audio on the iPhone in a very precise way. We also implemented some really cool UE/graphics designed by Tom Auger of Zeitguys in Toronto.

Incidentally, I'm available to do more iPhone consulting on a part-time basis :-) Bring in Simon & Woodside when you need crack software development (but not software development for crack).

How to really URL encode an NSString in Objective-C, iPhone, etc.

Posted by Simon on April 22, 2009 at 02:52 AM

Categories: code, mac, iphone, objectivec

Trying to encode URL parameters on Mac or iPhone? Frustrated because NSString stringByAddingPercentEscapesUsingEncoding encodes non-URL characters but leaves the reserved characters (like slash / and ampersand &) alone? "Apparently" this is a "bug" apple is aware of, but they haven't done anything about it yet, and so, here is a solution that actually works.

Try this:

  NSString * encodedString = (NSString *)CFURLCreateStringByAddingPercentEscapes(
 NULL,
 (CFStringRef)unencodedString,
 NULL,
 (CFStringRef)@"!*'();:@&=+$,/?%#[]",
 kCFStringEncodingUTF8 );

As an example, @"'Decoded data!'/foo.bar:baz" will become "%27Decoded%20data%21%27%2Ffoo.bar%3Abaz".

Obviously you would use this, not on the full URL, but just on the parameters.

iPhone programming: how to switch to a landscape view at the moment of your choosing

Posted by Simon on February 27, 2009 at 05:12 PM

Categories: code, mobile, iphone

Maybe someday, Apple will make it easy to rotate manually into a landscape view. But right now it's been causing me enormous headache with hideous frames issues. Running an app in landscape the whole time is easy, but doing just some views in landscape is insane, especially if you're trying to switch while in the middle of a navigation controller.

However I've found an easy solution which is to use a new window. Just reset the whole view problem. You can then fake out the navigation bar using the method of your preference. Here's the bare bones. For me, I'm going from a tableView, click on an item and get a "results view".

// In ResultsListController, a UITableView delegate:
- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath {
  ResultsViewController * resultsViewController = [[[ResultsViewController alloc] initWithNibName:@"ResultsViewController" bundle:nil] autorelease];
  resultsViewController._recordIndex = indexPath.row;
  UIWindow * window = [[UIWindow alloc] initWithFrame:[[UIScreen mainScreen] bounds]]; // this is a leak!
  window.backgroundColor = [UIColor redColor]; // just for debugging
  [window addSubview:resultsViewController.view];
  [window makeKeyAndVisible];
}

Now ResultsViewController has its own NIB, and the view is set to be sideways in IB.

// In ResultsViewController
- (void)viewWillAppear:(BOOL)animated; {
// First rotate the screen:
  [UIApplication sharedApplication].statusBarOrientation = UIInterfaceOrientationLandscapeRight;
// Then rotate the view and re-align it:
  CGAffineTransform landscapeTransform = CGAffineTransformMakeRotation( degreesToRadian(90) );
  landscapeTransform = CGAffineTransformTranslate( landscapeTransform, +90.0, +90.0 );
  [self.view setTransform:landscapeTransform];
}

// Connect your "back" button in the results view to this:
- (IBAction)back:sender; {
// return screen rotation to normal:
[UIApplication sharedApplication].statusBarOrientation = UIInterfaceOrientationPortrait;
// Get rid of the window, and the "normal" window will re-appear from underneath
self.view.window.hidden = YES;
[self.view.window resignKeyWindow];
}

Easy as cake!

UPDATE: There's follow-up Q&A on the iphonedevSDK forums.

How to make an iPhone button highlight (hold state)

Posted by Simon on February 05, 2009 at 07:26 PM

Categories: code, iphone

Here's how to use iPhone SDK to make a button hold it's on/highlighted state when you click on it:

- (IBAction)badButton:sender; {
  badButton.highlighted = YES;
  if( _hasChosen == NO ) {
    _hasChosen = YES;
    [NSTimer scheduledTimerWithTimeInterval:0.0 target:self selector:@selector(badButton:) userInfo:nil repeats:NO];
  }
}

On simulator it looks perfect, but on device there's a brief moment when it goes white before it goes blue/highlighted again.