CS Majors Need Something To Do!

Sunday, May 25th, 2008

In general, computer science majors arn’t the most social creatures.  There’s no particular hang out that you would go to to hang out with other computer science majors (In person at least).  This got me thinking about how other people meet other people.  In general you meet other people through parties, classes, events or other people.  Let’s cross off the first two on the list since I generally don’t specifically meet any other CS majors at parties and it’s summer, so class is not in session.  This leaves me with events and through other people;  These two in particular are how I meet a majority of my friends.

Last Friday (05/16/08) I organized a get together with my fellow students to go out for a beer in celebration of completing another  school year.  To my surprise people actually showed up and brought along some of their friends!  On top of that, the people who came actually had a good time and wanted to do it again!  Some already started talking about future events they had in mind.  To me this demonstrated a need for a central source of  events in Camarillo.  For those of you still in Camarillo, let’s face it, there isn’t really much to do here.  This is why it would be nice to establish a community of like-minded people to go hang out with.

I sit in front of a computer all day at work.  The last thing I want to do when I get home is to continue to sit in front of another computer.  I’d rather go outside and get active, hack on projects with friend, or simply enjoy a movie with others.  These sort of events will give us a chance to meet new people, a chance to exchange ideas, or collaborate with peers.  Already I met someone who was interested in collaborating on a project in python and showed me some stuff on recursive queries in MS-SQL.  Neat!  In general, I think this type of interaction is more important than interacting with a computer.

The obvious answer is to think of some events and send out invites!  The key I found is to just set a date to do something and people will show up.  Ideas I had in mind were LAN Parties (formal attire required?), simply going out for a beer (it seemd to have worked in the past!), movie nights (traditional and non-traditional), dinner parties, DevHouse (day-long hack-a-thon popularized in the bay area), and of course outdoor activities (camping, climbing, hiking).  So to all of you CS/IT majors in Camarillo/Ventura County, expect some invites to some events this summer!

ToDo This Summer

Friday, May 9th, 2008

So I pretty much have not updated whatsoever this semester.  Between school, work, homework and trying to maintain a social life, I haven’t had time for anything else.  With school over with in a week I’ll have free time again!  What will I be doing with this time?  This is what I got so far:

  •  Learn Python – I feel I should’ve avoided the whole Ruby craze and stuck with Python.  I started the O’Reilly book last summer, but never got around to finishing it.   I hope I have better luck this summer.
  • Learn C# – At work I’m pretty much forced to use .NET for some projects.  Since the only .NET language I remember is VB.NET I’ve been using that.  Instead I would prefer something that feels more like Java, thus the desire to want to learn C#.
  • Learn iPhone SDK – This is a “if I’m bored enough” idea.  I think it would be cool to write iPhone apps, but this doesn’t have any practical purpose.
  • Read – There are a few books I have in mind.  Here are a few that come to mind:
    • GTD – There’s so much information in this book, thus my desire to read it again.
    • The Pragmatic Programmer – Saw it at my school’s library
    • Books on System Theory - Jeff Lindsay started a google group for groksystems.  Of course this got me interested in Systems again.  I plan on finishing Ackoff’s Best and even found a couple books at the school library.
    • Chess books – I admit it: I like chess.
  • WeBGoat - This is a neat web security practice app.  It’s essentially a Tomcat server with insecure web pages (written in JSP) that teach you about a certain exploit and how to protect against it.  Sounds neat to me.
  • PBWiki QuickEdit – In my last post I had an idea for a notepad-like program that would instead edit wiki pages.  I actually want to make this program this summer.  The first thing I would have to do is make a library that does the communication and then write the application itself.  I’m kind of excited about this one!

So that’s the plan for this summer.  Writing down a list is one thing and doing it is another; we’ll see how it goes.

Idea for quick editing

Thursday, January 31st, 2008

I’m trying to transition my “ToDo” list to a wiki, but it’s just not as convenient as a simple text editor. I like the idea of being able to quickly open a file, edit and save it. With a wiki I have to open my browser, navigate to my wiki, etc. I think it would be cool to have a text editor that allows you to directly edit a page online. That way you only have to enter a URL and your credential information once (if you choose to save it that is). Whenever you open it, just find your file, make your changes and save. The updates would be sent to your wiki.

Anyways, I’m sure this would be a fun project when I have time, but just throwing the idea out there.

Jott

Monday, January 14th, 2008

Jott is my new favorite web app. I took notice of it when I noticed a few people using it on twitter. I would see a message with a link to a voice recording of the same message. This is a pretty neat use for it, but I have another use for it. Before I get ahead of myself, let’s look at what Jott is.

