Thursday, December 2, 2010

How I Fixed Ubuntu Boot Issue with Error Message, "Starting up... Undefined video mode 31f"

I ran some updates on Ubuntu 10.10 and found that when I booted up I got the message, "Starting up... Undefined video mode 31f".  (Sorry I am not sure which update caused this.)

I hit space and allowed it to continue.  I then watch Bleach 296, did a few other things and called it a day.  The next day when I booted up, same issue (I was kind of hoping it was a non-issue issue, O-well).

I googled the error message and found this post, which made perfect sense to me (I also found a lot of other posts that made no sense and gave no real fixes).  Following what was in post in the form, I did the following:

apt-get install hwinfo
sudo hwinfo --framebuffer

Giving me:

02: None 00.0: 11001 VESA Framebuffer                        
  [Created at bios.464]
  Unique ID: rdCR.zrHRJLheAS6
  Hardware Class: framebuffer
  Model: "NVIDIA G84 Board - p410h1b "
  Vendor: "NVIDIA Corporation"
  Device: "G84 Board - p410h1b "
  SubVendor: "NVIDIA"
  Revision: "Chip Rev"
  Memory Size: 14 MB
  Memory Range: 0xfb000000-0xfbdfffff (rw)
  Mode 0x0300: 640x400 (+640), 8 bits
  Mode 0x0301: 640x480 (+640), 8 bits
  Mode 0x0303: 800x600 (+800), 8 bits
  Mode 0x0305: 1024x768 (+1024), 8 bits
  Mode 0x0307: 1280x1024 (+1280), 8 bits
  Mode 0x030e: 320x200 (+640), 16 bits
  Mode 0x030f: 320x200 (+1280), 24 bits
  Mode 0x0311: 640x480 (+1280), 16 bits
  Mode 0x0312: 640x480 (+2560), 24 bits
  Mode 0x0314: 800x600 (+1600), 16 bits
  Mode 0x0315: 800x600 (+3200), 24 bits
  Mode 0x0317: 1024x768 (+2048), 16 bits
  Mode 0x0318: 1024x768 (+4096), 24 bits
  Mode 0x031a: 1280x1024 (+2560), 16 bits
  Mode 0x031b: 1280x1024 (+5120), 24 bits
  Mode 0x0330: 320x200 (+320), 8 bits
  Mode 0x0331: 320x400 (+320), 8 bits
  Mode 0x0332: 320x400 (+640), 16 bits
  Mode 0x0333: 320x400 (+1280), 24 bits
  Mode 0x0334: 320x240 (+320), 8 bits
  Mode 0x0335: 320x240 (+640), 16 bits
  Mode 0x0336: 320x240 (+1280), 24 bits
  Mode 0x033d: 640x400 (+1280), 16 bits
  Mode 0x033e: 640x400 (+2560), 24 bits
  Mode 0x0345: 1600x1200 (+1600), 8 bits
  Mode 0x0346: 1600x1200 (+3200), 16 bits
  Mode 0x0347: 1400x1050 (+1400), 8 bits
  Mode 0x0348: 1400x1050 (+2800), 16 bits
  Mode 0x0349: 1400x1050 (+5600), 24 bits
  Mode 0x034a: 1600x1200 (+6400), 24 bits
  Mode 0x0352: 2048x1536 (+8192), 24 bits
  Mode 0x0360: 1280x800 (+1280), 8 bits
  Mode 0x0361: 1280x800 (+5120), 24 bits
  Mode 0x0362: 768x480 (+768), 8 bits
  Mode 0x0364: 1440x900 (+1440), 8 bits
  Mode 0x0365: 1440x900 (+5760), 24 bits
  Mode 0x0368: 1680x1050 (+1680), 8 bits
  Mode 0x0369: 1680x1050 (+6720), 24 bits
  Mode 0x037c: 1920x1200 (+1920), 8 bits
  Mode 0x037d: 1920x1200 (+7680), 24 bits
  Config Status: cfg=new, avail=yes, need=no, active=unknown

I figured I'd use 0x0369

