Sunday, 29 August 2010

Where I'd go back

We've been so a bunch of places. They've been wonderful, and I'm always glad that we've went and seen all that we have. Of all the places that we've been, there is one place that I'd go back in a minute: the Osa.

It was so relaxing when we were there. It might not be your speed, but we thought that it was awesome. After flying to Puerto Jimenez we went to a Playa Preciosa and stayed there for a couple of days. When we were there, they still had to run a generator since the government had not finished running the power lines. I think that it was supposed to be done like 5 years before we went, so they were a bit behind. It was gorgeous there with long stretches of empty beaches and lots of playful dolphins around.
DSC06130
DSC06146

After that, we traveled to the Terrapin Lodge were we had wonderful food served on nice plates in the middle of the jungle. Each night around 5:30, the spider monkeys with their babies would come around to eat fruit from the tree beside our lodges porch. From there we took a hike into Corcovado. If we were to do that again, I'd book well in advance to stay at the ranger station and perhaps get a guide as well. Oh, and I'd also take a lot of water. They say that you should have at minimum 3 L / person. Ya, do that. Don't drink out out of a "potable" stream beside a vulcher like we did.
DSC06187

The rest of Costa Rica was wonderful too, but when my mind starts to think of tropics, my heart goes to the Osa.

Friday, 27 August 2010

Stopping the light

For photography you can buy all kinds of filters. Filters for colour, filters for types of light, filters that just reduce the amount of light getting to the camera (ND filters). The thing that I don't get is, why can't this be done in software on the camera. e.g. Set up the picture, and then going under "pre-picture, filters, ND, and then choose a level". All that filter does is cut down the amount of light getting to the camera, why can't the software just toss out every x photons that it gets to the sensor? I would have thought that would be a trivial feature to add. Same idea could be done with an grad ND - choose the amount, chose the transition line, etc. Why bother bringing around more expensive gear with you if this should be able to be done in software.

Sometimes I wish that I could hack the hardware that I deal with. It would make life a lot easier, or explain why this can't / shouldn't be done.

Thursday, 26 August 2010

Find all files extension with a given path in unix

Today I wanted to find all the types of files that people are using in their "resources" part of their project. Here's the script that allowed to to ssh to our CI server to find it.

find . -path "*/src/main/resources/*" | awk -F . '{print $NF}' | grep -v "/" | sort -u

Sunday, 22 August 2010

"Uncle Jim, do you *always* have a camera?"

I was actually asked that by my 7 (?) year old nephew. I understand why he thinks that - at family events I'm pretty much always carrying around a camera. Why do I do it? Well, first off I love pictures. I love taking them, I love seeing them, I love the memories they trigger when I have not seen them in years. Another reason is if I'm not taking pictures, I'm don't think that I can trust anyone else to have brought their camera. I worst part is that has become a catch-22: because everyone else assumes that I'll bring a camera and will be taking pictures, they don't even bother.

I somehow have ended up becoming one of the family archivist, even for media that I never captured.

Don't get me wrong - I'll still happily take the pictures. If only to get the moments like this:
DSC_0947

Saturday, 21 August 2010

Working on composition

One of the many things that I'm trying to work on is composition in my photos. To get a nice short depth of field I usually have to use our long lens (55-200mm). It allows you to get in close from far away and give you a more "intimate" feeling like below:
DSC_0018

One thing that I love love love with photos are our "perspective shots" like this shot in Barcelona:
The path along the beach goes on forever

I'm now trying to play with this for what I wouldn't have seen as a "perspective shot" before. Here's an example from some pipers on the hill a couple of weeks ago:
DSC_0019.

It's funny, looking back at some of the pictures that we took with our old point and shoot, I'm quite happy with those shots. They turned out quite well. That's just a reminder to myself for when the pictures don't turn out nice: the camera is not my limiting factor.

Friday, 20 August 2010

Looking at the world though pol coloured glasses

I've been a bit disappointed with some of the photos that I've taken with our D60. Don't get me wrong - I love the camera - I just wish that some of the pictures turned out as good as I saw them. A good (bad?) example of a disappointing picture is when we were hiking in Sa pa
DSC_0897.

The picture looks like crap compared to what I saw while I was there. So disappointing. My brother-in-law is also interested in photography, probably more than I am, and he wanted all kinds of filters for his birthday. He strongly insisted that I get a couple of filters, including a polarizer for my camera. So I started to do some reading and figured the artifacts that I wasn't happy with: glare from water, poor looking sky, vegetation that looks gray; all can be solved with a polarizer. It's not even something that can be fixed in software after the fact. Crap. Wish that I had known this before.

One reason why there has been such a disparity between what I saw and the pictures that were taken: my sunglasses are (linearly) polarized. All this time I thought that it was the cameras dynamic range being less than the eye. I guess that I don't have to focus on HDR photos to capture what I see.