Jott is a service that allows you to leave voice mails for yourself, or other people, and have it transcribed into text. From the phone number you choose to use, it will ask you who you want to Jott and then allow you to leave a message up to 30 seconds in length.

I haven’t used it to send messages to anyone or to any service, but rather, I use it to take notes for later use. Before I would usually take a picture of something or record video as reminders to myself. Instead I call Jott, leave a message telling myself to add a movie to my Netflix queue or to check out a new band. When I get home, I have a transcribed version of my message waiting for me in my inbox. The neat thing about having a transcribed version of my message is that I just have to glance at it to remind myself. There is no need to listen to what I said which takes a slightly longer time.

The transcription process is fairly accurate; Just make sure you speak clearly into your phone. If Jott can’t properly transcribe your message, and you don’t remember what you wanted to remind yourself of, you can always listen to the original voice mail.

The added benefit of using voice is that it’s quicker than texting. I find cell phone keypads to be slow, and distracting. With this service I can quickly leave my message and go back to my normal routine.

I can definitely see the service becoming big since it has a lot of potential. I recommend everyone to check it out and maybe write about how it has streamlined some task for you.

Report back from SHDH22

Wednesday, January 9th, 2008

Since moving to Camarillo for college in August, I missed both SHDH20 and SHDH21 due to the increased distance between the Bay Area and where I live. However, since I’m back in San Luis Obispo for winter break, I was able to attend SHDH22. Instead of spending my time socializing and learning, I actually came with an agenda of things to do.

A few months back I registered the domain http://picturesofpeopletakingpictures.net because my friends thought it would be funny. (Alcohol was also involved and it seemed like a good idea at the time). I still don’t know what I want to do with it, but I put wrote up a small script using Rails that queries flickr and displays a random picture tagged “picturesofpeopletakingpictures.” It turned out to actually be a huge pain in the ass because the flickr gem I used had their own API key built in. Once I hacked together a fix for using my own, I got it working pretty quickly. When I uploaded it to my web server, nothing worked. Duh I forgot to freeze the flickr gem! Nope that wasn’t the problem. Apparently you have to use a folder structure like ~/flickr-ver_num/lib/flickr.rb. The library had ~/flickr-ver_num/flickr.rb. After struggling with that for at least 45 minutes, I had it up and running. Anyways, if anyone has suggestions of something better, leave a comment.

I started on a project that could turn into a DevHouse competition. More on this later if it actually happens.

Lastly, I started looking at the Android Java Framework by Google for Cell Phones. I mean why not? Google has some pretty good documentation and tutorials that I was able to follow and I end up writing a Hello World program!

Ruby Iterators

Wednesday, January 9th, 2008

I’m sure like most people, I started learning Rails by reading about….Rails. It would seem logical to learn Rails by reading about Rails, right? I think a better way of learning about Rails is to first master Ruby and THEN learn the Rails framework for Ruby. This approach has helped me debug some of those error messages that seemed so cryptic at first. Recently I picked up “Programming Ruby” by The Pragmatic Programmers. Reading it I found out that some of methods that I thought were part of the Rails framework actually belong to Ruby.

One of the things I wanted to focus on are the differences between three different types of iterators in Ruby that are commonly used in Rails: find, each, and collect. Let’s first start by asking what is an iterator? An iterator goes through each element in an array or hash table and let’s us perform an action using the individual element. Let’s check out the differences between these iterators.

find

Find is a bit misleading. The classical definition of a find method would be to return the index of the element (or perhaps the entire element itself) that matches a string. The find iterator method in ruby will instead compare each element using some comparison operator (<, >, ==, etc.) and based off of the boolean result (true or false), it will return the first matching value. For example say we have an array called a:

a = [ 1, 2, 3, 4, 5 ]

Using this array we want to find the first even value. Our code would look something like this:

a.find { |n| n % 2 == 0 }

Since 2 is the first even number, that would be the result.

each

Each is the simplest iterator method of the three. It simply traverses all elements in the array and returns each one individually. So if we want to print all lements of the array a, it would look something like this:

a.each { |n| print n }

The result would look like 12345

collect

Collect, or also known as map, is pretty much the same as each, except that collect returns an array of values. For this example, we’ll increment each element in array a and save the new element in b.

b = a.collect { |n| n + 1 }

This returns the array [2, 3, 4, 5, 6]

I hope this gives some insight on how Rails uses these methods.

Fix for “uninitialized constant Gem::GemRunner (NameError)”

Monday, December 31st, 2007

I tried upgrading my version of rubygems to the most current version by running
sudo gem update --system
Which introduced this error:
/usr/bin/gem:23: uninitialized constant Gem::GemRunner(NameError)
whenever I tried to run rubygems. On the rails forum, I found a fix for it!
Simply add the line to the file /usr/bin/gem (may be different on a mac)
require 'rubygems/gem_runner'
after
require 'rubygems'
This fixed the issue in both Ubuntu and OS 10.4.

