Geeks making the world a bit better.

Entries Tagged Programming

Making CVtypes work on the Mac

I’m writing this down because I don’t see complete working (for me at least) directions anywhere else.

  1. Install xcode from the Mac OS X install CD
  2. MacPorts (everyone calls it DarwinPorts)
  3. Get and unpack the opencv source tarball
  4. cd opencv; mkdir build; cd build
  5. ../configure CPPFLAGS=”-I/opt/local/include” LDFLAGS=”-L/opt/local/lib” –without-python
  6. make
  7. sudo make install

I also needed the macam webcam driver to use my Logitech webcam. I believe the notebooks have a camera built in so you should be good to go on one of those.

I’m getting tons of error messages like these as my app is running and I’m only getting about 5 frames per second. What’s up with that?

2008-02-14 09:00:23.983 Python[85901:6d37] *** Break on _NSLockError() to debug.
2008-02-14 09:00:24.179 Python[85901:880f] *** -[NSLock unlock]: lock ( '(null)') unlocked from thread which did not lock it

Also, I note that video doesn’t start until I move the mouse. Are these macam bugs?

Bringing OS X compatibility to our apps

I regularly get requests from teachers at schools that are Mac based for versions of our software that will work for them. I want every kid to have access to our stuff so I bought a Mac mini for development. I’d rather be running OS X in a virtual machine but Apple won’t let me do that. So I’ve got the mini sitting here with its video out connected to one of the inputs on my right projector and I hacked a python wrapper for synergy server to switch the projector source when I move the mouse off my Ubuntu desktop onto the mini. It works great. Combine that with MacFusion for file sharing and routing the mini’s audio output into the line-in on my Ubuntu machine and it is just about as good as a VM would be.

Pygame seems to work fine on the mini so most of what I need is there. Good deal.

But it sure is frustrating to try to get anything else going. First there is hardly any information online. What I find is often out of date and useless because so much seems to change from release to release. Then when something doesn’t work I don’t know who to ask. In contrast on Windows or Ubuntu there are huge and active communities of hackers like me who 1) figure stuff out and 2) write it down where Google can find it. The problem is usually culling through millions of results. On queries related to OS X the problem is I get 5 hits, 3 of which are asking the same question with no answer. The documentation at Apple is horrible and either not indexed by Google or not indexed well. I seriously don’t know why software developers put up with it. I guess they like being pioneers. I just want to get the job done…

C00D11B1 error in windows media player

I downloaded a book from netlibrary.com via our campus library. When I tried to play it Windows Media Player (on VMware) would complain that it couldn’t play it with the only explanation being C00D11B1 (real useful). The error apparently means something went wrong. I tried several fixes none of which helped. I finally found the suggestion to delete the content of the DRM folder (c:\Document and Settings\All Users\DRM). I had to use regedit to find it. After deleting the content of that folder, opening the book produced the login response I expected and now the file plays fine. It is incredible to me that WMP was broken in this way. I created this VM and installed Windows XP SP2 fresh on it recently. This was the very first occasion that WMP has ever been used on this machine!

Opengazer

Wow! Pete sent me this pointer to Opengazer. I’ve wondered if this was possible but never found a student to work on it. Thanks to Piotr Zieliński for developing it and making it open source. We’ll have great fun with this in accessible applications for people with impaired movement.

Open source speech recognition

I saw a story on slashdot about the simon speech recognition system available on SourceForge.net.

Using the Wiimote with PyGame

Several of my project teams this semester will (I hope) use PyGame and the Wiimote in their projects. I had it working fine on Ubuntu but struggled to find an interface that works with Python on Windows XP. Luke pointed me to wiiuse so I wrote a very simple wrapper with ctypes and then wrapped that in a module for PyGame. You can find the code in CVS at SourceForge in pywiiuse. I also uploaded a source release. You’ll need wiiuse.dll on Windows or wiiuse.so on Ubuntu.

Continue reading →

Alternatives for distributing ET tools

We want to give away software for fun and learning and we want it to run on as many machines as possible. I think these are my minimum requirements.

  • One full-screen window, with 2D graphics and text.
  • Stereo sound with panning control at least.
  • Text to speech.
  • USB game controllers like DDR pads, joysticks, etc.
  • Access to new devices like the Wiimote

Other features that would be great include:

  • 3D graphics
  • Spatial sound.
  • Run within the browser
  • Small downloads and simple install if any.

It seems to me the possibilities are Flash, Javascript for a single browser like Firefox, Jython (Python on the Java VM), and Pygame.

