comments suggest edit

One trap that developers need to be wary of is the mentality of the Hammer Truism. This states that

When the only tool you have is a hammer, everything looks like a nail.

This is especially true of Design Patterns. I particularly liked what Erich Gamma said in this interview

Do not start immediately throwing patterns into a design, but use them as you go and understand more of the problem. Because of this I really like to use patterns after the fact, refactoring to patterns.

All too often, I’ve encountered code that uses a pattern because the developer felt he should use a pattern there, not because he needed the pattern.

Not every developer understands that patterns add complexity to a solution. Certainly abstraction and redirection are important benefits of many design patterns, but they come at a cost. To use design patterns effectively is to know when the benefits will payback that cost with interest.

The important concept to understand is that Design Patterns are descriptive not prescriptive. They aren’t intended to instruct how one should design a system, but merely describe successful designs that have worked in the past for common problems. Should the problem you’re tackling fit a particular recurring pattern, then applying a design pattern is certainly a good choice. But when the problem doesn’t quite fit one of the patterns, trying to cram the round pattern into the square design just doesn’t fit.

I’ve recently seen an example of this in regards to using an interface. I generally follow the rule of threes regarding polymorphism. For example, if I have a class with an enum indicating its “type” (for example, a User class with an enum property indicating whether the User is an employee or a manager), when that enum contains three values, I’ll consider refactoring the class to have a base class and inherited classes (for example, the User class might have an Employee subclass and Manager Subclass). Maybe I’ll use an IUser interface instead.

However, I caution against using an interface (or inheritance) just because it’s the “right” thing to do. There’s no point to implementing polymorphism if it is never used.

For example, I recently saw several classes in some code I was reading that implemented an interface we’ll call ISomeInterface. But nowhere did I find any code that referenced ISomeInterface. Instead, there were only references to concrete classes. I expected to see something like this somewhere in the code.

foreach(ISomeInterface something in SomeInterfaceCollection)

{

    something.DoSomething();

}

But no such code could be found. This was a prime example of a gratuitous use of an interface. This interface served no purpose and needed to be removed.

The important lesson here is to always start off by writing the simplest code possible and only add interfaces and design patterns when they are absolutely needed.

[Listening to: Voices (DJ Remy Remix) - Bedrock - Gatecrasher Global Sound System: Latitude (Disc 2) (5:13)]

comments suggest edit

When something tragic befalls a friend, or even an acquaintance, I used to wonder if expressing my condolences and sorrow really meant much to the afflicted person. It certainly is different from person to person. For Akumi and me, I think the answer to that is yes, it is helpful. We certainly felt some degree of comfort knowing friends and even strangers who read my blog were sending us well wishes and thinking of us.

So thank you for your comments. We appreciate them.

comments suggest edit

I know the timing is pretty crummy, but here it is. It is required, yes required, that I give you a true geek birthday salute (i.e. a blog birthday greeting).

Happy birthday love!

p.s. Yes, that cake is an ice-cream cake (my wife is allergic to eggs and anything made with eggs).

comments suggest edit

Hideo Yokoyama

Hideo Yokoyama 1943 - 2005 {style=”clear:both; margin-top:0px;”}

Akumi received a very tragic phone call yesterday afternoon from the San Diego county medical examiner’s office. Police had found her father, Hideo Yokoyama, pulled over to the side of the road with his windows down. While driving, he suffered a heart attack and died from cardiac arrest.

Only last weekend we had a great time with him down in San Diego. The fact that we saw him so recently has been good for Akumi. Though stunned and saddened, we both remember how happy he was, throwing back a beer together over fantastic food.

Akumi’s father loved to work, and spent nearly forty years doing so as an engineer at Sony. He is, in many ways partly responsible for all the Triniton televisions in the world. In the later parts of his career, he was challenged by a colleague who said to him…

We’ve sent all these Trinitrons out into the world. We now have a responsibility to do something about them when they return.

