Solving grade 8 algebra… the Enterprise way

June 1st, 2006


I have been tutoring grade 8 math for some time. And let me tell you that it is not easy. Doing grade 8 math is one thing, but tutoring/teaching it is a completely different story. The trouble is that, by dint of having done a lot of much harder math problems as a university graduate, high school math just seems to be second nature and it has become hard to recall or even explain the thinking process behind solving simple problems.

As someone who reads The Daily WTF religiously everyday, I thought I would be less likely to fall prey to Enterprise-hype. How wrong I am! Anyway, last week I pulled a Daily WTF while tutoring math to a girl. It turns out that I showed an Enterprise solution to a grade 8 algebra problem. Here it is:

Tommy’s father is 5 times as old as he is. His mother is 2 years younger than his father. Together, the sum of their ages is 75. How old is each of them?

Having dealt with multi-variable systems of linear equations for so long, my approach was “naturally” to identify the unknown variables and then to translate the sentences into equations:

T: Tommy;s age
F: the father’s age
M: the mother’s age

F = 5T
M = F – 2
T + F + M = 75

Now we do some substitutions:

M = 5T – 2
T + 5T + (5T – 2) = 75

Finally, we solve for T, F, and M:

11T – 2 = 75
11T = 77
T = 7
F = 5T = 5 * 7 = 35
M = F – 2 = 35 – 2 = 33

I thought that this method was already pretty dirty because I haven’t even put the equations into matrix form and used the more formal linear algebra methods that I learned in college (or even the Gauss-Seidel method).

Yesterday I was tutoring the girl again. This is the first thing she said as I took out my pencil, eraser, etc: “I asked my teacher about it and she said your method is completely wrong. She said that you are teaching me stuff that I am supposed to learn only next year so she doesn’t understand why you’re trying to confuse me.” I was pretty shocked and “pwned” was written all over my face. As it turns out, what the girl’s teacher has taught (and was thus expecting) was actually even dirtier:

Father’s age = 5x
Mother’s age = 5x – 2 (since we already know the father’s age is 5x)
Sum of the ages = 5x + (5x – 2) + x = 75 (since we already know the father’s age is 5x and the mother’s age is (5x – 2)
Therefore…
11x = 77 –> x = 7
Father’s age = 5 * 7 = 35
Mother’s age = 35 – 2 = 33

Notice that they don’t bother with things such as identifying variables or substitutions. The whole problem was solved pretty much using only 1 variable from start to end. The reduction in complexity and in number of steps is pretty amusing. I think it was a good lesson (for me).

Impresario Public Release

May 29th, 2006


It’s been decided. Impresario is scheduled for public release on June 1st. Among other cool new features, it will feature a setup wizard to facilitate deployment. I hope everybody will enjoy the release.

New Graduate Student for Hire!

May 13th, 2006


Exams were over more than a week ago. 3 of the 4 grades are already posted, the only grade missing being that of the capstone project. I can be sure that I’m graduating on time because there is pretty much no way that I can fail the capstone project.

So there you go, I will be officially a new graduate student for hire on June 2, when the graduation approval will be posted.

For those of you who don’t already know, I will be receiving a B.Eng degree in Software Engineering.

I figure that besides actively job hunting through craigslist, newspapers, and whatnot; it would be a good idea to tell you, my dear readers, that I’m for hire, in case I miss some really interesting job out there. For details on my background, skills, and qualifications, you are welcome to take a look at my résumé.

Send me an e-mail if you believe I can be of service to you. Don’t leave comments as I’m afraid the anti-spam plugins may eat them.

Impresario is not dead!

May 4th, 2006


From the reactions we gathered at the capstone demo, it appears that many people like our product. Now here is a great news for those of you interested: the development of Impresario is entering phase 2! That’s right, even though we have already handed in the product for evaluation, we have decided that we are going to keep improving it.

The scheduling plug-in is the one of the first components that we will upgrade.

Concordia Iron Ring Ceremony 2006

March 26th, 2006


After 4 years of blood, toil, tears, and sweat, (most of) my friends and I finally got our iron ring this Friday, March 24th. Having this special symbol of the engineer on the pinky feels great but it’s also difficult to not notice its presence. For instance, washing your hands with the ring on really hurts because it’s pointy and you rub it all over against your off-hand.

I’m not going to talk about the ceremony itself unless there is popular demand.

The evening of celebration was great. After the ceremony and the cocktail, our class of SOEN students went for dinner at La Cabane Grecque. Being part of a small program at university is great because we can go to a restaurant and celebrate with literally all of our classmates, plus some friends. We somehow got two TA’s, Stu and Daniel, to join us. But then again, it’s not so hard to invite Stu as long as we mention “alcohol” – just kidding.

After dinner, it was drinking and dancing at New Town. Ok, I’ll admit it: SOEN guys are not the wildest dancers, with a few exceptions. In fact, the lounge was already packed with other engineering students, so ordering drinks was a feat in itself. In the end, it was more like chilling than dancing but none of us (the guys) seemed to mind. It was still cool though because Fareena joined us for a bit and we even dragged Ahmed to the club downstairs.

I’m getting a bit sleepy and I don’t know what else to write for now. For pictures, please visit the gallery. (God, I look like such a retard when I smile while being drunk.) One of the TeamSuperGood members will post or has already posted a username and password on the SOEN 490 mailing list so you can also upload your pictures.

Concordia – Leaving Impressions – #2

March 22nd, 2006


I don’t like many of my “fellow” students.

Among all Concordia students, the engineering and computer science guys are probably the filthiest. The men’s washroom on the 8th floor of the Hall Building has a constant smell of pee and its toilets are full of toilet paper turds. Seriously, how hard is it to properly aim at and flush the urinals? And why won’t the building management place a garbage can in the washroom so people don’t have to throw litter everywhere? Isn’t it less work than removing litter from the whole washroom?

Engineering and computer science students are also some of the noisiest people around Concordia. The difference in noise level between the 11th floor (where the economics people are) and the floor of engineering and computer science is incredible. Sometimes my team even has to retreat to the 11th floor to work because it is simply so much quieter, but then we get weird looks from the economics people. :?

How to properly embed Macromedia Flash objects

March 14th, 2006


If any of you has been visiting this blog through Mozilla with the Tidy-based HTML validator extension, you may notice that the page now validates perfectly with no error and no warning at all, instead of having 1 warning like before. The problem had to do with the Flash movie from YouTube. The HTML code that YouTube supplied contained the <embed /> tag, which is not recognised by the W3C‘s HTML and XHTML specifications. Being a standard-compliant freak, I have been asking around for weeks about how to get rid of the warning; and then, just an hour ago, I read the HTML 4.01 specifications again and found >this<.

Before – the original code from YouTube:


<object width="425" height="350">
    <param name="movie"
        value="http://www.youtube.com/v/iIIoc8R26iM" />
    <embed src="http://www.youtube.com/v/iIIoc8R26iM"
        type="application/x-shockwave-flash"
        width="425" height="350" />
</object>

And after – the new code I figured out:


<object width="425" height="350"
    data="http://www.youtube.com/v/iIIoc8R26iM"
    type="application/x-shockwave-flash">
    Yellow Fever
</object>

Notice, however, that Microsoft Internet Explorer does not understand the second, correct version. It is a long-known fact that Internet Explorer’s HTML rendering engine is broken in many different places, with respect to the W3C specifications. Therefore, JavaScript needs to be used to determine which version to use:


<script type="text/javascript">
IEString = '<object width="425" height="350">'+
  '<param name="movie" '+
  'value="http://www.youtube.com/v/iIIoc8R26iM" />'+
  '<embed src="http://www.youtube.com/v/iIIoc8R26iM" '+
  'type="application/x-shockwave-flash" '+
  'width="425" height="350" />'+
'</object>';
MozString = '<object width="425" height="350" '+
  'data="http://www.youtube.com/v/iIIoc8R26iM" '+
  'type="application/x-shockwave-flash">'+
  'Yellow Fever'+
'</object>';

// The "browser" string is assigned by a nice
// browser detection script from quirksmode.org
if(browser == "Internet Explorer")
  document.write(IEString);
else
  document.write(MozString);
</script>

I hope this little piece of information helps those of you who want to use Flash on your webpages while being standard-compliant. I admit that the script does not take even other browsers like Opera, Safari, and Konqueror into account. I have not used those browsers long enough to know their behaviours off the back of my head. You are welcome to leave comments to help me improve the script. Notice also that, due to the default text processing options of WordPress, just pasting the script section inside a post usually does not work. You need to employ one of the solutions described >here<.

The Horrors of Adopting Standards

March 12th, 2006

Note: In order to not waste your time, I have decided to present the morals of the story before the actual story.

Morals of the story

  • Do the simplest thing that works;
  • Adopting a standard is not necessarily the simplest thing that works, depending on how you do it;
  • Look for reference implementation(s);
  • Look for intelligible documentation;

The actual story

Some of you know that I have been working on the capstone project since September 2005. We’re 10 people in the team and our project is about creating an extensible, web-based, software project management system, using Java Servlet and JSP technology. Eliott and I have been in charge of the task scheduler component since the very beginning.

Being the 2nd biggest standard-compliance freak in the team, I have decided that the task scheduler needs to support some existing calendar format. After some research, Eliott and I have agreed that the RFC 2445 iCalendar format would be the way to go for a few reasons:

  • It was already supported by major calendar programs (e.g. Mozilla Sunbird, Microsoft Outlook, and Apple’s iCal);
  • There was already a Java library (iCal4j) for working with iCalendar files;
  • The specifications for the format were publicly available.

We were quite excited because iCalendar seemed like a “big thing”, so we quickly grabbed the iCal4j library and started experimenting with it, while it was still at version 0.9.16. Soon though, we began running into problems.

First of all, learning to use the library was a disaster. We had no clue where to start and none of us knew the iCalendar format very well. The only documentation that the library had was some semi-complete JavaDoc. There was no tutorial and the introduction page on the official iCal4j website had some strange sample code that didn’t make much sense (e.g. one example involved creating an event, but then the sample code never showed how to insert that newly created event into the calendar object). This was our first mistake: to believe that the iCal4j library would be as good as an official reference implementation. This, combined with our inability to decipher the RFC 2445 specifications, made our life pretty miserable. Actually, I suspect the IETF is to blame for not writing intelligible specifications. =P

Once we began to get the hang of iCal4j, we produced some rough design, by deciding what functionality we needed and hence the classes for datasource and domain logic. We started coding and soon realised something fishy going on. Because the iCalendar file does not function like a database, everytime a single event needs to be read or added to the calendar, the whole iCalendar file needs to be read from disk, converted to a Calendar object, and once the event is added to the Calendar object, the iCalendar file is completely overwritten. This operating scheme is, of course, extremely inefficient and cannot be used with our system, where we expect hundreds of concurrent users. The fact that Mozilla Sunbird had switched its main storage from the iCalendar format to a simple database system confirmed our suspicion. Our solution was then to create a CalendarRegistry, which manages the reads and writes of iCalendar files, and at the same time provides protection against the concurrency issue of lost update.

The solution was far from perfect, however, as we found out soon after that the Java Virtual Machine has a limit on the amount of memory it can use, which seems to be 64 MB by default. Having the CalendarRegistry keep too many Calendar objects in memory was therefore also a bad idea.

In the end, we realised that the simplest thing to do was to just use a database for storage and add the functionality of importing from and exporting to iCalendar files. A few months of development time were lost, and we were sent back to the sketch board.

My Coffee Table

February 16th, 2006

After reading Kathy Sierra’s post about her coffee table, I have decided to show off my coffee table, too. Ok, I don’t exactly have a coffee table, but I’ll show you what I have on my desk anyway.

Books

  • Romance of the Three Kingdoms – one of the Four Great Classical Novels in Chinese literature;
  • Book of Han;
  • The Art of War – the original by Sun Zi; probably the best known of the Seven Military Classics; I also have another version with annotations by eleven Chinese historical figures, including the ambitious Cao Cao from the period of the Three Kingdoms;
  • Kong Ming’s Art of War – Kong Ming (Zhuge Liang‘s courtesy name) is a great politician, strategist, and tactician of legendary fame from the Three Kingdoms period; many people’s favourite character in The Romance of the Three Kingdoms, mostly for his wit, sense of honour, and loyalty;
  • Wei Liao Zi’s Art of War – Wei Liao Zi is not as famous as Sun Zi or Kong Ming, but still a great strategist and political theorist; another one of the Seven Military Classics;
  • Questions and Answers between Emperor Taizong of Tang and Li Jing – another one of the Seven Military Classics;
  • Four Booksthe reference for Confucianism;
  • The Heavenly Sword and the Dragon Saberwuxia novel by Jinyong;
  • The Deer and the Cauldron – another wuxia novel by Jinyong;
  • The Legend of the Condor Heroes – another one by Jinyong;
  • Three Hundred Poems of the Tang Dynasty;
  • Le Petit Prince – (finally some non-Chinese stuff, haha);
  • Technology & the Future – this is actually a required textbook of one of our engineering core classes; I kept it because it is an interesting read;
  • Invitation au latin, 4e – Highschool textbook to learn the Latin language and Roman history; written in French;
  • Invitation au latin, 3e – Despite the number, it is actually more advanced than the 4e.

Please note that I would rather read the Jinyong novels than watching any of these movies: Crouching Tiger, Hidden Dragon, Hero, or House of Flying Daggers. I consider the Hollywood effect dangerous and harmful to the proper development and preservation of the authentic wuxia genre.

Music

I have so much music that I can’t make an exhaustive list of it, so I’ll just list my favourite artists and albums in general.

Why Asian Guys Can’t Date White Girls

February 9th, 2006

Warning: Politically incorrect content.

There goes my life objective… XD

If you do not see the video below, it is because you are using a broken browser (e.g. Microsoft Internet Explorer). Please use a better, and generally more secure browser (i.e. Mozilla Firefox).

Yellow Fever