What cars are hot in Victoria?

I just got back from a month abroad, and I wonder if I’ve forgotten how to code. I ask around the office, how has it been? Did anything break while I was away?

Not only did nothing break, my boss was so bored that he’s been bothering the office manager and taking extra days off. I should probably investigate and find out what his deal is, but first I have a burning question.

What cars sell quickly on the used car market in Victoria, and what do they sell for?

This info is available through UsedVictoria – kind of. They have an RSS feed. So you can enter some search terms and they’ll show you the last 25 items posted with those criteria. You can’t page through the results, so that doesn’t give me any historical data. Any info I gather will start from today. But I can scrape the feed and save it in my own database, and graph it later once I have a body of data. Ok, here we go.

What’s going on: we ask UsedVic’s server for all the car ads they have with the following criteria: private sales only, priced between $400 and $6000. This returns a few hundred results, but the RSS feed will only give us 25. Oh well. I save each item in my database – the title, description, search criteria, date it was posted, and price.

The price, mind you, is in no way accurate. When I buy a car on UsedVic, I haggle. People who buy from me usually try to haggle as well. So the actual selling price is likely a couple hundred lower than what’s listed, in most cases. However, it does give you a little information. The listed price is the starting point of negotiation, so people generally won’t go see a car unless the listed price is at least in the realm of reality and their budget. If someone has set the price of a vehicle unrealistically high, the car will sit on the market for a long time.

This happened in the case of a rather spectacular Suzuki DRZ400SM that was posted last winter. It had several fancy racing upgrades, combined with an expensive but utterly tasteless metallic pink paint job. If I could have had that bike for $2000, I would have done so in a second even it was covered in swastikas and cocks. Paint is cheap. But the guy wanted $6500 for it, and the ad stayed up for something like 3-4 months. (Ask me how I know. Yes, I was checking every week. I have a problem. Don’t worry about me, mow your own lawn.)

So how to deal with the fact that we only get 25 items returned? Easy – check back every 2 hours. Usually 2-6 items are posted per hour. So I add a check to see if each item is already in my database, and if it isn’t, add it. This code is kind of inefficient. If any of the real programming nerds get hold of it, I will be embarrassed. But it’s good enough for my purposes, for now, probably.

So I wrote a cronjob to run this every 2 hours and report back to me when it’s done. Okay, cool.

Now how do we track items that are sold? It’s tough to count something that isn’t there. Not too tough though. More code:

You can also search for an ad using the exact title, and you’ll generally get back only that one exact result. Since I have the titles saved, I can do that. In my database, I have a column labelled “sold”. When the item is entered, that column is set to false.

This script gets a list of all items in my database that have “sold” set as false, and searches for them. If an item is not found, “sold” gets set to true, and the current date is recorded as well.

Listings expire after thirty days, which should help keep this script from getting out of control as it hits the UsedVictoria servers over and over again. After a few weeks, I’ll have hundreds of unsold listings in my database, and once a day, the script will request every single one of them. I may end up blocked by UsedVic pretty soon if the numbers get too high. But no worries for now.

Finally, I want the data in a manageable, bite-sized format. You can see the results at rocketships.ca/srs/scraper.

The table lists all cars that were posted and sold within the last thirty days, the number of days each was on the market, and the price requested. It’s still not as fine grained as I would like, but I think this will give me at least a vague answer to my question – which cars are hot in Victoria?

My theory: Miatas. I await hard data.

Next step is to decide what to do with the data. I had an idea about buying cars from the mainland, where they’re a bit cheaper, and flipping them locally. I feel like I could make a small profit doing this. However, to make it worth my time, I need a profit of at least $300 – that’s what I pay myself for working on the weekends.

So let’s say I bought a 1990 Miata for $1800 on the mainland and sold it for $2300 here. Those numbers are realistic, based on my experience to date.

I have to go the mainland ($18 there, $74 back), get my pedestrian ass to the seller’s house somehow (unless they’re kind enough to meet me at the ferry), check the car to make sure it isn’t shit (Honestly, what do I know? Not much, man. I’m a writer, not a mechanic.), and then the really fun part – figuring out insurance.

If I transfer my own car insurance to the new car, I will have to pay GST on the car. 12% of 1800 is $216. Big chunk of my profit gone right there. I can maybe get a temp permit, which is only $30 or so, but then I really have to get home smartly on the next boat, I don’t get to joyride the car while I’m waiting for a seller, and I can’t allow buyers to take a test drive. The insurance costs some money, so does registration, so does the plate if I haven’t organized that properly, and you have to pay a fee if you insure for less than a full year or if you want to pay monthly. Costs maybe $1200 for the full year? depending on the car and whether my points have expired yet.

