The Crack of Flash Games

February 13th, 2008, 9:23 pm PDT by Greg

I had to skip my first 376 lecture today. There was a perfectly socially-responsible reason for it that I’ll try to write about on Friday. For now, I’m tired, and annoyingly addicted to American Idol.

So for today, I will present the crack cocaine of Flash-based online games: Spin the Black Circle. Play it. Do it now. There is a runthrough on YouTube if you’re really stuck on a level (but try to keep the cheating to a minimum).

I finished it (level 24) over the weekend. Kat was making impressive progress through it the last time I checked in. Any game that can captivate both Kat and I must have something going for it.

Five things I hate about Python

January 29th, 2008, 10:15 pm PDT by Greg

A while ago, I stumbled on somebody else’s blog entry Five things I hate about Python. The game (apparently) is to pick your favourite programming language and pick five things you don’t like about it.

This seems most common among the Python crowd: Python 2, Python 3, Python 4. It’s probably because everybody loves Python. But, I did manage to find a few others: C,
Vista, Linux.

So, here are my five things:

  1. No parallelism. The Python interpreter has a global lock that makes it impossible to parallelize execution. My processor has two cores, multiple pipelines, and a vector unit. Wouldn’t it be spiffy to use those? I have used the Parallel Python module to get around this (by spawning multiple interpreters), but it’s a hassle, and only applicable in certain cases.

    To be fair, this is a common problem in imperative languages, which force the programmer to precisely specify how thing are calculated. It’s much easier for a compiler to parallelize things in functional language, which have the programmer specify only what is calculated. Maybe Haskell is the answer to all of our problems? Hey… why are all the 383 students looking at me like that?

  2. Late Binding. This is the mechanism that allows the beauty of duck typing, so it’s probably a net win. It comes up in situations like this:

    def add(a,b): return a+b

    Until the function is called, there’s no way for Python to know whether the + there is addition, string concatenation, or something else. So, when each statement executes, Python has to decide what operators (or whatever) to use at that moment. The net result is slowing the language down a lot.

    Apparently PyPy has some improvement here, and Pyrex allows extension modules with early binding.

  3. Type confusion. I don’t know if it’s the duck typing or weak typing, but beginning programmers (aka CMPT 120 students) often have problems getting the type that a particular value has. I very often see students converting a type to itself. For example:

    name = str(raw_input("Name: "))
    count = int(0)

    That indicates some serious confusion about what’s going on. Or maybe I’m a bad teacher. I’d accept that as an explanation.

  4. GUI libraries. The standard Python install comes with only a Tk binding for GUI development.

    I really wish wxPython came with the default install. Then, we could all use it and assume it would be there. It would make Python a pretty serious contender for cross-platform GUI development.

  5. Standard library. One of the principles of Python is that “the batteries are included”. In other words, the libraries you need are there by default.

    That’s usually true, but there are a few things I wish were always there. The Python modules that I seem to have to install the most often are: Biggles, Imaging, Numarray/Numeric, Parallel Python, PyGame.

    As an aside, maybe if the Imaging and PyGame modules were accepted into the standard library, there would be some pressure to get some good documentation going for them.

On Teaching

January 25th, 2008, 12:33 pm PDT by Greg

Well, it’s Link Friday again. I thought I had a lot of links to share, but I don’t have nearly as many links backed up as straight-up blog topics. Maybe Link Friday won’t be every Friday.

Anyway, for this week I have some links related to teaching. I teach stuff to people all the time, and suppose I must know something about it. Believe it or not, there are people that have made observations that even I haven’t had.

First are a couple of things my students should read. Everybody below about 85% in CMPT 120 should read How NOT to go about a programming assignment (Google cache link). Part of teaching a first year programming course is seeing each and every one of these things. Repeatedly.

This prof’s Top Ten No Sympathy Lines are really interesting. In particular, his answer to “There Was Too Much Memorization” was really insightful.

For the last several years, I have been trying to minimize the textbooks required for my classes: the pricing is criminal and they usually aren’t all that good. My rule has been to only require texts if they are really good and if I’m going use them very heavily. Otherwise, they are only recommended. So, this guy is my hero: UVSC prof. quits books.

I’m not sure that Taylor Mali on what teachers make particularly applies to me, but it makes me think that the high school teachers I know are a lot cooler.

