Subversion Aptitude Error
I used to have an SVN repository up and running. Then my server crashed. Nothing was really important so I never rebuilt it. However my server backup files referenced the SVN modules in apache. I suppose during the crazy rebuild time, I restored an old conf file that referenced dav_svn and I disabled the module by deleting the file.
So now I want to get SVN back because Git (while great) lacks a nice GUI. I'm not converting to SVN. I'm just going to put stuff in both places for a while and then merge them after playing with Versions.
Anyway, why you are here. You're getting a ERROR: Module dav_svn does not exist! when trying to install subversion with aptitude install libapache2-svn? That's what I was getting. I strace'd and googled it for a bit and nothing was working. Eventually I found the original files and put them in their place and that seemed to resolve the package installation however aptitude still thinks the conf files are there even after removing. So this method will get you past the aptitude install and let you install/uninstall as you like (I tested install/uninstall about fives times). And then it will remove your existing svn configs. So please don't have anything regarding mod_svn that you want to keep.
I found the originals from sysinf0.klabs.be.
Create or edit /etc/apache2/mods-available/dav_svn.conf
# dav_svn.conf - Example Subversion/Apache configuration
#
# For details and further options see the Apache user manual and
# the Subversion book.
#
# NOTE: for a setup with multiple vhosts, you will want to do this
# configuration in /etc/apache2/sites-available/*, not here.
#
# URL controls how the repository appears to the outside world.
# In this example clients access the repository as http://hostname/svn/
# Note, a literal /svn should NOT exist in your document root.
#
# Uncomment this to enable the repository
#DAV svn
# Set this to the path to your repository
#SVNPath /var/lib/svn
# Alternatively, use SVNParentPath if you have multiple repositories under
# under a single directory (/var/lib/svn/repo1, /var/lib/svn/repo2, ...).
# You need either SVNPath and SVNParentPath, but not both.
#SVNParentPath /var/lib/svn
# Access control is done at 3 levels: (1) Apache authentication, via
# any of several methods. A "Basic Auth" section is commented out
# below. (2) Apache
# below. (3) mod_authz_svn is a svn-specific authorization module
# which offers fine-grained read/write access control for paths
# within a repository. (The first two layers are coarse-grained; you
# can only enable/disable access to an entire repository.) Note that
# mod_authz_svn is noticeably slower than the other two layers, so if
# you don't need the fine-grained control, don't configure it.
# Basic Authentication is repository-wide. It is not secure unless
# you are using https. See the 'htpasswd' command to create and
# manage the password file - and the documentation for the
# 'auth_basic' and 'authn_file' modules, which you will need for this
# (enable them with 'a2enmod').
#AuthType Basic
#AuthName "Subversion Repository"
#AuthUserFile /etc/apache2/dav_svn.passwd
# To enable authorization via mod_authz_svn
#AuthzSVNAccessFile /etc/apache2/dav_svn.authz
# The following three lines allow anonymous read, but make
# committers authenticate themselves. It requires the 'authz_user'
# module (enable it with 'a2enmod').
#
#Require valid-user
#
#
Create or edit /etc/apache2/mods-available/dav_svn.load
# Depends: dav
LoadModule dav_svn_module /usr/lib/apache2/modules/mod_dav_svn.so
LoadModule authz_svn_module /usr/lib/apache2/modules/mod_authz_svn.so
After putting those in:
sudo aptitude uninstall libapache2-svn
sudo aptitude install libapache2-svn
/etc/init.d/apache2 restart
Now when you do:
sudo aptitude search libapache2-svn
c libapache2-svn - Subversion server modules for Apache
You'll see that annoying little 'c' from aptitude. That means that it's not installed but the config files are still hanging around. Purge the config files with:
sudo aptitude purge libapache2-svn
And you'll see:
aptitude search libapache2-svn
p libapache2-svn - Subversion server modules for Apache
Ethernet2 Arduino Library Fix on 0017