There are ways around these issues, namely, lyin’ and breakin’ the law. I’ve bought and sold something like 20 vehicles over the years, and I will not claim perfect observance of the rules. But any business plan that relies on illegal behaviour is a bad idea, and out of the question according to my principles.

So out of $500 profit, I might get to keep $300, legally. But that’s not the main issue. You can only get away with buying and selling a certain number of cars per year before the government starts to get suspicious. I think it might be around 6. After that you have to get a dealer’s license, which is ex$pen$$ive. I’m not really prepared to go down that road – messing around with cars is alright for a hobby, but used car salesmen are considered the scum of the earth by most humans, and for good reasons. So I would have to find a way to respect myself for doing it, first. My friend Dylan does it by specializing in high end racecars. My friend Ben doesn’t do used cars – he’s an honest to god legit new car salesman who provides warranties. But there are others who are pretty slimy.

With that problem unsolved, I have made the data and the code publicly available. Enjoy.

Getting into open source programming

Ever since I wrote my first line of Java for Intro to Programming 232 in 2010, I’ve asked the question, how can I get better at this? I google it, ask people, read proggit, read hackernews, read books. The answers are, in order, 1) study on your own 2) contribute to open source 3) learn from smarter friends and 4) go to school.

So I’ve done 1 and 4, and these days I’m soaking up as much #3 as I can from my boss here at Radar Hill. However, #2 has always eluded me. I want to contribute to open source not only to become a better coder, but to strengthen my resume and put my career in a better position, and also for the satisfaction of contributing to software that everyone uses, such as VLC, Subfix, Transmission or Firefox (open source projects that I use routinely).

So from time to time I get a head full of steam about it and start reading docs, forking repositories, skimming the ticket queues and trying to understand the code. So far, I have not gotten very far. I have yet to achieve a single pull request, and all the projects that I’ve looked at are still batter-proof fortresses to me.

I know it’s possible to get past this obstacle. Hundreds of other people have done it. I myself have battered my way past hundreds of similar obstacles. But even so, this one is frustrating me. Other people must be in the same position. Can we attack the problem together? Suppose we hire someone more advanced in their career than any of us, and get them to show us how to crack into an open source project, say in a two-week seminar? Laptops in a wi-fi enabled room, 2 nights a week? Yeah? How much would you pay? How mch would the teacher need to be paid? Can I make this happen?

Fix My Bug

After wrestling with a stupid syntax error for several days, I got sick of staring at the same code for ages and started working on this.

Fix my bug!

Sometimes it’s more fun to help someone else with their code than work on your own. That’s what fixmybug is for. Put your syntax error up, and while you wait for someone to figure it out, knock one out  for someone else.

I’m amazed at how quickly and easily this thing came together. It’s pretty bare bones, but it still required a couple of years to learn the css, html, javascript, php, and mysql that went into it. 2 years ago I wrote my first Hello World in Python, and it took months of half-hearted stabbing at the command line to even get that far. Now I’ve got 98% of a diploma in Computer Systems Technology, I can build stuff like this, I think I’m ready to start working for a living. I look forward to reviewing my source code a year from now and being ashamed of it. But right now, I’m pretty proud.

Go to http://www.rocketships.ca/fixmybug and start squishing.



How to Dynamically Add Radio Buttons

Haven’t seen a tutorial for this that isn’t badly spelled and hard to grok, so I’ll try it.

First, include the radio group widget and and declare one. You’ll also need LayoutParams and RadioButton, so include those as well.

Inside your onCreate method, initialize the radio group.

R.id.radio_selection_group is referring to a radio group that’s declared in your XML file, so make sure you have that as well.

Back in SomeAndroidActivity, create a method to dynamically add buttons to the radio group.

Then call that method in onCreate.

Easy pie.

Android Thing for Saving Money on Springs and Avoiding Math

So, my race car is slow, and I cannot afford a new motor because I spend all my money on race cars. Another way to make it faster is to throw in some springs (and shocks) that are a little bit harder than the stock ones.

I flip through the parts catalogue and find some springs that ought to do the trick.Then I look at the price and have a stroke, because they cost like 10 bajillion dollars. Might as well get the new motor – might as well get a new car!

Hmm, maybe there’s a better way. I’m gonna go to the junk yard, where there are tons of perfectly good springs just sitting there in rotten old cars, where I can haul them away for scrap metal money. Dope! Only how do I know which ones are going to be just a little bit harder than my current springs, and also maybe an inch or so lower?

Hey, what. There’s an app for that. Here you go, linky. It is free but feel free to mail me money or whatever, just out of love and sympathy for the fact that I’m broke, and don’t even have a race car.


