Sunday, 20 December 2009

Time machine failures

I've been having time machine troubles lately. From the console log it was giving a "failure to mount" the sparse image.

I didn't notice exactly when the failures started to happen, but I blamed it on an OS update. Now I suspect that it started to happen when we where having renovations done and the contractors turned off the power - probably mid-backup. I tried disk utility to fix the backup file, but something was corrupted with it. I found a way to repair a corrupted sparse file, but it requires DiskWarrior at 100 $. Since I don't really care about the history of the backups, I just want them to work now, I ended up just creating a new file and letting it run for a while (117 G ended up taking a while to backup).

So, what I learned is that time machine doesn't like it too much when the drive it's backing up to suddenly looses power. If I had more critical stuff on that drive, I'd put an UPS on it, but I'm still not sure if that would be good enough for the little 100 $ drive I've got plugged into it.

The other day the guys at work made fun of me for backing up my stuff twice - once manually and once with time machine, but it comes down (at this point) I don't trust time machine or myself manually backing files up. Hopefully both processes won't fail at the same time. Now I just have to set up a couple of more sites to backup files to - when copies and space are essentially free, why not store stuff every where I can. ;-)

Wednesday, 16 December 2009

The family grows

Laura would probably want me to wait to announce it, but I can't, I'm too excited. Our family is growing. At first we had Billy, then Niki, and now the newest member: Lulu (tentative name).

The third one is always the most rugged, and dare I say it, dashing good looks. :-D

Update: it looks like the name we have settled on for the new camera is "Steve" - because it's a pretty name.
(you won't get that unless you've seen Over the Hedge)

Saturday, 12 December 2009

Backing up MovableType 2.611

One of the many things that I don't do much is make a backup of my blog. Until recently the last backup was from 2005. This post is to help anyone else that had similar similar issues using MovableType 2 (version 2.661). Most posts on the 'net say "just press the export button". One of the complications that I have is: 1) I don't have access to the command line or db 2) I've never had access to the export command So, using either a template or scraping the html was the only way to grab the content. I found a really helpful post on a export template. The only issue was that it was written for a version of MT 2 versions newer than what I needed. So below is the tweaked template that I used. It's not perfect, but it's easier than scrapping html. The lastn attribute is for the max number of attributes and I had to remove the mt:if statements because those were from MT v4 (but I can't find the link right now).

<MTEntries sort_by="created_on" sort_order="ascend" lastn="25">
AUTHOR: <$MTEntryAuthor$>
TITLE: <$MTEntryTitle$>
BASENAME: <$MTEntryBasename$>
STATUS: <$MTEntryStatus$>
ALLOW COMMENTS: <MTEntryIfAllowComments>1<MTElse>0</MTElse></MTEntryIfAllowComments>
ALLOW PINGS: <MTEntryIfAllowPings>1<MTElse>0</MTElse></MTEntryIfAllowPings>
DATE: <MTEntryDate format="%m/%d/%Y %H:%M:%S"/>
CONVERT BREAKS: 1
<MTIF tag="EntryCategory">PRIMARY CATEGORY: <MTEntryCategory/>
<MTEntryCategories lastn="1000">
CATEGORY: <$MTCategoryLabel$></MTEntryCategories>
–––––
BODY:
<$MTEntryBody$>
–––––
EXTENDED BODY:
<MTEntryMore/>
–––––
EXCERPT:
<MTEntryExcerpt no_generate="1"/>
–––––
KEYWORDS:
<MTEntryKeywords/>
–––––
<MTComments lastn="1000000">
COMMENT:
AUTHOR: <MTCommentAuthor/>
EMAIL: <MTCommentEmail/>
IP: <MTCommentIP/>
URL: <MTCommentURL/>
DATE: <MTCommentDate format="%m/%d/%Y %H:%M:%S"/>
<MTCommentBody/>
–––––
</MTComments>
<MTPings lastn="1000000">
PING:
TITLE: <MTPingTitle/>
URL: <MTPingURL/>
IP: <MTPingIP/>
BLOG NAME: <MTPingBlogName/>
DATE: <MTPingDate format="%m/%d/%Y %H:%M:%S"/>
<MTPingExcerpt/>
–––––
</MTPings>
––––––––
</MTEntries>

Friday, 11 December 2009

Appropriate Process

In a big org, and gov't is one of the biggest, people are very process focused. I'm okay with that. I love some processes: issue tracking, unit tests, continuous integration, one click deployments, automated quality metrics, etc. The thing that I get frustrated with is process without an apparent positive ROI.

One term that's been mentioned at work lately is "appropriate process" and I really like that. Process can be the best of things if it's appropriate. Filling out forms that are not checked against the actual product you are creating is not something that I would call "appropriate". That would fall into the "process for the sake of process" category. I think that is worse than no process at all because it's taking time / money away from actually doing something positive for the org.

Management is always asking for feedback. That's what they say at least, I'm still not sure if they actually mean it. What I would like them to do is come up with a business case for every "stage gate", "go / no-go decision point" and what ever buzz words of they day is being used.

Part of that business process would help you cost out all the parts of bringing something to prod. I wonder what percentage would be attributed to "process". 10%? 50%? 80%?

I want everyone that I work with, from the top to the bottom, to be "adding value". If you're not, well then at least get out of my critical path. I just want to route around the damage.

Tuesday, 8 December 2009

Possibly moving and the plan

With Ryan gone I have no idea what's going to happen with his hosting and domains. I don't know if he's arranged to pass them on to someone else or what. If I was in Ryan's position, I sure that I wouldn't have made preparations like that.

Having said that, I'll probably be moving to a different location on the 'net. Not sure where or when. I've made a backup of most of my posts (not the last couple yet), so hopefully where ever I move my blog to, I'll import the last 1035 posts. Ideally I'd set it up as smoothly as possible so that it this location has the proper redirects etc. but we'll see.

One thing that I would like to do is make sure that Ryan's site - or at least the contents - don't get lost. Not sure what the plan is for his site / domain, but what I'm going to do is make a backup of his blog and host it where ever I have hosting. He's hosted me for this long, I think that I can host him the rest of the time. Fair is fair.

I think that for someone who's spent so much effort and time working online, an online legacy is fitting. Maybe that's just me. That's my plan to honour my friend.

Saturday, 5 December 2009

A compartmentalized life

Today was Ryan's funeral. It's funny how you can learn things about people after they are gone that you never knew in life. But I think that's the way that Ryan liked things. He told Karen and I once that he had "going out friends" and "work friends". Since school was "work", we were in the work category. For most of school Ryan wouldn't do social things with us, because that would breach that imaginary boundary that he had set up for us.

As life went on, he did would start to come to social things, but not always. He didn't want to muddy that line too much.

It's funny how Ryan kept things so compartmentalized in life. I always knew he loved sports, but I didn't know that he played hockey. I know that he loved music, but I didn't know that he played the trumpet. Apparently he played it very well - winning awards, joining regional groups, even tutoring grade 12's when he was in grade 9.

He was a passionate guy. Always seemly to be totally focused on the current task - even if the current task seemed to be multitasking. ;-) I seem to remember him saying that he had burned through a couple of pvr's because he'd watch / record 2 football games at once and when one game was in a break, he'd watch the other one. Because of his stories, I wanted to always rent our pvr rather than paying for it for when it inevitably burned out. We've never burned ours out. I guess I didn't put quite the same load on it as him.

You can see how he kept his life compartmentalized in his memorial page - it's either about programming, music, sports, or fun. Not much overlap in any one comment.

I'll miss his passion, his funny t-shirts, his laugh and the hidden secrets behind his eyes. You could seem them in the twinkle and his smile.

I'll miss my friend.

Thursday, 3 December 2009

Goodbye Ryan

I can't believe that I'm saying goodbye to another friend who left us in November. I found out yesterday that Ryan Lowe had passed away. There's a place on facebook where people can share stories and grieve.

I knew that Ryan was having a rough time, but I had no idea that he was so, so sick. Like with Betty, I should have visited recently. Email wasn't enough. I should have just gone. I shouldn't have made any excuses to myself - "tonight's not a good night", "tomorrow won't be enough notice". I feel like I've been run over by a truck, and I feel that I deserve every treadmark. For someone that had taught me so much, been such a good friend, I feel that I let him down when he needed support.

I feel so guilty and ashamed.

~~~~~~~~~~

Ryan was such a clear thinker. He'd quickly be able to move things into categories like "not worth my time". When we'd go to Tim Hortons at SITE, he leave all the pennies on the tables because he figured that they weren't worth his time.

Most of all he seemed to be passionate about everything that he did. Programming, sports, chillaxing - he never seemed to do anything half way. He's the one that got me into TDD. He seemed to have so much patience (trying to) teaching me ruby on rails.

He's been the one hosting this blog for over 6 years. He's the guy who got me to use a mac. He's the one that was always pushing for better. He's been my model developer.

I can just picture him doing one of his start-high-handshakes, smile, turn and walk away.

Goodbye Ryan. Safe journey.

Wednesday, 2 December 2009

Rude - just the opposite

Sometimes people from a given region get a reputation for something - being kind, smelly, tall, jolly, or rude. Like all stereotypes, you can always find supporting and contradicting cases.

