2010-04-17

Solaris 9 on Ubuntu!

Today, I successfully installed Solaris 9 (x86) guest operating system on Ubuntu 9.10 (Karmic Koala) host operating system. I used VMware Player to virtualise the Solaris 9 OS.

I had bought the Solaris 9 media back around 2003, and have been waiting for the right time to install the software on a spare computer (so I have been thinking, for years). But thanks to VMware Player, installing Solaris 9 and other interesting operating systems is now much easier than ever.

To do this install, I followed the directions from VMware on Solaris 9 guest OS: http://pubs.vmware.com/guestnotes/wwhelp/wwhimpl/common/html/wwhelp.htm?context=guestnotes&file=guestos_solaris9.html

Here are the results (I know, the display settings need some work)...

Solaris 9 on Ubuntu!

2010-03-16

Management of Software Projects: General Guidelines

Over the years I have been fortunate (and unfortunate) to have worked under a variety of project managers. Additionally, I have performed the roles of a technical lead and a project manager.

Here, I do not go into the finer aspects of management of a software project, but rather, emphasise the human element of leadership. In fact, the best book on leadership I have ever read is Steel My Soldier's Hearts, by Colonel David H. Hackworth (and his wife, Elihys England). This book definitely demonstrates how to lead, and has lessons that can be applied to any leadership position.



This post is not a summary of Hack's ideas (read the book--it's fantastic); but his work inspired some of the bullets below.

When in a leadership position, whether it be as a technical lead or project manager (or both), it is best to follow these guidelines:
  • Lead by example and lead from the front. You should be able to jump in and help with the actual work, if needed. You do not need to know all aspects of the domain of a problem, or how to do everything with a given framework, API, or language, but you should be able to function as an actual member of the development team. Because of all this, you should have the same IDE, build tools, version control client, developer system accounts, etc, as the rest of the development team. Be on top of what is being done--attempt to do builds of each iteration. Make sure that you monitor what goes into source control (either by watching the logs or by receiving email updates).
  • Appear serious most of the time. Especially in the beginning, when people are just starting to get to know you. Having a serious, intense look, but not angry or nervous-looking, will help people to take you seriously. Then, later on, if you smile or laugh at a joke, they will feel pleased that you have a "fun" side, too. But if you are smiley and happy from the start, they might not take you so seriously. A lot of leadership involves good showmanship.
  • Be friendly, but do not fraternise. Whilst being serious most of the time, you can still be friendly, just do not try to be close friends with your subordinates. Avoid going out drinking with them. Do not appear to be friendlier to one over another.
  • Do not assume that most tasks can be simply broken down into smaller subtasks in the form of steps. Some managers make this mistake in thinking that everything is done sequentially, and can be put into clearly defined steps. Some complex problems instead require parallel efforts and re-iterative techniques.
  • Take care of EVERY individual on your team. Make sure everyone has all the tools they need to get the job done. Make sure everyone has a functioning workstation and functioning accounts. Also, make sure everyone has equal access to equally good tools. If you have something someone needs, and you do not require it yourself, be willing to swap theirs with yours. For example, if your subordinate has a problematic monitor, and the company has none available to replace the monitor, then swap the monitor with your own. You should be like the general with shiny new boots who swaps his boots with the corporal who has worn-out boots with holes. Make sure everyone has an adequately comfortable work environment. Pay attention to every individual's complaints. Just because the rest of the team may not be complaining, does not mean that it's just one person with a problem; many are reluctant to speak up. So at EVERY meeting, ask everyone if they have what they need--do they need any extra tools to get the job done; are their workstations functioning adequately.
  • Treat every individual on the team with dignity. Treat everyone as you would want to be treated. Never ridicule, insult, or shout at anyone. Do not be condescending. Never suggest or imply to an individual that they "might be better doing something else, like [fill in the blank with a role that is lesser than the person's title]". If they are unhappy, it might very well be because you are not giving them suitable opportunities.
  • Use POSITIVE reinforcement and praise your subordinates FREQUENTLY. As an owner of several canines over the years, I have learned a lot about positive reinforcement. Workers are like dogs who love to be praised. You can get them to leap through hoops if you give them encouragement. Then, when they are being difficult, you can surprise them with a very stern voice and get their attention.
  • Never show favouritism. Do not take only certain subordinates out to lunch, or only invite select individuals to sit with at lunch. Also, if you do take the whole team out for a meal, make sure you attempt to accommodate the dietary restrictions of the individuals (some cannot enjoy alcohol, or eat anything that simply was cooked on the same surface as an "unclean" food). Do not ignore the fact that one team member might have lesser tools than another; make sure that the poorer one is brought up to the same level of toolsets.
  • Teach whatever needs to be taught, and more. Any good leader must be a teacher, too. You should be able to show anyone on the team how to do what must be done, or at least point them in the right direction. The managers or leads that say things like "I don't want to have to babysit" so-and-so; or, "I shouldn't have to spoon-feed" so-and-so, are fools that have no business occupying a leadership position. If you do not know how to teach the topic that needs teaching, you should at the very least link up the individual with someone who can show them the way. EVERY manager should be a good teacher. If you refuse to do this, then you should get out of IT project management.
  • Do not let anyone on your team just fail. That is, do not let them drown if they are struggling. Do not have the attitude of "sink or swim". If someone is failing, and yet they are trying to give a good and honest effort, then you need to show them the right way to get the job done. If anyone should have to stay late or come in on a weekend, it is the project manager--the manager was supposed to ensure that the tasks could be accomplished within normal business days (8 hours of work per business day, in most of North America).
  • Get rid of cubicle walls, if at all possible. Few things are as irritating as hearing someone near you, but not being able to see them. People should feel comfortable and confident about approaching other members of their team.
  • Avoid crass or disgusting habits. Such as: sitting on other's desks, using your saliva to clean off your keyboard, flossing at your desk, picking at your toes, etc. Practise good hygiene.

