Reform in Education

August 15, 2007

If only educators were required to see this (~20 minute) TED presentation before being given the minds of our students. Sir Ken Robinson focuses on creativity in the arts throughout this talk, but any programmer knows the benefit of being able to think creatively when writing code.

Sir Ken Robinson – Do Schools Kill Creativity? (via TED)

http://www.ted.com/talks/view/id/66

On Being Happy

May 25, 2007

My latest co-op has been an interesting one.

I’m working for SAIC down at their Chantilly, VA location but live in Columbia, MD. This results in a 112 mile daily commute through agonizingly slow traffic along the DC beltway (up to 3 hours in one direction when there is a bad accident). Add the long commute to an intern’s hourly wage slowly being strangled by the cost of rent ($500 monthly), food (~$200 monthly), and increasing gas prices (~$300 monthly) compounded by living 2,500 miles from my nearest family member and one can find themselves feeling overwhelmed.

There are however factors that make it bearable, even rewarding, and I hope that sharing them will help someone in a similar position:

First, I know this is temporary. I have committed to this situation for six months, and the amount I am learning about the professional world is invaluable. (For example, guess who is going to avoid a long commute if at all possible in the future? That’s right, yours truly. It just isn’t worth it.)

Second, I’m making connections in a very job-hot sector. Washington DC has got to be the easiest location to get a job at any level if you just know a couple people. Everyone here is so interconnected that just throwing out an e-mail to a friend or old manager is bound to net you a reply of a job opening in their company or one of the other agencies they routinely interact with. Managers talk, and are always looking for talented people.

Third, the commute is completely handled by your mindset. At first I was frustrated, tense, and bored just sitting in my car every day. Then I purchased an FM transmitter for my MP3 player and things changed. Now, while I wouldn’t say I look forward to my commute, I don’t dread it either. Audio books, lectures in various subjects from respected professors, and stretching my brain to extend my comprehension of German now occupy my time. It is actually kind of relaxing, and the time passes pretty quickly now. (Just remember to pack a water bottle and snacks! :) )

Fourth, I am recouping my gas costs by working overtime. I come in and leave early most days, but Thursdays and Fridays have the worst traffic by far, so I stay for two or three hours after my normal leaving time and work through the traffic. This time is my most productive because the weekend is close and no one is around, and getting paid 1.5x my hourly wage for these couple of hours really help when paying at the pump.

Fifth and most importantly, a lifestyle change. Specifically, I now make better use of my free time and balance the amount of time allocated to different activities. Number one on this list is spending time with my girlfriend. Being gone for 12 hours out of a day results in missing out on a lot of shared time, so I make it a point to use my two to four hours of daily free time to do things with her. Lately, we’ve been eating dinner, walking the dog, and either jogging around a loop nearby or to the library to get more books to keep moving. Then we wrap things up with back rubs and watching an episode of whatever TV show we are in the mood of before going to bed. It is amazing! If you aren’t spending quality time with your family and loved ones, you are missing out on something huge. Number two but equally important has been an attitude adjustment from my old style of skeptical and negative to skeptical and positive. Just giving people the benefit of the doubt and being a nicer person has made me feel a lot better about myself and my situation. It seriously has made me a happier person in general. Number three is personal enrichment. While you always feel busy and overworked, I’m learning that when you look back on yourself you can’t believe how much free time you had and wasted. I’m stopping that cycle and using my free time now to read more, spend more time outside enjoying the sun, and enjoy the company of others – because honestly the thing that has made me the most happy with my life is by making myself happy. It works.

Transition

March 27, 2007

I’ve decided to take a couple quarters off of school and accept a position at SAIC, and my new ISP doesn’t appreciate it’s users hosting services. Because of this, I’m moving to wordpress’s free blog hosting service. Everything transitioned smoothly except the files – expect all the links to be broken for a while as I move and update things.

Regular postings will return soon!

My Time With Facebook

December 17, 2006

Being one of the millions of Facebook users, I was pretty happy to hear that they opened up a restricted API for those interested in developing applications that interact with it. I found myself with a few hours one weekend, and came up with a simple application using the API to check if you have any Facebook messages. Normally I wouldn’t post a task like this because it was rather trivial, but I decided to anyway because I did it in what I think is a cool way.

First, the actual code to check the messages is written in PHP and hosted on my web server. It will refresh every five seconds and check if you have new messages, displaying an icon to open a new browser window to check the messages. It can be seen here. Notice that I’m much better at writing code than designing interfaces ;) If you are interested, I’m using the official Facebook PHP5 client as a base for the web portion of the application. Full source is here.

The second part of the final application is a program written in C#. It is a small window that fits the dimensions of the used part of that page, using the maximize button to switch between the messages pane and the login pane when required. Internet Explorer is embedded in the application to do the rendering, but is stripped down in terms of navigation and context menu usage. It is still possible to navigate outside of the intended area, but this is a limitation on how Facebook designed it’s login page. The source of the application can be obtained here (zip format) and the executable itself can be obtained here (zip format). The source was built using Visual Studio 2005 – you should be able to build it without complication.

But enough of the program specifics.

