Wednesday, January 31, 2007

Project Camelot Interviews Gordon Novel « Mysterious Universe

Gordon Novel is a quack!! (Google Video Link)

If you don't believe me, see for yourself (links above). I was actually interested in what he had to say for the first 10 minutes, then he got nervous and started fumbling his words together. It was painful watching him make stuff up on the fly. The interviewer was actually poking fun at him (or so I gathered). I didn't believe a word he had to say after about 15 minutes. There was clearly too much editing involved and it was obvious that he was tripping over his own stories. For example, he claims that he had never been to Area 51, and then later he claims he was there, but didn't see any underground bunkers, etc... Then he talks about the fact that we (Americans) have time travel, but can't release it and that there is a book on time travel out there that is "very accurate" in how it all works. He gives his opinions on everything controversial and made a complete ass out of himself as far as I'm concerned. He's a quack! Period.

Watching that video was a complete waste of time. I actually stopped it numerous times, but decided to finish it just so I could confirm this dude was full of crap. He is.

Watt-hour

I guess I'm (subliminally) posting this so that my wife will read it and turn off some lights. She loves her lights. :) Everybody knows when Jennifer is home; she has the house completely lit up. If she walked into a room 4 hours ago, you would know it because the light would still be on. I (on the other hand), go from room to room and turn lights off all day long. When I watch the kids or have the house to myself, you would never know that anybody is home. For example, right now I have the light on over my computer and that is it...

I heard the term "gigawatt" tonight and decided to figure out exactly how many watts a gigawatt would calculate to in household terms. If I had a gigawatt saved and was able to preserve that energy for a period of time, how long would I be able to "live" on it (taking into account tv, lights, radio, computer, vacuum, etc...)? Sounds silly, I know, but amuse me... Before I can calculate this, I need to see how many watt hours I'm using today. What is a watt-hour?

Watt-hour - Wikipedia, the free encyclopedia:
Power companies produce energy - a good - which is often purchased by the customer in units of kilowatt-hours. Consider a setup with two 50W light bulbs (100W total) left on for 10 hours per day. The setup will consume 1kilowatt-hour per day. If a power company charges US$0.10 / kilowatt-hour, then those two light bulbs will cost US$0.70 over the course of a week. (See unit juggling for more information.)
So a gigawatt would allow you to keep these two lights on for 10 hours a day for about 2,738 years. Or, in mathematical terms:

(1,000,000,000 watts /(100 watts * 10 hours))/365.25 days in a year = ~2,738 years

Realistically, I use more than 2 light bulbs. Let's assume that I pay about $120 for electric a month (which is kinda close). So in order to see how much time I could get from a gigawatt, I need to do more math...
$120 a month / 4.35 weeks = $27.60 a week
$27.60 a week / 7 days = $3.94 a day
$3.94 / $0.10 per kilowatt hour = 39.423 kilowatts a day

Now let's reverse the equation to find out how many years I can get on a gigawatt...

(1,000,000,000 watts / 39,423 watts a day) / 365.25 days in a year = 69.5 years

It would make sense to me that one day I might be able to purchase energy like this up front. Gigawatts, might be overkill, but who knows... We might have a higher demand for power in the years to come as well... We first need a device to store this energy. I would rather pay for power up front, than pay for it out the ass (play on words meaning after I use it). :) Allowing each home to store it's own energy would also solve the dreaded city-wide power outages (which just happened, last week).

Monday, January 29, 2007

Floppy Drive Wizardry

As I mentioned in my last post, I like to create shims when I want to avoid redundant tasks. My latest project (a needed project for my mother-in-law) was to copy a box of old floppy disks onto a single CD. I ordered her a computer a few weeks ago and didn't get her a floppy drive with the system. The problem is that she still needs to be able to setup all of her old tax programs (1996 - 2005), which just so happen to be on oodles of floppy disks. Each year's set of programs consisted of ~9 floppy disks. I actually started doing this one by one in Total Commander, and I found myself making silly mistakes along the way. I was basically doing the same thing over and over:
  1. Read the label on the floppy drive
  2. Create a new folder with that name
  3. Insert the floppy disk
  4. Refresh Total Commander
  5. Select all files from the floppy
  6. Copy the files to the newly created folder
  7. Wait until files are all copied...
  8. Rinse and Repeat
