Tab vs. Space, part XIV

So, lets say you are working in XCode 3, and you are trying to build a PyObjC app but for some reason the python code you wrote isn’t getting called.

If you are seeing weird errors in the console when you run the application (specifically “Could not connect the action <your_action> to target of class <your_AppDelgate_class>”), here’s what it probably is: In the AppDelegate python file that XCode creates it uses spaces to do the indentation of the methods.

I hail from a land where tabs are used for such tasks, and the use of spaces is look down upon in much the same way that pick ones nose in public is.

At any rate, what’s happening is when the code is compiled/run the python interpreter is not recognizing the new methods that I put in (using tabs to indent) and instead of giving me a warning about inconsistent indention, it fails somewhat silently in that it groans it can’t hook the action up to the class and that’s it. It wasn’t until I turned on the invisible characters that this occurred to me that it might be the root cause of my problems.

Once setting all of the indentions to be the same, I chose tabs, everything worked like a champ.

By the way, if you are looking for some tutorials for PyObjC in XCode 3 (there are a ton of XCode 2 tutorials out there, but things have changed ever so slightly in 3), be sure to check out these links:

XCode 3’s SCM makes me sad.

I just finished trying to use XCode 3’s built in support for Subversion. It did not end well.

For starters I created a new XCode project, ran it to make sure it could build, and then decided to check it in to svn so that I would have a “clean” starting point in case I ran into problems. This is how I normally work in other IDE’s, and I’ve never had a problem. Until today.

After setting up the repository in XCode I couldn’t find how to set the project so that XCode would “know” it was under version control (or SCM as XCode refers to it). If you look at the project’s properties, there is a drop down list the lists the available repositories (or it offers to let you set up a new one, which is a nice shortcut). However, the repository I just added is grayed out. After a half hour of trying various “obvious” things I gave up and googled around.

It turns out that XCode can’t create and then check in. The project has to be put into the repository, then checked out before XCode will recognize that it is under source control. Very unusual, but what ever, I decided to play along.  I used XCode’s svn browser (which isn’t half bad) to upload the code, then deleted the project and checked it out.

And right about then is when it became obvious that I was traveling the wrong way on a one way street. Here’s an executive summary of what I found so very, very, very wrong with XCode’s SCM integration:

  1. I had to create the project, check it in, then check it out for XCode to realize that it was under version control.
  2. Although XCode has an svn repository browser that allows me check in and out the code, it doesn’t seem to know anything about XCode projects as it checked in the build directory without asking. For me (and a lot of developers I know) the last thing I want in version control are files that are going to change constantly (i.e. object files). Checking in a finished version, fine. Checking in a ba-jillion intermediate files: fail.
  3. After checking out the project, XCode began complaining about there not being a lock on a file in the build directory. The error message actually said “This might be a bug, please report it.” Sorry Apple, I’m a nice guy, but I’ve got limits. This seems like something that shouldn’t happen on a fresh project (i.e. all boilerplate code, I haven’t done a thing to the project yet).
  4. Deciding that I might be slightly smarter than the computer, I decided to delete the build directory in the repository. I tried to refresh the project to let it know there was a change it might need to be aware of. Instead I was made aware of the fact that there doesn’t seem to be one central view of what’s changed for the project. The near-useless SCM menu item in the project reported that one file had change, and I could not seem to get it to even look at the project as a whole. Maybe I’m spoiled by the way Eclipse handles this situation (which provides a bunch of clues in different areas, but all of which lead to a pretty straightforward GUI for dealing with changes). Even TextMate handles this decently (just not as good looking as Eclipse).

By this time I just gave up. I removed the repository connection from the project settings, and decided to just go Command-line for doing my updates/commits. Life’s too short to be chasing my tail on stuff like this.

A good cup of Tea (and coffee)

I haven’t written much lately because I’ve decided to having two ears and one mouth probably means I should spend more time listening rather than talking.

It is an interesting exercise, trying to tune the world in while not adding to the noise. For programming I think this is an essential skill, it is how one learns new things. Lately I have found that having a good cup of hot tea and sitting back to take in things (bugs, new ideas, etc.) really helps me to move forward.

I’ve been hanging out at my favorite independent coffee house Tazza doing some programming work and thinking, and I have to say its a really cool place to hang out. I love the hot tea there, and from what everyone has told me the coffee is really good. The staff (hi everybody!) is very friendly and love to chat. That along with the cakes and cookies combined with the great (and free!) WiFi makes this little coffee bar the ultimate place for me to get away from the grind of the office.

