Thursday, December 11, 2008

Objective C Doc

Found this link at another blog (fullof.bs; no seriously, that's the domain): http://ktd.club.fr/programmation/fichiers/cpp-objc-en.pdf. So far, it's been a good read. Thought I'd post it since I've been away from the blog for a bit. Work and life has taken away my time to program for the iPod. Hope to get back to it soon. The more I read of Obj-C, the more I like it.

Sunday, November 16, 2008

Finally Displayed an Image

I'm not liking the Cookbook very much. It seems to try to be a combination of advanced-user-cookbook and beginner-tutorial and does neither very well. The author seems to take a huge number of short cuts, seeming to assume you went through the whole beta SDK process along with her. I didn't. I'm new to the game.

Anyway, since it wasn't really helping me, I decided to just try and draw a single picture on the simulator. What a pain, but then I had a similar problem with C#. UIImage:drawAtPoint doesn't actually draw at a point, for example, until you add it to a UIImageView. I was trying to draw the image raw, but that wouldn't happen. I suspect it's doable, but there's too much linkage with the .xib file that gets created in a basic project. Anyway, after much wailing and gnashing of teeth, I finally got it. Here it is, without the proper memory handling (because handling that's still new to me as well):

UIImage *myImage = [UIImage imageNamed:(@"Olga-Kurylenko-1.jpg")];
UIImageView *myImageView = [[UIImageView alloc] initWithImage:myImage];
[myImage drawAtPoint:(CGPointMake(50.0,50.0))];
[self.view addSubview:myImageView];

So there you are. I need to free up the "myImageView" variable and come to grips on who the heck frees the "myImage" variable. Oh, this goes into the "viewDidLoad:" method, by the way. The logic is that viewDidLoad: gets called and when the super viewDidLoad gets called, then the image view will also get displayed.

New iPhone/Obj C books

Bought two books on Friday:
  • The iPhone Developer's Cookbook: Building Applications with the iPhone SDK
  • Cocoa Programming for the Mac OS (3rd Edition)
Just now delving into them. I read some reviews on Amazon for each. The iPhone Cookbook got adequate reviews; I could readily see the points that some of the bad reviews were making. Nobody seem to notice the large number of misspellings in the book (like using "build" for "built"). I wonder if the author had an editor look at the book at all. I bought it primarily because it was the ONLY iPhone programming book at Barne's and Noble (the only close competitor was a book on programming for Safari for the iPhone; not quite the same thing).

The Cocoa Programming book starts out really well. I think it'll help dramatically in my understanding some of the more overwhelming aspects of learning this new programming language. I'll probably review both books later, after I've used them a bit more.

Friday, November 14, 2008

False Starts in Slideshow Development

I tried to write my first program tonight, from scratch (well, actually using a template from the New Project window). Didn't even really get started, because I got too caught up in how I should start. I have a simple design document, but I'm still not familiar enough with Apple's API set and terminology to determine what I should use for the various parts of my applet.

For instance, just to start, should I use UIWindow or IBOutlet UIWindow? What's the difference? (I read about it, but need to digest what they're talking about). For the images, should I use UIImage or UIImageView? The code samples use UIImageView, but UIImage seems more precise to me.

On the topic of views... what should I start with after I figure out my UIWindow dilemma? UIView or UIViewController. The sample apps seem to mix them up and I can't quite tell the superficial differences between the actions they offer. I'm definitely going to have to compare the sample code to the APIs in more detail and see what methods they are using (or not using).

The applet I'm trying to design is a simple "slideshow" type app. I want to be able to load in a list of pictures from the file system and then use the touch-flick action to move from one to the next and back (in a circular fashion). I heard a reference to a controller (or view?) that might be suited to such an activity in on of the early getting started videos. I might have to go back and look at that.

As far as resource handling is concerned, I want to be able to arbitrarily name my resources and associate that name with the actual external name. The few pieces of sample code I've looked at have just directly used the file name in question. I want to be able to easily change the files behind the scenes without changing the code (or lamely re-naming the files to match what's in the code). So I'll also have to look into how the resources are managed.

Lots to do! Maybe a book will help.

Wednesday, November 12, 2008

Mighty Mouse Wheel Stuck

Scanning the Google results for "stuck mighty mouse wheel" show a lot of people who have a similar problem to mine: the pea ball on the might mouse gets dirty, then doesn't work very well anymore. I tried a few of the tricks; turning it upside down and gently tapping the mouse worked for me once; rubbing it on a cloth didn't do any good. The other tricks seemed a little arduous, like using alcohol. This time when I encountered the problem, I took some wadded up facial tissue and gently rubbed the ball. There was a visible improvement overall cleanliness of the ball and lo, it worked fine. I think the tissue was firm enough to get at the dirt, but soft enough that it (at least for me) didn't risk damaging it. So there you are. Seems to work well for me. Hope it works well for you.

iPhone Provisioning

Ah-ah! Was watching the iPhone Dev Tools Overview (at work; I split my efforts between work and home) and they mention that I need the XCode Organizer in order to provision the phone for development. I found this in XCode earlier, but couldn't get it working. I suppose because I'm not provisioned!

How to NOT code sign an iPhone App

I spent a couple of hours looking for away to self-sign an iPhone app to no avail. None of the official documentation I've read explicitly says that you need to have a paid ($99) account with Apple to self-sign, yet it's not working. I'm suspecting it is because I'm missing an official WWDC (?) certificate as well... and possibly because I really, really need to cough up the $99.

