Articles for May 2007

Ride Report – Crib Point Road Race – D Grade

Friday night, I fell asleep at about 10:30pm while watching Man on Fire. Soon after I was cajoled into bed, and slept like a baby until 7:30am, whereupon I woke up, looked at the time and thought “Oh crap, I’m going to be so late for work.” I let Amanda know about this before I realised that it was Saturday. Whoops.

We drove on down to Crib Point, stopping in Hastings to get a peppered steak pie before the race. Yum. I wandered over to register for D grade, and got myself ready to go.

After a quick warmup, the race was off. I estimate somewhere between 30-40 riders in D grade. 5 laps, 40km. My game plan was to ride the first lap and see what the course was like, and then make up another plan. It’s a mostly flat course, (http://www.bikely.com/maps/bike-path/Crib-Point-road-race-circuit) with just 30 metres of vertical climbing.

The first lap turned out to be fairly quick on the back stretch, cruising around 46km/hr, but it was a slight downhill. I found myself near the back of the pack coming into the final stretch, and then we were on lap 2.

I moved closer to the front, and soon took a turn on the front. I figured I’d see what this bunch could do, and brought the speed up, hoping that I wouldn’t be exhausted too early. Another guy overtook me on the front, so I latched onto his wheel, and brought the bunch with us. Close to the end of the lap, he fell off the front and I was leading as we went over the finishing line.

Lap 3 will be forever known as the lap where noone did anything. I was briefly off the front, and Alex commented that this lap was feeling more sedate. All I could say was sorry :) I found myself on the front again soon after, and doing short turns with another guy. Unfortunately, noone else wanted to help us, and so the lap finished with me crossing the finish line in the lead again…

… Until the road started heading upwards in Lap 4. I was spat out the back of the pack, and had to dig to stay on. One guy just in front of me told me to go past as he wasn’t even in the race – but he must have been appreciating the slipstream! Two of us came detached from the peloton around the first corner, but I managed to tow us back in. From there, I sat in and rested, and the group was accommodating, only doing about 31km/hr.

“Bell, bell, bell” was called by the lap counter as we crossed the line, and Lap 5 was on – but nothing happened for the first half. Feeling more rested, I finished off my Staminade and stayed on the outside, moving up to be near the front. It was a fast lap, and I was about 5th wheel about 1km out. The sprint went off, and unfortunately two guys in front of me ran out of steam about 200 metres before the line, but I managed to dodge around, build up speed and come in with a comfortable 7th.

Not a bad effort! 43 km, riding time 1:12, about 36 km/hr average. As it’s such a flat course, no one would ever be able to breakaway unless you had a decent sized team working together. I was hoping to exhaust some people before the sprint, but the final couple of laps was too sedate to exhaust anyone. Luckily, I was able to recover enough to get a decent sprint in, something I’ve never been able to do at a crit before.

sp_executesql Breaks Chain of Ownership in SQL Server 2000

While developing a web-based application today I received an error message from SQL Server:

SELECT permission denied on object ‘Pit’, database ‘TG_ReportingSystem’, owner ‘dbo’. SELECT permission denied on object ‘IssueLogsType’, database ‘TG_ReportingSystem’, owner ‘dbo’. SELECT permission denied on …

This was initially confusing, as all my tables are owned by dbo, and all stored procedures are owned by dbo. The web user’s role had been granted execute permissions to the stored procedure, but it was still checking the permissions.

The cause? I’d used sp_executesql inside the stored procedure to execute some dynamic SQL, so the chain of ownership had broken. When running sp_executesql, it executes under the caller’s security settings, and so my dynamic select statement failed as the user’s role doesn’t have direct access to the tables.

The solution? There were three main solutions to this:

  1. Remove the dynamic SQL and so not require sp_executesql
  2. Grant SELECT permissions on the five tables
  3. Use a view that encapsulates the five tables that the dynamic SQL joins together, and grant the user’s role access to this view

The first option wasn’t really a solution without drastically increasing the complexity of the statement. The second one is simple and only provides information that the user can see through the web interface anyway.

The view would be a perfect solution, except that one of the tables is joined dynamically via a LEFT OUTER JOIN. In this case one solution would be to add this join to the view so it is used every time, but ensure that the join order specifies that the table should be joined as late as possible, as it is the only table to provide a one-to-many relationship. The other solution would be to keep this table joined dynamically, but grant SELECT access to this table.

In the end, the second option was chosen: the five tables don’t expose any data that any users wouldn’t be able to see anyway, and the view solution provides more complexity and may still require SELECT access to one of the tables.

SQL Server Katmai Announced

Microsoft have recently announced the next version of SQL Server, codenamed Katmai and due for release in 2008. The press release is available here, and more information is available here.

I imagine the jump between 2005 and Katmai won’t be as great as the jump between 2000 and 2005 due to the shorter release cycle. Katmai looks to be more about adding power to data manipulation than adding major new features to the database engine (for example, CLR integration in 2005) .

Back Online… Mostly

I arrive home tonight and performed my newest ritual: checking to see if the ADSL link light on the modem had come on. After being without home Internet access since we moved house on April 23 I was overjoyed to be reconnected – and to download my 35 MB of email that was waiting in my box.

The downside? My ADSL provider, who I’ve been a fanatically loyal customer since 2001 doesn’t provide ADSL2 access to my new house, seemly for political reasons, not technical. Consequently I’ve dropped from 8 MB/sec to 512 KB/sec, and from 20 GB a month to just 6 GB. Time to hunt for a new ISP…