Midterms: CS 341, CS 348 and CS 350

June 25th, 2010

…and the second half of the midterm barrage has finally come and gone. I guess it’s back to normal university life?

Anyway, I wrote my CS 350 (Operating Systems) midterm last Friday. As I expected, it was relatively hard. A large portion of it was rote memorization from the lectures, notes and textbook. Then there were a few analytical questions that really required a deep understanding of certain topics (i.e. how virtual addresses are structured to incorporate multi-level page tables, etc.). Good thing ~1/9th of the total marks were for bonus questions. :P

CS 348 (Intro. to Database Mgmt.) and CS 341 (Algorithms) were scheduled back-to-back on Wednesday and Thursday. I don’t have much to say about the former – the course is pretty straightforward especially since I had a lot of prior experience with the material in previous work terms and hobby projects. Algorithms, on the other hand, wasn’t anywhere as easy. Though the topic is very interesting (examples here, here and here), proving optimality and determining time complexity is not. Especially when the proofs lead to equations with chain exponents and logarithms. For the midterm I actually had to leave certain questions unfinished because going through the math alone would eat up all of my time. Meh.

Anyway, it doesn’t look like I can relax for a little while longer since I have a ton of assignments to do for various courses. Out of the frying pan and into the fire much? :P

Midterms: PSYCH 338 and BUS 352W

June 12th, 2010

It’s mid-June and things are starting to really pick up. Between interviews, assignments (lots of group projects for me this term), club meetings and other administrative stuff, I haven’t had too much time to do much else. Except for gaming. There’s always time for gaming. ;)

Anyway, I had my organizational behaviour midterm on Thursday followed by my marketing midterm on Friday. Needless to say I had a lot of reading to catch up on. :P I think between both of those courses I’ve went through around 400 pages of textbook reading. Speaking of textbooks… Ow.

Let’s start with PSYCH 338. One interesting concept about this particular course is that it’s divided into two parts: a standard lecture followed by discussion groups with TAs. This allows for more freedom to elaborate on weekly topics through various interesting activities (e.g. analyzing management styles in videos and teamwork exercises). It definitely helps considering my class size is well over 300. I thought all of the main concepts were articulated well; there was nothing that made me go “WTF is this?!”. :P

The midterm consisted of 55(+1) multiple-choice questions which I thought were relatively tricky. A large portion of them had options like “both A and B”, “all of X, Y, Z”, etc., while others contained negators and various keywords. Some were multi-part questions on a bunch of related terms. It definitely felt more like a 100+ question exam.

As for BUS 352W, I definitely enjoyed the lectures as there is a lot of discussion throughout (as opposed to most/all of my CS courses where everyone is just listening). A lot of the material resonated with me considering the stuff I read up on in my spare time (in addition to work experience). Good thing it’s summer though; I wouldn’t have liked walking to WLU and back in the snow. ;)

I probably wasn’t as prepared for the marketing midterm as I could have been since I was heavily distracted by a few side projects. The exam was basically a bunch of “short”-answer questions followed by some multiple-choice. It was a lot of writing, but I actually finished with time to spare. Three minutes, in fact. Awesome! (Note: I suck at writing tests and even moreso when they’re within tight time constraints.)

On the aforementioned distractions: I’ve been researching like mad on various topics like computer vision, AI, OCR and more. I wonder if there are courses at UW for some of those topics… I know that there is one for AI in CS; the others might be in various engineering disciplines. Currently my focus is on OpenCV (a programming library for real-time computer vision) and Tesseract (an OCR engine). I’ll probably write something about them later if I find anything interesting. :P

Back to University!

May 17th, 2010

Well, technically I’ve been back on campus for a couple of weeks now. I had quite a few things on my plate though so I haven’t written anything new in a while. :P

April 23rd marked my last day at Indigo. After four work terms there in two different positions, I think it’s safe to say I have a decent amount of knowledge about the company now; it’s been a lot of fun working on their website and trying not to break things. ;) I took the following week off to relax and to visit the Toronto Zoo – pictures to come later (maybe).

Anyway, I’ve finished my final work report last week. It was rather dry – as usual – since I had to conform to academic writing standards set by my faculty. At least the topic itself was rather interesting: I managed to catch up on some of the latest developments in HTML5 and CSS 3.

As for classes this term, I have CS 341 (Algorithms), CS 348 (Databases), CS 350 (Operating Systems), BUS 352W (Marketing) and PSYCH 338 (Organizational Psychology). All of them look to be relatively interesting from what I’ve seen so far. We’ll see if my opinion changes once things get underway. :P

Bleach (Chapter 399) and Naruto (Chapter 490)

April 7th, 2010

Looks like Manga Stream just released this week’s Bleach in addition to Naruto earlier this afternoon. Both of them are basically just fleshing out the cliffhangers from last week.

I wasn’t particularly impressed by Bleach. Gin’s bankai seems a bit…lacking…if all it does is increase his sword’s length. I suspect he has a few other tricks up his sleeves though; perhaps his sword can bend like a snake or something. Then again, maybe Kubo is just trying to push him to use his hollow powers. Also, did Gin actually open one of his eyes? That brings up the count to three(?) throughout the entire manga. :P It looks like Aizen is starting to feel the heat now too, finally.

As for Naruto… There’s a few developments that I’m interested in. The first one is seeing how Naruto will develop now that he has full use of the Kyuubi’s chakra. He should be able to handle it now after all the things that have happened (fights with Orochimaru and Pain, etc.), but we’ll see. Secondly, what is Kabuto up to? If I had to guess, he’s trying to experiment with another forbidden jutsu. Right now he’s easily the biggest threat in the manga in my opinion, since Sasuke is still recovering and Madara is fleshing out his plan. Thirdly, what did Kabuto summon that had Madara so alarmed? My prediction: Madara’s brother looking for revenge. I can’t really think of much else that would seriously surprise him at this point.

On a related note, the Bleach anime wrapped up its Sword Fiend arc with the last episode. As I expected, it didn’t live up to the standards set by the preceding Muramasa arc. It just felt too much like a set of monster-of-the-day episodes without much of an overarching storyline. Meh.

RuneScape Bonus XP Weekend: An Overview

March 21st, 2010

On February 26th, Mod Knox announced RuneScape’s first ever bonus XP event. It was to run on the weekend of March 12th, starting at 7:00 AM EST and running until the same time the following Monday.

The effects of this announcement were profound and widespread. In a matter of days, many popular items used in skill training (such as planks, herbs and summoning secondaries) became unbuyable on the Grand Exchange. Merchanting clans – and indeed, pretty much everybody – promptly jumped on the bandwagon, causing prices to spike in a dramatic fashion. This imbalance in the supply and demand of raw materials trickled down; soon, “essential” items such as potions were also bought out, crippling the ability of players to participate in PvP and other activities.

In a bid to hoard more supplies, however, many players began to sell off expensive items such as godswords and Bandos armour. This triggered a crash of sorts in the high-end market, causing many players to speculate on what the future has in store. What was notable, however, was the influx of discontinued items in the Grand Exchange; prior to the event announcement, traders often had to use “junk” in order to obtain them. There are two sides to this: although collectors were easily able to get something they want at a steep discount, said items became more heavily concentrated in the hands of wealthy players.

This state of affairs wouldn’t last for long, of course. About a week later, the market for training supplies began to cool down; it won’t be until the beginning of the actual event that things start to pick up again. Prices for high-end items took on a reversed course as people began to recognize that they were vastly undervalued.

Meanwhile, the RuneScape forums were raging with activity. Many players thought it was an awesome event and began preparing for it, even going so far as to use calculus to determine how much XP might be expected for a particular activity. Questions were thrown around left, right and center about what particular training methods were covered under the event. Others, however, had a negativistic view and stated that bonus XP devalued skills (in particular, summoning).