Put in some numbers that you can find or measure – the modulus of rigidity has to do with the quality of the steel in your spring – if you don’t know it and can’t find it, 14,947,500 is a reasonable number for Moog springs. Get out your calipers and measure the diameter of the wire. Get out your ruler and measure the diameter of the spring. Count up the number of active coils, you don’t even need a tool for that (just the one in your…head). Whang all the numbers in, and the calculator will tell you the spring return rate. Compare those numbers against the ones for your buddy’s cool blue springs, and find out if the 3 coils in a Ford pickup are equivalent to the 6 coils in your Corolla. And if they are, get those springs, get low, and hold on to your money.

If you want to get super scientific, you can calculate any of the five values, calculating your modulos of rigidity for various springs, averaging them up and so on. I leave it to the nerds to figure that out. I may later add the ability to save spring specs for easier comparing, but this is an MVP. That’s Minimum Viable Product, cause holy cow, I am so new at this game.

Things I learned

First of all, I found an easier way of wiring up an OnClick listener. It turns out you can make one OnClick listener for several buttons that do similar things, rather than creating a new OnClick object for each one. Not that it was relevant in this project anyway, since there’s only the one button.

Another good lesson was How To Avoid Doing Math. I got the formula from a website for shed engineers, as directed by DiscoQuinn (my first customer, lol). I then had a couple of helpful friends (Serge)(Matt) do the basic algebra to convert the formula to solve for the other 4 variables. Then I fed the calculator on the shed engineer’s page 5’s for every value, noted the spring return rate, and used those numbers to write JUnit tests for all the variables. AssertTrue(k == 2.605) and assertTrue(n == 5) for everything else, like so:

I’m really pleased about that.

Overall, I’m happy cause I learned a little bit and made something kind of useful. My code this time around is much more beautiful than what I did in the CFM calculator. One con is that I got so wrapped up in coding this, and enjoyed it so thoroughly, that I let my school work slide a bit. Hopefully by posting this, feature-poor as it is, I can put it to bed and focus on my C homework!

Justifying a trip to Australia via Cochlear Implants and programming


Being Deaf


I use a cochlear implant to help me hear. The thing is amazing, and it’s changed my life. Like, it’s the difference between being a shut-in with no life and being happy, well adjusted contributing citizen. But I always like to understand the devices I use in my life, tweaking and modifying them to suit me. I’d like a phone application to control it, or use it to receive phone calls, or whatever. Make the implant itself the size of the loonie, like the magnet part currently is, and control it only remotely. In this way it could be more seamless and waterproof.





I’m almost done my diploma in Computer Systems Technology. It’s a practical, hands-on course where you get tons of programming experience, like probably more than the average software engineering graduate gets. Last year we had a pretty amazing teacher for Java – a rather hard headed individual who was tough to get along with, however, he demanded more out of us than most teachers do, and got what he asked for. I think everyone who passed the course came away with an actual understanding of Java.

This year he’s teaching us Android programming. You can imagine how stoked I am. After this I’ll be able to build the interface for exactly the program that I want to control my CI.




Moving to Australia


The company that makes my CI is located in Brisbane, Australia. I’m going to be moving there in about 6 months. I’ll  have a diploma in computer programming, 6 years of being a CI user, and the ability, unlike many deaf people, to communicate clearly in English my needs and ideas for improving the equipment, and I’ll be in the city looking for a job.

Am I not the exact person that Cochlear is looking for? I think so. My mission now is to let them know.


For  CI company that makes my CI, which is based in Australia, in Brisbane where I’m moving to anyway, to hire me to make remote controls applications for their equipment. Everything kind of… works.

So, I’ll do the online application and all that. But this is going out to the internet, in hopes of finding the engineer, now working at Cochlear in Brisbane, who might be able to make room in his budget for one more engineer who has something special to offer.



New Phone Time

A couple weeks ago, my Blackberry started acting up. When the battery was low – not very low, like maybe half – I would get a white screen. All the buttons stopped working, I couldn’t turn it off, just bright white screen with nothing on it, until the battery died.

So, I started thinking about Android phones. My friend Kirby told  me of the Nexus 4 that was coming out in a few days. I didn’t manage to get one before they sold out, but it was too late anyway. I had downloaded the developer tools and was enthusiastically hammering away at my first Android Hello World.

Since I don’t actually have an Android phone, I have to use an emulator to test whether stuff works  – this is a slow, painful process that causes a lot of distraction and Redditing. However, after several days of trying to get the emulator to work, I was successful. Now to get my actual code to work, yay.

Here is some useful information:

If you find this text file in /adt-bundle-mac/sdk/tools:

The command you’re looking for is this one: