Monday, June 30, 2008

LINQ OrderBy

I'm extremely new to LINQ, okay?...

But today I discovered, this...

var currentValues = from c in metricsEntities.CurrentMetrics
                    join m in metricsEntities.MetricsSet
                        on c.MetricName equals m.MetricName
                    where m.HideFromView == false
                    orderby m.DisplayOrder ascending
                    select new { c, m }
                    ;

 

is very different to this...

var currentValues = from c in metricsEntities.CurrentMetrics
                    join m in metricsEntities.MetricsSet
                        on c.MetricName equals m.MetricName
                    orderby m.DisplayOrder ascending
                    where m.HideFromView == false
                    select new { c, m }
                    ;

The first query works like I expected, ordering my list properly but the second one (which is where I had started) simply seems to ignore the order.

It's all to do with the "order" of the "where" and "orderby" clauses. I suppose it makes sense really. The latter query orders first, the evaluates the where clause, but the orderby seems to get lost....

Ar well, you live and learn...

Thursday, June 12, 2008

Ankylosing Spondylitis

I suffer from a condition called Ankylosing Spondylitis. It's not the end of the world - there are far worse things out their and I'm not fishing for sympathy.

I thought my blog might be a good place to document that aspect of my life. I sometimes blog about work, sport whatever, and AnkSpon or AS as it's known to it's "friends" is something that might actually add some value to the "noise" that is the blogosphere.

So if you've found this, chances are it's because you were looking for it(or at least AnkSpon stuff right?). Leave a comment...let's discuss it.

As common as the literature say it is, I have only met one other person who suffers - and suffers far worse than I do.

My symptoms started when I was about 11. Soreness in the thighs back then. I had a brief period of swollen ankles (well ankle actually) then pain progressed to my hips (by aged 14). Then it was actually diagnosed as AS at about 19. By then I started taking Brufen and still am! (19 years later.) In my 20s the pain an stiffness progressed on up the back (spine) and now it's mainly my neck the suffers.

I've recently had some x-rays as part of a consultation with a rheumatologist which confirmed the complete calcification of many of my vertibrae. The back doesn't hurt that much anymore but the neck still has it's moments.

My condition is far better it would seem than many that suffer from AS. I've heard of people who end up in wheel chairs! I turn 38 this month, still play a bit of social "Indoor Cricket", played proper cricket until about 4 years ago, enjoy my family life, gardening etc, so as I said, this isn't a plea for sympathy or any such thing, it's just a blog post, about something about me, that others may relate to and can discuss if they feel so inclined.

I am no expert and have no medical training at all. This is just talk, anecdotes and opinions from experience.

I've seen doctors, physiotherapists, chiropractors, had deep tissue massage - nothing really fixes it. The massages help for a little while, maybe a day, but as doctors keep saying, it comes down to management.

To be honest, swimming and stretching help just as much.

I am a terrible swimmer - terrible! - but it does help. It's hard to motivate yourself to get to the pool especially now it's winter in Victoria. Thank goodness for me, winter here means lows of around 10 degrees (celcius), it must be far worse to live in a truly cold part of the world.

Anyway, swimming and stretching definitely help - warmer dry weather is better .

A recent visit to a rheumatologist tells me I don't qualify for any of the new drugs on offer, which apparently are a minor injection that can help slow the progression of the disease. If you're 20 and have AS - follow this up! I firmly believe that the very limited success I had in local cricket (very limited) would've been less limited, had my flexibility and mobility not been so constrained. (Read, I was a crap fielder which gave selectors a reason to drop me first!)

Anyway, if you have AS, let me know how you deal with it. If you have any ideas that are better than mine - let me know. Mine aren't earth shattering - just stretch and swim!

Wednesday, June 11, 2008

Seek first to Understand

I think it's the third of fourth habit in Steve Covey's "Seven Habits of Highly Effective People" right?

Another lesson in this today.

We've had an interesting support issue over the past couple of days regarding our payroll system, and Time in Lieu. This is where an employee works a 40 hour week, is paid for a 38 hours week but accrues 2 hours each week, towards an RDO. The catch is, all 40 hours have to be costed to jobs, even though they are only paid for 38 hours.

I documented a way to achieve this, by setting a cost allocation rate, entering 38 hours, then 2 hours time in lieu. All 40 hours get allocated. All 40 hours accrue entitlements. Only 38 of the hours have a pay rate - two do not. I went to great lengths to document this and for the first few sites it worked well.

Then a thorn in my side - one particular customer, no matter how many ways we explained it, could get their head around it. We explained it forwards backward, sideway, inside out...they just couldn't get passed the fact that they weren't entering payment lines for all 40 hours.

Now to cut a very long story short, it wasn't until we asked them to send copies of three week's time sheets, and a payslip that the penny dropped for me.

Their payslip showed all 40 hours worth of payments then a deduction for the 2 hours.  When you put it this way, it is so bloody obvious it's not funny. They show their employee all the payments they are eligible for, then they show the employee the money coming back out again.

Because we were focussing purely on a job costing (allocate costs to jobs) then topping up the accrual of entitlements later, we completely focussed on getting the hours in there without looking at it from the employee and his/her payslip side of things. Our clients solution still achieves all the same things but produces a better (more correct I think) payslip.

The nitty-gritty of this example doesn't matter that much.  The point remains the same - being so focussed on our solution, particularly since it had already worked for three other clients we just headed straight down the same path without trying to understand or really, really listen to what the client's concerns were.

It turns out, our system is flexible and well designed and can easily handle either scenario - if we'd just listened to what they were really asking, straight away, we would have heard, I want (or we need) the time in lieu to show as a deduction.

Now it does - now everyone is happy. (Just want to remember this...)