Friday, May 4, 2012

The Rights of Spring

I'm chilling in my room before I head to the Majestic. I've seen some of my friends and ad breakfast with a couple of the lads from DeeExpus. The festival hasn't even started yet and I'm having a great time already.  If you are a fan of good music you should make the pilgramige to Gettysburg. You won't regret it.

Wednesday, May 2, 2012

Pre-Rites of Spring

I’m watching the clock as it winds down for my last working day before I leave for this years Rites of Spring festival. This will be the second time I’ve made the pilgrimage to Gettysburg for this festival. Last year I knew one person before going and came home with many new friends. I can only imagine how many friends I’ll make this year.

Last year I was only familiar with Tinyfish before the festival. I really enjoyed listening and discovering the other bands there. Many of whom have earned places on my playlists. This year I know DeeExpus and the Aaron English Band. I look forward to hearing both of them perform again and learning about the other performers this year.

This year I’m going to try and make some notes to blog more about my experience at RoSfest. No promises though. The late night parties have a way of eating up what little free time I have. Plus there’s meeting all my friends who I haven’t seen in far too long.

Is it time to get on the plane yet?

Tuesday, February 28, 2012

New Rules for a New Era

As I write this it’s 2012.  There’s a new C++ standard, C++11, and yet I still come across a lot of bad C++ code in the wild.  So I decided to use some of my time to write some posts that I hope new programmers will find and use to improve their skills.  Today I’m going to talk about a “rule” I found on a blog post from 2007 that was one of the top results when I searched the web for information about exceptions.

The rule is:

Avoid exceptions.  Exceptions will only leave you open to the memory and resource leaks. Don't use them. The exception to this rule is if you are programming in a style that doesn't use pointers, and everything is encapsulated into smart pointers.

The problem I see is the exception to the rule that should be the standard programming style followed.  There is rarely a need to program in a style that uses bare pointers.  Even when you need to use a bare pointer the standard library has facilities to make them exception safe.  The example given in the posting was:

void foo()
{
    Object *obj = new Object();
    bar();
    delet obj;
}

As you can see if bar() throws an exception the instance of Object is not released and we have a resource leak.  This is used as the argument of why we shouldn’t use exceptions.  I counter that this is an example of poor coding.  I would recommend two ways to rewrite the foo() function that remove the resource leak.

The first method would be to declare the instance of Object on the stack.  If an exception is thrown the resources would be released when the stack is unwound as part of the exception processing.  If Object contains large data members they should be allocated on the heap as part of construction and released during destruction.  This would change foo() to:

void foo()
{
    Object obj();
    bar();
}

The second method would be to use std::unique_ptr<> which would wrap the instance of object allocated on the heap with new.  The instance would also be released when the stack is unwound during exception handling as the wrapper includes a destructor to free the resource.  This version of foo() would be:

void foo()
{
    std::unique_ptr<Object> obj(new Object());
    bar();
}

I mentioned before it was 2012.  Microsoft Visual C++ 2010 has support for some C++11 features and std::unique_ptr<> is one of them.  So stop using bare pointers unless you have a real need for them, and I’ll bet that you do not have a real need for them.

Monday, December 19, 2011

The Demons of Cyclic Space Redux

WinDemons

When I started learning how to write programs in C I wrote several as described in the book “The Magic Machine” by A.K. Dewdney.  Chapter twelve is called “The Demons of Cyclic Space” and I’ve been intrigued by the cellular automata it described.  Over the years I’ve re-implemented the simulation on a variety of systems and languages.  Four years ago I posted a video saved from a run and really haven’t touched it since then.

The Demons of Cyclic Space

Last week the video received a comment about the video and a question about my implementation.  So I decided to brush off the code and see about cleaning it up for release.  It was written using MFC in a version of Visual Studio I don’t have anymore.  As it wouldn’t build with Visual Studio 2010 I decided to re-implement it in C++ and ATL.  The screen shot at the start is the first pass which shows the initial world state that is generated.  The next step is to add updating the simulation and display the new state.  Finally I want to update the program to output the simulation run as a video file.

Once the program runs I will publish the repository and some information about the code and what’s happening behind the scenes.  Also in the plan is to implement the rest of the programs described in the book and post videos of the simulation runs.

Tuesday, September 20, 2011

Goedemorgen! Ik ben Brendan.

Goedemorgen! Ik ben Brendan.

I have decided to learn Dutch. Normally I spend my time playing with German as I’ve wanted to learn that language for a long time. That’s been the problem with German. I’ve only been playing at it and not really giving it the attention it needs. I have a trip to Amsterdam coming in a few months and another one planned for the 2013 Marillion Weekend. The first trip is only a few months away so I have to focus to meet my goal in time.

Speaking of goals here is mine: I want to be able to talk with the locals in their language. I want to be able to get around the city by reading signs and information on my own. In a concrete term I would like to achieve the B1 level of the Common European Framework of References for Languages (CEFR). My goal is to achieve level A2 by the end of 2011 and use the first months of 2012 to work up to B2 before the trip. I don’t have a date for the trip yet so I’m going to set the end of March 2012 for my deadline.

I have purchased a phrase book and book to learn the language. For the rest of September I’m going to create a list of tasks with deadlines breaking down the steps I’ll need to accomplish to meet my goals. Additionally I’ll search for free materials such as word lists, blogs, podcasts and videos to assist with learning the language. Sadly the Foreign Service Institute doesn’t provide Dutch as part of their free language courses.

Starting in October I’ll start by learning basic vocabulary and studying the book and finishing it in the month of October. In November I’ll add watching movies, reading blogs and listening to podcasts in the Dutch. Finally in December I’ll find natives who want to learn English and practice with them via VOIP.

That is enough of a plan for the moment. Tot ziens!

Wednesday, August 31, 2011

20110828 Alki Beach 5K Walk & Run

From Hiking & Walking

A few weeks ago a friend asked me to join them in the Alki Beach 5K Run & Walk and I agreed to go. Five kilometers isn't a difficult walk and I knew the route would be flat as it was along the shore of Alki beach.

Due to spending the two previous days at PAX the alarm on Sunday morning went off way too early. Yet I still made it up and over to meet my friends in time. It was a very foggy morning and as you can see from the photo I didn't see the sun or a lot of water during the walk. I finished the walk with an official time of 1:03:37. I am going to work on lowering my time for future 5K walks, but am satisfied with my results.

This was the first walk on a new pair of Brooks Beast running shoes that I had bought the week before. In the end the shoes were great as they didn't cause me any discomfort during the walk. Having high arches I like that the Beast comes in wide versions. I believe these are going to be a great pair of shoes for hiking on sidewalks and lighter trails. I'm considering buying another pair to use in the gym.

Finally, I have to say I look damn good in that picture! I don't feel like I've lost that much weight but looking at pictures like that compared to some a few years ago and I can see a positive difference. I win!

Monday, August 29, 2011

Whoops!

I've kept hiking and walking on a regular basis. The problem is I haven't been good and keeping up on blogging about it. Sorry folks.

This weekend while participating in the Alki Beach 5K I thought about the issues I have with gear while hiking and possibly blogging about how I find solutions and work arounds. For example, where can you buy base layer clothing to fit my larger frame. I figure that information could be useful to other big hikers. So I will start to include that on my posts here along with the rest of my life.