2010-03-07

Diagram of Skills: Perfect for IT Interviews

In addition to the typical CV/résumé for an IT interview, it might be helpful to the prospective employer to see a concise page displaying the candidate's skills. Because many of us who have been in the IT field for several years have very long lists of programming languages, frameworks, tools, IDEs, APIs, etc, that we have worked with, it might be helpful to break out the skills into separate categories. Better yet, instead of just listing them on a page, why not make a diagram? Here is a simple example:



Such a diagram can be saved to a PDF, then emailed to prospective employers or distributed at interviews.

2009-11-10

Bash Script to Web Scrape Forex Data

I like to track the value of the Loonie in US dollars; ie, CAD to USD. I often thought to myself that it would be fantastic to have a software application that can email me foreign exchange rate information on a periodic basis.

Using a script employing bash, grep, awk, and sed, this is possible, especially if you run the script as a cron job. This script does a web scrape of data from fxware.com.

The script fxgrab provides a convenient way to send an email notification of foreign exchange rate data via a bash script in a POSIX-like environment (such as in Cygwin or Linux). Feel free to use the code listed below for your own applications/utilities. The variable FROMCURR represents the currency converted to another currency (TOCURR). Enjoy!


#!/bin/bash


# fxgrab
# Copyright (c) 2009 Mike Quentel

# Permission is hereby granted, free of charge, to any person
# obtaining a copy of this software and associated documentation
# files (the "Software"), to deal in the Software without
# restriction, including without limitation the rights to use,
# copy, modify, merge, publish, distribute, sublicense, and/or sell
# copies of the Software, and to permit persons to whom the
# Software is furnished to do so, subject to the following
# conditions:

# The above copyright notice and this permission notice shall be
# included in all copies or substantial portions of the Software.

# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
# EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
# OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
# NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
# HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
# WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
# FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
# OTHER DEALINGS IN THE SOFTWARE.

# CONFIGURATION -- REPLACE THE FOLLOWING VARIABLES TO RUN THIS:
# FROMCURR = THE CURRENCY YOU ARE CONVERTING FROM.
# TOCURR = THE CURRENCY YOU ARE CONVERTING TO.
# FROM = WHO THE EMAIL IS FROM.
# SUBJECT = EMAIL SUBJECT.
# SMPTPSERVER = THE SERVER USED TO SEND THE EMAIL.
# PORT = EMAIL PORT.
# USER = EMAIL USER.
# PASSWD = EMAIL PASSWORD.
# RECIPIENT = EMAIL ADDRESS OF MESSAGE RECIPIENT.


CURRENT_DATE=$(date "+%A %Y%m%d %H:%M:%S")
FROMCURR="CAD"
TOCURR="USD"
FROM="replytothisaccount@someserver.com"
SUBJECT="FOREX NOTIFICATION"
SMTPSERVER="smtp.myisp.com"
PORT="587"
USER="myispuseraccount"
PASSWD="myisppassword"
RECIPIENT="somerecipient@someaddress.com"

