Replacing TwitterIM with my own bot.

January 7th, 2009
TwitterIM:  TwitterIM is under maintenance at the moment. Please check back later.

Twitter‘s AIM bot, TwitterIM, has been “under maintenance” for as long as I can remember.  The last time it worked for me was in January 2008, and I have been “checking back later” periodically since.  Personally, I do not have high hopes for it working any time soon.  I decided to just take advantage of Twitter and AIM’s APIs and write my own bot to update my twitter through AIM.

I wrote this in about 10 minutes, so its a really simple program.  Once it connects to the AIM server, it waits for messages from me, ignoring all other messages.  A message from me is immediately posted to Twitter through curl.  In this implementation, there is no check for a successful post, though that would not be particularly difficult to implement.

The source code is available here.  You need Perl, the Net::OSCAR module, and AIM and Twitter accounts, naturally.  Just fill in your credentials at the top of program and run it with Perl.

Ruby Blackjack

January 6th, 2009

“Hm, I should probably learn Ruby.”

I probably first said this about a year and a half ago when Ruby and Ruby on Rails were “in”, the cool new (relatively, anyways, Ruby was written in 1995) language and the easy to use web application framework that went along with it.  In the year and a half since then, I’ve glanced at Ruby and Rails, not looking at it close enough to discover more than that it resembled Perl and possibly Python.

Well, as part of an internship interview, I’ve finally gotten a reason to actually sit down, read the Ruby documentation, and understand how this language works.  I am almost done writing a command line blackjack implementation in Ruby.  Here are my thoughts:

Object-oriented. I really like the way Ruby strongly object oriented – everything is an object, including integers and booleans, which most other languages designate as primitives.  This preemptively takes care of the limitations in designating these types as primitives, which often lead to wrapper classes such as Java’s Boolean and Integer.

Open classes. Ruby implements open classes, which allows you to define or redefine the behavior of any class at any time.  This way, I can easily implement: a predicate in the String class that checks if a string is empty or nil, a foldr method in the Array class, or anything else that I need.  In contrast, in Java, implementing these functions would require creating another StringUtils or ArrayUtils class.

Powerful. I don’t know if powerful is the right word.  Overall, I just feel like I would be much more comfortable writing complicated/long programs in Ruby, over Python or Perl.  Normally, I would stick to Java or C++ for projects with a larger scope.  Ruby is really nice, except for…

End? Syntax complaint.  I really prefer using brackets {} to denote a block of code, such as the interior of a loop or a function.  Maybe I’m just not used to the language yet, but I feel that it is laid out so that it is difficult to understand and read code by simply scanning through it.  The problem is made worse by the fact that with brackets, I can easily use vim or TextMate to find the corresponding bracket, whereas “if … end” doesn’t lend itself quite as well to that kind of searching.

I hate blackjack. What a terrible game.  Blackjack is a mishmash of rules and variants that make an elegant implementation of the game difficult.  It is a simple, boring game that casinos keep around because it is considered a beginners game, and so is played by novices who pay little to no attention to strategy.  Provided a player plays correctly, the game is relatively even, with a house advantage of less than 0.5% for more common variants.  Generally, blackjack is just not worth playing. Stick with poker.

In summary, blackjack sucks, Ruby is pretty cool.

All your info are belong to Facebook (and Google)?

December 4th, 2008

“But what about interesting things that you do on other sites? Maybe you commented on a blog or dugg an article on Digg. Maybe you put up something for auction on eBay, or found a video you love and wanted to share it. Wouldn’t it be nice if when you were on another site, you could easily find your friends on that site and see what they are doing there, just like you can on Facebook?” — Facebook Connect

In what almost seems like a synchronized release, Facebook Connect and Google Friend Connect have been unveiled today by the largest social network and the largest search engine in the country.  At the very least, these two new technologies will be another general Web sign-on protocol, most likely replacing OpenID, which had a lackluster reception at best and will likely effectively disappear with these two giants as competition.  From a most pessimistic point of view, these two web giants who, between them, already have a ridiculous amount of information about the average user, has yet another means of data collection.

It does seem like Facebook has learned from Beacon, and has made Facebook Connect an opt-in service rather than an opt-out service, hopefully avoiding the privacy scandals that led Facebook to quickly pull Beacon off the site.  Still, I expect to hear stories of people accidentally publishing news about things that they don’t want known, though hopefully not to the same degree as the story about the man who bought an engagement ring on Overstock.com and got it published to his wall.

Perhaps these two tools can fulfill their promise of easy inter-website connectivity without bringing on the anti-privacy apocalypse.  I’ll keep my fingers crossed… while installing Facebook Connect onto my website.

Halloween!

November 8th, 2008

I don’t update very much, do I?

Blogs are hard. Oh well. Halloween happened! Here is a picture of me and Dana.

Stick figure ♥.

Stick figure ♥.

My dorm room…

September 9th, 2008

So I arrived at school expecting to set up my room in about the same way as I had the year before. My roommate and I would have our beds set up in a Captain’s bed style on opposite sides of the room along the shorter wall, with our desks along the longer wall and the refridgerator and microwave in the middle of the longer wall between ours desks.