We recently went to Toronto for a conference. People from Toronto seem to have developed a rep for being rude and always in a rush - or so tv tells me. In fact that it was just the opposite. People would stop and offer to help (as we're taking arm shot photos), help me with things when the bags I had dumped, and were generally just really pleasant.

I'm really happy that this stereotype seems to have been proven wrong in this case. ;-)

Saturday, 28 November 2009

Cavalcade of Lights Festival

We have the best luck. In Toronto for the weekend, staying right downtown, and apparently today is the start of the Cavalcade of Lights Festival. It meant a free concert with Steven Page doing some ladies classics (and some other performers I have never heard of) and fireworks. I always love fireworks.

I like it when cities plan to have festivals for us, even before we know we're going there. Highly convenient.

Friday, 27 November 2009

Should be required

For a professionally run website (which this is not one), I think that all 404's that have the referrer as the site's own domain (e.g. a broken link from their own content to their own content) should generate a nightly report of all broken links. Hell, ideally it would generate an email.

It would be great, it would simple, and in theory it would really help things. In practice it would probably be abused and all value from it would be stripped.

Saturday, 21 November 2009

Turn back time...

One thing that was bugging me a bit lately was that every hour timemachine would run, and would crunch a bunch of data, the cpu would run for a bit, heat up my laptop and mildly annoy me. Mildly because it's better than having a drive crash and losing data (again), but still it was distracting.

I started to look at the timemachine icon to see how much data it was backing up, and it was always just shy of 50 mb. Every hour, 50 mb... I'm not doing anything locally, so by putting 2 + 2 I figured out that it was firefox's cache that was being backed up.

I found an interesting post about what things Ryan Block doesn't back up. I'm going to start with just the cache directories for now. As things grow, I might add more, but I'm okay with backing up too much rather than not enough at this point.

Monday, 16 November 2009

Something secret about the canal at night

I don't know why, but I find something special and secret about biking along the canal at night. I don't know if it's the feeling of speed, the calmness of the water or how the lights dance. It's just something that I really enjoy doing, even when it's just a couple of degrees above freezing.

It's even better at 1 to 3 am when there is hardly anyone along it but the crazy people on bikes, but that's more of a summer thing.

Monday, 9 November 2009

Goodbye Betty

Today I am saying goodbye to a friend, Betty Nesseth. I'm very sad because I feel Betty had such a large impact on me.

I sat beside Betty on my last co-op. She was looking for someone to run with at lunch and asked me. I replied with "oh no, I can't run" to which she replied without skipping a heartbeat "bullshit! Everyone can run, you just have to learn how". She encouraged me to run and to push myself. She was a great coach and friend.

Betty was never interested in excuses. She would dismiss them with a wave of her hand. She cared about what you did, not what you talked about doing. It was about the goal, about pushing yourself to get there, and once you were there, pushing to get further. You'd make so much progress, when you paused you would wonder how you could have ever gotten there. The answer was simple: "stretch it out", "we love hills! Feel it pull us up!", "feel that wind (blowing in our face), it's just filling our lungs!", and "feel the invisible elastic band around your waist? It's just pulling you home".

I have not spoken to Betty in probably over a year. I'd make excuses, but Betty wouldn't be interested, so I won't.

It's funny - in my last co-op I think that I learned the most, and all of the important stuff had nothing to do with software.

I'll miss you Betty. I still hear your voice in my head when I run and I really don't think that will change any time soon. I feel for your family and I know that where ever you are, you're running free, steady, and in all weather.

Goodbye friend.

Friday, 6 November 2009

Roll back the tech

I read a sci fi story once where a group of people had to enter a space ship that had been gone for like 200 years and needed to interface with the ship remotely. They had emulators running emulators, down like 15 layers. That only works for software (and assuming that you keep all the emulators for years and years).

We're running into that problem now with hardware. Our printer is old as far as printers go and has a parallel (?) printer port. Of our computers, only Laura's has that port, and I'm expecting her computer to fail any time now (6+ year old laptop with a battery that lasts 3 minutes). That's not too bad since printers are so cheap and I can even get a usb to printer for cable for like 20 $.

The difficult part is not printing, but getting data. Yesterday Laura got a floppy disk in the mail. Yes, you read that correct. The ministry of health doesn't trust this new internet thing, and will only transfer data via dead trees, floppy disks, or dial up access. Something about security - and in some ways I understand that, but there are solutions to having a secure network.

The issue is that we don't actually have anything that will read a floppy... the last computer that had that I gave to my brothers and I think it's since been broken. So now I'm going to look for a usb / floppy drive to have on hand because it's going to suck to go buy a computer that must have a floppy...

Software emulation is great, but if you're much more screwed if it's hardware that's out of date.

Aside: it was hilarious to hear Laura rant "who sends a floppy?!? I mean really!". Even funnier when I started to picture her saying it in an Austin Powers voice when he was talking about Random Task throwing a shoe...

Saturday, 24 October 2009

Pricematch yourself

The other week we were out shopping at zellers and the item we wanted one half open and they only had one left. Normally I wouldn't mind, but this was for a gift. We pulled out Laura's phone, checked bestbuy and lo and behold they were 30% cheaper. Sweet!

So we headed over to bestbuy, found the item and... the price wasn't the same as online. It was still cheaper than zellers, but now I felt like we were being ripped off. So we picked up the item, walked up to customer server and showed them the price online and they gave it to us for that price. Of course they didn't fix the price on the shelf, but what can you do.

As a warning to others that have access to "fancy phones", check the online price while you're there to price compare.

Battlestar ending

First point: I'm going to keep this post spoiler free. Please respect that in the comments too.

I finally finished season 4 of Battlestar Galactica the other night and I'm still not sure how I feel about the ending. Questions I had were not answered, other things came full circle and were answered better than I had expected. I can't find the word to describe it, but I'm satisfied and dissatisfied all at the same time - like being stuffed from a buffet while still being hungry.

I almost feel like I need something along the lines of a book club - but instead of sitting around drinking coffee and eating cake in someone's living room I'd change it to beer and nachos at a pub.

Such a strange feeling.

Tuesday, 20 October 2009

Good Job at being a douchebag!

Sometimes things are not all happy happy joy joy biking to work. Sometimes the drivers do things that seem to have the sole purpose of just trying to piss me off. I don't swear at them, I don't bang on their cars.

I thank them and give a thumbs up. They just don't realize that it's because I think that they are douchebags.

Today a pickup was stopped beside a parked box truck. Traffic wasn't moving, but what I consider to be a biking lane beside the parked vehicles and the left lane was free and clear. As I was approaching this stopped truck in the left lane, the guy cranks the wheel and moves to the right. Not forward, just more to the right. So much so that I couldn't actually get by while riding, I had to stop and maneuver around his side mirror. I don't take up much room, so this was really close to the box truck. So I thanked the guy loudly, moved around his truck and turned back and made sure that I gave him a big thumbs up with an added "good job!" for good measure.

He won the Douchebag of the Day award, but I'm just not sure he knew it. He seems to be pretty dumb, so I'm not going to give him the benefit of the doubt and assume that he would understand. Maybe I need stickers that I can slap onto the vehicle as I go by...

Sunday, 18 October 2009

Rediscover the wonder of things

I find it funny when people look at how kids find everything new, fun, and wonderful and say "don't you wish you could see the world like that?". Well, why can't you? You can look at a cellphone as just a bunch of plastic junk that lets you talk to someone else, or you can look at it as something magical, where you can talk into a plastic box and communicate to anyone, anywhere in the world. Amazing.

You can discover the beauty of a spider web, and the frighteningly horribleness of the spider. You can be amazed at how the forest moves in the wind or how the water flows in a stream. Just because you are grown up and may understand a tiny, infinitesimal, fraction of a percent of the current knowledge does not mean that you cannot choose to see every snow fall or sunrise as a new and wonderful discovery.

You don't need to learn how to see the world this way, you can have to remember how. ;-)

Tuesday, 13 October 2009

First turkey

This Thanksgiving we hosted my in-laws so that Laura could be close enough to get into work if she was called. We cooked the turkey, made stuffing, did sweet potatoes, white potatoes, turnip, gravy, etc. The whole shebang. Laura had picked up a cook from frozen, already stuffed turkey and I was really thankful for that. I found that everything turned out really, really well - which is a good thing.

I think that I was pretty nervous about the meal. The night before I woke up at 1:30 when Laura got called, and I couldn't get back to sleep until 4:30 or 5. I was so, so tired, but luckily had a nap before everyone came over. The only thing that I regret is that I don't have any photographic evidence because our battery died for the camera.

Thursday, 8 October 2009

What "Call" for doctors means to me

For different jobs people are sometimes "on call". It usually means that there is a pager they have to carry and if some emergency happens they have to respond to it. If it actually goes off, they try and resolve the issue before most people start their "work day". When their co-workers start the day, the person on call hands off the issue to them and goes to home to bed.

That's not what call means to me.

Now, take this with a grain of salt because I've only seen call from a 2nd hand experience. I've never worked what I'm going to describe.

First, there are 2 types of call: in-house call and home call. In house call means you stay at the hospital. You sleep in a room and are woken up at any time. Of course that assumes that you get a chance to sleep, which isn't necessarily the case. When Laura worked those shifts, she's start work around 7 am, work until 5 pm. Then "call" would start where they'd work from 7 pm until 8 am (only on a rotation or 2), or noon or 1 pm. Then you'd go home, try and get a nap, get up, eat dinner, and go to bed because you'd have to be back at work for 7 am. It seems to be some weird sleep deprivation experiment. From my understanding, some residency programs do 1 in 4 call - one "day" of call in every 4 - for 5+ years.

Now home call is much nicer. You still have the whole 7 am - 5 pm [1] idea, but you've got the chance to "go home". You can go home, see your family, eat at home, etc. If you're called in, you are supposed to be able to make it to the hospital in 20 minutes. If you get called, sometimes you can give orders over the phone, but more than often I have seen Laura go in.

You'd think that it might be worth the money though. I did a quick calculation for what the residents get paid for being on call - for those hours from 5 pm to noon-ish, it worked out to be about 2 $ / hour.

What's it like when your SO is on call? Trying to pick up some slack, make sure that their a hot meal available when needed, being flexible with your schedule. Sometimes it means dealing with someone who is so tired you have to keep repeating what you said 90 seconds ago.

Sometimes when talking to people they give a "I know what that's like!" and "when I was on call...". I don't actually think that they do know what it's like. I feel I only have a vague idea, and I'm front row. Sort of like how I am not going to say to a parent "I know what that's like!" because I've got no clue and babysitting or looking after someone else's kids isn't the same.

That's what call means to me.

[1] Think of 5 pm as a "guideline". Depending on the work, 5 pm can be more like 9 pm.

Wednesday, 7 October 2009

Emotion of music

I love soundtracks to movies. Music that's designed to convey the mood at a specific point in the story, not just to sell something or get to the top 40. Music to invoke emotion in the listener.

I've had the soundtrack to the Lord of the Rings movies playing in the background while I eat dinner and make dinner for tomorrow (mmm... second day sauce). Not paying any attention to what was going on, I was suddenly overwhelmed with sadness and I'm sure that something was in my eye. It was the part from the movie when they were in Lothlorien and the elves were singing a lament for Gandalf.

Without thinking about the movie, without any visual cues, solely based on the music I felt so, so sad. That was what I was supposed to feel at that point in the story, to try and understand the bitterness and loss the characters were going through.

Now that's awesome music.

Sunday, 4 October 2009

Everything's better with lazer gun sounds

For my birthday I got Wii Sports Resort and an additional MotionPlus. It's fun and I've already spent too much time playing it. One of the things that I've enjoyed is the airplane game. Of course in a wii game you couldn't have a "gun" on a plane, so it's a "balloon popper" that shoots these balls that pop balloons. But the best part: it makes a "pew pew pew" sound as it fires. So. Much. Fun.

I think that just about anything would be more fun if it could make a "pew pew" sound.

Saturday, 3 October 2009

Signed up

Something that I had been debating for a while and I've gone ahead with it. I've signed up to join the public service. I've been working for years in the gov't as a contractor, so I hope I have an idea what I'm getting into.

We'll see how it goes.

Thursday, 1 October 2009

Execute order 66... and pick up some milk

It seems amazing to me the pace that things go from science fiction to products on the market. Telecommunications, medicine, our understanding of the universe, ... everything.

So when I watch something set in the "future", I wonder how long until we get there. In episode 3 of Star Wars when Order 66 is communicated to Commander Cody via a hand held holo projector, I wonder how long until I'll have access to my very own holo projector. Then my thoughts wonder to what something like that would be used for most of the time. Things along the lines of "pick up some milk on your way home" and "see you at soccer practice"

I giggle (inside) when I imagine the Emperor with his raspy voice saying "Remember to grap some take out on your way home, Commander"

Good times.

Wednesday, 30 September 2009

Shiny, Capín.

Sometimes I like throwing in random lingo or quotes from pop culture just to see what happens. Sometimes I get a smile and a nod, sometimes I get a concerned look and the person backing away slowly. Either way I find it funny.

Wednesday, 23 September 2009

Million dollar idea

I have an idea for a product that could make someone millions of dollars. The potential market is billions of people. And you know what, I'll give away the idea here. All I ask is when you own your own small island, you remember that you read about the idea here and you pass me some products that you create. That's all I want really, not to be the baron of a multi-national company, but to enjoy the product that I'm thinking of. Ready? Here's the idea:

Comfortable dress shoes.

Brilliant, right? I can't believe that no one has thought of this before now. I'll be expecting my comfy shoes soon. ;-)