Finally, the… um… darker side of teaching. Apparently, according to a peer-reviewed article, Teaching may be hazardous to your marriage. And the complementary article: If College-Themed Porn Were Real.

Buying vs Renting

January 23rd, 2008, 5:23 pm PDT by Greg

A while ago, I posted a calculation that I had done on renting a home vs buying one. Those calculations have been intriguing me ever since. I have had several conversations with people about the pros and cons, and and what-if scenarios.

I finally decided that I needed to automate these calculations so I could easily handle the what-ifs. Thus came to be my very own Renting vs Buying Calculator.

Follow that link, have a look, and play with some numbers. The buttons beside text boxes generally calculate/estimate the corresponding value from relevant numbers above. You only really have to fill in the numbers without buttons beside them. The defaults are my current best-guess at the economics of buying/renting a nice condo in suburban Vancouver.

It’s shocking how hard it is to make buying financially better, as long as you assume two important things:

  • House values aren’t going to continue to rise at the outrageous rates they have for the last five years in North America. This is already slowing, and betting your only/largest investment on that assumption is foolish.
  • You have the discipline to invest in something else (mutual funds or what have you) without the pressure of a looming mortgage payment. Automatic monthly withdrawals make this easy, but it has to actually happen.

The only scenario that I can find where buying has a marginal benefit is buying a small detached home (one of the 1970s-era Vancouver specials), and renting a basement suite. Of course, that comes with the extra responsibilities and headaches of being a landlord.

On the other hand, it can be hard to find rental places that are as nice as what you might imagine buying. The rental market seems to generally target “livable”, not “nice”.

Any comments on the calculator are appreciated. It has everything I can think of that should be in there, but some of you might know better than me.

Update 12/2010: vancouvercondo.info has created a similar calculator.

Flash Games

January 19th, 2008, 12:08 am PDT by Greg

In my thrice-weekly-blogging quest, I’m going to try to use Fridays as “link day”. For the first Greg The Aggregator day, I’m going to link to some of my favourite flash-based games.

Of course, there’s the stupidly-simple Line Rider. The deal is simple: draw lines and a little guy on a sled rides down them. You wouldn’t think that would be so addictive, but I distinctly remember spending an entire Friday afternoon in the CSSS common room with Jen trying to make him do loops, flips, etc.

I have recently been addicted to Filler, which doesn’t seem to be working for me right at the moment, but will likely be back soon. There are some little balls bouncing around: avoid those. You place bigger circles around the grid until you’ve filled up 2/3 of the board.

Shuffle isn’t much more than a flash version of marbles, but fun.

Finally, Zwingo is another marble-like game. Your job is to guard the big marble in the centre with the marble-on-an-elastic that you control.

Okay, none of those sound like much fun, but go play them and find out. Oddly, all of the games I’ve listed here have at least a little physics involved. I guess we’ve figured out what I like in a simple flash game.

Boing Boing

January 12th, 2008, 11:03 am PDT by Greg

For a while there, I had started to think that the posts on Boing Boing (“A Directory of Wonderful Things”) weren’t as good as they used to be (too much politics, not enough wonder?). Whether or not that was true, they totally redeemed themselves with two posts I saw this morning.

The video of people from 1 to 100 hitting a drum is pretty much what it sounds like. There’s really no reason for it to be as captivating as it is, but I couldn’t stop watching it.

Second was a link to Bent Objects. I especially liked “Chained to His Desk“. Now, there are certainly ways in which I am creative, but I still often mourn my lack of creativity. When I do that, this is exactly the kind of thing I wish I could think of, but never would in a million years.

Also, the octopus who is friends with a Mr. Potato Head was funny.

OMG, toys!

November 12th, 2007, 3:30 pm PDT by Greg

Pay attention to this sentence, because it’s not one you have probably heard before: This week, I bought three new laptops for $800.

This morning, the One Laptop Per Child project opened up their give one, get one program, and I was there. For US$400, I bought two OLPC XO laptops. One goes to me, one to some kid in a developing country.

So, I suppose that’s a halfway decent thing to do. But, I mostly wanted to get my hands on one of these things that we have all heard so much about.

Second, I ordered an ASUS Eee. For $400, it’s a more-or-less fully functional Linux laptop and about the size of a small hardcover book. I’m hoping this one has a little more real utility.