I always wondered why some developers hang out in coffee shops, and now I think I know why: its a good place to be in order to keep your perspective. I might be the only programmer in there, so hearing other people talk about other things helps me to keep things in the right light.

So if you are in Atlanta (especially the Buckhead/Midtown/Georgia Tech area) you owe it to yourself to drop in to Tazza and enjoy a good cup. (The address is 1700 Northside Drive, Atlanta GA 30318 or just use this link)

Never were truer words spoken (or typed)

The other day I came across this really cool posting talking about school projects for computer science students.
Basically it talks about the different “levels” of effort required to make a certain type of video game for a CS class. Having just finished a CS class that involved a group project (but not a game) I was intrigued by the author’s take on the topic. (I usually try to dissuade people from doing games as a CS project, they just eat up too much time usually unless everyone in the group is on the same page.)

Overall I found myself agreeing with the various comments and evaluations of each game type (pacman, tetris, etc.). But when I got to the end of the “Advanced” topics section, I laughed out loud:

RPG - if you hate your life (and some apparently do), this obviously final year attempt at video game programming glory is likely to end badly.

That pretty much sums up my experience so far with my attempts to make a “simple” RPG. There’s a lot going on in a typical RPG, and it takes a lot of effort and attention to detail to pull it off and make it look good and play well. And even then, if you manage to get the mechanics of the game engine working semi-decently, then you have a tall order to fill by creating the contents (scripts, maps, graphics). Needless to say it can quickly become a huge time sink. Which isn’t to say it isn’t fun, because it is. But when you get overwhelmed on a project like this where you are working for yourself (i.e. not getting paid to work on it) it becomes very difficult to get your motivation back.

Personally, I’m hoping to get my motivation back to work on my little project some more. I think what I’ll probably wind up doing is working on it in-between other projects.

Why I like the SICP book

The Structure and Interpretation of Computer Programs is turning out to be a rather awesome read. What makes it so cool for me is that I’m taking a class in Numerical Analysis, and in sections 1.2 and 1.3 the examples read like something right out of the class. The really odd thing for me is that this “double teaming” of my brain is paying off in that I’m learning the Lispy things, and at the same time I’m learning the Numerical things. Each one builds on the other, reenforcing the lessons learned. Very recursive, just like Lisp.

One of the things I have learned just today is that loops are actually allowed in Lisp. All of the recursive thinking I’ve been doing lately has made me think that there’s always a way too write a loop in a recursive manner. But, I was looking at Neville’s Method the other day and it struck me that with it’s nested loops, that could be quite a challenge to write it in a recursive manner. While trying to find an example of nested loop in Lisp, I found all kinds of cool links I thought I would share:

Go check them out, they are great resources!

Learning Lisp

One of those “personal/professional” development things that you should do every so often is try to learn something new in your field. For me, I’ve decided I will learn more about Lisp, and programs in general.

To that end I’ve been working my way through the book The Structure and Interpretation of Computer Programs which is a dense volume that is chock full of good knowledge about how computer programs work from a critical and analytical point of view. The language the book uses is Scheme which is a variant of Lisp.

Having worked with XEmacs and its version of lisp (called appropriately elisp), I thought I would be able to pick up Scheme pretty quickly. This is pretty much true, since the two languages have the same general syntax/form. One thing I don’t have those is a Scheme interpreter! I did install SBCL and CLISP a while ago, so I figured that I would just use that.

Well, it turns out that Scheme is also slightly different than Common Lisp. :) But thanks to Peter Seibel and his excellent book “Practical Common Lisp”, I was able to translate the first few programs in the SICP so that they would run in my CLISP-Slime environment.

So if you find yourself in this situation, be sure to check out the best Common Lisp tutorial on the net. Its free and it is very well written, so I highly recommend it. I remember playing around with it a while ago, and being impressed with it back then. The good news is it is still as good now as it was then.

CSS + Javascript + web = fun Easter eggs!

It occurred to me the yesterday, with more and more people seeing the power of Javascript and CSS, more websites are getting slick. Ok, that’s a pretty obvious statement, but here’s something that’s not obvious: This presents a great opportunity for easter eggs!

Easter Eggs are little hidden things in side of a bigger program. Some times it just the developer’s names, other times it can be something totally unexpected like a flight simulator hidden in a spreadsheet program. With the power of Javascript and nice tutorials like this one, there’s a lot of opportunity to have some real fun!

