Macbeth, Teller-style

I saw this production of Macbeth this afternoon with my friends Jen and Alban.  We were rewarded for our wait in the freezing cold (for standing room tickets) with actual seats for the show.  Thanks to Alban (I owe you big for this one), yours truly got a front row seat to the show.  Directed and produced in large part by Teller (of Penn & Teller), it was anything but your typical Shakespeare production (if there is such a thing).  I’m no aficionado of magic, but they pulled some incredible tricks in this show.  People appeared and disappeared before our eyes.  We saw fake blood which looked uncomfortably real.  I knew we were in for quite a ride when the show began with a Folger Shakespeare Library staffer stabbed through the back while reading us an announcement from the stage.  This doesn’t even include the excellent acting, the great fight choreography, the sound effects and percussion.


Upgraded to Leopard

I installed it last Wednesday. My first upgrade attempt failed, so I paid a visit to the Tyson’s Corner Apple Store to get some help from the Genius Bar. Apparently the DVD wasn’t clean or something (since the guy cleaned it off), because when I tried archive+install as recommended, there were no problems.  The next day, I picked up a 1TB Western Digital MyBook Home Edition at MicroCenter for $220 + tax so the Time Machine feature would have plenty of room to operate.  It’s definitely as cool as advertised.  I was impressed that when you plug in an unformatted drive, Leopard asks if you want to use for Time Machine.  I was pretty lax about my backups before, so this will be a huge help.


Changing Primary Keys from "int" to "uniqueidentifier"

I’m in the process of doing this for a project that uses Microsoft SQL Server.  One of the “gotchas” I came across was that once you’ve switched from “int” to “uniqueidentifier”, @@IDENTITY and SCOPE_IDENTITY references won’t work.  The second response in this thread pointed me in the right direction.  You have to call NEWID() in the context where you need it (and save the value) in order to be able to refer to it later.


Back to the trenches

Instead of management and code, I’ll just be writing code (at least for now). Today, I started a new job at a small consulting firm in Virginia with a software lab that wants to start putting out products.

Today consisted of the environment configuration and filling out of forms typical of a first day.  Most of the last half of the day was taken up by a boot camp.  I found it to be a very enlightening how-to on consulting, as well as an intro to the company’s culture.


Stockholm, Sweden

Yesterday, before our concert at Ekebyholmsskolan, we got to tour Stockholm.  We arrived there from Finland via a Viking Line ferry named Isabella.  Two other chaperones and I spent virtually the entire time touring the older parts of Stockholm, including a number of churches.  Of the cities we’ve visited so far on the concert tour, Stockholm is the most beautiful.  I really like the architecture.  Bicycles get their own lanes.  It’s a city that’s very easy to tour on foot.  The fact that it’s on the water is also a big plus in my book.

We’re getting on our tour bus in another 15 minutes for the drive to Oslo, Norway.


Scandinavia Tour

I’m writing this from a school dorm at Toivonlinna, a Seventh-day Adventist school in Finland.  I’m one of a number of chaperones for a high school choir giving concerts in Scandinavia.  We gave a concert at the school this morning (and I really do mean “we”, since the chaperones got drafted to sing also).  Our concert yesterday in Turku went well enough that the choir went back up to sing an encore.  Iceland was our first stop, and despite its name, it was warmer than Finland is now.  Even as I type, it is snowing.

The next stop on our tour is Sweden.  We’ll be taking an overnight ferry there from Finland (assuming the weather cooperates) after lunch, a cathedral tour, and some shopping.


A More Perfect Union

Barack Obama spoke at length yesterday on the issue of race in general and his former pastor in particular.  If you haven’t already seen and heard the speech, or read the transcript, I encourage you to do so.  There is no soundbite that can do justice to the importance and brilliance of his message.  If there was ever a politician who could legitimately argue that he’s a uniter and not a divider, it is Barack Obama.  I only hope it helps him win in Pennsylvania.


$1.67

That’s how much one (1) euro cost me yesterday when I was converting currency with Chevy Chase Bank for an upcoming trip. You know things are bad when even the branch manager is surprised by the rate of exchange. The exchange rate is probably even worse today. Even if I took out the fees they charged, the exchange rate is probably 20-30 cents worse than it was when I first went to Europe in 2005.

It reminded me of economics classes in business school, and what we learned about what countries do to defend their currency.  The Fed is doing the opposite of those things right now, so between that and deficits our government runs, I expect the dollar to be worth less and less in the near term.


The truth about usability

I came across this via Daring Fireball today.  There’s a lot more than a grain of truth to what it suggests about how what most user interfaces look like.


Time to buy an iPhone?

