Archive for October, 2006

Disposing of SharePoint objects

You should dispose of SharePoint objects like SPWeb and SPSite. Gotta admit, I hadn’t realised they were disposable.

Ways of getting items in a List

An interesting look at how to get items from your SharePoint list. I didn’t know about the datatable view. Guess it can’t do a bulk update though.

Dude, whats my column type?

Some weird behaviour with SharePoint column types, and the data you get by looking at the SPListItem.properties hash.

So, I’ve got a document library, and I’ve added 3 extra columns to it. For simplicity, I shall call them ‘Text’, ‘Number’ and ‘CheckBox’. I filled in some data for them - a number in the Text field, the same number in the number field, and I check the checkbox for all of the items. I end up with a list looking like below…

So, for now, let’s ignore the fact that the value for some of the longer numbers has been rounded in one of the fields - and not ask why MOSS didn’t just complain that the numbers were too big. Instead, let’s ask what the column types being used are… Read more »

Power Supplies

So, I’ve had two power supplies blow on me in the last 6 months, for different things. My wireless router died, and my home laptop’s power died a couple of days ago.

This strikes me as very wrong. It’s not like they had to do anything complicated - they’re just transformers. The technology has been understood for a long time. I mean, batteries are one thing, but transformers?

The complication then comes that there are dozens of almost identical connectors, and finding out what connector you had is hard work.

So, couldn’t electronics companies build better power supplies? With fewer ’standard’ connectors (and none of this proprietry bollocks like some laptop manufacturers use - there’s no need)? And perhaps some system of colour coding, or at least documentation of what the connector is? Would that be too much to ask?

Note about a Windows Service writing to the event log

I was using the System.Diagnostics.EventLog.WriteEntry function, and I kept getting a System.security.securityException about “requested Registry access” not being available. Well, a note for myself - use localsystem not localservice as the account to run under - then it is fine!

Why I wrote simplyxiangqi.com

A long time ago, my Dad got me the game ‘Battlechess 2′. Much time my surprise, it was some strange variant called ‘Chinese Chess’, and I enjoyed it (even though I’m not much good). It doesn’t have the whole ‘pawn-shuffling’ start or drawn out end games, so it appealed.

A lot of time passed, and I became a developer. One day I was looking at an online chess site and I just thought ‘I could build this’. I had recently started learning about JSP and Servlets to work towards Java Web Developer certification. So, I sat down, worked out the logic, learnt about ‘bit boards’, and build the engine for working out valid moves, given a position. And I wrote it all in Java.

After that, all I had to do was build the website to support that engine, and at this point I stalled. Building websites out of Java was excessively hard - security filters for login, carefully planned data structures, lots of JDBC to connect to the database. To be honest, the hard problem cracked, I lost interest.

Time passed. I started to read about this new thing ‘Ruby on Rails’, and so I thought I should take a look. I went through a couple of tutorials and I was impressed. In minutes I could make a (very basic) site that dealt with security, database interaction, etc., pretty much for me. I just thought “Now this is a simple way of building that site”. So, I did.

I ported my code from Java into Ruby in about 4 hours - most of which was getting to grips with the Ruby language itself. I built a database schema, and based the site around that structure.

And that’s pretty much where simplyxiangqi came from.

Reflections

Add reflections to images using JavaScript. Neat.

More on Delay Activities, Workflow, and Beta 2 Tech Refresh

I’m coming to the conclusion that Beta 2 TR has broken Delay Activities…

What I did was build a test workflow. I’d got delay activities that weren’t working, and I wanted to investigate the possible factors involved.

I know that they were working just fine in Beta 2. I thought the difference here from what I was doing in Beta 2 was that I was setting the TimeoutDuration at runtime, through the InitializeTimeoutDuration function.

So I built a test workflow with 2 different parallel branches. One had a ’static’ (design time) configured delay, and the other had a ‘dynamic’ (runtime) set delay. Both had an InitializeTimeoutDuration function set, though for the ’static’ case all this did was log that it had been invoked.

I ran the workflow. My log file showed that the workflow ran both the InitializeTimeoutDuration functions, and nothing else.

Previously, I’d not run that function at all, so I tried configuring both Delays to not call InitializeTimeoutDuration. I ran the workflow, and again, nothing after the delays ever happened.

So I thought maybe it was because I had 2 delays. I disabled one sequence, and added a new second sequence that just contained a code step. I ran this - and again, anything after the Delay activity was never run.

In the end, I took one of the sequences outside the Parallel Activity. The workflow was now OnWorkflowActivated - Code - Delay - Code. And the second code step never runs.

I know this worked in Beta 2 - has the Tech Refresh broken this?

Comments from my old blog:

 

I got the same impression ;) - Beta 2 TR has broken Delay Activities…

By Robert at 15:50:06 Tuesday 10th October 2006

MCTS Self Paced Training kit for Exam 70-536

By Tony Northrup, Shawn Wildermuth, Bill Ryan

Full Title: Microsoft .NET Framework 2.0 Application Development Foundation Self-Paced Training Kit

The best thing that I can say about this book is that it gives you a feel for the things covered in the 70-536 exam. Other than that, it’s the worst technical book I’ve read.

It is poorly structured. I mean answers to some of the ‘end of lesson’ questions refer to things that haven’t been introduced yet. If it isn’t an aspect of .NET that you’ve encountered in your work, you can’t answer that! And what’s with all the tables listing the features of all these different stream readers and writers - just show me ONE, and then explain how the others are DIFFERENT.

That said, I’d still have given this 3 stars if it weren’t for the errors. The book is littered with them. Examples of gzip decompression that actually compress, answers to questions with typos, hell, even answers to a completely different question in one chapter. I literally have too many to list. This is appalling quality control. If I can spot them, the reviewers should have. It’s just not good enough.

If it weren’t that it’s the ONLY book on the subject out here, I’d recommend ANYTHING else.