Ethernet2 lib. It's a lighterweight and better Ethernet class. Head into your ~/Documents/Arduino/libraries (or Windows equivalent) and checkout the SVN project:
$ svn co http://tinkerit.googlecode.com/svn/trunk/Ethernet2%20library/Ethernet2
Now change your sketch to use Ethernet2.h instead of Ethernet.h. Wondeful? No. You'll get this error in 0017.
'EthernetClass' has not been declared
Ok, the forums have a fix. But it didn't work for the longest time because I didn't know what they meant by Server.cpp. There's two of them! The original or the new one?! If you edit the old one you'll get this:
Print.cpp:129: first defined here
So:
1. Edit Server.cpp in Ethernet2 to include Ethernet2.h and not Ethernet.h.
2. Delete the Print.cpp and Print.h files from Ethernet2.
3. Compile.
4. Have some yay.
Buying a cat with logic switches
Charles Petzold's book Code is an awesome read. I'm reading it again actually. It's so elegant and simple. Walks you through history and experiments in a style I find extremely invoking. I wanted to build a logic switch but I don't want to blow anything up so I tried this java applet at falstad.com and it works pretty well. I tried qucs but it's way too complicate for me and doesn't include an LED.
An example from Code (this is not the exact example) is where he's trying to buy a pet from a pet store and he creates a logic circuit that will light up a light bulb when the pet is correct. Let's say I'm looking for a normal gray cat as a house pet (not a tiger! rawr!). When I flip all the switches correctly, the LED lights up but if I get a gray tiger (that's technically a cat) then the LED (the red dot) says nope.
The salesman brings me a gray tiger. Nope.

The salesman brings me a gray cat that's not a tiger. Yep.

Arduino Sessions
Hacking around with sparkfun shipments and components. I got a starter set with a box. Included a 7 segment led. Got it to display the number 4. Moved on to a capcitor test. Arduino playground has a read/discharge example. It reads how many milliseconds it takes to charge/discharge. I got it working but don't understand it still. I did a potentiometer test. A basic rocker switch test. Resistors in serial, resistors in parallel. I made a push switch toggle on/off led light with a transistor (I think). Transistor testing (those things are weird). Just kinda went through the box and saw what did what. I want to understand multiplexing and make a 2 digit or more 7-segment LED display work. I have a bunch of wire and things to make it work now. I need a resistor kit, sparkfun was sold out recently but now they have them. It's a kit of every resistor you can think of.

I also put together a wingshield kit. I makes connecting wires to the arduino a little more stable because you can screw them into the screw terminals. I seriously screwed up at one point, snipping off the header pins when you aren't supposed to snip them, doh (what will plug in to the headers if you snip the pins?). I had to desolder and use parts from another kit. Amazingly the desoldering went better (although it takes a long time) and the shield seems to work.
Sparkfun Onslaught

