Jason Copenhaver

the stuff

February 18th, 2007

Writing Haikus with GEdit

In preparation for Linux Haiku IV I’ve written a plugin for GEdit.  I don’t really use GEdit, but it has a very simple plugin system that made this possible.  In true open source spirit I cobbled together some syllable counting code from here and here, and then plowed head first into writing my first python code.  I’m happy with my first draft.  It still needs work in the actual syllable counting part but it is usable for the most part.  The two major TODO items for it would be.

1.   Add a configure option to use something like the CMU Pronouncing Dictionary before going to the guessing algorithm.
2.   Fine tune the guessing algorithm with a test bench built from the above mentioned dictionary.


Enjoy!

gedit-plugin-haiku-0.1.tgz




February 16th, 2007

Comcast Network Health

nada

comcast-nada.jpg

I’m so glad Comcast had that informative network health page.

January 23rd, 2007

Traffic we REALLY don’t need

It’s bad enough that I’m constantly bombarded with advertisements over the radio, on TV, on the Internet, hell, even the occasional SMS message on my cell phone. Now someone has got the great idea to drive around in heavy traffic with signs. Ads2Go, which is now operating in Sarasota, likes to drive trucks “through the most heavily traveled corridors in multiple, predetermined zones. Awesome. They are going to drive trucks carrying nothing but signs around in heavily trafficked areas. This should do wonders for gas conservation and traffic congestion.

January 19th, 2007

Books

The main reason I installed drupal was because I wanted a place to keep a list of the books I’ve read.  I wanted to remember when I last read them and what I thought.  The bookreview module that I have installed now has served me pretty well but I always felt like I had to put too much information into to make it work.  After reading this review of Shelfari I thought I would try out some of the sites it mentions.  The first one I hit was LibraryThing.  It was a one step shot to sign up for an account and I had my first book put into it in seconds.  I quickly learned how to navigate the site and was generally impressed.  I really love the mass import feature of the site.  It allowed me to export 54 ISBNs from my current database and import them into my new account.  I then went to Shelfari, although the site looked better the layout of the UI didn’t seem as nice to me.  It felt cumbersome entering a review and didn’t have the import feature I wanted.  I also went over and checked out Listal.  I think this site would be worth trying if I cared about cataloging my movies and music also.  But I just don’t.  In the end I’ve decided to move my book reviewing to LibraryThing.  I’ll make a couple of changes on my site so I can still get the book reviews to show up here but I’m hoping LibraryThing makes the whole process easier.

December 22nd, 2006

The Hunt of Joy

My birthday was a little over a week ago.  The best gift that I got wasn’t one thing, but an experience.  I found out that my wife is a lot more talented than me in certain areas and I shouldn’t try to think while drunk.  (Which might bode ill for this blog as I’m on my second glass of scotch).  I had a little party at Shakespeare’s this year with a bunch of people showing up.  When it came time to open my wife’s gift I was happy to find a Tower’s of Hanoi set.  I’ve liked this puzzle ever since I first learned about it in college.  Along with the puzzle came a riddle!  I hadn’t had too much to drink at this point so I deciphered it pretty quickly and figured out that I would have to wait until I got home for the next piece of the puzzle.  Late that night when I finally got home, after a short run in with the police, don’t ride with friends that have suspended licenses, I tried to solve the next piece of the puzzle.  This is when I figured out I shouldn’t try to think to hard after drinking.  I got pretty frustrated with it and I think even hurt my wife’s feelings.  At that point I gave up and went to bed.  Luckily my wife forgave me and when I got home from the work the next day I made it through the rest of the riddles and found two more gifts.  I’ll end this post with the riddles that I had to figure out.


1.
We visit it frequently
Nearly every supper
Look to this holder
Of the quicker picker-upper

2.
From here it gets harder
You must travel East,
if only in thought, to
recall the spirit of the gift.
    - Queen of Afghanistan

3.
I’ve been to an Island Along A Great Rim
a paradise abundant, feasts at my whim;
a land of milk, a long of Bee Nectar,
I Fed Like A Babe, then sadly I left her.

4a.
They Stand among friends,
looking commonplace
They hardly ever move,
taking up our Shared Space,
How rude! they whisper,
All circled and grouped,
Like they’ve something to hide,
Inside their rigid loop.

4b.
They are messy as neighbors
but tolerate we must.
It’s illegal to harm them
or remove them from us!

4c.
Tall proud and naked,
they are a shameless bunch
Always dropping things
to the floor
with a crunch