I went to the barbershop on Friday.  During my haircut, I ask my barber how he likes the iPhone.  He doesn’t just like it, he loves it.  I got quite a sales pitch from him.  Then the guy getting his haircut next to me chimes in.  He just got an iPhone as well.  He actually said he’d been thinking about getting a laptop, but found the iPhone did what he needed.Of all the iPhone owners I’ve talked to since it came out (friends, fellow conference attendees, even a guy waiting for the bus in Seattle),  I have yet to hear any complaints.I haven’t caved in and bought one (yet), for a few reasons:

  • I’ve been kind of annoyed with AT&T Wireless lately over dropped calls
  • Don’t really like the idea of a $70/month cellphone bill
  • I’m kinda waiting for the next version of the iPhone (new hardware anyway)
Every day that goes by however, I find I dislike the Motorola Razr I've got just a bit more.  The gap between my current monthly cellphone bill and that $70/month is starting to get smaller too (probably too much text messaging).  I'm also not sure I want 3G badly enough to wait months and months for it.

Refactoring

Last night, I went to a presentation on refactoring by Jonathan Cogley.  My notes are below:

refactor - improve the design of existing code incrementally

Code must:

  • do the job
  • be maintainable/extensible
  • communicate its intent
Code that doesn't accomplish all of the above is broken.

Refactorings

  • rename
  • extract method
  • inline method
  • introduce explaining variable
  • move method
  • inline temp
technical debt - anything that needs to be done to the code that gets put off until a later date

I found a much better definition for technical debt.  It makes a nice argument in favor of refactoring (though not as good as it would be with some way to quantify and measure it).

code smell - indication that something could be wrong with the code

Code Smells

  • duplicated code
  •  long methods
  • large classes
  • Too many private/protected methods
  • Empty catch clause (FxCop flags these by default)
  • Too many static methods
  • Variables with large scope
  • Poorly-named variables
  • Comments
  • Switch statements
  • Unnecessary complexity
Even though comments in code to tend to get out of date, I'm not sure I'd call them a code smell.  Wikipedia has another definition of code smell, along with a link to a taxonomy of code smells.

When to refactor:

  • before a change
  • after all current tests are green
Sometimes, refactoring is necessary to understand code.

reduce scope - bring variable closer to where it’s used

Be sure your unit tests don’t re implement what the tested code is doing.

Eliminate double assignments (a = b = 0) for clarity.

Each method should have only one operation/concept.

If you must use code comments, they should explain the “why”.  The code should be clear enough to explain the “what”.

Favor virtual instance methods where possible in your code.

Avoid using the debugger.  Write unit tests instead.

Performance improvements tend to make code harder to understand.  Don’t use refactoring to address application performance.

Recommended reading:

Refactoring to Patterns


Wireless Mighty Mouse

