Archive for January, 2009

Bling in Mah Grill

Friday, January 30th, 2009

I had to go to the dentist the other day and unfortunately, one of my fillings cracked and I had to get a crown. Buuuuut, it turns out that the best material for crowns is gold. Porcelain looks more like natural teeth but has a tendancy to eventually wear away or crack. On the other hand, gold is pretty malleable so it’ll last a good long time.

L’esprit de l’escalier

Wednesday, January 28th, 2009

There’s a French phrase “l’esprit de l’escalier” (“wit of the staircase”). It refers to those times when you think of a witty response or retort … just a little too late. It happens a fair amount to me in real life but I’m referring to something on my blog.

See, occasionally, I get a small spike of visitors on my blog. Someone links to my blog and then a bunch of their readers check out my site. Sadly, they usually only visit once and I don’t find out until the next day when I check out my traffic stats in the morning. It’s too bad because I’d like to greet them with something like, “Hey, readers from Kupuk.com, welcome to my site!” and also that … umm, well, I guess I don’t have much more than that.

In any case, I just wanted to say, “Hey, readers that happen to be visiting my little blog for the first time today, welcome to my site! I mostly started this blog to chronicle my experiences developing iPhone apps. But occasionally, I write about other things. I guess that’s about it. Oh, I almost forgot, go buy Mach Dice!”

glColorPointer Size Must be 4

Monday, January 26th, 2009

I did a bit more work on app #2 this weekend and I managed to get something working fine on the simulator, but it was all messed up when I actually tried it out on my iPhone. Turns out the problem was a call to glColorPointer(). There is a “size” parameter, which can normally be 1, 2, 3, or 4 depending on how many of the (r, g, b, a) channels you want to set. But for the iPhone OpenGL ES implementation, size must be 4. So, bear that in mind if you want to draw a vertex color poly mesh. You can’t just specify a color, you have to specify an alpha as well.

I probably would have gotten more done on my app if our friend hadn’t called us over for a game of Castle Crashers. I’m not addicted! I can quit anytime…

Memory Usage in UIImagePickerController

Friday, January 23rd, 2009

I’m diligently working on app #2, which includes the ability to use photos from your photo library (or the camera if your device has one) and I ran into some memory issues. If you repeatedly create and destroy UIImagePickerController instances, you’ll quickly run out of memory (after picking like, seven photos). Fortunately, a little digging around led to the solution. Essentially, it involves keeping one instance around and continually re-using it.

Oh, also, if you’re doing animation in your app, be sure to turn off the animation while you access the camera. Otherwise, the camera will be really, really slow; causing you to question whether or not your app idea is even feasible; leading to a looong sleepless night until you finally realize what you were doing wrong. Just sayin’…

I make mistakes so that you don’t have to.

Historic Day

Wednesday, January 21st, 2009

Yesterday was an historic day that will be remembered for years to come. Many wondered if this day would ever come, some felt it was inevitable. But now that it has happened, I feel a sense of relief and maybe even a bit of optimism. I am, of course, referring to the fact that according to my tallies of daily sales around the world, I have sold my 10,000th copy of Mach Dice yesterday! Woohoo!

Oh, also, some new guy became President of the United States so … you know, that’s cool, too. =)

MLK

Monday, January 19th, 2009

Happy Martin Luther King Jr. Day! I actually get the day off work today, which always throws me off my schedule a bit so I almost forgot to post. I don’t know if anyone noticed, but I’m trying to adhere to a Monday-Wednesday-Friday posting schedule.

Anyways, yay Martin Luther King Jr. — civil rights leader, inspired orator, and all-around great guy. MLK makes me think of milk but it also makes me think of Harvey Milk, another civil rights leader, which makes me think of the movie Milk, directed by Gus Van Sant, whom I met once during a extras casting call for said movie. But that’s a whole ‘nother story…

Ricardo Montalban

Friday, January 16th, 2009

Ricardo Montalban passed away earlier this week. He was wonderful as Mr. Rourke on Fantasy Island. He was terrifying as the indomitable Khan on Star Trek. He had such a charismatic air about him that he was fascinating in any role. He was an all-around great guy. And now he is gone.

It got me to thinking about people I’ve lost in my own life. My father passed away nearly a decade ago. My piano teacher passed away when I was in high school. I’ve lost beloved aunts and uncles and grandparents throughout the years as well. There are people whose very presence make life just a little bit brighter and it’s sad when they go. I wish I had told them how much they meant to me when I had the chance. But maybe they already knew.

I guess I’ve veered a bit from Ricardo Montalban. But I hope that he had some sense of how much people around the world enjoyed his performances. I’m going to try to spend the day being more appreciative of the people in my life including each and every one of you dear readers.

The Importance of nil

Wednesday, January 14th, 2009

Take a look at these two nearly-identical pieces of code. Can you spot the difference?

UIActionSheet *actionSheet = [[UIActionSheet alloc]
initWithTitle:@”Choose Image Source”
delegate:self
cancelButtonTitle:@”Cancel”
destructiveButtonTitle:nil
otherButtonTitles:@”Camera”, @”Photo Library”];

UIActionSheet *actionSheet = [[UIActionSheet alloc]
initWithTitle:@”Choose Image Source”
delegate:self
cancelButtonTitle:@”Cancel”
destructiveButtonTitle:nil
otherButtonTitles:@”Camera”, @”Photo Library”, nil];

The first one will cause you untold amounts of misery as you futilely search with increasing desperation as the hours go by for the mysterious cause of your app’s sudden propensity to hang when a certain button is pressed. The second one has a “nil” at the end.

(The moral of the story is that variable length arguments need to be terminated with “nil”. Also, don’t program while sleepy.)

Programming with Friends vs Programming Solo

Monday, January 12th, 2009

I’ve got a number of friends who are also interested in programming for the iPhone. Even though we’re all working on our own separate ideas, it’s fun to work in a group because you can get feedback from each other, bounce ideas off each other, ask each other questions, etc. Sure, you can focus more easily on something if you’re working by yourself. But I think the benefits of working with other people far outweigh working alone … unless your programming session devolves into an epic game of Castle Crashers

Banned in Beijing!

Friday, January 9th, 2009

One of my friends from high school, Betty C Tang, is currently in Beijing. She mentioned that she can’t see my website and that it was possibly blocked in China. This, of course, has two very important consequences. One: any potential Mach Dice buyers in China won’t be able to get support for their product. Two: I can talk all I want about my friend Betty and she’ll have no idea because she can’t see this site!

Betty was the artistic one in high school. She drew a lot and she was really good. Soon after graduation, she landed a gig working as an animator on The Simpsons. We were all terribly impressed. Now she’s a supervising animator at a company in Beijing …

… where she can’t see my blog! What’s up with that? I mean, it’s not like I’m writing “Boobies, boobies, boobies!” everywhere or talking about Tianamen Square. I think they might just block all WordPress websites or something. Anyways, censorship is bad.

(Boobies, boobies, boobies!)

(Hmm … that could be an interesting iPhone app…)