This was a turning point for Hideo, who then focused his energies on electronics recycling. He spoke at many conferences and worked hard within Sony to take a lead in recycling efforts. In many ways, Japan is way ahead of the US in this effort.

His efforts landed him a two year post as CEO of a joint venture between Sony, Panasonic, and several other electronics giants to research and promote recycling technologies. The member companies appointed an employee to this position for two years at a time on a revolving basis. He was a believer in sustainable modes of production.

After retiring from Sony, he took a position as President of a Japanese company with operations in Tijuana. Residing in Chula Vista, Akumi and I had the great privilege of seeing him once a month.

My fondest memory of him is that of my second or third trip to Japan with Akumi. We were staying with him at his apartment and we had just returned with some Yakitori. He had bought a bottle of Nigori (unfiltered) Sake (my favorite) for this occasion. He grabbed the bottle, looked at me with a mischevious grin, and said, “Phil. We are not leaving this table until this bottle is empty.” Suffice to say, I had to enlist the help of Akumi to get through it, but get through it we did.

On Tuesday, Akumi’s mom, brother and his wife will fly in from Japan. We will drive down to San Diego and take care of arrangements.

comments suggest edit

Four friends who hadn’t seen each other in 30 years, reunited at a party. After several drinks, one of the men had to use the rest room. Those who remained talked about their kids.

The 1st guy said “My son is my pride and joy. He started working at a successful company at the bottom of the barrel. He studied economics and Business Administration and soon began to climb the corporate ladder and now he’s the president of the company. He became so rich that he gave his best friend a top of the line Mercedes for his birthday.”

The 2nd guy said “Damn, that’s terrific! My son is also my pride and joy. He started working for a big airline, then went to flight school to become a pilot. Eventually he became partner in the company, where he owns the majority of its assets. He’s so rich that he gave his best friend a brand new jet for his birthday.”

The 3rd man said “Well, that’s terrific! My son studied in the best universities and became an engineer. Then he started his own construction company and is now a multimillionaire. He also gave something very nice and expensive to his best friend for his birthday: a 30,000 square foot mansion.”

The three friends congratulated each other just as the fourth returned from the restroom and asked “What are all the congratulations for?”

One of the three said “We were talking about the pride we feel for the successes of our sons. What about your son? The 4th man replied “My son is gay and makes a living dancing as a stripper in a nightclub.” The three friends said “What a shame….what a disappointment.” The 4th man replied “No, I’m not ashamed. He’s my son, I love him and he’s lucky, too. His birthday just passed and he received a beautiful 30,000 square foot mansion, a brand new jet and a top of the line Mercedes from his three boyfriends!”

[Listening to: Exodus - Bob Marley And The Wailers - Legend (7:35)]

comments suggest edit

I swear I never do these stupid quizzes or memes or whatever you call it, but this is only three questions. If it’s good enough for Sam Ruby, it’s good enough for me.

  1. Why did you begin blogging and what motivates you to blog today?

    I started before it was called blogging as a way for my family and friends to keep tabs on me. I was basically rubbing it in that I was in sunny Los Angeles while my family and friends suffered the bitter cold of an Alaskan winter. What motivates me today is fame, fortune and vanity! Though the first two still elude me, what really motivates me are these great relationships and conversations I’ve had online. Blogging spurred me to get involved in open source software and provides a steady stream of alternate viewpoints.

  2. What tips can you offer to others who want to start blogging or improve their existing blog?

    I think Sam says it well enough. I’ll only add, don’t take yourself too seriously and have fun with it. Write for yourself first, and others second. Thus if blogging ends up being just a fad (I don’t think it is), what would you care as you’ve improved your writing skills, had an outlet of expression, and made many interesting contacts along the way. Not to mention the fame and fortune that most certainly is yours.

  3. What are three blogs that you read daily and why?

    Did you say three, or three hundred? If I tried to only list three, I’d start to sound like an incoherent academy award winner stepping over the alloted time thanking countless friends and feigning worry about those little people I might offend. I started off with a small list and it just seemed to grow organically. Person A, whom I respect, mentions person B alot, so I link to person B. I often subscribe to people who link to my site (because they obviously have good taste) or comment on my site, and then drop them if they start to bore me. I really need to cut down on my list. But since you asked, three that come to mind are…