I then edited grub using:

sudo gedit /boot/grub/menu.lst

I look for the "vga=" and change it to the mode value I wanted to use (0x0369)

## ## End Default Options ##

title Ubuntu 10.10, kernel 2.6.35-23-generic-pae
root (hd0,6)
kernel /boot/vmlinuz-2.6.35-23-generic-pae root=UUID=3608162f-dcd7-4b92-b1d9-c2162c720162 ro quiet vga=0x0369 
initrd /boot/initrd.img-2.6.35-23-generic-pae

Restarted and now no more error message!

Saturday, October 30, 2010

On Communication

Spaceship Earth

This fall for my fifth wedding anniversary to my lovely wife, we went to Disney World and Universal's  Islands of Adventure (to go to the Wizarding World of Harry Potter).  While at Epcot we went on Spaceship Earth, the newly redone ride in the big sphere.  The ride was very interesting as it tells the history of the mankind.

The theme running through the ride (at least to me) was that of the evolution of communication.
Spaceship Earth starts with the dawn of human kind, humans hunting by themselves, it then goes on to say the first breakthrough was people working together to hunt.  From groups hunting we have tribes, then towns, cities, and countries forming.  All-a-long this forming of larger groups of people we find people sharing information as key to progress.  This progress spans from: early cave drawings, to papias writings, books, universities, libraries, and finally computers with large databases and other means of storage.  A very interesting way of looking at the history of mankind.

Basic Patterns of Communication

Spaceship Earth got me thinking again about something I've been thinking about since my undergrad at NIU, there are really only two forms of communications, information sharing and information downloading.

Information Sharing

Information sharing, to me, is anytime you have more than one entity sharing information.  Example of this are a conversation among two people.  A conversation is when all parties are speaking and thinking about what each other are saying and are forming a pool of shared meaning and knowledge, all parties gain knowledge and insight from this conversation and leave it with more knowledge than before it took place.

In the picture above we have two people, Jim and Cindy (my parents) communicating back and forth with each other.  We could easily abstract this to two computer systems communicating as shown below.

There is no difference in the pattern between Jim and Cindy speaking and Chrome and Google communicating, they both share information back and forth and leave the conversation with more knowledge than when they entered it (true you could say that Chrome and Google do not gain anything, but they could if they wanted to and sometimes do, i.e. browser cookies and web server analytics).

Information Downloading

Information downloading, again to me, is anytime one entity is obtain information from an information storage.  This storage can take any form: a book, database, or even a teacher.  In this form of communication only one entity gains anything from the communication, the storage gains nothing.  An example of this would be a presentation, in the typical presentation the presenter gains no new knowledge on the presentation they are giving, but the observers of the presentation gain the knowledge being presented.

In this picture we have myself presenting a topic to an audience.  Since I am just presenting, I am not gaining any new knowledge on the topic while (I hope) the audience is gaining new knowledge about the topic being presented.  This can be abstracted to web service and a database as shown below.

There is no difference between Mike and the audience or GetParty web service and the Party Details database, both the audience and GetParty are downloading information from Mike and Party Details.  In both cases Mike and the Party Details database gain nothing from the exchange.

Saturday, October 2, 2010

How to format the Date and Time in an Ant Script

Configuration Nightmare

On the current project I am working on, we have people in three different timezones working on the same code and environments.  We have a fairly normal testing environments set up of: Unit, Integration, System, Acceptance, and Regression levels.  Our current deployment strategy calls for each WebService to have everything it needs in one package, meaning that if WebService A and B both use the same Data Access jar, then both WebService packages will have their own versions of the jar.  As you may have guess this works fine for the most part if that Data Access jar is not changing, but if it does change then both WebServices will have to be redeployed if they both want to use any changes to the Data Access jar.

This strategy can lead to the following issues (shown in this UML Deployment Diagram):