Saturday, 12 September 2009

Puttering around the house

Years ago I always thought that my grandfather liked to putter around the house / cottage fixing and cleaning stuff all the time. My dad also does similar things, keeping busy all the time, always with the next job or eight in mind. They never bitched about the work that needed to be done, they just got to it. I thought that they did it because they loved it. I'm slowly starting to realize that they might not have loved needing to do things all the time - it was a necessity.

With a house there seems to always be something that needs a repair, to be cleaned, painted, replaced, wired, tidied, fastened or straightened. After having a house for less than 2 years, it's not something that I bitch about, just something that needs to get done and it's either going to be me or Laura to do it. I can see how after owning a house for a couple of decades it wouldn't even seem like work anymore, just something that needs to be done like making dinner or doing the dishes.

Today, on a gorgeous late summer day, I found myself puttering around the house doing things that needed to be done. It makes me feel like a Grown Up. It makes me want to go play with my lego.

Wednesday, 9 September 2009

My first ruby script

It's been a while since I was reading my ruby book. I end up forgetting most of what I read because I have not used it in a project. Today I needed to do some xml parsing and I always find it so clunky to do in java, so I took ruby for a spin.

For the life of me I couldn't get gems to work properly without adding in "require gems" at the top. Not sure if I needed to be setting some env var, but I figure running on XP using cygwin is a bit out of the normal ruby path.

My other complaint (if you can call it this) is that there seems to be 50 different ways to do everything. There are similar issues in java of course, but it took me a bit to find a small, clear example.

After I got through the "research" part, I found it a lot of fun for a 15 line script.

Monday, 7 September 2009

Apple's got me

We were going through the rideau center yesterday, and of course we wondered by the mac store. It's not been there long, but I've enjoyed being in there each time we've gone. It's got a very different feeling than a store like bestbuy.

We've been trying to figure out a good way to listen to our music collection on our stereo in the living room. The speakers are hidden behind the couch and the stereo itself is hidden under an end table. We've been debating getting a "good" stereo that we could hook up to an ipod, but even a crappy stereo starts over 100 $. Instead of doing that, we did a little experiment where we bought an AirPort Express Base Station and just plugged the stereo into that. Then I put the iphone remote app on Laura's phone and we can put the computer anywhere we want. One of these days I'm going to have to hook up an actual media server, but this is a good start. ;-)

Monday, 31 August 2009

Painting thoughts

We've just gone through a bit of painting at home and are planning some more. The thing is that it always takes longer than I thought that it would and it never looks as nice. I see all the flaws, even if no one else does.

We ran out of time, but I regret not doing a little more prep work. Going around with a really bright light and finding and fixing all the flaws. It would take a bit more time, but I think that it would be worth it.

If you don't want to put in the time to do the extra prep work - my advice is to start taking lights out of a room. Nothing shows flaws like lights close to walls. When you can't fix 'em, hide 'em.

Saturday, 15 August 2009

Cost of biking

Being unable to fall alseep (even though I'm pretty tired) I figured that it would be interesting to do a cost analysis of different commuting methods. Just rough estimates, but let's see where it takes us.

According to google maps, a route that's close to what I take to work is 7.7 km. Let's assume that it's closer to 7.2 km each way. Aprox 20 working days in a month, times 8 months of possible biking a year, that works out to 2304 km. Actual costs would be almost zero (let's not count extra food I eat during biking season nor when I take the bus when it rains).

Using the bus actually takes longer even though I'm 10 minutes walk from a major downtown hub. Monthly bus pass is $84.75, times 8 months is 678 $. That works out to aprox 0.29 $ / km.

For a car, let's assume that I could get parking for 10 $ / day. That works out to 1600 $ in parking. Our car's fuel economy is listed at 10.7 L / 100 km in the city (I consider this a lower limit). That works out to 246.528 L of gas. Assuming aprox 1 $ / L, that works out to a total cost of 1846.53 $ or about 0.80 $ / km.

Again, to put that into a daily amount, that works out to something like 0 vs 2.09 vs 5.76 $ / day for bike vs bus vs car. The one that I find helps me the most? Biking of course. ;-)

I was surprised that the km came out to 2304 km. With those numbers, I wouldn't be surprised if the actual km that I put on / season was in the 2500 - 3000 range. 2300 km is like biking from Ottawa, ON to Brandon, MB.

Friday, 7 August 2009

A regular day in Gatineau Park

Today we took my sister zip lining at camp fortune which was awesome, if a long activity. Then we headed over to OíBrien beach on Meech Lake. It's kind of a small beach that's close to the road. Nothing out of the ordinary happened until the bear showed up.