This got redundant and I realized I had to give it my full attention. Otherwise I got side tracked while the floppy was copying to my hard drive and a lot of time was lost for each disk. Once I got back to the process, I had to remember where I was at. It was very error prone; sometimes I would copy the same disk twice, or overwrite a directory with a different floppy. It was becoming a mundane process and I was going insane 1.44 mb at a time. After about the 12th floppy disk I decided to take some time out and write a small utility app to help make this nightmare easier. I had about 80 more floppy's to go and this isn't the best way to do it...

I decided that each year's set of disks was really a "Disk Set", and each "Disk Set" had multiple floppy disks associated with it (ie. W2 Program (Disk 1), W2 Program (Disk 2), etc...).

I got out my pencil and paper and drew up a mock version of what a UI might look like, then after about 10 minutes, I opened up VS2005 and started building the dialog. Once I got all the controls in place, I just started writing the code behind the various controls. The code behind the buttons is ridiculously easy, and the productivity of the whole "floppy disk project" was increased 10 fold. I just described the disk sets (ie. created the directories), and clicked 'import'. Once the app starts, it notifies me when I need to switch disks and I just switch disks and click enter. I created the app (start to finish) in about 2 hours; there were lots of small glitches to fix and various interruptions.

Here it is if you're interested in seeing it:
http://www.hardbarger.com/lucnjen/floppywizard.zip

It works like this:

  • Define the 'temp' directory that all files will go
  • Create a disk set (ie. 1998 Tax Programs, 1999 Tax Programs, etc..)
  • Define the various disks in the disk set (ie. W2 Program, 1099 Program, etc..)
  • Begin the import of the disk set
  • Answer the prompts...
The program could easily be used to consolidate an old box of floppy's onto your hard drive. Just gather a bunch of floppy disks and separate them into logical groups. Once they're in their groups, just enter the name of each disk and click "Import". The app takes over and prompts on what disk to put in the drive next. It even comes equipped with a progress bar... one of the glitches I had was that I didn't know if it was copying or not, so...

If you decide to download it, please let me know what you think. :)

Shimmy Shimmy!!

Programming Shims

When I was at CodeMash, I attended a very cool session given by Neal Ford called The Productive Programmer. In this session Neal talked about "... how to become a more productive programmer every day by using tools that you didn't know you already had." Some of the stuff was no-brainer stuff. I was happy to find that a lot of the things discussed where things that I already practice. Here is a brief list of all the things I can remember:
  1. Learn all IDE shortcut key combinations
  2. Get a refactoring tool (ie. Resharper or Refactor! Pro)
  3. Write shims where possible (more later)
  4. Learn Regular Expressions!
  5. Find a scripting language you like and use it
  6. Find a good text editor (notepad++, editplus, etc...)
    1. Multiple Clipboards
    2. Macro Support
    3. Regular Expressions
    4. Customizable Shortcuts
    5. File Templates
    6. Allows Plug-Ins
  7. Learn to love and use macro's
  8. Etc...
He went into a couple of stories where he had to write little apps to help automate simple things that were a bit timely up front, but saved time in the long run. For example, he was part of a team that was split between many different offices (even across seas) and the team was using Subversion for to version their source code. Every time the development team checked in the code, they had to provide a simple comment on what changed. At the end of every week, they had to update their corporate wiki with notes about what they did that week. We do this at Data Dynamics and I do see how this is rather redundant; developers are forced to update the information in two places. Neal decided to write a "shim" to fix this... He wrote a script to take the users comments from their source file check-ins and update their status page on the wiki with this information (files checked in, what time, comments, etc...).

He claimed that the little bit of work he did to figure out how to do this has really improved the overall productivity of the whole team. Developers just check-in their source files and their wiki's are updated automatically. Plus, the project leads and product managers were able to check the various wiki's with an accurate reading of what got done at the end of every day. They no longer had to wait til the end of the week and then rely on developers to remember to update their status pages.