If you look closely you will see that in GetAccount WebService in the Integration level we have version 1 of the DataAccess jar, if all our testing validates that this service works but we want the new functionality of version 2 of the DataAccess jar, we will have to retest with version 2 to validate that the new jar does not cause issues.  This issue is easy enough for the Environment Manager, all they have to do is deploy the GetAccount WebService with version 2 of the DataAccess jar.  The Environment Manager will just have to go to the CMS and get version 2 of the jar, unfortantly the CMS is designed to be accessed by dates of atrifacts and has a totally different concept of versions.  To make matters worst the Environment Manager is in a different timezone than the developers and the CMS they use.

This was the kind of position I found myself in recently.  The MAINIFEST.MF in the jar was using a date and time format that was in the European style (day/month/year) with a time without a timezone.  The Ant script was creating a MAINIFEST.MF file with attributes for the data and time that confused everyone, so I went in and changed the script.  That is when I found out there was no single document that covered the Ant TStamp task in full.  I hope the rest of this blog will solve that issue.

Ant TStamp Task

TStamp Task has the following format:

propertyThe property to receive the date/time string in the given pattern.Yes
patternThe date/time pattern to be used. The values are as defined by the Java SimpleDateFormat class.Yes
timezoneThe timezone to use for displaying time. The values are as defined by the Java TimeZone class.No
offsetThe numeric offset to the current timeNo
unitThe unit of the offset to be applied to the current time. Valid Values are
  • millisecond
  • second
  • minute
  • hour
  • day
  • week
  • month
  • year
localeThe locale used to create date/time string. The general form is "language, country, variant" but either variant or variant and country may be omitted. For more information please refer to documentation for the Locale class.No

An example would be:
  <format property="datetime" pattern="MM/dd/yyyy hh:mm"/>

I find this pattern for the format of the date and time to be a bit elitist.  Meaning people use to the European style of dates might get confuse, plus there is no timezone on the time which could lead to even more confusion.  Instead I think that the month should be spelled out and the time should have a timezone.  We are lucky since the pattern that Ant's TStamp Task uses is the same pattern used for Java's SimpleDateFormat class.

Java SimpleDateFormat Pattern

Java's SimpleDateFormat uses the follow pattern:

LetterDate or Time ComponentPresentationExamples
GEra designatorTextAD
MMonth in yearMonthJulyJul07
wWeek in yearNumber27
WWeek in monthNumber2
DDay in yearNumber189
dDay in monthNumber10
FDay of week in monthNumber2
EDay in weekTextTuesdayTue
aAm/pm markerTextPM
HHour in day (0-23)Number0
kHour in day (1-24)Number24
KHour in am/pm (0-11)Number0
hHour in am/pm (1-12)Number12
mMinute in hourNumber30
sSecond in minuteNumber55
zTime zoneGeneral time zonePacific Standard TimePSTGMT-08:00
ZTime zoneRFC 822 time zone-0800

Look at the table above we see that M can be used to show the month and z can be used to show the timezone.  Looking at the examples given in the Java doc we see the following:

Date and Time PatternResult
"yyyy.MM.dd G 'at' HH:mm:ss z"2001.07.04 AD at 12:08:56 PDT
"EEE, MMM d, ''yy"Wed, Jul 4, '01
"h:mm a"12:08 PM
"hh 'o''clock' a, zzzz"12 o'clock PM, Pacific Daylight Time
"K:mm a, z"0:08 PM, PDT
"yyyyy.MMMMM.dd GGG hh:mm aaa"02001.July.04 AD 12:08 PM
"EEE, d MMM yyyy HH:mm:ss Z"Wed, 4 Jul 2001 12:08:56 -0700