A small black bear tried to get into the animal proof garbage cans. It was the closest that I have been to a bear while not being in a car / house before (let's say 40'). The life guard made a phone call and a guy in a fluorescent vest showed up. He put on some ear protection and used something that looked like a spray can on the bear. It didn't enjoy that much and took off. This was only after the bear discovered that it didn't have to get into the garbage cans to get to food - some was on tables with people just milling about it.

Since my mom was quite concerned about us taking VR zip lining we made sure that she called home with a message along the lines of "we're safe and well and the bear didn't eat our lunch". You know, 'cause it's never too late to mess with your mom's head. ;-)

Wednesday, 5 August 2009

Indistinguishable from magic

I love Clarke's laws, especially the 3rd:
Any sufficiently advanced technology is indistinguishable from magic.


Until today I never really thought of that it would seem so literal until I saw some new interface prototypes (via /.). Particularly the "3D Teleconferencing" which looked straight out of Harry Potter.

Next time I re-read Harry Potter, I'll try and imagine it as a sci-fi story filled with fantastic devices and genetically engineered creatures rather than magical. Right now I can't picture where that analogous fails. Perhaps one day Muggle will mean "non-technological folk".

Wednesday, 29 July 2009

Why bus tickets are getting bigger

I finally figured out why the oc transpo bus tickets are getting bigger and bigger - it's so that you feel you're getting your money's worth as they keep on increasing the cost. Pretty soon one ticket will be A4 size. An express ticket? It'll be poster size. Please don't ask about a rural ticket...

Monday, 27 July 2009

Physical signs going the way of the buggy whip

Driving around the other day in a city I wasn't familiar with, I was happy that we had the GPS that's on Laura's phone. When you have a GPS, you don't even need to see signs because the GPS is telling you what road it is before you can even see the road sign. This of course made me think of what it would be like in the future. I think that at some point augmented reality using a HUD will be a normal thing, sort of like a wearing watch is now (or having a phone to tell you what time it is).

Aside: I think that a watch is an exceptional good analogy in this case for figuring out where you are. Clocks were used for ship navigation and "time" is a fundamental component of GPS. An interesting read is the effects of relativity on GPS.

So, with everyone using a HUD that will help them navigate (in their own language of course), what use would a physical sign be anymore? It would just be an expense to build and maintain. If you had a "digital" sign that was available to people via their ubiquitous HUD's, your sign would always look new, be as you decide to have it today with much less cost in changing it, consume near zero of your own power (since you wouldn't have to pay to light it), no repair costs due to weather or vandalism, etc. Signs for navigation will go the way of the sextant. Signs for advertising? I'm assuming that it would be the same story. I just can't imagine how the conflict of "what advertisers want you to see" vs "what I want to see" will be resolved. Either way I figure that the future will be interesting. ;-)

Monday, 20 July 2009

I love the smell of rm -rf * in the morning

Smells like... victory.

Some times when you have been stuck in the same place long enough and aren't able to make any progress, there's something really satisfying about deleting it all and starting over. Sometimes that actually fixes things. Mostly in the case of Windows, and, as I discovered today, WebSphere.

Clean slates are nice. ;-)

Sunday, 19 July 2009

Who's the audience and how are they going to consume the product?

One thing that I find asking at lot of work is "who is the audience?". I find that it helps to eliminate possibilities for how work can be done. E.g. "let's document something in the issue tracking software so we can easily use it" - that doesn't help if the consumers of the info would never use the issue tracking software (upper mgmt) and they just want an executive summary. Figuring out the output first makes it a lot easier to determine what the input should be.

I found myself making this mistake yesterday with a different kind of situation. We had some family over for a bbq and I decided that we'd serve some watermelon. I tried my hand at trying to carve it like a pretty flower. After watching several demos online and then creating a product that looked like a drunken monkey took a weed whacker to it (but everyone said it was nice), it was put on the table. No one touched it. Not even myself. It could be a case of too much food, but I think that it was just in the wrong format to be eaten at the bbq. I should have just quartered and sliced it. Fancy carving - dinner party. Brunch - melon balls. BBQ - slices.

When making it, I was thinking of first step. I should have thought of the last step and worked backwards. If you don't know where you're going, any path will take you there.

Thursday, 16 July 2009

Open Mind - Clear Entertainment

Tonight we decided last minute to go to a movie. Laura picked the movie and I insisted that she not tell me anything about it. I didn't know what it was about, who was in it, how long, what genre, etc. The only thing that I knew was the name. As for any kind of media, I think that's the best possible scenario: going in with a totally open mind and just enjoying it as it stands. That's wonderful.

Out of interest, the movie was called The Soloist.

Tuesday, 7 July 2009

Everyone gets a meaningful URL

One of the things that I don't necessarily enjoy is messed up URL's. Don't get me wrong, I've done my part in creating some apps that create unreadable url's, but that doesn't mean that I liked it.



One of the issues we've had a work is part of CLF 2.0 (because it's a 2.0 world) where they talk about url's and how they should give equal treatment to both official languages when naming folders and files. Now, having people talented at development and translation and have those translations jive with what the client feels is correct can be almost impossible. So having url's that are contained within an app is just a recipe for tons of QA and redeploys as discussions over the proper word happens.



Using annotations and spring's @RequestMapping value attribute you can tie a controller or method of a controller to multiple url mappings. e.g. you can have your method run if someone hits home.html or maison.html The issue with this solution is 1) that your mapping is still within your code 2) you can't easily add support for another language.



Aside: stay with me on this one, I haven't worked through the issues like security. Andrew and I only came up with this last thing today.



Normally if you're using the @RequestMapping annotation you need to have the DefaultAnnotationHandlerMapping bean configured. This is what connects the url's coming into the app with the annotations configured. On start up it "registers" all the annotations. What you can do is have an external data store (property files, db, it doesn't matter) that will contain all the accepted urls for what's contained in the annotation.



Example:


public class MultilingualAnnotationHandlerMapping extends DefaultAnnotationHandlerMapping {

// TODO inject into bean
private String suffix = ".html";

// TODO inject as well, for both possibily have them as a Collection
private String prefix = "/";

@Override
protected void addUrlsForPath(Set<String> urls, String path) {

// this map you get from another service / file etc. Either cache it on this bean or somewhere else.
Map<String, Collection<String>> urlMapping = // ...

// the path is the thing that's found in the annotation
if (urlMapping.containsKey(path)) {
Collection<String> languageUrls = urlMapping.get(path);

// register each url
for (String url : languageUrls) {
super.addUrlsForPath(urls, buildKey(url));
}
}

// make sure we also add the original path as well
super.addUrlsForPath(urls, path);
}

private String buildKey(String path) {
return prefix + path + suffix;
}
}



Now in your controller class, you can just put in a something like @RequestMapping("my.admin.controller.key") and have the urlMapping object above populated with a list of all the different translations for that key. eg. You can have key "my.admin.controller.key" point to [home, maison, casa], etc. You can even leave it to the original home.html as your key and just add mappings for the other languages.



This solution only helps solve the different translations coming in, it would still be required to have a tag lib or EL function or something that would put the correct name into your jsp or whatever. But having done this you can have the app provide meaningful urls to all the users, rather than a subset or none.



I'm actually hopeful that this solution would work well. ;-)



Thursday, 2 July 2009

In order to fly you've got to let go

One thing that occurred to me tonight was the futility of trying to be as quick as possible in an environment where you do not control the database. No matter how agile you want to be, no matter how fast you think that you can go, you will never be able to be able to take advantage of the whole "convention over configuration" if an external (database) group has control. You're on the autobahn driving a Lamborghini with the limiter set to 80 km. Sure, that might have been a safe speed for your 1985 ford tempo, but it's not helping you keep the hourly rate down today. If that's a bottleneck that the org is willing to live with, that's fine because that's the org's call. If the org is unaware of it, that's a totally different thing.

The only way for the org to truly fly is to let go of some control, trust the people to do good work, and put in place the tools and processes that would help the people quickly identify and fix any issues.

Wednesday, 1 July 2009

1000th post!

Yay! 1000th post! And on Canada Day too. ;-)

A lot has happened since I've been blogging in this location. Started to date Laura, moved in together, got married and bought a house. Many friends have gotten married, babies have been born, and we've lost friends. In short, a lot of Life has happened in the last six years of blogging here.

Good times, good times. ;-)

Tuesday, 30 June 2009

Covering getters and setters? We're starting to focus on the wrong things

The project I've been assigned at work is a small one, but I've been keeping 100% coverage on the things that I care about - the things that I think are important. However, it sucks to have the metrics that will be looked at by management to be less than 100%. "It's okay, because that code isn't important!" Stupid getters and setters didn't have 100% coverage...

In my search for the One True Answer, I came across an interesting post that's the closest to my feelings on it. If I've gotten uncovered getters / setters, then I might not actually need that code. That was a big part of my solution today - deleting setters.

My whole issue with this is that now I'm taking time to think about code that I generate and for all intents and purposes has no effect on my project. Does it matter that a model object has an unused setter to a field? I don't think so. It can show that you don't have a test case covered, but if your only way to tell if you are missing an important use case is an uncovered getter / setter, you might have other problems.