I admit that I get caught up in writing shims a lot. I actually wrote one the other day in Excel. My mother-in-law is an accountant and every year, her and her secretary (who is actually her sister; my aunt-in-law if you will) have me print out daily schedule forms for them. I've tried to convince them to use Outlook or something similar to keep track of appointments, but they insist on the paper form...

Anyway, every year I have to create an Excel sheet that starts from the first week in the next year to the week of April 15th (unless April 15th falls on a weekend, in which case do that next week). Each page represents a single week and appointments run from 7am to 7pm in 1/2 hour increments on each page. I dread doing it every year because I always have to rebuild it or use last years file and modify / edit / format it accordingly. Last week I decided to just sit down and write a "shim" to do it instead. Here it is:
Sub CreateScheduleSheet()
Dim year As Integer
Dim eachDay As Date
Dim columnIndex As Integer
Dim rowIndex As Integer
Dim wereDone As Boolean
Dim thisCell As Object

' get the year
year = CInt(InputBox("What year do you need the sheets for?", _
"Year Entry", Format(Now(), "yyyy")))

' get the first date cell
' since the sheet has to start on a sunday, find
' the first sunday (on or before) the first of the year
eachDay = DateSerial(year, 1, 1)
Do Until Weekday(eachDay) = 1
eachDay = DateAdd("d", -1, eachDay)
Loop

' start at b2 and loop through all columns til we're done
wereDone = False
columnIndex = 2
rowIndex = 2

Do Until wereDone

' get the current cell and increment the column index
' if the date a saturday, skip a column
Set thisCell = Sheet1.Cells(rowIndex, columnIndex)
columnIndex = columnIndex + IIf(Weekday(eachDay) = 7, 2, 1)

' set the date and increment the date
thisCell.Value = Format$(eachDay, "m/d/yyyy")
eachDay = DateAdd("d", 1, eachDay)

' check to see if we're done yet (remember to end on a saturday)
If eachDay >= DateSerial(year, 4, 15) Then
If Weekday(eachDay) = 7 Then
wereDone = True
End If
End If
Loop
End Sub
It works rather well and has already come in handy actually. I printed out the wrong year the first time, so I just came back home, ran the macro with the new year, and viola. It has some assumptions built into it, but it serves a single purpose and has already saved me a small chunk of time. Now I won't dread it when I remember I have to create a paper schedule next year during tax season.

Friday, January 26, 2007

The Top Ten Astronomy Images of 2006

This blog post is mainly for James. :) I'm sure he's already seen the images, however I really enjoyed them and felt they were blog worthy: Bad Astronomy Blog » The Top Ten Astronomy Images of 2006
I changed my desktop background to the image at the very bottom (the #1 astronomical image of 2006). It's amazing how small Earth is in the image. The post states that Cassini took the image and was one billion miles from us when it took the image... yeah... 1,000,000,000 miles away. Man!

Tuesday, January 23, 2007

I've been Flickred

Jason Follas got a "really good" picture of me at the Day of .NET in Ann Arbor last year (yes I just found it): Lucas from Data Dynamics - Jason Follas Photo's

Monday, January 22, 2007

Hardbarger Vacation 2007

As I've said before, we went to the Kalahari Resort for CodeMash. Here some of the photo's that were taken...
I'm anxious to see how this
cool
very cool
damn cool
holy-shit-cool

I mean, even CTRL-Z works!! wow!

Smooth Criminal

The craziest thing happened to me just now. I had to tell somebody, so I thought why not tell everybody. :)

I was surfing the web and singing "Annie are you ok? Are you ok? Are you ok Annie?" over and over. I did it for a while, then realized I didn't have any music playing; I was sitting in complete silence. I decided to open iTunes and get zoned in. Low & behold, the very next song in my Party Shuffle was Smooth Criminal!!! BWHAT!!??

I'm flipping out! I haven't had my iTunes open since last Tuesday, so there is no way that I would have known (even subliminally) that this was next. Weird!

Five things you would never know about me unless I voluntarily told you

I have seen a lot of bloggers talking about 5 things that people don't know about them. Some are very interesting to say the least. :) James tagged me today...