When M is used three or more times, we get a text representation of the month, which is what we want.  Further, with a z we get the timezone and also with an a we get the AM/PM marker (which is good since we have options for 24 hour days starting with either 0 or 1, so we'll do the easy thing and use AM/PM).

TStamp Task Solution

I changed the date and time MANIFEST attribute to be:
  <format property="datetime" 
pattern="EEE, MMM dd, yyyy hh:mm:ss a z"/>

which gives the follow:

Wed, Jul 04, 2001 12:08:56 PM PDT

Which I find much more readable and understandable to people across the world.

Monday, September 20, 2010

How to view the MANIFEST.MF file of a jar

If you do not work with the command line with jars a lot it is easy to forget what the options are. I was surprise to learn that if you do a search for "How to view the MANIFEST.MF file of a jar" you do not find anything that simply tells you how (or even how to in a round about way). I hope this post will solve that.

Say you have a jar file like http.jar from the NetBeans Flower Store example.

View contents of jar

If you want to view the contents of the jar simply use jar tf  jar
mike@mike-laptop:~$ jar tf /home/mike/NetBeansProjects/FlowerRest/build/web/WEB-INF/lib/http.jar

There it is the MANIFEST.MF file, I've highlighted it in red.

Get MANIFEST.MF from jar

To extract the MANIFEST.MF file simply use jar xf  jar META-INF/MANIFEST.MF
mike@mike-laptop:~$ jar xf /home/mike/NetBeansProjects/FlowerRest/build/web/WEB-INF/lib/http.jar META-INF/MANIFEST.MF

View MANIFEST.MF from jar

To view the file use cat META-INF/MANIFEST.MF or edit META-INF/MANIFEST.MF in Windows.
mike@mike-laptop:~$ cat META-INF/MANIFEST.MF
Manifest-Version: 1.0
Created-By: 1.5.0 (Sun Microsystems Inc.)

Easy enough.  The xf option on the jar, extracts the file so you may want to delete the extracted META-INF/MANIFEST.MF afterwards.

Tuesday, September 14, 2010

Complex SQL Updates with the Case Statement

One of the most important rules-of-thumb for database performance and data quality is to do as much as you can in as few transactions as possible.  When making Updates to data sometimes you need to do different things based on different conditions.  In order to make these complex Updates and to do them in as few transaction as possible, you'll need some way to make a decision.  One way to make a decision in SQL is by using the Case statement.

Given the following table:

Say the state and zip columns are now made nullable so that garbage data will stop being put into it (e.g., UK having state AA and ?, and zip of 0 and 99999).  You'll want to correct the data you have so that you no longer have garbage data in the table.  To do so what you'll want to do is null the state and zip when the country is not USA.

update location
    state = case
      when country = 'USA' then state
      when country <> 'USA' then null
    zip = case
      when country = 'USA' then zip
      when country <> 'USA' then null

or you can do

update location
    state = case
      when country = 'USA' then state
      else null
    zip = case
      when country = 'USA' then zip
      else null

or you can replace null with ''.

The table should look like this now:

You can also used any other value you can obtain from the table in the Update statement, like this.

Given the following table again:

We can do something like this (assuming that state and zip are Character data types).

update location
    state = case
      when country = 'USA' then state
      when country <> 'USA' then country
    zip = case
      when country = 'USA' then zip
      when country <> 'USA' then country

The table should look like this now:

Remember if you can picture what you want the data to look like then you can do it in SQL, it is a declarative programming language after all.

Saturday, September 11, 2010

Tracking New Referrals Traffic Through Google Analytics

If you read this blog on a regular basis (thank you) you might notice two tags at the bottom of the site.  These tags have placed this blog on two different blog referral sites.  Since I use Google Analytics to monitor the site, I figured I'd set up Segments to see if the blog referral sites are actually sending traffic to the site.  The goal is for these sites to send 100 new visitors in a month, if they do not then the tags will be removed.

To set up a Segment in Google Analytics you do the following.

1) Click on "Advance Segments" under "My Customizations" on the left.

2) Click the "Create new custom segment" button

3) Drag the "Dimensions" and "Metrics" you want to use to create the Segment

4) Add the Segments to the view by clicking on the "View" button on the top right

5) Now the Segments on show along with everything else on the dashboard.

That is it.  Now I can easily see if these sites are sending any traffic my way.  Feel free to comment.

Sunday, August 22, 2010

Subtractive Merge