What I wish they built into java was something along the lines of Ruby's attr_accessor keyword or the similar solution in just about every other language. There's even a feature request for it in java - but since it's over a decade old I'm not going to hold my breath.

The fact that there are so many discussions, work arounds, IDE tools, scripts, etc should indicate that it's a problem that should be solved on the language level. The fact that I was thinking about it today at work was a waste of time and money. Uncovered accessors effecting the perceived quality of an app I work on means 1) the metrics need improvement 2) I'm probably not the only one wasting time on this issue 3) we're discussing field accessors when we could be solving an actual business need.

It's stuff like this that makes me wonder how long it will be before enough people move to other solutions like groovy, ruby, phython, etc. before the people in control of java sit up and take notice and cut the cruft out. At that point it'll probably be too late. It's really hard to un-sink a ship. :-/

Monday, 29 June 2009

Data plan please, hold the voice

Looking at all the cool things the smart phones can do these days, I'm really starting to want one. The draw back is that the phones all seem to require you to have a voice plan first. Yes, I understand that it's a cell phone, but I don't want to use it as a cell phone. I want to use it as a mobile computer. What I want is a pay-as-you-go voice plan and a data plan.

I wouldn't mind paying for the services that I want, but the 100% mark up for something that I think I won't really use is holding me back. I think that in 5 years it will hard to get a cell phone that doesn't have a data plan available. Patience, my friend, patience...

Tuesday, 23 June 2009

Starving to death at a buffet

One thing that really pisses me off is when people don't take responsibility for their own learning. Yes, some places actually allocate money and time for you to bring up your skills - but I think that in no way makes this the employers responsibility. A training budget is a perk, not a scape goat.

For some jobs it is beyond an individuals ability to self-fund their own training - e.g. an astronaut or deep sea diver. For someone in IT, for the most part it just means having access to the internet or going to the library and borrowing a book (if you're too cheap to buy one). To buy one job specific book a year and read it is well within most people's budget.

When I hear someone say "I have not been sent on training so I don't know how to do that (on something that's happened over the last 10 years)" I just want to call bullshit. I picture that person going to a buffet where the restaurant staff are busting their asses to make sure that the actual buffet has a ton of food on it, the person sitting down at a table and then letting themselves starve to death because no one has brought them food. Life is a buffet, so get off your ass and help yourself. For IT professionals (or amateurs), the internet is the biggest smorgasbord of information and training that you can possibly come across, you just have to help yourself.

Next time you hear someone whining about their lack of knowledge because someone else has not sent them for training, just imagine how well that would go for other professions. Would you accept that as an excuse from your health care professional? Your accountant? Your lawyer?

If people are self sufficient enough to take care of themselves (wash, bath, dress, eat, ...), they should be able to do some reading on their own. Take responsibility for your life.

Saturday, 20 June 2009

Verifying proper HttpSession use for clusterable applications using eclipse, AJDT, AspectJ and maven

One question that I hear often at work is "how can we tell if a given application will work properly in a cluster?". The answer is always "test it", but honestly that's pretty hard to do really often. The tests usually rely on the app running in a cluster, session use, someone downing one of the servers as the functional tests run, etc. The really hard part, I think, is for an error to pop up that will be noticed. If session gets improperly synced across nodes, it might corrupt the data, but not in a way that's quickly noticed.



At work with our current clustering setup, objects put into session must implement java.io.Serializable, and the way you notify the server to sync your session is to call session.setAttribute(..). A hard to track down bug would be if you have a reference to an object, set it into session, and then use your reference to change the state of that object. What I set out to do is to create a fail-fast test where we can identify improper session use in the unit tests, before we even get close to deploying an app to a server.



Below is my first foray into the AOP java world using aspectj. I'm fully documenting this because, while there were many posts on aspectj, etc, I never found one that put it all together. I did originally start off trying to use the java annotations for aspectj, but after much struggle, I gave up and moved to using AJDT with great success.



The layout the solution consists of a corporate pom, a "auditor" library, and an example app that has unit tests. I won't actually show an example of the sample application because it simply is a bunch of tests, and has the corporate pom as it's parent. The code that runs the session tests has been put into a maven profile so that we can have one pom, but be able to mark applications as "clusterable" one by one. So, after each app updates to the given parent pom, to check if they are using session properly [1] they only have to run mvn clean test -Pclusterable.



One thing that I left as a TODO in the aspect is checking if the value being set into the session is actually serializable or not. I had actually written some code at work to do that, so I won't re-do it at home. ;-)



The algorithm


The high level idea of how the aspect works is that every time someone who implements HttpSession calls setAttribute(String,Object), we 1) can inspect the values being set to make sure that it's serializable 2) keep a reference to the session object for later 3) generate a hash of the attribute and store the hash in the session object [2]. After a test has successfully finished, we go over all the attributes in the session and check if the hash of each attribute matches the hash that we generated when setAttribute(..) was called. For the problems that we encounter, we throw a AssertionError - which is the same kind that junit throws.



Our corporate pom is below. Some important things to note are using the same version of aspectj everywhere, locking down the JSE version in the various plugins, and specifying the additional javaagent argument to surefire when using AOP.



<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0
http://maven.apache.org/maven-v4_0_0.xsd">

<modelVersion>4.0.0</modelVersion>
<groupId>ca.beernut.jim</groupId>
<artifactId>ParentPom</artifactId>
<version>1.0.1</version>
<packaging>pom</packaging>

<properties>
<aspectjVersion>1.6.4</aspectjVersion>
<jseVersion>1.5</jseVersion>
<surefireMemoryArgs>-Xmx512m -Xms128m</surefireMemoryArgs>
<auditorJarVersion>3.1.4</auditorJarVersion>
</properties>

<dependencyManagement>
<dependencies>
<dependency>
<groupId>javax.servlet</groupId>
<artifactId>servlet-api</artifactId>
<version>2.4</version>
<scope>provided</scope>
</dependency>
</dependencies>
</dependencyManagement>
<build>
<pluginManagement>
<plugins>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>aspectj-maven-plugin</artifactId>
<version>1.1</version>
<configuration>
<source>${jseVersion}</source>
<complianceLevel>${jseVersion}</complianceLevel>
</configuration>
<executions>
<execution>
<goals>
<goal>compile</goal>
<goal>test-compile</goal>
</goals>
</execution>
</executions>
<dependencies>
<dependency>
<groupId>org.aspectj</groupId>
<artifactId>aspectjtools</artifactId>
<version>${aspectjVersion}</version>
</dependency>
</dependencies>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<configuration>
<source>${jseVersion}</source>
<target>${jseVersion}</target>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-eclipse-plugin</artifactId>
<version>2.7</version>
<configuration>
<downloadSources>true</downloadSources>
<downloadJavadocs>true</downloadJavadocs>
<ajdtVersion>none</ajdtVersion>
</configuration>
</plugin>
<plugin>
<artifactId>maven-surefire-plugin</artifactId>
<version>2.4.3</version>
<configuration>
<forkMode>once</forkMode>
<argLine>${surefireMemoryArgs}</argLine>
</configuration>
</plugin>
</plugins>
</pluginManagement>
</build>
<profiles>
<profile>
<id>clusterable</id>
<activation>
<activeByDefault>false</activeByDefault>
</activation>
<build>
<pluginManagement>
<plugins>
<plugin>
<artifactId>maven-surefire-plugin</artifactId>
<configuration>
<argLine>-javaagent:"${settings.localRepository}org/aspectj/aspectjweaver/${aspectjVersion}/aspectjweaver-${aspectjVersion}.jar"\
${surefireMemoryArgs}</argLine>
</configuration>
</plugin>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>aspectj-maven-plugin</artifactId>
<configuration>
<aspectLibraries>
<aspectLibrary>
<groupId>ca.beernut.jim.aspects</groupId>
<artifactId>ProjectAuditor</artifactId>
</aspectLibrary>
</aspectLibraries>
</configuration>
<dependencies>
<dependency>
<groupId>org.aspectj</groupId>
<artifactId>aspectjtools</artifactId>
<version>${aspectjVersion}</version>
</dependency>
</dependencies>
</plugin>
</plugins>
</pluginManagement>
</build>
<dependencies>
<dependency>
<groupId>org.aspectj</groupId>
<artifactId>aspectjweaver</artifactId>
<version>${aspectjVersion}</version>
</dependency>
<dependency>
<groupId>ca.beernut.jim.aspects</groupId>
<artifactId>ProjectAuditor</artifactId>
<version>${auditorJarVersion}</version>
</dependency>
</dependencies>
</profile>
</profiles>
</project>


Our ProjectAuditor pom's is as follows:



<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0
http://maven.apache.org/maven-v4_0_0.xsd">

<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>ca.beernut.jim</groupId>
<artifactId>ParentPom</artifactId>
<version>1.0.0</version>
</parent>

<groupId>ca.beernut.jim.aspects</groupId>
<artifactId>ProjectAuditor</artifactId>
<version>3.1.4</version>
<packaging>jar</packaging>