Just think, with all of the computing power a modern browser affords us developers, it should be very easy to recreate tons of games from the Atari 2600, early Nintendo systems. The imagination can very easily run wild….

Title first, then game?

I’ve been watching Code Monkeys a lot lately. If you haven’t seen it yet, its a cartoon on G4 that is basically South Park, but set in a 80’s video game company. Its pretty funny, sometimes sick, but always twisted. Every week the characters get into all kinds of trouble, usually while trying to make a “new” game.

One of the best parts of the show is when the developers are either talking about or pitching their new games. Just from hearing the titles of the games I wish some of them had been made! Cool titles like “Monkey vs. Cobra” or “Hobo Killer” or “Family Ties: The Video Game”. Plus some of the shots of the games looked pretty funny too. Check out the whole list here: Games featured on Code Monkeys

All of those wacky titles reminded me of all the times in other movies, TV shows, games, etc. I saw a “fake” video game and thought it was the coolest idea ever. Like “Billy Graham’s Bible Blaster” on the Simpsons. Or “Astro Chicken” in the Space Quest series. Classics!

And thanks to the wonders of the internet/web2.0/lazy web/wikipedia, there’s a massive list of all of these fictional games! Check out the list here: Fake Games

Seeing all of those games there got me thinking: Wouldn’t it be cool if someone made some of these games based on just the title? (Or in the case of shows like the Simpsons, take the clip of the game and expand it into a full fledged game!)  That would be so cool. So cool in fact, I think I’m going to start doing that, looking at a title and then trying to come up with a game. Cheesy, yes. Wacky, you bet. Fun? Lets find out.

Very well stated Guido!

Thanks to Reddit today, I saw this posting from Guido Van Rossum about the recent flap about the GIL in Python:

On 9/13/07, Andy Wiggin <andywiggin at gmail.com> wrote:
> I thought the discussion was very interesting. I think true parallel
> programming is the challenge of our time, so I’m quite disappointed
> that the Python powers that be do not seem to feel any imperative to
> address it. I’ve always been kind of assuming that Python would
> provide a “pythonic” parallel programming paradigm that would “just
> work” and be as elegant as the rest of the language.

I’m sorry, but this attitude just really pisses me off. Python is the
work of many people. If you want something to happen, make it happen.
Don’t wait for someone else to solve your problem for you.

–
–Guido van Rossum (home page: http://www.python.org/~guido/)

Guido is 100% right. I used to (and some times still do) sit around waiting for someone else to take care of a “problem”. That’s certainly one way to approach a problem, but it is even better if you can get into it, figure it out and produce your own solution. That is the way to truly gain new wisdom (and to learn all kinds of interesting new things).

I have discovered several times that simply waiting for someone else solve your problem is a horrible compromise to make. It usually lessens the quality of your code because the solution isn’t a perfect fit for what you are doing, and overall keeps you from gaining the true deep knowledge that is oh so helpful when debugging.

Not to mention the fact that so many open source projects have gotten their start because someone (like Guido) got tired of waiting for someone else to do something. I think its a great that Guido has been so up front with this whole GIL issue: He has said that if someone will do the leg work and prove a better way that is still backwards compatible he will welcome it. The key thing is that he said “someone” and not “I” or “me”. This encourages more people to get involved, and for a community based project/product/language, this is a great thing.

So, kudos to you Guido! Keep up the great work! And please note that I am not saying that “Not Invented Here” syndrome is the way to go, I am saying: Don’t wait for a patch, see what you can do yourself to fix it!

The trials of indie game development

I saw today that a indie developed “Fallout inspired” RPG was being taken down by the author due to lack of sales. This bummed me out because:

  1. It sounds like a game I would have really been interested in
  2. Although it had been out for some time, I had never heard of it
  3. I’m wanting to make a RPG that isn’t based in a dungeon
  4. The world needs new games that aren’t just derivative sequels of the same-old-same-old

Its always sad when a product is retired, but this situation sounds bad. According to the comments on the Ramapant Coyote site, lot of people are feeling the same way I do. But at the end of the day, its the author’s call, and in this case the author decided to pack it in.

I stated in #4 above that the world is too full of games that aren’t anything special. That’s why indie games are so exciting. Many are of the games that are made on the indie seen are passion works on the part of their creators. As a result these games are different than what you normally find in a store. They try new things, they take chances.

But sadly, just as in real life, sometimes you win, sometimes you loose. I hope Mr. Moffat finds the success he is looking for in his future endeavors.