I saw one of these as a clearance item at MicroCenter yesterday, so I picked one up to try it out.  In the tiny bit of time I’ve used it so far, the only annoyance (and a minor one at that) is turning the mouse on and off.  I find it challenging to move the slider on the bottom of the mouse without clicking the mouse body a few times.   I like the little trackball on the top for 360 degree scrolling (though I don’t find myself scrolling sideways much with a 24" monitor).  I haven’t played with the configuration tool much yet, but it appears to give you a wide variety of ways to customize the mouse’s behavior.  We’ll see how the battery life is.


Taxes

For the first time in a number of years, I had a professional do my taxes.  I’d been a TurboTax Online user for the past 6 years, but got a referral from a friend and figured I’d try them out.  The parking situation wasn’t ideal, and the wait to be seen was long (over 3 hours for me), but the size of the refund I got back made it worthwhile.  If you don’t mind a wait (or the fact that they’re cash-only), visit Newby Tax Service at 6315 Windsor Mill Rd, Gwynn Oak, MD 21207.

Rates are $150 for single filers, $300 for businesses.  The charge for e-filing is an additional $80.


Null Coalescing Operator

I didn’t know about this C# 2.0 operator (??) until ReSharper suggested it as a replacement for a particular use of arithmetic if (?:) that I’d added to some code recently.  I already prefer C# to VB.NET because of its terse syntax and stricter compiler, so this discovery tipped the scales just that much more.

The most recent blog post Google coughed up for this operator is this one, from Aaron Zupancic.  Aaron links to another post that demonstrate its use for viewstate.


Fixing Computer Science

I’ve been reading a lot of complaints about the current state of computer science education lately.  This post makes a reasonable attempt at summarizing the different ideas around what sort of graduates these programs should produce.  I’ve been in industry long enough that my CS program hadn’t switched to using Java as the initial language when I started.  I agree with Brian Hurt and Chris Cummer about the value of a computer science degree.

The right courses in a CS degree amount to a toolbox of concepts that you can use to solve whatever real-world problem you’re facing.  The most recent example of this happened on the job.  We had an issue where some text files being downloaded for storage in a database kept causing failures in a process.  Because of how the process was implemented, there was no way to pin the cause of a failure on a particular line of the file.  The files in question are regularly more than a gigabyte in size, so manual inspection wasn’t an option.  The minimal understanding I have of how compilers work enabled me to direct my staff to build a parser, so we could validate the input file before running the process against it.  Without a CS background, it’s highly likely that I don’t come up with a solution at all (or a really bad implementation of a parser).

If I had it to do over again, I would have spent more time in my CS program getting better depth in compilers, operating systems, and other areas.

Computer science isn’t perfect, but it’s relatively young as a field compared to disciplines like law or medicine.  There are probably things that should be changed, but I think the fundamentals are good.


TeamCity 3.0

Now there’s a freeware version of it that supports up to 20 users and build configurations.  We were looking at setting up CruiseControl.NET again for continuous integration at work, but this will be much easier.


Apple Stuff

iPod nano

The iPod I mentioned yesterday is the 4th (!) one I’ve owned. Each of the previous ones was sold to help fund the upgrade to the next one. I love this one even more than all the previous ones because it handles video.  The video is watchable, even at that size.  The nano makes great use of the screen when it isn’t playing video too.  The earbuds that came with this one are better than the previous ones, but I’m still going to buy a better set.

Thoughts on MacWorld

The most important product announced there isn’t MacBook Air–it’s Time Capsule.  I think far more people will find a use for wireless drive backup than they will for a really thin laptop.  Because Time Capsule also works as a router and can share a USB device (or devices if you plug in USB hub), you could conceivably share even more hard drive space and a printer to every machine on your wireless network.  As far as I can tell, Time Capsule provides more capabilities than Mirra Personal Server (a comparable backup/Internet access product) at a lower price ($300 for the 500GB version) in a much smaller form factor.  After a copy of Leopard, I think a Time Capsule will be my next purchase from Apple.


Birthday

I turned 34 today. I suppose I’m officially in my “mid-30s” instead of my early 30s now. Other than that, it doesn’t seem different at all from any of my other post-30 birthdays.

I did pick up a new toy for my birthday–an 8GB iPod nano.


The trouble with using strongly-typed datasets

Apparently, if your database-driven website is under heavy concurrent user load, the  Adapter.Fill method in the .NET Framework (called by code generated by the XSD in Visual Studio) begins to fail because it doesn’t close connections properly.

The next time I need a data access layer for anything of substance, strongly-typed datasets are off the list.


Welcome to 2008

If a single word could define my 2007, it would be “travel”.  I suspect it’s the biggest reason I enjoyed the year.  The places I had the chance to visit include:

  • San Jose, CA
  • San Francisco, CA
  • Portland, OR
  • Seattle, WA
  • Vancouver, BC (Canada)
  • Orlando, FL
  • Dallas, TX
There were a couple of short road trips to Pennsylvania as well.

Looking back at the five things I wanted to accomplish this year, I finished two: taking two full weeks off, and forming an LLC.  The latter should play a large part in what 2008 will be like for me.  The three things I didn’t accomplish last year go back on the list for this year:

  • Learn a new programming language/product. I ended doing nothing at all with Eiffel last year.  This year, particularly with the LLC, I've been thinking about specializing in a product.  When I worked for Lockheed-Martin, I specialized in the customization of Community Server.  I'll either go back to that, or look at a technology from Microsoft (BizTalk, SharePoint, etc).  If I learn another programming language, it will probably be something like Python.
  • Re-learn the piano. I hardly played at all last year.  I'm glad my ability to read music hasn't disappeared.  I'm not sure what it will take to get me practicing regularly again, but I'll figure something out.
  • Study the Bible more regularly. I've started using online devotionals and religious podcasts to jump-start this.
One brand-new goal for this year is to increase my involvement in software development training.  Last year, I started an informal learning lunch program at work.  My original intent was to give the consultants that work for us multiple opportunities to transfer their knowledge to our permanent staff.  I ended up preparing and presenting on a wide variety of topics myself.  The program has been very well-received by the staff, and I've enjoyed assembling and giving presentations on best practices and technologies.  At the suggestion of friends & family, I've decided to pursue part-time openings as a technology instructor.  I'm scheduled to interview with a local community college for an adjunct position this month.  It will be the first work I do for my LLC if I'm accepted.