Archive for the author ·

Tim

·...

Today on eBay

no comments

Apple iPhone 3G 16Gb (Launched July 2008) – $160
Apple iPhone 3GS 16Gb (Launched June 2009) – $335
Motorola Droid (Launched October 2009) – $79
Apple iPhone 4 16Gb (Launched June 2010) – $400 – with cracked glass

Share

iMovie for Editing Video on iPhone

no comments

I shot the following footage of the Great Forrest Park Bicycle Race this weekend on my iPhone. I was going to try putting the videos together on my new iPad2 using iMovie – but there is no easy way to transfer the video from the phone to the iPad without going through iTunes – so i decided to do the mixing on the iPhone instead.

iMovie is very easy to use and after taking a couple of guesses on what the different buttons mean you can quickly get a hang of video editing using the phone – or you can use the excellent help from within the app. The phone version of iMovie has two simple transitions as well as a straight cut to the next video segment with no transition option. iMovie also comes with a couple of preset styles, which allow you to add text to your video clips (double tap the clip), but I did not use those for this project.

After editing the video it took about 3 minutes to export the final video and another 10 minutes to upload in HD to YouTube (over WiFi).

Share

Getting meaningful device information for iPhone app support

no comments

Every developer must have had at least one email that goes something like this:  “I opened the app and it did not work”.  For emails like that there is not much you can do but be patient and try to figure out exactly what the problem was.  For other emails though it may sometimes be good to know a little about the device that the person was having the problem with.  For example “The GPS says it is not working so therefore your app is junk” could be put into context by seeing that the email was sent from an iPod Touch (which does not have a GPS chip).  Also, information about the version of iOS helps with locating what the issue may be.  Finally it can be very useful to know which version of your app the person is using since they may be having a problem with an old version of the app where the problem may have been fixed in the latest version.

	MFMailComposeViewController *mail = [[MFMailComposeViewController alloc] init];
	mail.mailComposeDelegate = self;

	if ([MFMailComposeViewController canSendMail]) {

		//Setting up the Subject, recipients, and message body.
		[mail setToRecipients:[NSArray arrayWithObjects:@"YOUREMAIL.com",nil]];
		[mail setSubject: [NSString stringWithFormat:@"%@ iPhone Application Feedback", kTWApplicationName]];
		[mail setMessageBody:[NSString stringWithFormat:@"\n\n\nIn order for us to better help you, please provide the following information:\nCountry: \n\nDebug info:\n%@ v %@\niOS version %@\nModel: %@",
							  kTWApplicationName,
							  [[[NSBundle mainBundle] infoDictionary] objectForKey:@"CFBundleVersion"],
							  [[UIDevice currentDevice] systemVersion],
							  [[UIDevice currentDevice] model]

							  ] isHTML:NO];

		//Present the mail view controller
		[self presentModalViewController:mail animated:YES];
	}

	//release the mail
	[mail release];

The  TWApplicationName is a constant that is set to the string value of the application name – this allows you to also see which application your user is asking about in case you have more than one app.

Share

How to batch change volume of aif files

1 comment

After creating aif files that tells the distance of upto 100 miles in both miles and kilometers (around 50 individual files) I tested the distance announcement while playing music and found that the volume of all my files was too low.  Now I could go in and manually increase the volume on each file – but that would be a bit of a pain and possibly not very consistent.  Besides one of the things computers are good at is doing the same task over and over again.  So I looked for a software solution.  Luckily there is a great open source command line sound manipulation software called <a href=”http://sox.sourceforge.net/”>SOX</a>.  This tool has a function for gain which lets you set the gain of any files in decibels (dB).

To run this program on all files in a folder run the following command from the terminal after copying the sox program to the folder:

for i in *.aif; do ./sox $i ${i%.*}.aiff gain -n 8; done;

In the instance above the original files are .aif and they were converted to have the file extension .aiff.  I tried to overwrite the original file – but that did not work well.

Share

Getting the timezone on the device

no comments

Since the LogYourRun iPhone application will show you your running data in week and month views it is necessary to know the timezone of the user in order to bring up the data for the correct week/month. At first I thought I could use the NSDateFormatter to do this. The documentation says that you can get timezone informationby using %z or %Z as the format. The %z should get you the offset in hours while the %Z should get you the name. However when tested it turned out that the opposite is the case…

The following code gets you the timezone offset in hours:

NSDateFormatter* dateFormatter = [[NSDateFormatter alloc] init];
[dateFormatter setDateFormat:@"Z"]; // error in documentation - the zone in hours should be 'z' not 'Z'
timezoneoffset = (int) [[dateFormatter stringFromDate:[NSDate date]] intValue]/100;
DLog(@"format %@", [dateFormatter stringFromDate:[NSDate date]]);
[dateFormatter release];

(Note the division by 100 is because the timezone is reported in military time so for 30 min offset the final timezone would be read as x.30 which is not really correct – but for getting a ballpark figure it would suffice).

Since the code is not behaving according to documentation it is not a good idea to use this to get the timezone because the code will break if the code ever starts behaving according to documentation.

Instead it turns out that there is a very nice NSTimeZone object which will give you the timezone offset from GMT in seconds:

int timezoneoffset = ([[NSTimeZone systemTimeZone] secondsFromGMT] / 3600);

Then all you have to do to get the hour difference is divide by 3600 (seconds per hour). If you cared about the half hour offsets you would make this a float – but this is plenty for getting a ballpark figure.

Share