Justin Lín

Archive for May, 2009

Bypass MinUWet on Windows

May 26th, 2009  |  Published in Waterloo 2B  |  4 Comments

Wireless on the UW campus forces you to run an application (MinUWet) before it lets you use any port besides http (so, you can’t use ssh, imap, torrent, or anything useful).

That’s fine, however the annoying thing about MinUWet is that it won’t grant you privileges unless it detects that you have installed an antivirus on Windows. I’ve never had one or needed one, and I don’t plan to install one. [Anti-viruses cause way more problems than they solve (if they solve any). Trying to detecting viruses is pointless, even with heuristics, since they can be very easily recompiled/modified to be undetected (you’ll always be 1 step behind with an antivirus). The only thing that might be useful is having kernel-level hooks to protect special API’s, but I’ve never had problems such that it’s worth the trouble.]

Another reason it’s annoying is because it does not support the OS I am currently using, Windows 7, and it flags my computer as not having the correct updates.

Anyways, here’s how to bypass having to run MinUWet and get premium access (all ports) on Windows:

  1. Get VirtualBox
  2. Get any Linux live cd (preferably a small one): I use SliTaz
  3. Connect to uw-wireless
  4. Start the VM
  5. Login to UW-Wireless through the VM

minuwet

If you already logged in through Windows, just go to http://uw-wireless.uwaterloo.ca and logout. Then, log back in through the VM. The portal will think that you are running Linux and give you premium access without needed to run MinUWet.

Note: Don’t forget to save/close the VM after you’ve logged in as it can be battery draining…

Velocity Presentation on Startups

May 25th, 2009  |  Published in Waterloo 2B  |  1 Comment

[I found the last presentation at the Velocity kickoff event very insightful. I will be posting some notes on this soon.]

Omar Ismail, ProductWiki co-founder and CTO, presented tips for starting a business(?). Here are some of the notes I took.

Prioritizing

Time is finite, so to have time for your business, you need to make sacrifices somewhere:

  • Quitting TV is a must, following shows just eats up way too much time. Taking 6 hours to finish a season of Big Bang Theory could have been spent on an entire prototype for your business.
  • Quit Movies; I’m willing to watch less movies, but not quit…
  • Drinking; OK, can’t quit that.
  • Skip classes; great time saver here.
  • Anything that is cut is time that can be spent on your business

He sounded alot like my mom when mentioning a lot of these things, and she is always right. When you watch a movie, you aren’t wasting just the 2-3 hours watching the movie, you’re actually wasting closer to 5-6 hours which is almost an entire day without the eating time. This is due to time spent preparing to go out, meeting up with everyone (there’s always late people, like me), getting there, buying tickets, getting seats, screwing around, then getting back. Similarly, when you go drinking, you’re actually wasting close to 24 hours since the morning/afternoon after will usually be useless.

Ideas

  • Keep it simple!

This has been said so many times, but it’s because it’s easy to lose focus of this criteria. You try to get ideas that will impress people from the idea itself when it should actually be the execution that stands out. Having a complicated idea will usually both deter people from using such a product and be difficult to implement (higher costs with lower returns). So, to make this point easier to satisfy, two additional points were made:

  • Keep it focused (satisfying a single need)
  • It’s fine to copy/steal other people’s ideas

Pretty much everything has already been done now, it’s just a matter of doing it better, making it more focused and presenting it to people in such a way to encourage them to use it instead of a competing product.

Execution

Actually another thing my mom always tells me is don’t try to do everything perfectly and Omar mentioned this point as well. It’s all about cutting corners, getting things working quickly rather than perfectly. He mentioned that it’s better to release early and get feedback from users than to spend a considerable amount of time perfecting a product. Chances are, the feature that is taking too much time to perfect is something that will only be used by 5% of users.

Tools. Using the right tools is indispensable, and careful research into this can save countless hours. Instead of coding up your own libraries, a considerable amount of time can be saved by researching and using a public library that is already written and actively maintained.

Coding

  • Momentum is key
  • Keep a micro perspective of your work

Coding is about momentum. This is where the sum of it’s parts is less than the whole. Coding 3 sessions of 2 hours each will NOT be as effective as coding for 6 hours straight. Alot of development is about digging through information, and taking a break simply breaks your concentration and makes you lose your momentum.

Keeping a micro perspective while working allows you to do things that would otherwise not be possible. Thinking too much just gets in the way sometimes. If you keep a micro view, you don’t care whether something can or can’t be done, you just do it.

The Team/Respect

For startups, a small founding team was recommended. Omar argued for working with people close to you as in your siblings or parents. I would argue that genuine people are the kind of people that will be able to produce the spark needed for a business. These people are the kind of people who are predictable in the sense that they are consistent with who they are, but they are unpredictable in the creativity of their work.

Treat co-founding members with respect. A point one of the previous speakers made is that silence is disrespectful. This applies not only in work, but also in life. If you have a problem, say it. Doing otherwise is disrespectful and nobody gains anything.

Credits: www.productwiki.com

Unboxing NullPointerException

May 23rd, 2009  |  Published in Waterloo 2B  |  No Comments

I was working on a HashTable for SE240, and I ran into this retarded mistake.

I started with something like this, which worked fine:

int a[] = new int[5];
a[3] = 5;
for (int i=0; i<a.length; i++) {
    if (a[i] == 5)
        System.out.println("success! " + i);
}

However, I needed a way to mark an entry as “empty.” I probably can’t use “0” because “0” could be a valid entry. I could use “-1″ or any other negative number, but what if I needed negative numbers to be valid at some point. I could use a specific very large boundary number, but this also lacks flexibility. So, I decided to use “null” instead. To do this, I needed to change my int array to an Integer array:

Integer a[] = new Integer[5];
a[3] = 5;
for (int i=0; i<a.length; i++) {
    if (a[i] == 5)
        System.out.println("success! " + i);
}

Bam! NullPointerException. What the hell, what’s the difference?! The error happens on line 4. Java initializes arrays when they are created and an int[] would be initialized to “0”‘s but an Integer[] would be initialized to null. Hmm, this should still be fine, what’s the problem then? The culprit is in fact: unboxing. With an int[], the comparison is fine, but with an Integer[] it will implicitly dereference the Integer object. Since I only set a value for a[3], the rest will be null, and a comparison will implicitly dereference the Integer object which causes the NullPointerException.

The cure:

Integer a[] = new Integer[5];
a[3] = 5;
for (int i=0; i<a.length; i++) {
    if (a[i] != null && a[i] == 5)
        System.out.println("success! " + i);
}

Maybe I should have gone to some of my CS134 lectures.

Set root password on Ubuntu

May 15th, 2009  |  Published in Waterloo 2B  |  No Comments

To be able to login as root

:~$ sudo passwd

Alternatively

:~$ sudo sh

Week 13-16: The End

May 11th, 2009  |  Published in Sun Microsystems  |  No Comments

The first week of school was so busy that I don’t really remember what I was going to write about the end of the work term. A new perspective on the research world, much better time management and Unix tools are the main things I’ve learned besides CS theory.

To sum up:

Did I learn alot? Yes.
Would I go back? Definitely.

[Rant: When I said “step away from the Windows world,” I didn’t mean from an OS perspective, but instead from a tools perspective (latex saved me so much time for the work report). Windows is still my OS of choice (Windows 7 is great), but it’s command-line interface is inferior, at least to me, to a full blown Unix shell (batch scripting *shudder*). In certain ways, having a default crippled command-line is good for security since Windows does not support a remote login shell unless you enable WinRM and even if you get in, there’s not too much damage you can do.]