Flash has nice graphics, good sound, and small downloads. I hate the expensive IDE that is required for development. Flash has no access to game controllers and such without some downloaded extension. Perhaps if we could make custom “Projectors” (as they appear to call their stand along executables) we could embed the extensions. I don’t know if that is possible. Flash has no text-to-speech though we’ve done a simple web service that handles it remotely. Very slow though. The security model is always (it seems) getting in the way of doing interesting things.

Javascript in a single browser would avoid the ugliness of trying to make it work everywhere but like Flash you’ve got no access to special devices, and no text to speech. I guess we could build a custom version that is extended or have people download a little local service (a bit like Google Gears). We could use a simple fixed Flash movie to get access to sound. We’d have to worry about the browser supporting crappy old PCs.

Jython on the Java VM could be cool. If we programmed for the lowest common denominator VM (1.1) we’d have a pretty good chance of working on most machines. I’ve never had good luck with Java sound. Last time I tried (not that long ago) the demo’s on the Sun website died. That’s not encouraging. We’d have no access to special devices without some sort of bridge.

I really like Pygame. It is a nice simple game development environment. Pygame claims to run on Windows, Mac, and Linux. I can verify that it works fine on Windows and Linux. Miriam pointed me to Renpy, a visual novel system built on top of pygame. I see people over there distributing games/novels with downloads for all three platforms. We can’t run in browser and we have to test everywhere. The downloads will be big. We’ve already figured out how to do text to speech on all 3 platforms and we can have 3D graphics using OpenGL. We could get 3D sound with FMODex. I wrote a wrapper in pyrex but keeping it sync’d with their ever changing api is a major pain. But the 2D sound in pygame is good for most of what we do because you can’t really count on schools having more than stereo sound anyway.

LiveCDs for delivery of ET applications?

Our games and tools for kids with disabilities should run on whatever computer they have at the school (typically an old PC running some version of Windows or a Mac). One alternative to cross-platform testing might be a LiveCD that boots some OS (say Linux) and runs our software. Then our development environment is fixed and we’re relying on the OS to cover over hardware differences. Pete and I spent a bit of time this last weekend trying our various LiveCDs to see how little memory they could be made to use.

We used VMware as the test platform and tried Ubuntu, Xubuntu, Fedora 8, Puppy Linux, and Damn Small Linux. Something Ubuntu-based would suit me best because it is the environment I know. The results of our casual testing appear to be that 128 megabytes of memory is about the minimum for for the Ubuntu or Fedora livecds to boot properly. That isn’t to say we couldn’t make our own that would require less. Pete found Reconstructor which claims to make LiveCDs configured however you like. I’m guessing we could strip things down to the point that there isn’t even a window manager. If I could get a single OpenGL rendering context that filled the screen I’d be pretty happy for most of our stuff.

I also tried Puppy Linux and DSL. I couldn’t get Puppy to boot live in less than 64 megabytes. DSL would boot live in 32 megabytes but I couldn’t do much else. I’ve ready that PyGame can be made to work under Puppy. I’m hesitant to go in that direction just because I’d be giving up the very supportive Ubuntu community and repositories.

None of these is as promising as I had hoped. I think I’ll take a LiveCD with me when I visit Andrew’s Elementary later this week and see if I can get one to boot on the PC’s there.

Pros of LiveCDs:

  • We’re in charge of the environment our software runs in.
  • We’d never have to test on Vista
  • No worries about the IT department being unwilling to install the software (lots of teachers complain about this).
  • Simple for teacher’s to use with no complicated installation instructions

Cons of LiveCDs:

  • Apparently requires a pretty beefy machine with 64 to 128 megabytes of memory and CD drive.
  • Unclear how many different hardware configurations are really supported in a strict plug-and-play way (no way I’m going to get teachers to type options for the boot command).
  • They would be impossible for most users to download because they are so big.
  • Intel only (but that hardly matters anymore)

Wii Enabled Javascript Applications, Games, and SDK

Daniel Gump has released an open source SDK for application development in the Opera Browser on the Wii. He provides access to the Wii remote functions, complete source and documentation. Thank you Daniel for contributing your effort. I’m looking forward to the great ET applications we can develop for the Wii.

Update: Some of these don’t work so well for me. The “Wall demo” completely locks up the Wii requiring a power off to recover. The Ship demo won’t start. Pressing A does nothing.

A comic about my favorite language

Over at xkcd.