[Listening to: So Danço Samba - Stan Getz & João Gilberto - Getz/Gilberto (3:45)]

personal comments suggest edit

Thierry Henry One of my friends from our weekend pick-up game sent around this quote from Nick Hornby’s novel, Fever Pitch (which was regrettably turned into a movie about baseball, rather than soccer as it was written).

This quote just captures the love and passion the world has for soccer.

Luckily, it is possible to be a professional footballer without walking on to a League pitch, and without being blessed with a footballer’s physique or pace or stamina or talent. There are the grimaces and gestures - the screwed-up eyes and slumped shoulders when you miss a good chance, the high-fives when you score, the clenched fists and hand-claps when your teammates require encouragement, the open arms and upturned palms indicating your superior positioning and your teammate’s greed, the finger pointing to where you would like a pass delivered, and, after the pass has been delivered just right and you have messed up anyway, the raised hand acknowledging both facts. And sometimes, when you receive the ball with your back to the goal and knock a short pass out wide, you know you have done it just right, just so, and that were it not for your paunch and your lack of hair, and your lack of height, were it not for all those peripherals, you would have looked just like….(Thierry Henry).

For those (probably just family and friends) that are interested, here are some pics from a recent pick-up game we had. We rented a pitch with a perfect artificial turf for $175 an hour for two hours (I need to get into that racket). One of our players is also an aspiring photographer.

Clark Saves

This is Clark, our fearless phenomenal goalie. You may have seen him in that movie, In Good Company.

Ron Dribbles

Ron, who organizes these games at the nice field, attempts to pass the ball.

Peter Passes

Peter here, good bloke from England, gives an undoubtedly nice cross to a teammate. Notice the rubber pellets he kicks up.

Phil Fights Off Defender

This here is me, attempting to keep a defender away from the ball.

Vanessa Strikes

Vanessa makes sure to look good at all times when striking the ball.

Vince protects the ball from an encroaching Peter. Vince is probably the most talented player on the field.

My teammate Bill puts one in the back of the net.

comments suggest edit

Yesterday we drove down to the San Diego area to spend the day with Akumi’s dad in Chula Vista, right on the border with Mexico. Trips to visit her dad end up being culinary expeditions of the highest quality. For lunch, we had some of the most delicious Ton-Katsu since Japan. Unfortunately we stuffed our faces so much that by the time we went to dinner, we were still a bit full and couldn’t enjoy the meal. Which was too bad because we went to the best Sushi place in San Diego. Perhaps the best in Southern California. Sushi Ota.

It’s a rather non-descript little place in a small strip mall that has been rated by Zagat as the best all around restaurant in San Diego (not sure what its current rating is), not just the best Sushi restaurant. If you call ahead for reservations, ask to be seated in front of Mr. Ota. He doesn’t work many days of the week, so you might need to call ahead, but it’s worth it.

comments suggest edit

UPDATE: Whoops! I linked to the wrong versions of putty and pageant. I corrected the links.

UPDATE: June 1, 2006 Sourceforge has changed the CVSROOT in use for each project. The server hostname now has the project unix name prepended. For example, to connect to RSS Bandit’s CVS repository, connect to rssbandit.cvs.sourceforge.net.

Introduction

This post is dedicated to the .NET head who’s grown up on Visual Source Safe and suddenly finds himself (or herself) in the midst of an open source project hosted by SourceForge. CVS is very different from the check-out, check-in pessimistic locking approach taken by VSS. I hope to demistify it just a bit so you can start hacking away at the numerous .NET based open source projects hosted on SourceForge.

Disclaimer