On the first day of the actual event, people quickly determined that the XP rate counter was decreasing faster than it should have been. Mod Nexus confirmed this in a forum thread, saying it was because of a rounding error in the math calculations. This meant that the curve leveled off at 110% normal experience approximately 3 hours faster than expected, throwing off many of the more meticulous plans for the day.

Despite this miscalculation, players were undeterred in their training. Areas such as Castle Wars and the Ourania Runecrafting Altar were flooded with skillers. At multiple points throughout the weekend, RuneScape peaked at over 180k people online. Such enthusiasm turned what is ordinarily dull training into a group activity, building relationships between players; it was sort of like a global skilling clan going to areas normally devoid of people. In the end, many ‘Scapers received a hefty experience boost in the skill(s) of their choice.

So that’s pretty much what happened. Here’s a few of my thoughts on the event.

There’s no doubt that it was one of the most controversial announcements of the year. Although bonus XP events were commonplace in many other MMORPGs, this marks the first time such a thing has happened in RuneScape. Much of the debate centered around the “devaluing” of achievements prior to the weekend. In particular, summoning took the brunt of the criticism due to the design of the skill itself; most of the time spent is on charm gathering rather than pouch making, so it was possible to save months of playtime (rather than the ~5 or so hours with most other skills). Herblore took second place due to the vast amounts of money that could be saved in the process of gaining upwards of ~4 million XP over the weekend.

What’s the big deal? Well, RuneScape is largely a time-based game (more so than most); there are few things that players can’t do if they put in sufficient effort. As a result, the main thing distinguishing players is the number of hours spent in-game (way overgeneralizing here). To put it into perspective: think of time as some sort of currency and a government deciding to introduce more of it into the economy – causing hyperinflation to occur.

It’s essentially an egotistical argument; the idea boils down to “I worked for my skills the hard way, so everyone else should too”. In a game like RuneScape, where higher levels give substantially larger advantages, it becomes easy for players to point fingers at the bonus XP event and say that it nullifies their competitive advantage over others. For example, let’s use the pack yak as an example: it requires level 96 summoning and provides a massive advantage in the form of extra inventory space (and long-range banking). Those who have gotten the yak prior to the event were able to cash in on their efforts, staying at boss fights and whatnot longer than their lower-leveled counterparts. However, there may be those who have, say, level 85-90 summoning who didn’t have enough resources to reach level 96, but had enough to achieve half of that. The bonus weekend helps to put the pack yak in their line of sight, making it possible for more people to compete with others who have already done so.

Now, I’m a relatively casual player. Although I’ve been “around” longer than probably 95% of the population today, I haven’t done many noteworthy things. For example, I’ve never hit maxed level in any skill thus far, and have no plans on doing so. My reason? I dislike grinding and am happy with ~90% of the benefits in a third of the time. Basically, my opportunity cost for gaining the last little bit of extra advantages are too high. And yeah, being a mathie I have a habit of calculating efficiency rates for various activities in the game. :P So what draws me into RuneScape? Questing is probably the primary reason. It’s also one of the few games that I’m capable of multitasking well with when I’m knocking heads together in Guild Wars or programming “the next big thing”. ;) For someone like me who pretty much tries everything to avoid straight-up grind, anything that increases efficiency per time spent is likely to be more good than bad (just as a sidenote, I went for summoning, construction and hunter last weekend).

There’s a couple of arguments in favour of the event that I haven’t really seen yet. First of all, it was sort of a money-sink. In the case of summoning, many players had to buy shards from the shop, removing gold from the game. It’s no big secret that inflation has been running rampant over the last couple years so every little bit helps. For other materials, it helped to decentralize wealth as people with a lot of money bought things from those who supply them (merchants notwithstanding). Secondly, an increased number of higher-leveled players can actually help the game. Think of it this way: if more people are able to make an attempt at the God Wars Dungeon or the Corporeal Beast, then prices of the more expensive items may drop into affordable range.