Delete Vs. Destroy In Rails

Friday, December 21st, 2007

I’ve been writing this web app that has the following models: Order, Recipient, Message. An order has many recipients and a recipient has many messages. The recipients are also dependent upon the order and the messages are dependent upon the recipient.

In Ruby code this looks like:
Order.rb

class Order < ActiveRecord::Base
has_many :recipients, :dependent => :destroy
has_many :messages, :through => :recipients
end

Recipient.rb

class Recipient < ActiveRecord::Base
belongs_to :order
has_many :messages, :dependent => :destroy
end

The idea here is that when I delete an order, I also delete any associated recipients and any associated messages. My controller looked like this:

def delete
Order.delete(params[:id])
end

There are a couple things wrong with this. The first and most important thing is that when I delete a row in the order table, it leaves orphaned rows in the order and messages table. I want to delete these rows as well! The next thing is that this isn’t RESTful design. Instead of calling my method “delete,” let’s call it “destroy.” To fix the issue though, we need to use another method that has subtle difference than delete. Instead of delete, I should be using the destroy method. Why is that?

The delete method essentially deletes a row (or an array of rows) from the database. Destroy on the other hand allows for a few more options. First, it will check any callbacks such as before_delete, or any dependencies that we specify in our model. Next, it will keep the object that just got deleted in memory; this allows us to leave a message saying something like “Order #{order.id} has been deleted.” Lastly, and most importantly, it will also delete any child objects associated with that object!

Now my code in my controller looks like this.

def destroy
Order.destroy(params[:id])
end

Whenever I delete an order object, it will delete all child recipient and message rows in the database . This prevents any orphaned rows and allows for consistency in the database!

Wireless Issues on Gutsy Gibbon (and a fix!)

Wednesday, October 17th, 2007

I couldn’t wait and installed the latest RC of Gutsy Gibbon today. To my surprise the wireless did not work whatsoever! ifconfig didn’t list my interface, but it showed up when I ran lspci. I decided to boot into an older kernel (2.6.20) and it showed up! It must’ve been some sort of module that wasn’t loading in the 2.6.22 kernel. After doing some research I found out that this particular version of the kernel wasn’t loading restricted modules. If you’re having problems using devices that used to work in in Feisty Fawn try running this command:
sudo apt-get install linux-restricted-modules
After running this command my wireless drivers work (ipw2200bg) on my Dell Inspiron 9300.
I’m still trying to figure out how to get my screen resolution back to normal (It’s at 1680×1050 when it should be at 1920×1200). The moral of the story is to wait for everyone else to find the bugs before you make an upgrade!
Edit:
I fixed my display issue. Here’s a snippet of my xorg.conf file. Don’t simply copy and paste it, but use it as a reference to get yours to work
Section "Monitor"
Identifier "monitor1"
VendorName "Unknown"
ModelName "Unknown"
HorizSync 30.0 - 110.0
VertRefresh 50.0 - 150.0
Option "DPMS"
EndSection

Section "Device"
Identifier "Generic Video Card"
Driver "nvidia"
BoardName "nv"
BusID "PCI:1:0:0"
Screen 1
EndSection

Section "Device"
#
Identifier "device1"
Driver "nvidia"
BoardName "nv"
BusID "PCI:1:0:0"
Screen 0
EndSection

Section "Screen"
Identifier "screen1"
Device "device1"
Monitor "monitor1"
DefaultDepth 24
SubSection "Display"
Depth 24
Modes "1920x1200" "1440x900"
EndSubSection
EndSection

Afterwards I used System->Preferences->Screen Resolution to change the resolution and it works beautifully.
I recommend you make a backup of your xorg.conf file. Who knows when you might mess with it and everything goes wrong. It’s nice to have that backup in case things take a turn for the worse.

Facebook Apps are ruining Facebook!

Tuesday, September 25th, 2007

The reason I left MySpace was mostly because of all the spam I would receive. “Hot girls” were always trying to add me as a friend to promote their porn site. Luckily I know that girls like that arn’t into guys like me, so I wasn’t tricked like so many other people were. The same thing is happening with facebook. Friends want to send me drinks, say something on my superwall, turn me into a zombie. What the fuck? This is just as bad as the spam I was getting on myspace! One time I actually caved in and added one of the Facebook apps just to see what one of my old co-workers wrote on my “Superwall.” When I added it, it wanted to send an invite to each one of my friends by default. This to me is worm-like activity….as in computer virus-like activity.
There needs to be an option like “Mark Application as Spam” so people can get rid of these troublesome applications.