I followed the instruction in the Code Signing Guide (http://developer.apple.com/documentation/Security/Conceptual/CodeSigningGuide/Introduction/chapter_1_section_1.html) and kept getting the same errors about not being able to find the right certificate. In fact, I had changed from using my first + last name and just used my first, yet the code kept compiling and looking for the first + last cert. I had to finally delete the entire code base (deleting just the Info.plist wasn't enough) and replace it with a new copy (btw, I was trying the BubbleLevel demo program out). I tried a variety of permutations of my name, including the "iPhone Developer:" prefix which I kept seeing in documentation. Nothing. I was very concerned that maybe XCode didn't know which keystore the cert was in (I created one called Software to keep it distinct from the other certs).

Finally, after a lot of looking around, I found a site for a fellow (which I can't re-find now, unfortunately) who had screenshots of his efforts and his Apple account. I think I see how it works now and indeed it appears you need the $99 account to do it. From what I gather, the account allows for "members" who can then be synced to the phone. That connection to the device profile is what then allows XCode to sign the code and sync it with the device. I think.

The overall experience was very frustrating. I'm waiting for offical approval from Apple on my business' account so I can try it then (how long does it take to process the account?). In the meantime, I played with the simulator instead, which is actually very nice compared to what I have to work with in BREW. It's even a step up from the J2ME simulator. Ah, the benefits of having a single hardware platform.

Tuesday, November 11, 2008

Touchscreen iPod Development

Last night I finally hunkered down and begin trying to get a test program ("MoveMe") onto my iPod Touch using the iPhone SDK. What a painful activity.

When I first hooked my iPod up to my Mac, XCode complained about being "unable to locate a suitable developer disk image." A very helpful message, of course, forcing me to Google for an answer, which I finally found in this forum: http://www.iphonedevsdk.com/forum/iphone-sdk-development/4216-unable-locate-suitable-developer-disk-image.html.

All I did was this from Terminal:
cd /Developer/Platforms/iPhoneOS.platform/DeviceSupport
ln -s 2.1/ 2.1.1
and it worked. I could connect to my iPod without the error.

I'm still not sure of the consequences. The frusting part was that some of the suggestions were to "Restore" your iPod, which I've never done before. Posters made it sound innocuous, but pressing the "Restore" button in iTunes pops a message saying it will erase everything to factory default. I wasn't sure I was in the mood to have to hassle with that if something went terribly wrong.

The second problem I ran into was that I was unable to compile the test code I pulled from Apple's website for the "MoveMe" app. I kept getting a "CodeSign error: no provisioning profiles found for code signing identity 'iPhone Developer'" error. A little more clear, but a Google search revealed nothing. Even reading all of Apple's security documentation was of little help (this: http://developer.apple.com/iphone/gettingstarted/docs/signingcodeforiphonedev.action, this: http://developer.apple.com/documentation/Security/Conceptual/Security_Overview/Introduction/chapter_1_section_1.html, and this: http://developer.apple.com/documentation/Security/Conceptual/CodeSigningGuide/Introduction/chapter_1_section_1.html).

I created my own personal certificate, but to no avail. The best I could glean at this point is that I have to fully sign up with the Apple Developer Program for $99 bucks, so I could prove who I was. I get that for an application that is intended to be sold via the AppStore, but what about us developers who just want to play around and get a feel for things? Seems like a burn to us. I may eventually want to sell a product, but I would like to learn a little more about what I'm getting into.

That said, maybe I just haven't read enough of the massive amount of documentation or viewed the multitude of videos on Apple's site.

I finally got the application working on the Simulator. Maybe my experience with Visual Studio and NetBeans has colored my view a little too much, but the XCode doesn't seem as intuitive to use as the other two IDE's I'm familiar with. I used XCode many, many years ago (just learing how to write a Cocoa app) and it seemed better then. Maybe it's just my hazy memory though. Most likely I'll change my tune was I get more familiar with the application.

Next up, I try to get an account with the Developer Program.

C#: the end

Well, that didn't work out so well. I targeted myself to complete the C# book by the end of summer, but got distracted with a million other things. One of those things was an internal project at my work which I did in C#. Instead of reading the book, I picked the brain of my C#-smart co-workers to get the information I needed. It was quite a learning experience, but in the end I simply didn't feel compelled to finish the book off.

Judgment of the book is in limbo. I still feel that it has good potential, especially for beginning programmers. I may return to it later, especially if I get involved in database access in C#. We'll see what the future holds.

Monday, July 28, 2008

C# Lab #1

Started the first lab of the Head First C# book. I skimmed the first few chapters, just looking for tips and tricks on the Visual Studio IDE and anything that might have stood out in the C# language.

Completing the lab was a bit of a challenge, as it made some assumptions... like that you read the previous chapters very thoroughly and caught some of the quickly covered topics. I, of course, skimmed everything, so missed a couple of key points. I suppose if I went through the actual exercises, I wouldn't have missed those points.

Overall, the lab was pretty straight forward. I'm already a coder and a wee bit familiar with C# from things I've done at work, so I pumped through it in a few hours. It took that long mostly because I'm a stickler for details, and the project plan wasn't exactly detail rich (which is fine, since they want you, the dear reader, to use your own mind on figuring out the specific implementation. I just come from a very rigid design document background).

Thursday, July 24, 2008

C#: the beginning

To start the blog off, I'm going to follow my attempt to use my newly purchased "Head First C#" book to teach myself C#. I already used the Java version of the series to brush up on my Java skills (which often fade to the wayside because I'm a C/C++ programmer as a general rule). I thought the Java book was fantastic. The C# book is much thicker and proves to be very challenging. I've done some programming in C# before (created a GUI for a build system; accessed a small DB to get the data), but it's been a while and I'm hoping that this effort will re-engage me with the language starting at a more fundamental level (how do I set it up from scratch for example?) and then see what the "basic advanced" features of the language offers. Wish me luck. I hope to get it done before the end of summer.