Sparkfun had their free day today. I tried to nab some stuff but their servers were too busy and I couldn't sit there and refresh all day (what am I idle rich?). I just happened to have an order placed the week before and it all came in today.
WRL-08664 XBee 1mW Chip Antenna
DEV-09063 Arduino XBee Shield Empty
KIT-09285 Beginner Parts Kit
DEV-09282 ScrewShield
DEV-00666 Arduino USB Board
LCD-00258 Serial Enabled LCD Backpack
TOL-09465 Tool Kit - Beginner
TOL-09317 Third Hand
KIT-09343 Simon Game - Through-Hole Soldering Kit
TOL-00298 Wall Adapter Power Supply - 9VDC 650mA
SEN-08958 Infrared Proximity Sensor Long Range - Sharp GP2Y0A02YK0F
SEN-08733 Infrared Sensor Jumper Wire - 3-Pin JST
Chief amongst the loot was a soldering iron and a simon game kit. Really, I could care less if the thing worked. I wanted to learn soldering. I seriously have never done it before. I couldn't believe my eyes when the damn thing lit up and worked! I thought for sure my scorch marks had screwed something up. When I was soldering the legs on the mega-168 processor the thing got warm. I was working kind of fast and nervous. I guess I didn't burn anything too bad. Many of my connections look like shiz and I have pointy parts all over the place. I was really trying to peer and study how the solder was making the connections. I'd shake and bend the pins to see how much strength it had and so on. I was really surprised at out unintuitive the whole process is. You'd think it'd be harder but after doing the same pins over and over you start to see what a good solder bead looks like. I just followed the instructions (some of which were a bit off because of a newer board rev) and it wasn't too hard when I took my time and read ahead making sure I wasn't doing something stupid.
Crazy pants! I can't believe it worked! The cheapy soldering iron and solder they sent with a starter kit worked really well. I just held the solder inside the plastic tube it came in. I thought that the cheapy iron would be crappy but it worked well. I got some helping hands to help. They helped. :D What was also helpful was having a workbench, damp sponge, helping hands and some youtube videos for instruction. It's just not as hard as I thought it was. Now SMD soldering, I have no idea how people do that.
So really I was expecting the kit to be a learning experience and I'd throw it away. But somehow, despite the weird and PCB-stress-inducing battery clips, the Simon game worked. When it lit up and I played a little game of simon, I was really surprised. Kristin has it on the coffee table and she plays it a lot. I don't think she ever played it in the 80s, weird. I tweeted about my success and the freaking official Sparkfun twitter account saw my #sparkfun tag and congratulated me. Awesome!
After a holiday break, a sudden rush of software-type-hacky-motivation came to me. I grabbed my arduino and laptop and checked it out. First, it didn't work. The laptop is new and I had to set up the dev-env again. Apparently the default now is the ATmega328 and my Arduino is based on the ATmega168. After that was settled, I had a led blinking again.
So I had this Hitachi based LCD panel that I had never done anything with. I got it powered (3.3v) and was trying to figure out how to run the thing. I read and read and found that I didn't have the right crap on hand. First, it seems like there's two ways to drive it. You can drive it "manually" with a bunch of parallel type wires or you can buy a serial backpack and solder it on (I think). I tried getting things working parallel but it turned out to be a little more than I was comfortable with. I don't understand multiplexing yet and I actually didn't have enough hook up wires to get it done. So part of the order you see up top is a serial backpack. Well somehow I managed to get it wired up but it'd short out my Arduino board, I was just using the board for power. My LED would fade away, it seems to do that when I short something out. Thinking that this was a power problem, I plugged in the 9v adapter with the usb (5v). Well then I started smelling a plastic smell. I heard a crackle and then I saw a little bubble appear on the backpack chip. Ow. I threw it away and I don't have a picture of it. All it reminded me off is when Tim and I burned up a southbridge on my old AMD computer. Smells like fail.
So I just played around with the broken backpack. I desoldered some of the headers off for practice. Desoldering is hard, I burned up the PCB pretty bad but it was a good learning experience. Then threw it away. I ordered a proper serial LCD from sparkfun. I recently got that working electrically although the code side of it I need to clean up a little bit and grok it some more.
Dataloading ftw
Man. I need to finish this ruby project I started. I've had this RSS loader running on a box since 7/10/2009 and:
mysql> select count(*) from jobs; +----------+ | 1414595 | +----------+ mysql> select count(*) from entries; +----------+ | 184149 | +----------+ mysql> select count(*) from batches; +----------+ | 35170 | +----------+
1.4 millions jobs with 184k RSS posts. Eep. I need to finish the analyzer part and turn this off. It's only a 200mb DB right now but my procrastination could cause /var to fill up. Heh.
iPhoneDevCampDC 2009