Keep in mind that I’m basing this on my experience. Although there are multiple Windows CVS clients, I’ve only used TortoiseCVS. However, I’m sure these experiences apply to WinCVS as well.

Software

Before we begin, please download the following tools.

Generate SSH Keys

The next step is to run PuTTYGen to generate your SSH keys.

  1. In the Parameters section at the bottom, make sure to select “SSH2 DSA’. \ PuTTYGen Screenshot
  2. Click the “Generate“ button.
  3. Follow the on-screen instructions (“Please generate some randomness by moving the mouse over the blank area“). Key generation will be performed immediately afterward.
  4. Upon completion of key generation, enter username@shell.sf.net in the “Key comment“ field, replacing ’username’ with your SourceForge.net user name. This comment will help you identify the purpose of this key.
  5. Enter a passphrase and confirm it.\
  6. Click on the “Save Private Key“ button and save your private key (using the .ppk extension) somewhere you’ll be able to find it again.
  7. Good, now you can post your keys on SourceForge. Keep PuTTYGen open to where it is because you’ll need it later.

Posting Your SSH Keys

The point of this process is so that you don’t have to enter your password for every single CVS file operation. In order to do that, CVS needs a copy of your public SSH key. To do that, make sure you are logged in and…

  1. Go to your account page.
  2. Scroll down to the “Host Access Information“ section.
  3. You should see a section about the Project Shell Server. Click on the “Edit SSH Keys for Shell/CVS“ link.\
  4. This will provide a form in which you can post your public key. The text to post in here is displayed at the top of PuTTYGen in a text box with the label “Public key for pasting into OpenSSH authorized_keys file:“\
  5. Make sure to follow the instructions on the page. Multiple keys can be posted, as long as there is one per line.

There is a delay before your keys are fully posted, so be patient.

Getting Pageant Involved

Now is where Pageant gets involved. Pageant is a little service that runs in your system tray. It’s primary purpose is to provide authentication into SSH. It holds your private keys in memory, already decoded, so you can use them without having to enter your passphrase all the time. Instead, you enter your passphrase once when you start pageant.

  1. After installing and running Pageant, you can double click on its icon at any time. It looks like a computer with a hat on it.
  2. Simply click on the “Add Key“ button and find the private (*.ppk) file you created earlier. That’s it!

Checking Out A Module

At this point, you are all set to get going.

  1. Make sure you’ve been added as a developer to the project you’re going to work on. A project administrator would have to do this.
  2. In Windows Explorer go to the folder you wish to check the code out into.
  3. Right click and select the “CVS Checkout“ command.\ CVS Checkout Command
  4. You will need your username on SourceForge and the project UNIX name. For example, if your username was “haacked“ (it isn’t, because that’s mine) and the project you were working on is “subtext“, you’d enter the following information
    • Protocol: Secure Shell (:ext)
    • Server: projectname.cvs.sourceforge.net
    • Directory: /cvsroot/subtext
    • Username: haacked

    \ CVS Checkout Module Dialog

  5. Wait patiently as the project is created on your local machine.

Now Write Some Code

Note that you only have to checkout a module once. Afterwards you can run the update command to get changes committed by other developers. It’s a good idea to do this before and after you make any changes.

CVS Update

Commiting Changes

After you’ve changed some files, their icons be marked with an orange arrow. To commit your changes, right click and select the Commit command. Please make sure to enter an informative comment.

To commit multiple changes, right click on the root folder and select Commit. You’llget a list of all changed files. You can check the ones you wish to commit and commit them in bulk.

Adding Files

If you add a new file to the project, you’ll need to add it to CVS and THEN commit it. To add a file, simply right click on it and select “CVS Add“.

Know when to ignore

TortoiseCVS is not integrated with Visual Studio.NET. Thus it doesn’t know that there are some files you do not want to add to CVS such as *.suo, * and maybe the “bin“ and “obj“ folders. To ignore folders, simply right click on them and select “CVS Ignore“. This will create a .cvsignore file in the directory. It’s probably not a bad idea to add this to the repository so that others don’t accidentally add “ignored“ files.