Programming is a fun thing, sometimes the best thing you can do is to remove or undo what you have done. There are many reason for this, some of which could be:
  • You were trying out something and it did not work as planed.
  • You were using a new version of a library and it has bugs in it.
  • You made changes that were not needed and what to just go back to an old version.
In the end, the result is the same, you have changes that you made and now you want to get rid of them.

If you are using a Code Management System, what you'll need to is a subtractive merge. A subtractive merge is a way to remove or undo changes.

Say you have the following Ruby code

Version 1:

# Hello World program in Ruby

puts "Hello World"

Version 2:

# Hello World program in Ruby

puts "Good Bye World"

Version 3:

# Hello World program in Ruby

puts "Good Bye World"
puts "Hello world again"

Say you are currently at the third version of code ("Hello world again") and you want to go back to the first version of the code ("Hello World"), what you'll need to do is subtractive merge back to the first version of the code.

The way to think of a subtractive merge is that you are removing changes that were done. In the case of doing a subtractive merge back to version 1, creating a new version 4 of the code we will have the following for version 4 of our code:

Version 4:

# Hello World program in Ruby

puts "Hello World"

Example in ClearCase:
To do this in ClearCase from the command line you would do the following:

cleartool merge -to filename -delete -ver \main\branch\versionNumber \main\branch\versionNumber

Example with file hello.rb in the \main\dev stream:

cleartool merge -to hello.rb -delete -ver \main\dev\2 \main\dev\3

Next time you find yourself wanting to rollback or undo changes, try a subtractive merge.

Wednesday, August 4, 2010

What Side of the Tracks Should I Be On?

Whenever I can, I try to take a train to the city. Trains are great: no traffic jams, no trouble finding a parking spot, and no taking the wrong exit off the highway. Plus they are green (for the most part).

One thing I noticed is that most of the time the train station gives no indicator as to which side of the tracks to be on. In the morning when there are lots of people going to work, this is not an issue. Just go to where the people are. However, this does not work at odd times when you might be the only person at the station.

When at a station by one's self I find the general rules to help tell which side of the tracks to be on.
  • Most people wait for the train in the morning on their way to work in the city, when they get off the train on their way home they do not wait around they just leave; therefore the benches and covered waiting areas are on the side of the tracks going to the city.
  • If benches and covered waiting areas are on both sides of the tracks, the side with more benches and larger covered waiting areas is the side going to the city (the reason is volume).
  • If there are three or more tracks with a fence splitting the tracks, the slide of the fence with more tracks is the side going to the city (again the reason is volume, but this time in the number of trains).
Following these simple rules should help get you on the right side of the tracks, if they do not work please let me and others know by commenting.

Monday, July 5, 2010

Use Pictures to Communicate Not Words

As I move up the ranks at work I find myself asked more to share my ideas; as I get to present my ideas I noticed that the more casual (i.e. drawing on a white board) I present my ideas the better they "go-over" and get remembered by others.
Not only do my ideas "go-over" better with others, they also are more memorable to people. The order seems to go, from worst to best, verbal/Word without images, check list, Power Point/Word with text and pictures, and best of all, white board. I believe this happens for a few reason, but I the number one reason is words can have different means to different people.

Think about it, how often do two different people get the same mean from reading the same thing? Not often. If we did then we would not have introductions to books and teachers would not do anything but read to their classes. No, it seems that just words are bad at communicating ideas to people. Pictures are much better at communicating ideas and staying with us after the presentation. In fact most of our brain (75% according to Unfolding the Napkin) is used for processing what we see.

Which do you find communicates how a Data WebService works better?
Next time you need to communicate something to someone, try using a picture or two.

Wednesday, May 19, 2010

Software Testing 101: Boundary-value analysis

Welcome to Software Testing 101, a guild to assist in the testing of software. Today's topic, boundary-value analysis also known as boundary testing.

Boundary-value analysis is used to test the boundary of a process. For instance, say we have a process which can take inputs between 1 and 100. How can we test the process with the minimal amount of test cases (in most work environments it is hard enough to get enough time to test the cases needed).
What we want to do, to test this process, is to test the boundary or edge condition. The boundaries of this process are 1 and 100, therefore if we test integers around 1 and 100, we would be testing the boundary.