cd /var/tmp
wget --post-data "f=$FROMCURR&t=$TOCURR" -o /dev/null -O forex.asp http://www.fxware.com/forex-currency/forex.asp
FX=$(grep -oE toa.*[0-9] forex.asp | awk '{print $3}' | sed -e 's/16px;">//g')
MESSAGE="Foreign exchange data accessed at $CURRENT_DATE on this server. 1 $FROMCURR = $FX $TOCURR"
echo $MESSAGE | email -f "$FROM" -s "$SUBJECT" -r "$SMTPSERVER" -p $PORT -u "$USER" -i "$PASSWD" -m login $RECIPIENT
rm -f forex.asp

2009-11-07

Bash Script Using wget to Update Twitter

The script BWTU (Bash-Wget-Twitter-Updater) provides a convenient way to update Twitter from a command line (such as in Cygwin or Linux). Feel free to use the code below for your own applications/utilities. To put more content in the Twitter updates, you can omit the CURRENT_DATE and UTC_DATE entries which are tagged onto every update by default in this blog post listing. Enjoy!

#!/bin/bash



# BWTU (Bash-Wget-Twitter-Updater)
# Copyright (c) 2009 Mike Quentel

# Permission is hereby granted, free of charge, to any person
# obtaining a copy of this software and associated documentation
# files (the "Software"), to deal in the Software without
# restriction, including without limitation the rights to use,
# copy, modify, merge, publish, distribute, sublicense, and/or sell
# copies of the Software, and to permit persons to whom the
# Software is furnished to do so, subject to the following
# conditions:

# The above copyright notice and this permission notice shall be
# included in all copies or substantial portions of the Software.

# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
# EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
# OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
# NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
# HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
# WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
# FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
# OTHER DEALINGS IN THE SOFTWARE.




# DATE AND TIME.
CURRENT_DATE=$(date "+%A %Y%m%d %H:%M:%S")
UTC_DATE=$(date -u "+%A %Y%m%d %H:%M:%S")

# CD TO /var/tmp
cd /var/tmp

# READ IN LOGIN INFO.
echo -n "username: "
read -e USER
echo -n "password: "
stty -echo
read -e PASSWD
stty echo
echo 

# WHILE LOOP -- CTRL+C TO BREAK.
echo "Enter ctrl+c to exit..."

while true; do

  # READ IN STATUS COMMENT.
  echo 
  echo -n "Enter status update to Twitter: "
  read -e STATUS

  # DO wget OF STATUS UPDATE TO TWITTER.
  wget -O /dev/null -o /dev/null --http-user=$USER \
  --http-password=$PASSWD --post-data "status=$STATUS \
  -- $UTC_DATE UTC /  $CURRENT_DATE LOCAL" \
  http://twitter.com:80/statuses/update.xml

done

Using wget to Interact with Websites

wget is an outstanding software for interacting with websites. I've used wget to automate downloads of backup files from an ISP, as well as to make posts to Twitter.

For your convenience, here are some useful examples of posting to a site requiring sign-in and authentication...

Logging into an HTTPS site with user name and password:


#!/bin/bash
CURRENT_DATE=$(date "+%Y%m%d")


# LOGS INTO SERVER.

wget -O /dev/null -o /dev/null --keep-session-cookies --no-check-certificate --save-cookies cookies.txt --post-data "login=myusername&password=mypassword" https://secure.somewebsite.com/Authentication/Account/Index.rails


# NAVIGATES TO A PAGE WITH A LINK TO A DATABASE BACKUP.
wget -O /dev/null -o /dev/null --keep-session-cookies --no-check-certificate --load-cookies cookies.txt --save-cookies cookies.txt https://secure.somewebsite.com/HostingManager/Databases/BackupFiles.rails?databaseId=xxxxxxxx-yyyy-zzzz-1111-222222222222


# DOES A GET REQUEST ON THE PAGE.
wget -O /dev/null -o /dev/null --keep-session-cookies --no-check-certificate --load-cookies cookies.txt --post-data "databaseId=xxxxxxxx-yyyy-zzzz-1111-222222222222&fileName=my_database_name_${CURRENT_DATE}.BAK" https://secure.somewebsite.com/HostingManager/Databases/CopyBackup.rails


# DOES AN FTP REQUEST.
wget ftp://username:password@ftp.someftpsite.com/database/my_database_name_$CURRENT_DATE.BAK*