Web applications are nice for developers. They develop the application in one place, and the changes are immediate to all users of the software. Feature and security updates are completely transparent, and best of all, the users don’t have to worry about them. Developer liability goes down because users aren’t running around with out of date and possibly insecure versions of their application, and users are happy because they always have the latest version of the software – a win-win situation. Even better, developers don’t have to concern themselves with deciding which operating systems or platforms to develop their primary application for because it is all online. This opens the application to a huge market of people. On the down side, web applications aren’t as accessible to as many people. Most people understand how to click an icon and use a program, it takes a higher level of acceptance to understand, for example, that their web browser could be used to replace Excel. The obvious solution to this problem is what is exemplified in the small application I’ve written to do an overall meaningless task. Embedding a browser in an application allows developers to have a binary executable that the masses are comfortable with that navigates solely to a web application that the developers prefer to maintain. With proper design, the web application can be made to always look good within the client executable, and following some rules of development will prevent people escaping to other sites from within the application. Everyone is happy.

I might expand on the idea later. There are other ways this would be useful, and some other ideas I’d like to tack to the list of supporting reasons for this concept. We’ll see :) It should also be noted that these thoughts originally came out of talking with the very intelligent Mike Manzano in my time working as his intern at Topia Technologies. See Mike, I *was* listening!

Back To School: Terminal Tips

September 30, 2006

Over the past week I’ve been doing a lot of tweaking to my shell environment, and helping others do the same. I’ve come across a few fixes and common things that people might find useful, so here we go!

The first is a script snippet to change your shell to bash on login. It only works in some environments, but for those of you who are desparate, throw this in your .cshrc:

if ($?prompt != 0 ) then
     setenv SHELL_NAME /bin/bash
     if ($SHELL != $SHELL_NAME ) then
          set shell = $SHELL_NAME
          setenv SHELL $SHELL_NAME
          exec $SHELL
     endif
endif

One of the more frequent questions I answer is how to get around having to type ‘./’ to run programs in your current directory. The answer is in editing your PATH variable. Throw the following in your shell’s rc file:

export PATH=.:${PATH}

In order to make use of colors in your terminal, you first need to be using a terminal that supports them, and then tell the tty so. To do this, you need to change your SHELL variable to something that supports colors:

export TERM=xterm-color

To make full use of your color supporting terminal, we can make use of newer versions of grep and ls to make output use colors. While we are doing this, we might as well make things more human friendly, so let’s make du and df print out human friendly data. Aliasing automatically replaces words you’ve specified in your .bashrc with the strings they’ve been aliased to, and allows us to do all of these things at once. Here are some examples:

# Aliases for making the command line human friendly
alias df='df - h'
alias du='du -h'      # Make du and df always report human readable data
alias ls='ls --color'     # If your version of ls supports it, use colors
alias grep='grep --color'     # If your version of grep supports it, use colors

Finally, some misceallaneous tips. The first clears the *extremely* annoying issue of having a command line that doesn’t support backspaces or other common keys. Put this in your shell’s rc file:

stty sane

Some environments allow other users logged into the same machine as you to send messages to your terminal. This is annoying if your peers think it is funny to disrupt your debugging. To turn it off, just issue the following at the command line (to disable it for that session) or in your shell’s rc file as a permanent fix:

mesg n

And if you want to be one of those kids that interrupts someone else, don’t just write them stupid messages and giggle about it. It is much more entertaining to send an endless amount of gibberish to their screen. The following script will pipe data from /dev/random to another user’s terminal until you kill it:

#!/bin/bash
echo "Enter a username: "
read user
dd if =/dev/random | hd -c | write $user

We have a couple windows servers here in the SE department to run WSUS and AD. I set up the WSUS server and am responsible for maintaining it, but since I run Debian Linux and the machine is in the server room, I previously had to go to the server room to work on it. Being lazy, I did some searching and found rdesktop, a linux friendly implementation of the RDP protocol. Installation is easy if you are running Debian, Ubuntu, or one of the many flavors of linux based on Debian:


sudo apt-get install rdesktop

To use the client, pop open a terminal and issue:


rdesktop -u -p -

This will, after prompting you for your password, (the -p – part) attempt to start a remote desktop session with using and the password you supply.

Then again, you could skip a lot of this nonsense (and get around Microsoft’s ridiculously restrictive and expensive terminal licensing…) if you just installed an OpenSSH server on your windows machine via Cygwin, but that is for another post :)

Generic Process Keepalive

August 18, 2006

At work I was testing a server that would exit upon receiving a certain message. Having to restart the server every time I wanted to run another test got to be annoying, so I came up with this script to automate the process. It is written in ruby, and has been tested to work in MacOSX, Debian Linux, and MS Windows with Cygwin. There is no reason it wouldn’t work on other Unix-like systems, those are just the ones I tested.


#!/usr/bin/ruby
#
# This script will restart a process if it dies.
# Usage: ruby Proternal
#
# Written by Robert Peaslee
#

if $*.length   "
	exit( 1 )
end

$CMD_PATH = $*[0]
$CMD_PATTERN = $*[1]
$INTERVAL = $*[2].to_i

while true do
	processes = `ps | grep #{$CMD_PATTERN}`
	pcount = processes.length
	if pcount > 1
		p "Multiple processes found Exiting."
		exit( 1 )
	elsif pcount == 0
		`#{$CMD_PATH}`
	end
	sleep( $INTERVAL )
end

There is a direct link to the source file here.

First post!

August 8, 2006

This is just a placeholder until I can dedicate more time to something useful. Holding true to my roots,

Hello World!