You can also set ignored files using file patterns within TortoiseCVS’s preferences dialog. Right click on any file and select “CVS“ -> “Preferences“. Under the “Ignored Files“ tab, enter file patters such as *.user.

Submitting Patches as a Non-Developer

If you do not have developer access, you can still submit patches to a project. In most SourceForge project sites, there is a “Patch“ section where patches can be submitted. In order to learn how to submit and apply patches, read the following article “Using a Windows version of GNU Patch.exe with CVS and Diff Files“.

For More Information

Conclusion

I hope this gets you on your feet when joining an open source project in SourceForge. If you find any errors, omissions, and such, please let me know so I can correct it.

[Listening to: Check It Out - Lee Burridge - Nubreed 005 CD1 (6:36)]

comments suggest edit

Alright, it’s time for me to pull this ratty old thing out of the closet, dust it off a bit, and step onto it. Yes, my pedestal.

In this week’s newsweek, there’s an article entitled “How To Build a Better High School” which starts out with an anecdote about a student who transfers to the number 1 school in the nation (according to Newsweek). To demonstrate the rigor and difficulty of this school, the article highlights that the first assignment for in this student’s AP European History class is to…

…memorize the map of Europe and be able to draw every country, along with 10 captials, 10 rivers and 10 bodies of water.

My goodness what a brain teaser! Can anyone say “busy work”? Is this what passes for great education today? I can just see this student twenty years from now as a diplomat or foreign policy analyst.

Well sir, before we head into this meeting, do you understand the historical context surrounding the animosity between these two nations and how their cultural differences have stoked this hatred?

Hmm… Not really, but I can draw you a pretty map with turquoise rivers.

Now in all fairness, I’m sure they will cover meatier subjects, but is this rote memorization necessary? Is it preparing them to be thinkers and leaders of the future? Rather than relying on rote memorization, involve them in a discussion about the history, culture and politics of these countries and point it out on a map as you do so. They’ll figure out where these countries are located.

Rote memorization has its place (like sports statistics), but by highschool it should be at a minimum. Ok, rant over. I have to go memorize some HTML entity codes.

[Listening to: Just Be - Tiësto - Just Be (8:46)]

subtext comments suggest edit

Subtext Logo For the past several days, I’ve been consumed with working on the Subtext blogging engine (not to be confused with the Subtext programming language). It’s been the most fun I’ve had writing software since, well, since working on RSS Bandit as a matter of fact. ;)

Speaking of RSS Bandit, Dare offers some good advice for those starting an Open Source project. I’m going to have to pick his (and others) brain some more and maybe write a short article with advice on starting and continuing an open source project. Especially since I’ve already violated one piece of his advice, which is to save the announcement till you have a release, in order to generate more excitement.

Despite not having a release yet, I have seen some excitement in the community over this project and I appreciate all the well wishers. If you’re interested in taking a look, you can get the latest source code at any time, but you’ll have to use CVS until we get a release prepared. I was working furiously to get an installer package ready, but upon the advice of the team, I put that aside so we could focus on having a more compelling release first. That also bought me some time and breathing room as I was completely stuck on a problem using WiX.

So far, some of the interesting features I’ve implemented are…

  • Friendly and informative error pages for missing blog_config records and malformed (or just wrong) connection string.
  • Skins can now add an edit link visible only to the admin user to the ViewPost page. So when viewing a page as an admin, you can click the edit link to go directly to the post editor. Sometimes I like to edit an older post and hated having to page through so many records. Instead, I can use Google to find the post and then click the edit link.
  • Fixed the MetaBlogAPI. I hated the fact I couldn’t edit old posts with w.Bloggar. Now I can.
  • Syndication compression (for aggregators that support it) using contributed code.
  • Applied a contributed patch to add “image”, “license”, and “copyright” elements to the RSS feed for those that want it.
  • Comments can be turned off after a configurable number of days.
  • … and more!