It’s been my experience that forums aren’t a very good way to judge feedback to an in-game event. The responses tend to be skewed towards the dissenting side and for good reason – happy players tend to be the ones actually playing the content. I suspect given the amount of activity last weekend that it was a huge success, so I wouldn’t be surprised if another similar announcement comes up in the future.

I appreciate a gaming company who’s willing to try out controversial things so I have a few suggestions for Jagex. It’d be nice to give less notice should a repeat occur, as the Grand Exchange was essentially destabilized for a month. Using a limited subset of activities might be interesting too, as that would herd players to various areas (this, of course, only works if the activity isn’t based around zero-sum like mining).

Anyway, this post has gotten a bit out of hand so I’ll wrap things up for now. :P

Guild Wars Community Event: Maragon

March 6th, 2010

Last week the KISS alliance hosted its annual Maragon on Guild Wars. Basically it’s a massive riddle-solving and running event spanning over two long days.

I haven’t even been on Guild Wars for a significant period of time since last year, so this was kind of interesting. In the beginning I thought I’d be at a severe disadvantage due to the time lapse; at least I’d have Dacelo et. al. backing me up though. ;)

In hindsight I didn’t have much to worry about. The group riddles weren’t all that hard – although there were a few “wtf” moments. I mean, how did we manage to derive Sifhalla as the endpoint three times consecutively? :P Some of the runs were definitely crazy though: the two runs in the Realm of Torment and the HM run from Arbor Bay to Gadd’s Encampment.

Good thing as a “PUG” I had the advantage of running in full armour. :P The change to Shadow Form last Thursday and its subsequent unbanment (I officially declare unbanment to be a real word) from the event was a godsend as well. I don’t know if it’d be possible to solo run half of those routes otherwise.

Anyway, some pictures:

Maragon - Deldrimor War Camp

Taking a nice long break after the crazy run from Beacon's Perch to Deldrimor War Camp

Starting the solo riddle for Prophecies.

Crowding around the leader of KISS - James - before the start of the final solo riddle of the event.

All in all it was good fun. I definitely got a lot of running practice over that weekend. :P Now if only I remembered to record one of the more challenging runs on video… And congratulations to Dacelo for winning first prize (Obsidian Armour set) in the Nightfall portion of the event. It was totally worth participating just to hear Tessa’s expression. ;)

I think my brain has fully recovered now.

Random Thought of the Day

February 8th, 2010

Ever had this crazy awesome vision in your head but just can’t get it down into a physical format? It could be an idea for a project, a solution to an issue, whatever. Well, that’s basically the sort of problem I’ve been dealing with for the past few weeks or so.

The problem: create a design for the front page of my site (and perhaps this blog too, in time). The vision: a dark theme, using fantasy and sci-fi material as inspiration (planets, stars, floating islands…). The solution: uhh…?

I call it “creative paralysis”. It’s something similar to writer’s block (which, incidentally, I happen to encounter constantly when I’m writing academic papers and such). I suppose it’s different in that the idea is already at hand; the issue is figuring out what to do with it.

For me, I’m thinking that my lack of experience in Photoshop (and artistic skills in general) is holding me back. I’ll probably end up messing around randomly and hope things work out. Who knows, I might actually learn something in the process…

I probably have a few hundred or so images in my head that I’d love to get on paper. Hell, my lucid dreams can probably form the basis of several short stories. Now, if only the details were a bit clearer… :P

Seriously, if there was a machine that could materialize thoughts into physical matter, I’d venture to say that we’d be living in a rather interesting world. ;) In the meantime, I’d be happy if virtual/augmented reality stuff went mainstream.

Bleach (Episode 256)

February 8th, 2010

…and so the filler continues. I’m not entirely sure I like where this is heading; personally, I thought the last episode would have ended this arc rather nicely. However, I’m willing to give the writers the benefit of the doubt. They did manage to get a pretty intriguing storyline going after all… I’m just hoping that it doesn’t end on a sour note. ;)