As I walked into my room on the first day, my first thought was that it felt somewhat smaller than it should have been. I soon discovered that this was because it actually was smaller, as the school had, without informing us, shortened the shorter wall by about 6 inches, supposedly to earthquake-proof the dormitory.

These are pictures of my suitemates’ room, which is set up like I was going to.

The bed is set up in a Captain's style, with the drawers and bookshelf underneath.

The bed is set up in a Captain's style, with the drawers and bookshelf underneath.

The two desks are along the longer wall, with the fridge between the desks.

The two desks are along the longer wall, with the fridge between the desks.

As a result of these changes, one of the beds no longer fit along the shorter wall (the side with the door), and nothing worked anymore! All my plans had been ruined! After a quick scramble to find an acceptable room design, we decided upon this design (I would try to describe it but pictures would work better I think):

The two beds are lofted and closer together. Mine is along the far side of the room, and Patrick's is in the middle of the room.

The desks and drawers are under the beds, with our work areas in the room between the beds.

A lounge area is set up with a sofa, bean bag sofa, fridge, TV, and video games.

A lounge area is set up with a sofa, bean bag sofa, fridge, TV, and video games.

To achieve this setup, I just bought the sofa, and had the bean bag sofa donated to me from my friend. The leather sofa chair I used to have is now in the courtyard outside my room. The only drawback is that our beds are now lofted and relatively close to each other, instead of on opposite sides of the room. This hangout area is pretty sweet though. Fair trade.

On favicons

July 28th, 2008

I’ve spent several hours this weekend working on a favicon for my website and blog. I’ve finally settled on one I think I can live with – the simple little blue button with the letter M engraved in it.  I’m still not entirely happy with it, though, so it may change again in the near future.

I considered several different candidates, some of which I’ve shown below, for a favicon before settling on this one.

Gallery of rejected favicons

So what is the point of the favicon, and why am I spending hours working on this tiny 16×16 pixel image?  The favicon has become an important part of a website’s identity, representing it in the address bar, on browser tabs, and on bookmarks.  As all modern web browsers now have favicon support, this seemingly unimportant little image has become more and more important as a way to make a website stand out in tabs or in bookmarks.  A well made favicon makes a website look more professional and complete.  It adds a little personality to the site, making it more visible around other websites.

It’s not enough to have just any favicon, though.  The favicon is part of a site’s identity, creating a visual representation of it for its visitors.  Most web hosts or blogging engines come with a default favicon nowadays.  A blog or website that simply uses this default favicon is actually weakening its brand, as a visitor, when remembering the favicon will think of the host from which it originated instead.

At first glance, all these blogs look the same, as they all use the default blogger favicon.

A good favicon should fit the website to which it belongs.  It should match the logo or, if there is no logo, match the color scheme.  This is, for example, part of why I did not choose to use the rainbow colored ball should above as the favicon for this blog.  With the simple blue and white color scheme, a bright, colorful favicon would have looked out of place.  The simple blue button I finally chose was much more appropriate.

Favicons should not be taken lightly.  They are an essential piece to a website’s professionalism, and should be chosen with care.

About me

July 25th, 2008

Who are you?

I’m Marquis Wang.  I go to school at Harvey Mudd College in Claremont, California, where I am planning on majoring in Computer Science.  I grew up in Champaign, IL, attending the University of Illinois Laboratory High School, which I graduated from in 2007.

I like to keep busy with various programming projects, which range from designing and maintaining my personal web sites to writing small programs or games.  I will keep some of the more complete ones in my sandbox.

Otherwise, my interests vary from moment to moment.  I enjoy playing chess, going hiking, reading books, and going on adventures.

As a student, my employment status changes from year to year, but in the past 3 years, I have been a sysadmin for the University of Illinois’s Theoretical and Computational Biophysics Group, a student webmaster for Harvey Mudd College, and I am currently working as a programmer for the Cognitive Computation Group, once again at the University of Illinois.

Why do you blog?

I’m starting this blog as a record of the things that I’m interested in – things that I am working on or thinking about.  I can research things that I find interesting, then document my findings on this blog, so that I can refer back to it as necessary.  At the same time, other people can benefit from the same information, and hopefully give some feedback so I’m not working in a black hole.  Some people say that isolation is the best environment for creativity, but I find that it is far too easy to find yourself in a rut unless you have some outside input.

What exactly is a monochromatic oeuvre?

Monochromatic: (adj) Containing or using only one color; monotonous or lacking in variety
Oeuvre: (noun) The works of a painter, composer, or author regarded collectively; a work of art, music, or literature

Therefore, a monochromatic oeuvre is a collection of art of all one color or type.  Hopefully, the contents of this blog will be at least slightly polychromatic.  The title is a tribute to one of the best comic strips of the last two decades, Bill Watterson’s Calvin and Hobbes.  I’ll leave it as an exercise for the reader to find the exact strip in question.

How can I contact you?

marquis@marquiswang.com