Now, here is an example of doing an update to Twitter (based on information from an excellent article by Mark Gibbs at http://www.networkworld.com/columnists/2008/052108-gearhead.html):


#!/bin/bash
CURRENT_DATE=$(date "+%A %Y%m%d %H:%M:%S")
UTC_DATE=$(date -u "+%A %Y%m%d %H:%M:%S")


wget -O /dev/null -o /dev/null --http-user=myusername --http-password=mypassword --post-data "status=Hello World using wget! $UTC_DATE UTC / $CURRENT_DATE LOCAL" http://twitter.com:80/statuses/update.xml


2007-06-20

Groovy and Grails: Introduction



Groovy and Grails very much excite me.

Groovy is an alternative programming language for the Java Virtual Machine (JVM). Java Specification Request 241 (JSR 241) states that "Groovy is an agile, dynamic programming language for the Java Virtual Machine". This alternative language for the JVM has been around for a few years; see the blog of James Strachan. A programmer can put into a few lines of Groovy code the same task that would take several more lines of Java.

According to the Grails official web site, Grails is "an open-source web application framework that leverages the Groovy language and complements Java Web development"; in other words, a programmer can use Grails to build web applications in a simple, organised manner using the Groovy and Java languages. The idea behind Grails is to build upon some of the desirable functionalities available in the web application framework Rails, but with functionality more familiar to Java developers. The official Grails web site does a better job of fully explaining Grails than what I care to do here.

So, I'd like to share my journey exploring Groovy and Grails....

Quick note: I recently purchased a new laptop (or "notebook")--a Lenovo Z61m running Microsoft Windows Vista Home Premium operating system. Some software do not install or run properly on Vista, but this should be a temporary state of affairs with most major Windows software manufacturers. Thankfully, Java appears to run well on Vista; so, once again, Java has proven itself a reliable platform.

To get started, I wanted to use a good IDE for Java development, so I downloaded my favourite Java IDE: JDeveloper (aka "JDev"). Right now, I have Studio Edition Version 10.1.3.2.0.4066. When I downloaded JDev, I selected the Base Install (does not include JDK) rather than the Full Install (includes JDK). I'd also downloaded and installed the latest JDK (JDK 6u1) from Sun. I decided to do this so as to have JDev running with the latest JDK.

Next, I downloaded a free Groovy plug-in/add-on/extension for JDev through the Help-->Check for Updates dialog in JDev (this ability to easily download plug-ins for JDev is fantastic).

Then, I downloaded Grails from the official Grails web site. At first, I thought that since the Groovy plug-in for JDev included the necessary Groovy library, that I would not need to download Groovy for Grails to run; i.e., I thought that I'd be able to tell Grails to use the Groovy library in the JDev extensions directory. Apparently, this did not work; so I downloaded Groovy from the official Groovy web site. After installing both Grails and Groovy, and setting Windows environment variables that include JAVA_HOME, GRAILS_HOME, and GROOVY_HOME, as well as updating the Path variable to include references to bin directories of Groovy and Grails, I was able to create a new Grails project.

Before attempting to work with Grails, it helps to test if it exists by typing the following request for Grails Help at the command line:

grails /?

Next, at the command line, try to create a new Grails application using the create-app command:

grails create-app my_grails_example

You should see output from the command line that looks something like the following:



The resulting directory structure will appear like this:
C:\Users\mikequentel\my_grails_example
├───grails-app
│   ├───conf
│   ├───controllers
│   ├───domain
│   ├───i18n
│   ├───services
│   ├───taglib
│   ├───utils
│   └───views
│       └───layouts
├───hibernate
├───lib
├───plugins
│   └───core
│       └───grails-app
│           ├───taglib
│           └───utils
├───scripts
├───spring
├───src
│   ├───groovy
│   ├───java
│   └───test
├───test
│   ├───integration
│   └───unit
└───web-app
  ├───css
  │   └───tree
  │       ├───check
  │       ├───default
  │       ├───folders
  │       └───menu
  ├───images
  │   └───tree
  │       ├───check
  │       ├───default
  │       ├───folders
  │       └───menu
  ├───js
  │   ├───prototype
  │   └───yahoo
  │       └───assets
  ├───META-INF
  └───WEB-INF
      ├───classes
      ├───grails-app
      │   └───i18n
      ├───lib
      ├───spring
      └───tld

Because Grails includes a Jetty container, you can immediately test the web application (though you will probably want to configure Grails to run on another Servlet Container or J2EE platform). Navigate to the base directory of your Grails application (in this example, navigate to my_grails_example). Then, use the run-app command:

grails run-app my_grails_example

You should see something like this at the command line:



Once this runs, you can then launch a browser window and enter the URL provided in the end of the output at the command line (in this example, http://localhost:8080/my_grails_example). You should see something like this:



Because this is just a skeleton of a Grails application, there is no list of controllers as might be suggested in the welcome message.

After I create an example with some more functionality, I shall show you how Groovy and Grails can provide a powerful tool set for developing web applications.