5.
You are near
Where the
journey Ends
Go to the edge of the world
    - S.S.

6.
Where some people keep
small change,
and others keep
larger assets

7.
You may have noticed that I’m terrible
at rhyme, meter, iambic pentameter;
but I once became acquainted with
an oft-drunk literary genius who was
fabulous at it…

November 22nd, 2006

Reading a book, one email at a time

If you take a quick look at what I post here you’ll see that I do book reviews quite often. Now I’ve found a way to squeeze even more reading into my schedule. DailyLit is a great website that will email a section of a book whenever you want. The interface is very easy to use, pick a book, pick how often you want it sent (i.e., daily at 5pm, every Monday, Wednesday, Friday, etc), and where to send it. They then email you a readable section of the book. It takes maybe 5 minutes to get through what they’ve sent. The email also contains nice links like “get the next section now”, “suspend”, or a more powerful “manage my subscriptions”. I don’t think they are trying to make money, as the only pseudo advertisement is a text link at the end of the email taking you to amazon in case you want to buy the book. Because you don’t pay anything for this service the book selection is of course limited to public domain works. So far I’m really enjoying it. It has let me start on a book that I had yet to find the time to buy and it doesn’t get in the way of my other reading. If you can spend a couple of minutes a day reading a blog then you shouldn’t have any trouble reading a book using this great service.

November 6th, 2006

I’m living with a Master

A master in Epidemiology that is. My wife defended her Master’s Thesis today and everything went well. She was unbelievably stressed this weekend and today before she actually presented, but she pulled it off just like I knew she would. To celebrate we had snacks and a couple of beers at Shakespeare’s and were even lucky enough to run into one of the former Surly Chicks of Sarasota. Elsie talked about Shakespeare’s in her blog so much that I had to go down and try the place a couple of months ago. I think I’ve been at least once a week since. To finish the evening off we watched the gift I got for my wife, The Little Mermaid on DVD, just released. This is by far my wife’s favorite Disney movie. Aren’t I the best?

October 28th, 2006

Here and There

This has been a really good month.  And next month is shaping up to be just as good.  I started out this month with a week long trip to Germany.   Part business part sight seeing.  That was a great time.  The really funny part of it is that when Cathy and I first got married we jokingly said that we would go to Octoberfest in Germany on our 5 year anniversary.  Well that anniversary is coming up next year and we hadn’t really made any plans.  Then I found out that my job is sending me there for a week! Just in time!  We didn’t hit the biggest Octoberfest in Munich but we went to the Volksfest in Stuttgart.  The beer tents were awesome.  It is quite a feat drinking beer a liter at a time.  Also this month I stopped at MacAllister’s in Lakewood Ranch for the Scotch Tasting.  That is a great way to bring attention to the restaurant. The Famous Grouse vendor was there with plenty of free samples.  I’m thinking I’ve actually found an affordable everyday Scotch.  I’m not sure if that is a good thing or not =).  Today was also a busy day, with a stop at Hunsader Farms for the Pumpkin festival, and finished the night off at the Sarasota Blues Fest.  But the fun doesn’t stop there!  I’m planning on being at the Sarasota Reading Festival , the Sarasota Medieval Fair , and the Suncoast Wine Festival.  Once all that is taken care of it will be the holiday season and I’ll be visiting family and friends.  This is going to be a busy end to the year.








September 10th, 2006

Visual Basic And Delegates

In the article “Combine Static and Dynamic Types” Danijel Arsenovski explains a refactoring technique using late-bound calls or “duck typing” as a lot of people call it. I don’t particularly care for duck typing. I much prefer my coding errors to be caught at compile time. With duck typing if you try to call a method on an object that doesn’t support that method an exception is usually thrown at runtime. A lot of people say this type of error should be caught in the unit test phase, but how many people have 100% code coverage for their unit tests? Discussing the Pros and Cons of Duck Typing can take quite awhile so we’ll just say that I don’t particularly like it and I wanted to try and find a different solution.

The Problem

The two classes Worksheet and Document both have methods with the signature “CheckSpelling()” and “SaveAs(FileName As String)”. We wanted to write a function like the following that works on both Worksheet and Document objects.

Public Sub CheckSpellingAndSave(ByVal officeOjbect As Object)
   officeOjbect.CheckSpelling()
   officeOjbect.SaveAs(FileName)
End Sub

Seeings how we don’t have the source for Worksheet and Document we can’t change them to inherit from a common interface that supports these methods, and the common base class that they have doesn’t expose these methods.

Duck Typing Solution