The specs sound a little thin for a modern laptop: 900MHz, 512 MB RAM, 4GB storage (flash, not hard drive), 800×480 display. But, that would have been a pretty snappy laptop 4 or 5 years ago. How much has my workflow really changed in the last 4 years? [A laptop isn’t a primary PC for me. It’s a thing to use when not in my office or at home.]

I know low-end mainstream laptops are bumping down in the $500–600 range, but there’s that part about weighing less than a kilogram and fitting in my man-purse. How could this not be ideal for travelling?

I’m also hoping it can ride on a iRobot Create and run Player for a sweet little autonomous robotics platform. If they come out with the $200 model, that would give us a full setup for <$500 that high school kids could play with.

BTW, thanks all for the interest in my CMPT 120 assignment. I went with controlling the ghosts in a pacman-like game. That should keep ’em busy.

Real Estate

August 30th, 2007, 9:15 pm PDT by Greg

A while ago, I came across this rent-or-buy calculator. After playing around with it for a while, I learned two things: (1) I didn’t really understand what it was trying to display, and (2) the buying/renting distinction was more subtle than I thought. So, let me work through this…

Option 1: Buy

Let’s buy a $400,000 home. Let’s say we get together a $50,000 down payment and mortgage $350,000.

At the moment, the banks’ best lending rates are 6.25% on variable rate mortgages. Let’s assume (foolishly) that that will not increase over a 20 year mortgage. A mortgage calculator says that the monthly payment will be $2,542.

So, after 20 years, we own our home. Apparently, home prices don’t really increase that much, on average in the long-term. (I suspect the problem here is that after 20 years, your house is 20 years older, thus less desirable to potential buyers. It’s not relevant to compare new-home prices.) Let’s say the home appreciates at 2% after inflation. At the end of the mortgage, a compound interest calculator says that our home will be worth $594,379.

Option 2: Rent

Let’s use the mortgage payment of $2,542 per month. We rent a place for $1,500 (which should be comparable to what we could buy for $400k at the moment), and invest the other $1042. Start the investment account off with the $50,000 down-payment.

Like in my last money-related post, I’ll use 6% after inflation as the rate of return and an investment calculator gives us $649,364 after 20 years. A net worth of $55k more than if we had bought.

Notes

  • Option 1 ignores property taxes, fees, and maintenance. Strata fees in particular are going to really add up if you’re buying a condo.
  • In option 1, you might do really well if housing prices go up dramatically. Or you might get screwed. Basically, the problem is that you have a horribly diversified portfolio. You have one thing, your house, and are very susceptible to market fluctuations.
  • Option 1 doesn’t take into account any improvements made that would increase the value of the house. It doesn’t count the cost of those improvements either.
  • A home is about the least-liquid asset you can have. It may be worth $600k, but you have to sell it (and thus start renting) to get at that capital.
  • After the 20 years, you’re definitely still paying rent in option 2.
  • Option 2 assumes the discipline to invest without the threat of the bank breaking your kneecaps.
  • There are probably some tax implications of buying that I don’t know about.
  • There are any number of possibly-invalid assumptions there, but I’ve tried to hit a reasonable balance (except that thing about interest rates never going up: that’s nuts). The calculations are particularly sensitive to changes in the interest/return rates.

So…

I don’t know, really. I just needed to work an example through. I guess the message is that buying a home isn’t the be-all and end-all of investing.

We can rent, invest, and relax.

Financial security on $15/day

August 12th, 2007, 6:18 pm PDT by Greg