<dependencies>
<dependency>
<groupId>javax.servlet</groupId>
<artifactId>servlet-api</artifactId>
</dependency>
<dependency>
<groupId>org.aspectj</groupId>
<artifactId>aspectjrt</artifactId>
<version>${aspectjVersion}</version>
</dependency>
<dependency>
<groupId>commons-lang</groupId>
<artifactId>commons-lang</artifactId>
<version>2.4</version>
</dependency>
<!-- This needs to be compile scope since we include it -->
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>4.4</version>
<scope>compile</scope>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>aspectj-maven-plugin</artifactId>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-eclipse-plugin</artifactId>
<configuration>
<!-- Override this because it is set to none in the parent -->
<ajdtVersion>1.5</ajdtVersion>
</configuration>
</plugin>
</plugins>
</build>

</project>


In ProjectAuditor, we had the 2 files: src/main/aspect/ca/beernut/jim/aspects/ClusterableHttpSessionAspect.aj



package ca.beernut.jim.aspects;

import java.util.ArrayList;
import java.util.Collection;
import java.util.Enumeration;
import java.util.HashMap;
import java.util.Map;

import javax.servlet.http.HttpSession;

import org.apache.commons.lang.builder.HashCodeBuilder;

public final aspect ClusterableHttpSessionAspect {

/**
* Here is where we will keep track of all the session objects that were
* created. The key if the system's hashcode
*/
private ThreadLocal<Map<Integer, ClusterableHttpSession>> sessions = new ThreadLocal<Map<Integer, ClusterableHttpSession>>();

/** Default constructor that initalizes the thread local. */
public ClusterableHttpSessionAspect() {
sessions.set(new HashMap<Integer, ClusterableHttpSession>());
}

/**
* Create an interface type so that we can attach a member to it.
*/
declare parents : (HttpSession) implements ClusterableHttpSession;

private Map<String, Integer> ClusterableHttpSession.hashOnSet = new HashMap<String, Integer>();

public Map<String, Integer> ClusterableHttpSession.getHashOnSet() {
return hashOnSet;
}

public static interface ClusterableHttpSession {
}

/**
* Before anyone calls setAttribute, check that the pram is okay and keep
* track of it so later we can detect if it was changed outside of the set
* method.
*
* I could not get the method
* <code>after() returning (ClusterableHttpSession m): call(ClusterableHttpSession+.new(..))</code>
* to work for all mock sessions (see servletunit.HttpSessionSimulator), so
* I'm keeping track of the sessions in this method.
*/
before(ClusterableHttpSession m, String key, Object value) :
call(void HttpSession.setAttribute(..)) && target(m) && args(key,value) {

// TODO this is where you would put in your test to check if the "value"
// is serializable

// the value is serializable, so let's keep track of it's state
Map<Integer, ClusterableHttpSession> sessionList = sessions.get();

// let's keep track of this hash if we don't already have it
Integer sessionHash = Integer.valueOf(System.identityHashCode(m));
if (!sessionList.containsKey(sessionHash)) {
sessionList.put(sessionHash, m);
System.out.println("Added to thread local session: " + m);
}

Integer hash = hash(value);
m.getHashOnSet().put(key, hash);

System.out.println("For key: " + key + " and value " + value + " we have hash # of: " + hash);
}

pointcut afterUnitTest() : execution(void test*()) || @annotation(org.junit.Test);

/**
* After the unit test has finished, use the sessions that we have in thread
* local to check if the attribute has changed outside of the setAttribute
* call.
*
* This is just an "after returning" method because we only care about the
* state of the session if no exceptions were thrown.
*/
after() returning : afterUnitTest() {

Map<Integer, ClusterableHttpSession> sessionList = sessions.get();

System.out.println("After returning and sessions are : " + sessionList);

try {

// for each session, check the attributes that remain in the
// session against the ones that were set into it and make
// sure that the last matches

for (ClusterableHttpSession session : sessionList.values()) {
HttpSession httpSession = (HttpSession) session;
ClusterableHttpSession clusterableHttpSession = (ClusterableHttpSession) session;

for (Enumeration enumeration = httpSession.getAttributeNames(); enumeration.hasMoreElements();) {
String attributeName = (String) enumeration.nextElement();
Object value = httpSession.getAttribute(attributeName);

// we have to cast it here
Integer lastHash = clusterableHttpSession.getHashOnSet().get(attributeName);
Integer currentHash = hash(value);

if (!lastHash.equals(currentHash)) {
String message = "Object in session " + httpSession + " under key '" + attributeName
+ "' has hash of " + currentHash
+ ". However the prevous hash when setAttritbute was used was " + lastHash
+ ". Always call setAttribute on objects in session after changing their state.";
throw new AssertionError(message);
}
}
}
} finally {
clearThreadLocal();
}
}

/** If something was thrown, just clear the thread local for the next run. */
after() throwing : afterUnitTest() {
clearThreadLocal();
}

/**
* Clear out the thread local if the test returns properly or not
*/
private void clearThreadLocal() {

Map<Integer, ClusterableHttpSession> sessionList = sessions.get();

// clear out the thread local so we don't keep sessions from
// test to test
sessionList.clear();
}

/** A hash method to determine the state of the object. */
private Integer hash(Object obj) {
return Integer.valueOf(HashCodeBuilder.reflectionHashCode(obj));
}

}


Here is the second file with a special location and name: src/main/resources/META-INF/aop.xml



<aspectj>
<aspects>
<aspect name="ca.beernut.jim.aspects.ClusterableHttpSessionAspect" />
</aspects>
<weaver options="-verbose -showWeaveInfo -Xset:weaveJavaxPackages=true">
</weaver>
</aspectj>


Notes:

[1] With this code we're only checking code that gets run by their unit tests.

[2] See Inter-type Declarations



Friday, 12 June 2009

Junit Interceptors

Sometimes you come across a problem to which you find a solution only to realize that it's not been released, and even if it was, it's blocked by another dependency's conflict. D'oh.

Here I thought that I was being clever... However, I have to be careful with that. :-/

Update: I think that I'm going to ditch the whole junit runner / listener idea. I think that I'll be able to do what I want a lot easier by just using aspectj for some pure AOP goodness. Time to start reading...

Wednesday, 10 June 2009

Surprised at good ideas

When I'm at work in discussions, sometimes I voice Good Ideas - and people act all surprised. Honestly I can't blame them, they surprise me as well. Sometimes they flow, sometimes they evolve, but most of the time they just stumble out of my brain like a teenager out of bed at 6 am. I wish that I could help them come more often, but I'll take what I can get.

Monday, 8 June 2009

Banned words

There are a couple of words that, when used, usually piss me off because of the tone that seems to come with them. I call this class of words the "jerk words" because they seem dismissive and arrogant. Words like "obviously" and "clearly". It's clichÈ, but what's obvious to one person is not to another. I don't believe that it's from lack of intelligence (in all cases), but more often from the different backgrounds and experiences that people have had in their lives. Obviously people like to use big words, but clearly it makes them sound like an ass.

The funniest thing: if it was actually clear to everyone involved, why the hell is anyone explaining it? The very act of explaining things using the jerk words means that the issue was not obvious.

*deep breath out*

You'll look sweet upon the seat...

Laura and I have often talked about taking a bicycle built for two (b42) for a spin. As a bit of a surprise, we rented a "KHS Alite tandem" and took it for a spin down to the arboretum for a picnic lunch. I've learned a couple of things:

  1. a b42 will either strengthen a relationship, or end it

  2. it's much harder than it looks

  3. they don't turn so well... hard to avoid people along the busy canal

  4. when the road is open, you can really motor along

  5. communication is key - I felt like I was on a ship from the old movies "engine ahead full!", "hard to port!!!", "tourist, dead ahead!"

  6. I glad we rented it and I had a lot of fun, but I don't think that I'll be looking to invest in one



Sunday, 7 June 2009

Fast turn around

I guess that it depends on your customers what support you provide. I emailed 2 different companies that sell medical software to doctors for their mobile devices (palm, iphone, crackberries, etc) and within two hours both companies got back to me with a good and useful answer. On a Sunday. I don't have an account with them, I was just making an inquiry. Pretty cool.

Now that I am thinking about it, if I was a company making software for mobile devices I would have my customer service / help lines all working with mobile devices so that I could schedule people to be on call on the weekends. It makes sense.

Friday, 5 June 2009

Up in 3D

Tonight we saw the new Pixar movie Up - in 3D. I think that the last time I saw a 3D film in a theater was when I was 6 in Disney World. I thought that it would be the old red / blue glasses, but it wasn't. In the theater I guessed that the glasses used some sort polarization, but not the kind I thought that it was. Laura thought that I looked like Stevie Wonder twisting my head and looking at my watch trying to see where the watch face turns black, but it didn't happen. Apparently it's using some kind of fancy new 3D system. Pretty cool.

We really enjoyed the movie. I won't say too much other than it's funny, sad, and silly - often switching between all 3 in quick succession. I'm not sure what my favourite Pixar film is: The Incredibles or Up.

Monday, 1 June 2009

The little things

It's the little things that make you feel really lucky. Biking home today in 9C rainy weather can really makes you feel lucky:

  • I hit every green light

  • It wasn't raining too hard

  • There wasn't much wind

  • It wasn't hailing

  • Traffic was light

  • I've got a warm house

  • There is lasagna to eat (as soon as I bake it)