So he proposed an interesting combination of dynamic and static typing. In one file have the following:

Option Strict Off
Public Class OfficeWrapper
   Implements IOfficeWrapper

   Private docOrsheet As Object

   Public Sub New(ByRef docOrsheet As Object)
      Me.docOrsheet = docOrsheet
   End Sub

   Public Sub CheckSpelling() Implements IOfficeWrapper.CheckSpelling       docOrsheet.CheckSpelling()
   End Sub

   Public Sub SaveAs(ByVal fileName As String) Implements IOfficeWrapper.SaveAs
      docOrsheet.SaveAs(fileName)
   End Sub

End Class

And in the other file:

Option Strict On
Public Interface IOfficeWrapper
   Sub CheckSpelling()
   Sub SaveAs(ByVal fileName As String)
End Interface

Public Sub CheckSpellingAndSave(ByVal officeOjbect As Object)
   Dim officeWrapper As IOfficeWrapper = New OfficeWrapper(officeOjbect)
   officeWrapper.CheckSpelling()
   officeWrapper.SaveAs(FileName)
End Sub

This of course allows you to make the following two calls just fine:

   CheckSpellingAndSave(worksheetObject)
   CheckSpellingAndSave(documentObject)

What do you gain from this though? In my opinion you don’t gain enough. Yes you get IntelliSense support when working of IOfficeWrapper and yes you are only allowed to call known methods of IOfficeWrapper, BUT you can pass ANY object into IOfficeWrapper and you won’t see a problem until runtime!

Delegates

The following is the code I wrote using delegates to avoid using “Option Strict Off”

Public Delegate Sub CheckSpelling()
Public Delegate Sub SaveAs(ByVal fileName As String)

Public Sub CheckSpellingAndSaveDelegates(ByVal checkSpellingSub As CheckSpelling, ByVal saveSub As SaveAs)
   checkSpellingSub()
   saveSub(FileName)

End Sub

CheckSpellingAndSaveDelegates(New CheckSpelling(AddressOf worksheetObject.CheckSpelling), New SaveAs(AddressOf worksheetObject.SaveAs))
CheckSpellingAndSaveDelegates(New CheckSpelling(AddressOf documentObject.CheckSpelling), New SaveAs(AddressOf documentObject.SaveAs))
‘ this line doesn’t compile because database doesn’t implement CheckSpelling!

‘ compile time error rather than runtime!
CheckSpellingAndSaveDelegates(New CheckSpelling(AddressOf databaseObject.CheckSpelling), New SaveAs(AddressOf databaseObject.SaveAs))

I prefer this solution because it forces the developer the think about what methods they are going to pass to the CheckSpellingAndSaveDelegates to handle the CheckSpelling part. If someone just does blind copy and paste and changes the object it won’t compile.

Conclusion

To be fair I think Danijel’s article was more about an interesting use of Option Strict than the particular solution given. I still haven’t been sold on Duck Typing though and as long as I can find reasonable solutions with static typing I think I’ll stay away from ducks. This was also my first time touching Visual Basic since 1998 so it is possible that I have done something terribly egregious.

September 2nd, 2006

2006 Sarasota | Manatee Technology Conference

For a first time event I was pretty impressed. I think close to 200 people turned out to talk about the technology scene in Sarasota and Manatee. The content was pretty high level and focused a lot on the small business crowd. That of course makes sense considering that it is mostly small businesses in this area. I was very excited to hear about the company culture at LexJet. Their three rules ares:

1. Have Fun
2. Make Money
3. Don’t get in the way of anyone else having fun or making money.

The co-founder talked a lot about the importance of having a good company culture and hiring good individuals. He also mentioned that they pay above average salaries so they can ATTRACT and RETAINT the high quality people that make them successful.

I was also really impressed with the stuff that Robert Hanson is doing with the Sarasota County IT department. They are consolidating services and servers throughout the county. They are really embracing the software as a service (SaaS) model and trying to save the tax-payers money yet still provide superior service and capabilities to the local government departments.

After the conference some of the crowd headed over to G.Wiz for the Digirati party. This was a really fun event for me. I was able to talk to a lot of interesting people and it was the first time that I personally felt successful and confident at networking. I had a great conversation with Andrew Foley, from Sarasota News & Books, about the impact of the Internet on local culture. I’ll have to stop by his bookstore sometime soon to see what other interesting conversations come up.

I’d really like to thank all the people at the Young Technology Alliance, who don’t have a web page just about them yet, for putting on this great event. I can’t wait for next years.