Went to the first annual iPhone Dev Camp here in DC. It was a barcamp style event over two days. It was very enjoyable although there were quite a few heavy hitters there (I wasn't one of them). There were a few different types of people there and I was one of the ones who doesn't have anything on the app store and isn't making any money off iPhone dev. A few people there had apps I knew from the press as well as an author (Dave Mark -- who was great) that I've read quite a bit from.
What follows is some of the notes that I took at the conference. It's by no means a transcription.
Peter Corbett - Apps for Democracy
@corbet3000
He met with Vivek Kundra (CTO/fed CIO DC) and started a dontest for DC, open data. Citizens created "fix my city" type apps. 43 webapps created, $2.3 EST value, $50k cost, 5000% roi. Huge success.
A few examples:
- areyousafedc iphone app - a tachometer as you walk, green = safe, red = danger. Pulls data from open city sources, crime reports etc. Very simple interface, pretty cool
- wethepeoplewiki.com - structured wiki, real-time crime data. I didn't get this.
- park it dc - very cool parking meter app. People report broken meters, displays broken meters on a google map mashup. City found their contractors were fixing their meters in avg of 7 days but their SLA was 24 hours. Broken meters not cities fault, app helped DC discover the real problem.
- iPhone demo at DC311 - http://victorshillo.com/dc311/2/
Really good presentation. Peter is a cool guy. Nice, technical and well connected. Peter did another awesome presentation called No one cares about your crappy webapp at an Ignite Baltimore conference. I tried to tell him how awesome that was but it's hard to put into words.
Jonathan Blocksom - OpenGL
@jblocksom
http://www.gollygee.com/weblogs/jblocksom
Jonathan works at google. He had an android shirt on. It was pretty funny. I seriously think he was there to convert some people. :P He was really nice and I enjoyed talking to him about gamedev (even if most of my stuff has been in Java). He did a really nice overview of OpenGL, computer graphics and his game Bubbles. His game has been on the app store since the beginning of the app store opening.
- Z buffering is checking if a pixel is behind another, won't render.
- Use the iPhone boilerplate template to learn
- Overview of the various buffers that the template creates.
- You can use the bullet SDK, collada to import 3d models etc
- You can use the Texture2D class to easily import textures from the apple Lunar lander sample code
- You can use the touch fighter sample code. It shows how to overlay a high score list over opengl view
- Don't mix OpenGL and cocoa views together for performance reasons
- He gave an overview of his sales history which was interesting.
A lot of people showed their sales tapering off after an initial burst of sales. Sometimes press coverage or even competing apps would create another bust of sales.
Leon Palm - Computer Vision
Leon also works at Google (not that anyone is judging people based on their day job. Hey, google is a cool company (currently). He was a really smart and nice guy. Easy to talk to. Had a cool Sudoku solver app to demo. I thought I had seen his app covered in the press but that turned out to be a competing one (oops!). His presentation walked through how the app works. Some parts are super confusing and hard but he did a good job in breaking it down.
How his app works:
- Evolution algorithm
- RANSAC to find the line
- Walk the intersection of the lines
- Find 8x8 inliers in checkers, 7x8 in connect four
- Have lines, apply transform matrix to rectify image
- Get pieces is easy
- Sample region at expected center, create int array for piece config
- Use open source solver etc
Drawing the results back.
We have: piece colors, positions, sizes and warp matrix. Derectify image and draw over solution.
Conclusion: easy to do if task is broken down. Use existing knowledge (whitepapers). Filtering/tweaking is the most important part. You have to tweak it to work with cameras lighting and make it accurate. He said tweaking and adjusting took the most time. I believe it.
I have done some test type stuff with OpenCV but Leon had really taken this all the way to the finish line. It was a really in-depth talk that was academically the most complicated of all the talks.
Kiril - Working w Designers from Imagini Studios
Kiril is the artist that worked on Harbor Master. It's a "line drawing" game similar to Flight Control. Apparently it's doing very well on the app store. These guys were super pro. They had a great presentation, super personalities and they had found success being an indie game dev shop. I was really green but then I hadn't put in the hours etc.
Kiril talked about his mock ups, how he worked with the developers (2 of them) and showed his different iterative art pieces. He mentioned ffffound for art inspiration. And his most important advice to developers: don't think that mockups are the final product. He said many people can't make the jump from concept to final product.
Christopher Brown - App Store Data!
Christopher runs an analytics company called Tap Metrics. They had a super slick web app that scrapes data from the app store (I imagine only a few people can do this). He had run many reports and shared some interesting trends:
- Most people that buy an app stay in that category and buy again
- 94% of apps are in English, meaning German/English counts. Germany only counts wouldn't count. All -> EN -> DE, FR, JP
- 1% conversion freemium rate free->pro. Meaning 1M free downloads.
1.99 better segment, .99 is saturated
If I was on the store, I'd talk to Chris about metrics. I can't imagine anyone else having something similar in polish. I hope he gets some traction (if he hasn't already) on his work. It was impressive.
Dave Smith - Audio on the iPhone
Dave had a presentation that I really enjoyed having worked with various audio APIs. I asked the most questions on this one. He walked through his audiobook app (which was really neat). He was friendly to talk to (for further notice ... everyone was nice). He gave a good overview of real code and a real working audiobook app he works on. The app displays the text version of the audiobook while it plays and stays in sync. It's very polished.
Some random notes (I wrote as fast as I could):
- AVAudioPlayer level above openAL
- mp3 format is hw decompression, good for batt/performance
- To get started, add AVFoundation, AudioToolbox frameworks to project
- Make a pointer: AVAudioPlayer* player
- - (IBAction)play:(id)sender; // methods for button actions etc
- In interface builder, mapping actions using touchUpInside is the best option to capture user button push
- Useful command line utility in OSX: /usr/bin/afconvert -iaf4 (convert aiff to compressed formats, pre-compress best for iphone optimization)
- UInt32 category = kAudioSessionCategory_MediaPlayback // kAudioSessionCategory_* has many diff options
He always released his memory correctly. :)
[player pause]
[player release]
player = nil // nice GC technique
His start method created the player and played at the same time. Pause destroyed it. This might seem odd but he said, "don't keep player instances around for a long time, non deterministic things can start happening."
Sze Wong - $1M app
Sze asked the question "what would a $1M iphone app look like?". He also talked about enterprise development and asked if the iPhone could be a serious contender. He has a metric ton of experience doing enterprise and mobile development. He seems to like the iPhone (hey a lot of us are sick of doing J2EE) as a refreshing platform.
Sze had a really nice presentation that didn't materialize for me until he showed his demo. I can only describe it as Oracle Forms for the iPhone. He has a slick web ui that can generate custom forms for many different uses. His forms could even include a signature box that the iPhone can use to create a UPS type delivery board. It was pretty compelling and he had a lot of nice backend stuff (like JSON, RSS, XLS exporters) created in the web ui.
Other topics
Things wound down and at the end they had a panel of the experts there give answers to various questions by Dave Mark. It was really neat to see an improvised conference.
- A lot of people mentioned the importance of Touch Arcade.
- Someone mentioned nsfetchrequest for nstableviews?
- Ad hoc distribution for beta testers? I need to research that.
- Imangi Studios mentioned getsatisfaction, a customer support portal to outsource support
Fun conference. I hope to see them next year or sooner. I think ruby dcamp is next for me.
When is information correct?
A wiki is constantly edited. Unlike a document which can have revisions and snapshots in time, a wiki may or may not ever be correct. But hold on. What is so magical about a revision stamped out? A book isn't naturally correct. Information has nothing to do with correctness.
Think about a filesystem check (like Windows7 CHKDSK, ha). While fixing and committing filesystem fixes (with or without transactions I don't know), the state of the data is in flux. When the program finishes, it declares the information to be correct. Is this declaration any different than someone looking at 1+1=2 and saying "yep."?
Information is correct when an observer correctly or incorrectly says it's correct. Any deeper discussion of what is correct or real is getting into Descartes territory and I'm not talking about that. Print off a wikipedia page (version), you (observer) review it (validation) and say it's correct. The data hasn't changed. Rather it's a data decoration, metadata about the print-out.
Rails on Leopard via davesouth.org
Started a side project on rails, many guides on how to upgrade a Mac. Every OS has it's weirdness. Ubuntu wants to control ruby and the gems. OSX has an older version included. Macports sometimes doesn't add the PATH. It was all really muddy.
Then I found a page by Dave South. The article's post date is old but at the bottom you'll see he keeps it updated. Thanks Dave!
Better tetris collision detection

As I said in the TODO part of the Making Tetris post, a better way to do collision detection is to have the blocks on the field be bits. This is typically what I saw in academic assignments and student presentations. This is probably the right way to do it in other words. It's more efficient and it's more simple (KISS).
Even though this isn't how I did it in the game, I still wanted to play around with the concept so I made a little prototype that demonstrates the basic gist. Instead of a piece, it's a single block. Instead of a tetris grid of finished blocks, it's random blocks. It's really the same thing, it just looks and plays with different shapes.
So here it is. Space randomizes the grid and the arrow keys move. Play It!