You can watch the episode here.

The Hype Surrounding Apple’s iPad

January 28th, 2010

Geez, Apple’s hype machine is ridiculous. Pretty much every other news story and tweet I’ve been reading had some sort of reference to the iPad. Just take a look at TechCrunch and Techmeme over the last day and a bit – I’m hoping no company was stupid enough to release anything that day. :P

Building a Web Scraper Using JavaScript and jQuery

January 25th, 2010

When building web applications, sometimes there’s a need to fetch data from other sources. Perhaps you’re building a custom RSS feed of news items based on your interests or you want to aggregate data from several sites. In any case, it’s not always possible to do this elegantly; you may not have direct access to the raw data and an existing API may not exist. For these situations there’s one general (albeit fragile) solution: manually parse the end result when a page is loaded in a browser.

There are many different ways to build a web scraper. A server-side language such as PHP will have a much easier time as there are less limitations and existing libraries (such as cURL) to accomplish the task. I’ll be using JavaScript (with the jQuery library), however, as I want a standalone client independent of server technology.

Let’s start with a random snippet of code:

1
2
3
4
5
6
7
8
9
10
11
12
function fetchPage(url) {
    $.ajax({
        type: "GET",
        url: url,
        error: function(request, status) {
            alert('Error fetching ' + url);
        },
        success: function(data) {
            parse(data.responseText);
        }
    });
}

The above function attempts to make an AJAX call to a specified web page, fetch the HTML of said page and pass it to a parsing function. Simple enough, right?

Unfortunately there’s a little problem with this. Client-side programming languages have to deal with something called the same origin policy which basically restricts scripts from accessing external domains. From a security standpoint this is obviously a good thing; however it can be a headache for web app. developers (indeed, there are ideas such as the origin HTTP header to solve this). (The following bit can be ignored if the scraper is on the same domain as the data source – but in such a case why is said scraper even necessary?)

In this case, there are a couple of solutions (that I can think of). Both of them take advantage of the fact that JavaScript can read JSON even if it is located on a different domain.

  • The first one is writing a complementary server-side script that takes a few arguments (such as the target URL), makes the call, parses the result into JSON format and passes it back to the calling function. It’s a simple idea, but I never really liked it because it introduced a major dependency (which, in my case, can be a pain to deal with). However, it’s definitely a viable solution which works extremely well.
  • The second is using an existing system such as Yahoo’s YQL to fetch the required data and return it in a structured form. This is the method that I’ll be using.

YQL is an interesting little beast. From their site:

The Yahoo! Query Language is an expressive SQL-like language that lets you query, filter, and join data across Web services. With YQL, apps run faster with fewer lines of code and a smaller network footprint.

I haven’t had too much time to look into it so I do what all programmers do: Google the living crap out of a problem to find a solution. :P In this case, Chris Heilmann has a great post on how to load external content via. various methods including YQL. To simplify things, James Padolsey wrote a plugin that detects an external AJAX call and passes it to YQL automatically.

Anyway, that solves the problem of fetching data from an external source. All that’s left is extracting the relevant pieces for whatever application is being built. Consider the following example:

1
2
3
function parse(data) {
    alert($(data).find("h1").text());
}

The parse() function takes the responseText data from the earlier fetchPage() function and then proceeds to pick at it slowly and painfully. What’s really cool about it is that pretty much all of jQuery’s selectors can be used to select relevant data. In the above case, I’m trying to extract text inside the first <h1> tag found on a page and outputting it as an alert to the browser. Obviously there are more complex uses for this but they are outside the scope of this post. :P

And…that’s it! :D Those two code blocks combined pretty much handles all of the grunt-work in extracting data from external sources. Again, this is a rather fragile solution – it can break if the target page’s HTML changes (one possible solution is to pick unique identifiers or classes). In addition, some sites may have restrictions on their data – but I’m sure everyone reads those long-winded documents. ;)