A lot of people seem to be talking to me about money recently. Like, a lot. I don’t know what’s up with that but, like questions from my class, I assume that if 3 people have asked, 30 have the question. So, here is everything you need to know to be financially secure. Seriously.

  1. Start an investment account. My advice here is to go to one of the investment things in a bank: CIBC/Wood Gundy, BMO/Nesbitt Burns, or whatever. These have the advantage that if you move across the country, you can just move your account to a different branch. If you’re just starting out, they’ll probably put you with some schmuck that handles you and a thousand other accounts, but don’t worry about it.

    The investment advisor will do a little general financial planning: financial goals, risk tolerance, etc. To my mind, it’s worth it to have them do this kind of stuff.

  2. Invest 10% of your income. Have the investment guy/gal set up a monthly or bi-weekly withdrawal of 10% of your income from your bank account to your investment account. You’ll never notice it’s gone. Really.

    If after six months, you think “boy I really feel poor without that 10% of my income,” I’ll buy your poor ass lunch.

  3. Invest in mutual funds. Pick two mutual funds with as few adjectives as possible. That is, you want the “Growth Fund”, not the “Pacific Rim Manufacturing Fund”. All you’re doing by buying a more limited fund is limiting what your fund manager can do with your money. The fund manager knows what he/she is doing. You’re buying their expertise as much as anything else. Let them do their thing.

    The only other thing you need to worry about is risk tolerance: high growth and high risk generally go together. Your financial advisor should point you to funds that match your risk tolerance. (Basically, go high risk over the long term and lower risk for short term investments.) Edit 11/2007: Watch the fees on mutual funds too. A fund that gets 1% better return, but charges a 2% fee is a loss.

  4. Paying off debt is the best investment. Since lending rates are typically higher than investment earnings, it makes sense to pay off any debts (say, by doing the 10% thing) before you invest elsewhere.

    If that’s going to take you a little time, first convert any credit card debt into something with a less-stupid interest rate.

  5. Increase the 10% to cover your RRSP contribution. Have a look at what you’re allowed to contribute to your RRSP (it’s on a slip that comes back after you’ve filed your taxes). Get that amount into a registered investment and the taxman gives you 30–40% of it back. (Yay free money.)

    If you’re reading this, you probably want the retirement money in a high-risk/high-yield fund since you won’t be touching it for several decades.

  6. Don’t shuffle investments. The whole point of the mutual fund is that somebody smarter than you is doing the buying and selling for you. Do you know what Russian textile companies are going to be up to over the next decade? Do you care? No? Then piss off and let the mutual fund manager to his/her job. Don’t let your investment guy/gal talk you into selling one investment for another unless they have a damned good reason.

    The only good reason I can think of: going from high-risk investments to lower-risk because you’re going to need the money in the medium-term.

  7. The scary future. Get home/renters insurance for your shit. If you’re child-free and debt-free, you probably don’t need life insurance. You likely need long-term disability insurance, though. Your job may get you some of this for free.

    Come to think of it, get yourself a will too.

  8. Do whatever the hell you want with the rest of your money. Liquor, hookers, fast cars, whatever. Fuck budgeting, we’re all too stupid for that. Make sure there’s enough for rent and food and don’t go into debt.

  9. Read The Wealthy Barber. What I just wrote there is basically a distilled version of The Wealthy Barber. It’s a fast read and has better explanations and more details than I have here. I’ll lend you a copy if you want.

Okay, that might seem like a longish list of stuff, but until you have kids or edge up on retirement, that’s just about all you need. The time needed to maintain this is like 2 hours/year.

In fact, if you only get steps 1–3 down, you’ll probably be fine.

The only other things I can think of: Buying a house shifts some of your investments from mutual funds to real estate. If you get married and have dissimilar incomes, you need life insurance and can shuffle some things between you to save on taxes.

The magic here is, of course, compound interest. Try the calculator on that link: starting at $0, contributing 10% of your income per year, enter the number of years until you expect to retire, and a 6% return. Six percent is pretty reasonable over the long term, taking inflation into account.

Remember: that 10% is in addition to your basic retirement plan. That’s “I’m retired and want to live it up” money. That calculation also assumes you’ll never in your life get a raise beyond the cost of living.

They say money can’t make you happy? Bullshit. I look at the investment summary they send me every month and giggle to myself.

Self-help

August 6th, 2007, 4:02 pm PDT by Greg

I recently (either through Digg of StumbleUpon) found an article 10 virtually instant ways to improve your life. Now, I don’t usually go in for self-help douchebaggery, but this one made some sense to me. For the impatient, the ten things are:

  1. Stop jumping to conclusions.
  2. Don’t dramatize.
  3. Don’t invent rules.
  4. Avoid stereotyping or labeling people or situations.
  5. Quit being a perfectionist.
  6. Don’t over-generalize.
  7. Don’t take things so personally.
  8. Don’t assume your emotions are trustworthy.
  9. Don’t let life get you down. Keep practicing being optimistic.
  10. Don’t hang on to the past… let go and move on.

It’s amazing how many people come to mind when reading this: colleagues, questionable supervisors, ….

Of course, the elephant in the room is actually noticing that you’re doing these things when you are. That seems to be the tricky thing.

Hmmm… Maybe I should just concentrate on one at a time and make real sure I’m not doing that one. Fuck… that’s being a perfectionist! 🙂

« Previous Entries   Next Entries »