Reading this you probably think that I am nuts. You may be right. Either way I just feel really lucky right now.

Sunday, 31 May 2009

You minus 10 years probably equals dumbass

This is a retelling of a story that was told to a guy I worked with. The original person is in their 70's, but I thought it interesting enough to pass on.

When the guy was 18 he thought that he had pretty much figured things out in life and knew what was what. When he turned 28 he felt the same way, but he had come a long way since he was 18. His eighteen year old self he now considered a dumbass and he was glad that he had gained that knowledge of the last 10 years.

When he turned 38, now he really knew what was what, had figured out life and looking back his twenty eight year old self was a dumbass. Same conclusions every decade as he aged: no matter how much he had figured out, give it 10 years and hindsight and he really knew squat and behaved like an ass.

I don't think that I have to live to be in my 70's to take this guys lesson. I'll operate under the assumption that 10 years from now, I'll probably look back at my confidence and knowledge and consider my younger self to be a dumbass. This seems yet another way to keep hubris in check.

Do you think that you're smart and have your shit together? Yes? You might not think that in 10 years. Dumbass.

Saturday, 23 May 2009

Log entry: Day 8 of the Experiment

So far the experiment of growing a full beard is proceeding without any drastic events. However I have reservations about the eventual outcome and if it will be sustainable. The decision to embark on this path was partially forced by the failure of half of the shaver which meant trimming the neck-ular area took far longer than it had in the past. To an outside observer they might attribute the additional facial hair to the current hockey playoffs, but for the people that know this researcher they would know that is not the case. Only time will tell the outcome of this endeavor, but my heart tells me that it probably won't last. If that is to be the case, then a new shaver will be an expenditure that I must undertake.
End log.

Wednesday, 20 May 2009

Water around the rock

It's with problems that are "owned" by other people. If they do not have any motivation to change the state of things, it's almost certain that things will remain how they are. Reminds me of a law I once read about. So, if you want things to be different I think that your choices are limited to:
1) change the force so that some movement of the issue happens
2) route around the problem like a stream when it encounters a rock in its path
3) shut the hell up, move on, and focus on issues that you can change

Now #1 sometimes can be impossible if you don't have a lever big enough. #2 might not be an applicable option. That leaves #3. The problem with #3 is that it never actually solves anything. It's a good "I'm too tired of this issue right now, I'm going to move on to something else". The problem will continue to be a pain and it will resurface again and again until someone can figure out how to do #1 or #2 - lather, rinse, repeat.

Since #3 is always going to suck, each time you come to a problem you need to either have be carrying a big enough stick to make the problem go away OR to be able to totally sidestep the source of the problem and come up with an alternative solution. Otherwise you're stuck in some kind of eternal return.

Thursday, 14 May 2009

Just gotta let things rest

One thing that I think that I should be doing for the food I make is to let it rest (sit) for a while. It just allows everything to meld and taste oh-so-good. The tricky part is that I don't often make the time to do this. Hell, I don't know what I'm going to serve as I'm preparing the meal sometimes. It is how it is when it's done.

Now, for me to make really good food, I think that I have to come home from work at like noon and start preparing things. Either that, or make 1/2 the things that I want to eat the day before. :-/

I better stop stalling and make some dinner so that it can sit and rest some. :-P

Tuesday, 12 May 2009

Brilliant deduction Captain Obvious!

A lot of the time people will say something so obvious that I just want to mock them the moment it's out of their mouth. But I'm either not quick enough, or too nice, or a combo of the 2 to actually slam them.

The first thing out of someone's mouth when I show up wearing a bike helmet and shorts, holding panniers is "Did you bike here?". Like every freaking time. I very much want to answer in a deadpan voice and expression "No, I just took the bus." I don't know if it's a social reflex or what, but it's annoying.

One lady a couple of months ago was trying to get into our 7th floor work area. She was looking for some boardroom 10-something. She asked us if we knew where it was, and the first thing that popped out of my mouth was "no, but I'd try the 10th floor". I'm just glad that it was polite. I guess that some people aren't used to numbering conventions...

*sigh*

Saturday, 9 May 2009

Calling you man

It's steadily increasing how many times it's been a PITA for Laura and I both not to have a mobile phone. It's annoying, it's harder to co-ordinate or meet up. It's really starting to tick me off. I've been lightly shopping for a new phone for Laura because if there's someone who actually needs a smart phone of the 2 of us, it's her. She usually carries a cell, pager, palm pilot (old school, not wireless, not a phone) - and she actually uses them. It's not a toy for her, it's a tool.

Me on the other hand, it would very much just be a toy. A nice, shiny toy. Do I need a smart phone? No. Do I want one? Of course. But, like most things, I just don't want to pay for one. I think that the simplest (and cheapest) thing that would solve my current frustration would be to add a text messaging plan to our pay-as-you-go phone and for me to carry that one.

I'm excited for Laura because this summer it sounds like both the palm pre and goggle (android) phones are being released, in addition to the iphone and blackberries already on the market.

If I was going to choose one based solely on what I know now, I'd probably get the android based HTC Magic. Looks pretty, has all the google stuff built in (which I use a lot), is somewhat hackable with being able to write java apps for it. It looks like you can even use maven and eclipse for building apps, all you need in a one time 25 $ output to put things into the market. That's the phone I want to play with.

What phone do I think Laura should get? Unfortunately for the apps that she'll probably need, I doubt that they would have an android version right now. (Laura, remind me if you read this to give me a list of the apps you use so I can write the companies asking / requesting android versions). We'll see what kinds of mid-summer deals the carriers will come out with.

Wax on / Wax off

Since we have the brand new car we were hoping to keep it nice for as long as possible. I don't want it to rust out like the focus. So, in order to make it stay shiny and new I spent a good part of the day washing and waxing it. I've never waxed a car I own before. I probably have not waxed a car or anything since I was 10.

After I washed it I left it to dry a bit. When I went to go wax it, the weather has just started to spit. So, in the garage and time for the work. It took a while, but it looks great. I think that I've spent more time cleaning a car today than I have in the last 10 years total. Crazy.

One thing that I should have realized but didn't is that dirt is a Bad Thing. When your car is dirty, moisture, oils, etc stick to the car, eat away at the paint and allows rust (apparently). Clean car == not too rusty car. So we're going to do our best to keep the car clean and have it last as long as possible.

Thursday, 7 May 2009

Getting it done

One of the things that I'm coming to realize is that sometimes it's much more important to get things done than waiting until you have time to "do it right". Sub-optimal, but done, is better than not done, but with plans on doing it totally "right". Of course this sub-optimal solution has to be weighed against not doing anything at all. You don't want your half-assed solution to actually cause more work.

Examples work best for me. For one of the COTS apps that I help take care of, it comes with logging configured to create a new file each day and never clears out the old logs. And it logs a lot - somewhere in the range of 1 G + / week. The "right" solution would be to look into changing the logging level and how the files are created. The sub-optimal solution I did was write a cron that finds all files older than the last 5 days and delete them. Not ideal, but it's done.

Done half-assed is better than done no-assed, as I always say. Well, that was the first time, but I'm sure that I'll say it some other time too...

Saturday, 2 May 2009

<del>Stuff under my stuff</del> Junk in my Trunk

We just picked up our first new car the other day - a 2009 vw rabbit. Very excited about something so new and shiny. This is the first car that I don't end explaining what car I have with the phrase "... that's all that I could afford that I also fit in". It's quite peppy and corners awesome, I'm just going to have to watch so I don't speed because there is no roar / shake at speeds.

There are many different things that I'm sure that I'm going to be excited about the new car, but I really like the storage underneath the area in the trunk. It's actually useful compared to every other car I've driven. In the back of my other cars, it's difficult to get to the spare tire, and when you do there really isn't any places for anything else. In the rabbit (and many other cars I looked at), it's easy to get to the tire and there is all these spaces for tools or junk.

In the last car I had bungee cords, rope, air compressor, etc all bouncing around in the trunk. That meant that they were always in a tangled ball. In the new car there are these little sections that I can fit all these things in nice rolled up sections. I'm carrying around stuff that I feel is useful, but the trunk looks empty.

I don't know if it's a getting old thing or what, but I really appreciate and enjoy good packaging and when things are "smartly" built. It just shows that there has been some focus on the details, and I find the quality of the details is one of the best indication of overall quality.

Monday, 27 April 2009

Normal Eclipse plugins

Sometimes I end up searching my blog for eclipse plugins, but I have a hard time finding them. Here's a quick list of what I have installed or plan to install.



As for maven integration, I'm divided if I should do m2eclipse or Eclipse IAM (formally Q4E) since both are now hosted on eclipse.org and look like they both have the potential of being moved into eclipse proper.

Sunday, 19 April 2009

Advice is tricky

One of the things that I've just seemed to realize that when people provide advice, it's usually the same course of action that they have already taken. I'm not sure if it's just "I went through it, and this was the right choice so I did it" or if it's "I made a choice (right or wrong), and now cognitive dissonance is kicking in". Maybe it's just the brain tricking itself thinking a random choice was logically thought out (aside: I wish I could find the study that talks about that. I don't think that Magic and the Brain is it, but it's good reading anyways).