In order to test any boundary, fully, you would need three test cases:
  • Out side the boundary
  • Exactly on the boundary
  • In side the boundary
In this case for the lower bound of 1, we should test 0 (one out side of the boundary), 1 (exactly on the boundary), and 2 (one in side the boundary). Likewise for the upper bound of 100, we should test 99 (one in side the boundary), 100 (exactly on the boundary), and 101 (one out side of the boundary).

By using boundary-value analysis we are able to limit the number of test cases and fully test the boundary of a process.

Tuesday, May 11, 2010

Upgrading to Ubuntu 10.04 LTS

Just upgraded my Dell Vostro 1500 to Ubuntu 10.04 LTS on Saturday (May 8, 2010) and so far I love it!

I made the upgrade because it is a LTS (long term support) release, but the main reason was, I was having issue with my wireless connecting to U-verse. I am happy to say, the upgrade has seem to resolve my wireless connectivity issues. I can go back to watching Bleach in my bedroom if my wife wants to watch something in the living room (I am on episode 263, 幽閉?!千本桜&蛇尾丸).

Other benefits of the upgrade include:

Faster boot time (it seems to be faster to me)
Better looking default desktop and style
Sound working out of the box (even Flash sound in Chrome)

Over all I am loving the upgrade. Nice work Ubuntu team!

Monday, February 15, 2010

How I Fixed Flash's Sound In Chrome

I recently upgraded to Ubuntu 9.10 (which is really fast, very nice looking, and all around great). Everything worked great out of the box for the most part. A few issues with the Wireless (it was picking an unsecured network instead of mine). One big problem, my sound in Flash did not work, which means I could not watch Bleach on YouTube!

It took a bit, I installed many different version of flash, moved files around, but atleast it did not work. Then I came across this thread, entry number 7. I brought up alsamixer (just type alsamixer in your terminal).

Arrowed over to Speaker (just use the right arrow key on your keyboard):
Do you see the MM, right above 64<>64 on the far right? Well, that is what is stopping your sound. That's right the speakers are muted!

Hit m (just type the letter m on your keyboard) to unmute:
See the OO, that means that you are no longer muted. Hit Esc to exit and return to the terminal.

I did this all while running Bleach in Chrome on YouTube and what happen?!? I heard sound; lovely sound!

All is well with my computer now (sad, but true).

Saturday, February 6, 2010

Upgrade to Ubuntu 9.10

For few years now, I've been running Ubuntu on my Dell Vostro 1500. For about a year I've been using Ubuntu 8.04 LTS (Hardy Heron). I have never really had any issues but I would like to run a much newer version of Eclipse. You see I am running Eclipse 3.2 and I would like to run Eclipse 3.5 so I can use newer plugins like the Orc plugin. To be able to run Eclipse 3.5, I will need to upgrade to Ubuntu 9.10 (Karmic Koala).

Upgrading to Karmic Koala from Hardy Heron, will require an upgrade from 8.04 to 8.10, then from 8.10 to 9.04, and finally from 9.04 to 9.10. I believe this will take about 3 1/2 hours. I am thinking that since I am running on a Vostro 1500 on the upgrade from 8.10 to 9.04 (Intrepid Ibex to Jaunty Jackalope) I will most likely either have to enable my Wireless again through Backports or just use a cable.

Why would my Wireless stop working? Well you see the drivers I need to run my Wireless are not Open Source and as such I will need to use Non-Open Source; Backport; drivers to be able to use it. If you have only used Windows or OS X this most likely sounds odd, but what it comes down to is Copy Rights. Ubuntu does not install Backports, you have to enable them by saying that you will agree to their Copy Rights and then they will be downloaded and installed.

I did a quick Google search to make sure that I will not have an issues with Karmic Koala on my Vostro and what I found sounds like I will not have any. In fact it sounds like the Koala runs a lot better than Hardy. Even more import and the reason for the whole upgrade Eclipse 3.5 is in Synaptic.