Already it’s at a point that I can’t wait to deploy it to my own blog. But I’m going to hold off till we can implement a few more features and get the installation package together. That’s the biggest technical challenge right now and I welcome any offers of help on that.

My pace on this project will slow by necessity as I get my consulting projects moving forward. But I have to admit, I’m having so much fun on this I often catch myself daydreaming about finding a wealthy patron to sponsor me to work on open source projects. But a foot set firmly in reality snaps me out of that stupor and back to writing code.

[Listening to: Plantastic - Artifacts - Lee Burridge - Nubreed 005 CD2 (6:01)]

comments suggest edit

This just cracks me up. Especially after reading #1 through #3 and then you get to #4, I can’t stop laughing. If you’ve been these various venues (rave, dance club, hip-hop club, etc…), you’ll totally get this humor.

You know who you are. Standing behind that deck of turntables, holding one headphone to your ear, being pretentious and aloof as you play with knobs and shuffle through records. You can just settle down, because nobody cares that you’re a DJ.

Take a read.

comments suggest edit

Today has been an awful day, starting just past midnight, I lose the database for my site. Later, I played in the most dreadful soccer game ever. We only fielded ten players, but the other team only had seven showup to start! Yet, they managed to put three in the back of the net by half-time.

At half time, one more of their players showed up and one of ours had to leave, leaving us with a only a 9 to 8 advantage (which felt like a disadvantage at this point). If it wasn’t for a red card one of their player’s drew for kicking me in the chest while I was down on the ground, they probably would have scored 10 goals in the second half, rather than keeping the score at 3 to nill. It was complete and total humiliation.

Now, after recreating my blog entries (an upbeat note), my Toshiba M205 takes a dive with the blue screen of death and won’t boot properly. GodDamnPieceOfShitSonofabitch!!!

Anyways, I’m annoyed, but not too down about it. Heck, I live in Los Angeles, it’s sunny outside, and my wife made me a nice coffee. I really can’t complain. But I just did, didn’t I. ;)

UPDATE: I forgot to mention that my office smells like dog piss because Twiggy has taken a liking to doing her dirty deed in a particular corner of the room. Just lovely.

comments suggest edit

As a developer, I like choice. For example, WiX doesn’t currently support managed custom actions. You can hack it together, but they won’t support your endeavor. Personally, I want the choice to shoot myself in the foot with a managed custom action. Hand over that gun!

However, too many choices can be quite paralytic as well. You ever try to round up more than four coworkers for lunch and figure out where to go? So it comes as no surprise that having too many options in a company 401 (k) actually decreases overall enrollment (as reported by The Wall Street Journal). My buddy Walter here has a analysis of the topic.

comments suggest edit

If there’s one thing I’ve learned as a professional developer, it is that “TIP” is bad. Never Test In Production! Unfortunately in my case, it was past midnight, I was tired, and I had two query analyzer windows open, one to my local host, and one to my website’s database, both with the same database name

I was testing an installation script that would drop and recreate the Subtext database, and I just happened to run it in the wrong Query Analyzer window. You can imagine my distress as I visited my site to find it pretty much gone.

Fortunately, my hosting provider takes regular backups and they had a backup from four days ago. Once the backup was restored, I went in and carefully recreated four days worth of blog posts with help from my RSS Bandit cache. You see, it’s more than vanity that I subscribe to my own feed.

In case your curious, I used Query Analyzer to reconstruct the posts since the URLs were generated using the ID column (identity) and the DateAdded column. With liberal use of the

DBCC CHECKIDENT (‘blog_content’, RESEED, 3073)

command, I recreated the proper IDs so that existing links to these posts would not break. Unfortunately I lost all comments.

[Listening to: Duke Pearson (With Airto And Stella Mars) / O Amor Em Paz (Once I Loved) - Blue Note Plays Jobim (5:24)]