What I find more interesting is when people advise you to do something that they did not do. I think that there potentially more useful information in that decision and the discussion that follows. It's like the more valuable things to know on an assignment are the things that you got wrong, rather than correct.

Monday, 13 April 2009

I don't know how to express my anger at the use of flash

I get so freaking frustrated when sites provide content in flash. At best it's clunklier than html, at worse it's unusable. If you're providing data in tables, paragraphs, etc how much more difficult is it to provide it in html??? It means that your tables are so squished because of the data jammed into them I can't make out what value belongs to which column. I can't open features in new tabs, and how sections of their site seem to just hang.

I'm looking at you mazda.

There are places were it's great to use flash (360 degree views), but just because you've got a hammer doesn't mean that everything is a nail. :-(

It would be wonderful if every public facing website had to go through usability testing, and you know, heed the advice. For every flash developer, they should also be made to use their own app on a 28.8 connection while blindfolded and being gnawed on by wild badgers. The last part serves no technical advantage, I just hate the flash that has spewed across the intertubes and feel that someone should incur my wrath.

Tuesday, 31 March 2009

How much is my idea worth to you?

The other day I was talking to a friend and I mentioned that an app that I wished that I had. Now what happens if he builds that and makes enough money to retire? How much money was that idea worth?

Zero. Nothing. Nada. Zilch.

I don't think that the idea is worth anything. What would be worth something would be the designing, testing, implementing, marketing, support, etc of the idea. That's where the cost is. The cost isn't in mentioning something in passing that popped into my head.

I think that the idea of things like copyright are good: provide someone a temporary monopoly in order that they can have a chance to make back their costs. Something as a reward for putting in the effort of "creating" in the first place and to encourage more creating. If someone is not going to create a product, I don't see any point in a copyright or patients. If they could only grant those based on intent, but how could you judge intent?

What would I ideally like to happen if I acted as a muse to someone? Well, a free copy of their product would be nice, but what I'd really want would be a cold beer on a warm patio. And I'd buy the second round. ;-)

No risk, no work, no reward. I understand and I am okay with that.

Sunday, 29 March 2009

When buying photo stuff, what I'd do different

It's not been a long time since we've bought photo stuff, but I think that if I was to provide advice to someone, I'd tell them to do it slightly different than we did it.

1) I'd make sure that the tripod that I bought has a quick release. It's pretty annoying to spend 1 minute putting the camera on, than another minute taking off, all for a picture that might take 10 seconds to take. Slow, annoying, and if it's cold, freezing because using the screw isn't something that you can do with gloves on.

2) I think that rather than buying zoom lens that have a max aperture of f/3.5 I'd get a normal, prime lens with a max aperture of f/1.4 or f/1.8... something really fast. That way when taking pictures of all the children that people seem to have right now I could use available light and have the shutter speed fast enough that the kid isn't blurry. I find that the things that I get most frustrated with any camera that I've used is the low light performance.

3) This last thing I'm still not sure about. We bought the entry DSLR. It's smaller, has less features, but is less flexible by the types of lens / accessories that it can take. For autofocus to work, each lens has a motor that does the focusing. With the next line up in the camera focusing is done with a screw from the body. Our camera body also isn't compatible with Nikon's new GPS attachement. However, it's our first DSLR and if we find that it's actually limiting what we're doing, we can also upgrade / buy another. I mean, disposable income has to go somewhere, right? :-P

Saturday, 28 March 2009

If a dollar was a second

I just finished watching an episode of 22 minutes and they were talking about how much debt the Americans are in. They used an analogy of "if a dollar was a second". If that's true, then 1 million dollars would be about 11.5 days. 1 trillion seconds would be 31,688 years.

Now if you look at wikipedia, "As of March 16, 2009, the total U.S. federal debt was $11,042,553,971,450.47". Now that number is 349,925 years. Even if you take the other possible, smaller "public" debt of 6.74 trillion, that still works out to 213,582 years.

It's a bit funny to try and change a number so big into something tangible to understand the scale of it, but it's scary that you end up with an equally large and abstract number. The scale just boggles my mind. To give some scale, the oldest fossil record of humans is from about 130,000 years ago.

Monday, 23 March 2009

The future is now

One of the things that occurred to me as I was video chatting with Laura tonight is just how much "now" - is how the far off future was imagined to be by some. Video phones, huge flat tv's, 100's of channel, instant communication from "anywhere", the worlds information accessible at your finger tips, having robots do our dirty work for us (until the uprising that is...).

Know what the funny part about this is? I had the same impression almost 5 years ago too. I guess that means that the future was then. :-P

Sunday, 22 March 2009

What would I do if I didn't have to work?

One of the "general interest" questions that I've heard asked in an interview is "what would you do if you could do any job and not worry about money?". When, an an interviewer I was asked this question as well, I didn't have an answer. I think that I've figured it out though. I think that I'd travel and take photos. Take classes when I felt I needed improvement in either. Rinse and repeat.

For good or bad, I think that if I tried to switch to be a travel photographer I'd starve. I really enjoy eating so I don't think that I'm going to switch jobs any time soon.

Sunday, 15 March 2009

Experiment means most of the results are crap

I love our newest addition to the family. Our little niki. I took a walk with niki last night snapping some experiments and playing with things like aperture, shutter speed, lightening levels etc. The key word is "experiments". As with science, I think that the results of most of my experiments were crap and should be deleted. I mean, how many blurry pictures of ducks do I need?

As a self confessed digital packrat I find deleting anything very difficult. I'm working on it though. It's one thing to delete travel pictures, but it's another thing to delete shots that I took while walking in my neighbourhood. In any case, I think that I should be more selective with the pictures that I upload. I should probably be doing more post-processing (cropping, colour tweaks, etc) and just not upload everything. But when bandwidth and storage are effectively free, there is little incentive to be selective.

Saturday, 14 March 2009

Telebacon

With Laura in the Sioux Sioux Lookout for four weeks, we figured that it would be weird being away for so long. Before she left we popped over to bestbuy and picked up a 30$ webcam to use with google video chat. The quality is "okay", but it's better than using the phone.

One of the things that we've been doing is eating our meals together. Somewhat weird I know, but nice none the less. It gives a sense to normalcy to the situation. Today we had our normal Saturday breakfast together. We both set up the computer in the kitchen and cooked the same meal together, 1,316 km apart as the crow flies (1,834 km as the driving directions go). I'm finding it much easier if we eat together. I'm not sure why that makes sense, but it's working for me.

Wednesday, 11 March 2009

Carnival in Rio de Janeiro

This year we were incredibly fortunate to visit Rio during Carnaval. We went to the main attraction at the Sambadrome to see the parade. I'm going to try and explain what it was like, but I assure you that any glimmer that you gain is just a pale shadow of what it was actually like.

It starts are 9 pm and goes to about 6 am (the official schedule says 3:40). The tickets that we had were not cheap, but I've never been packed so closely in with other people for an event before. Since it was so crowded, it was very, very hot. We took things that we could fan ourselves with and it was still hot. The section that we were in was concrete bleachers which isn't the softest thing to stand or sit on.

The thing that I was unprepared for was the scale of the whole event. On a night there are 6 Samba schools that parade down a street that's 700 m long. It takes them 50-60 minutes for the school to pass it's so long. For each school there's about 250-300 members of a band singing, and playing music while they are doing parading. They are singing one song the entire time with so much energy. The coolest part about the song? When they start the crowd joins in and sings and dances as well. I just can't describe the energy that you feel when the crowd and band are just so pumped up. If you want to get an idea of what the songs are, you can find them for each school and have a listen.

For each school I think that there was ~ 20 of the most fantastic floats that I have ever seen for each school. (Wikipedia say 6-8 floats, but I swear that there was more). The floats were not driven, but pushed by a group of guys. Dancers would be in the most impossible places on the floats: they must have been put on with a crane or lift or something. They'd be on a column that's 20 feet high, standing on a platform that looks 1 m round with nothing to hold on to except for what looks like 2 broom handles. No safety lines, nets, rails, anything. Of course they are dancing and singing and shaking the whole float as they go...

The energy, the songs, the colours... I had such a great time. Unfortunately we had been warned so much about the safety of Rio we didn't even risk taking our 4 year old digital point and shoot camera. We purchased a disposable but the pictures didn't turn out at all. Thankfully there's a bunch on flickr (Warning: the pic's might be NSFW) I really wish that we had taken a digital camera. I wish that we could have taken our new camera to be able to zoom in on the costumes, but there is no way that I would have felt comfortable taking it.

For the people that didn't go to the Sambadrome, they rationalized that they wouldn't have liked it. Some of the people that did go said "well, it's something that you do once in your life". Some said that next time they'll pay to be some of the dancers in the parade - such a cool idea. I really enjoyed it and would do it again, but paying for better seats. Since that's not possible every year, I thought that I'd just try and watch it on tv each year. When we got back to our room because we left "early" at ~ 2:30 am, we turned it on the tv and it really isn't the same. I was disappointed. You miss out on the energy watching it without being there. It's better than nothing, but it's just not the same.

If you ever find yourself with a chance to go to Rio during Carnival, take the opportunity. It really feels like no other party on earth.