The other shots that I was having troubles with? Taking longer exposures of things like moving water to get a really flowy effect can be solved with a neutral density. Below is my best hand-held attempt. I could only get the effect by taking a picture of a darker, less interesting part of the river.
DSC_0576

I really wish that I had taken the photography class in high school. The fact that it conflicted with 2 other classes that I had to take to go to university, which forced me to do one class at night school, really sucks. I've read a book about photography, but I think I need to read more and / or take a class.

Sunday, 15 August 2010

Printing from a new mac using a parallel printer cable

Just in case that anyone else has this problem, or more likely, that I need to find this again, I finally have printing from the mac to our 1999 laser printer via a Sabrent usb to parallel port printer cable which I bought from tigerdirect.ca. Before I couldn't get it to work at all. I figured that it had been worth the 12 $ for the experiment though. Tonight I decided to look again, and behold, I found a 9 year old post explaining exactly what I needed to do. I just had to go to the Gutenprint project and install the "usbtb" module.

My only explanation for why Laura's printer doesn't need ink is that it's a TARDIS and has a supertanker of printer ink inside - the future's currency standard after gold became easy to manufacture.

Package is more then just a package

People are dumb. It just seems to be how we are wired. For some reason, we end up putting more value on first impressions and packaging then I think that we should. Some times it doesn't even have to be a covering / wrapping, just how it is delivered. I'm sure that there are have been many PhD's written to prove this all, I just can't be bothered to reference them. (aside: People are also lazy).

I try and make dinner seem special most nights. I find the effort is worth it, if only for my enjoyment. No, that's a lie. I do it for Laura. On the nights I'm home alone I'd eat out of a can if only I could microwave it. So, with the idea to maximize the impression of dinner tonight, I presented it as "Poached west coast salmon, served in a cream and bacon reduction, with steamed swiss chard, and sweet Ontario maize". Sounds good. Sounds much better than than "fish cooked a in pan with some water and things Laura didn't want me to add, cooked green wach-ma-call-its and week old leftover corn". It's the same food, just one meal tastes better before you've even lifted a fork to your mouth.

Friday, 13 August 2010

The Accessible Home

We recently got a new front and back door. That means new door knobs. One that I really wanted to lever style door handles (on the inside at least). I got this idea from my dad when he was telling me that it's building code for commercial building to have these because they are easier to open if you can't "grip" - like if you suffer from arthritis. It also makes it easier to open the door if you have your hands full.

With new lever action black hardware for the outside doors, that meant we had to get new matching ones for the inside. I put up a fuss over the cost, but not too much because 1) I also wanted new handles for the inside and 2) the old brass ones don't match any of the changes we've made to the house, and some are quite beat up and crappy looking. Now I've replaced the handles on the main floor and everything looks good. Most importantly, I can now open our doors with my feet if I'm holding milk and cookies. And that, my friends, is the true meaning of "accessible".

Friday, 6 August 2010

Cooking by weight

I keep on thinking about getting an accurate kitchen scale and cooking by weight. For baking I think that it would be much better. Well, at least more consistent. The other day I read an interesting article - To Enhance Flavor, Just Add Water - where they talked about fine tuning flavour. The really interesting part of that was the part about making better coffee. I'm always looking for ways to make better coffee and the idea of being precise with the ingredients appeals to my nerd side. Not that randomly throwing beans and water together would produce anything bad, it's can just always be better.

Thursday, 5 August 2010

Overriding selective methods in order to unit test

Today I was trying to test a taglib that was quite old and structured in a way that didn't make testing easy. The class under test was pretty simple, but it called a method in its parent which was quite complicated and made for extensive setup for each test. It occurred to me that if I just override that other method - not the one I was trying to test - it would make my life a lot easier.



The code I had was something like this:



public class MyTag {
public void doStart() {
try {
MyObject ob = hardToTestMethod();

if (ob.doSomethingState()) {
// do something
} else {
// do something else
}

} catch (Exception e) {
throw new JspException("something went wrong", e);
}
}
}

Which gave me 3 use cases: an exception is throw, MyObject is returned in a doSomethingState or not. Inline we can easily override the hardToTestMethod to throw an exception or a mock object, using your favourite mock lib.



@Test(expected = JspException.class)
public void doStart_ThrowsAnException() {
MyTag tag = new MyTag() {

@Override
public MyObject hardToTestMethod() {
// or you could return a mock
throw new RuntimeException("I'm on a boat yo!");
}
};
tag.doStart();
}


I felt all clever. At that point I knew that this must be a well known technique. The closest thing that I found with a couple of minutes of searching is an IBM article from 2002 which talks about refactoring factory code. Not exactly the same thing, but close enough. I just thought that I would share in case other people were dealing with difficult to test java and wanted to know another technique to be able to unit test it.