Teaching Myself the HTML Canvas Element

I rewrote some JavaScript of mine to use <canvas> instead of a <pre> block to display some data from a database scraped from a webpage. So far, it’s looking a lot nicer:
CanvasTest1I can do all sorts of other cool visualizations of the data too. Some things I learned that weren’t in the Mozilla documentation:

save(), restore(), scale(), and translate() are useful, but when you want to do operations about a point other than the origin, setTransform() does a much nicer job when you use a point other 0,0 for the origin. I could have sworn there was a way that didn’t involve me doing math to do it, but I couldn’t find it and ended up just doing the math to get setTransform to work.

scale() does a really horrible job. I abandoned using tiled images and scaled Text. As you can see, I went with a solid background, and in that picture I removed for aesthetics — but I ended up writing my own custom method for scaling text (I had to do more math!).

I’m not sure how far I’ll take this, or in what direction, but I’ll have fun along the way.

September 16th, 2009 | Nerd | No comments

Blast from the Past [2000] my !hme script

I completely forgot about this mIRC script I made back in 2000, but apparently I was ahead of my time. I wrote a crowdsourcing script before there was crowdsourcing. The script was very simple, query it with !hme <name of show> and the script replies with how many episodes it thinks are in the show. To contribute, anyone could say !hme.add <name of show> <number of episodes>. I did have a blacklist of people who couldn’t add, but I don’t think I ever had to use it. You didn’t care about the accuracy of the name of the shows, because the script searched the best fit, and if there were duplicate variations (Evangelion vs Neon Genesis Evangelion), it didn’t matter. I just stored extra information. The last time the script was used… 2002… it had 500 entries.

August 13th, 2009 | Life=Boring, Mental Note: Add Category, Neato!, Nerd | No comments