Here goes:

1.) I hung out with some pretty bad kids in my neighborhood growing up and I think I'm the only one of them that has never been to juvie. :)

2.) I have always thought my wife was out of my league. When we first started dating, I lost 60 lbs to try and get into her league. I guess it worked... she married me. The weight had nothing to do with it though, I've since gained most of it back and she still loves me. :)

3.) I saw a ghost when I was about 13 and it scared the shit out of me. I haven't seen one since, but the whole phenomenon fascinates me still to this day... What was that?...

4.) In high school people thought I was "popular", but I really wasn't. I was just nice to everybody (nerds, jocks, stoners, head bangers, preps, losers, everybody) and feel that this is why I got all of that attention my junior and senior years. I was elected onto the homecoming court, prom court, and given various superlative awards. I always felt out of place getting my name called with all the other "popular" kids at the big events. I thought it was cool that they were all nice to me. Maybe they didn't feel popular either??? Anyway, I will always feel like a chubby nerd on the inside. :)

5.) I was an extremely ugly baby and nobody liked me. My body was covered with rashes and I was completely bald for the first 2 years of my life. I didn't walk until after I was 2 because I was so overweight. People still call me Charlie Brown because of this "era" in my life. :) My mom says that she couldn't get anybody to babysit me either because I was such a mama's boy that I screamed uncontrollably if I didn't see her in my line of sight. MOMMY!!!??? :)

Friday, January 19, 2007

I'm Flickr Savvy Now

I periodically checkup on Flickr for cool photo's. I like the ones of Log Cabins and streams and stuff. I know, kinda silly, but it's true. Anyway, I got to looking through it and decided why not give it a chance. I did it.

So here is the latest link dump for all of my online photo albums:
Hardbarger.com: http://www.hardbarger.com/photos
Picasa: http://picasaweb.google.com/lucas.hardbarger
Flickr: http://www.flickr.com/photos/20854535@N00

How in the world do the computer gods expect us to keep up with all of these competing sites?

CodeMash Agenda

Well, I'm here at CodeMash and I'm loving it. There are some really cool sessions. I went to one yesterday by Owen Taylor where he described Jini and the whole "grid computing" realm. It was very interesting and he had some cool demo that showed how it all works. Today I went to Scott Gutrhie's keynote on LINQ. I didn't realize how cool linq was until I saw him getting crazy with it. He described how we are all single thread programmers by nature and that this is a problem as we move more and more away from Moore's Law. In the future, we will be dealing with more and more multi-core machines.

Here is a problem area:

  List<customer> customers = GetCustomers();
foreach(Customer cust in customers)
if(cust.Salary <= 40000)
DoSomething(cust);

With LINQ, all of the complexities are handled for us... No 'GetCustomers()' method to extract the values from a database or or XML file (or whetever). There is also no need to do the dreaded "for loop" with all the all the "if this, then that" crap. The complexities and tediousness is gone. Here is the new approach:

  // syntax might be wrong, but...
var customers = from c in customers
where salary >= 40000 select c;

The beauty of this is that everything is handled "under the covers" for us. For example, if you have a quad core processor, each core will be able to contribute to the results of the query, not just a single thread. Pretty cool! There is more to it than this, but this is the one thing that stuck out for me. :)

See also: Generic Query Operators for .NET 2.0

Wednesday, January 10, 2007

Jazzy on Google Video




Lizzie filmed Jazzy being crazy one night on accident. She didn't realize that it was in 'camera' mode and the result was great... see for yourself. :) Jazzy is a clown by nature and this video says it all.

I figured this is a good first post of my video collection. I still have a slew of stuff I need to put on my pc from our camcorder. Maybe this post will motivate me. :)

Direct Link: http://video.google.com/videoplay?docid=7923672950936409171

First Real Snow of the Year

And I was prepared... I just went outside to get more wood for the fire and when I walked outside, snow is covering the entire hillside. As you can see in the picture, the wood pile was covered in snow too.

When the girls wake up tomorrow, they will be pretty excited. They got new snow boots that they haven't been able to wear yet. Looks like I'll have to go searching for those sleds in the attic tomorrow too.