They say you learn something new every day.

Archive for January, 2012

Asps in Nets (31/01/2012)

I’m struggling a little bit with .Net. It’s a little bit different from languages I’ve used before, and I’m worried that I’m falling back on what I know a bit – doing things in less efficient ways because that’s how I’ve always done them.

This is a bit of a problem really. What’s always inspired me to learn something new is the drive to get something to work. If I can get it to work, albeit in the “wrong” way, then I tend to stop.

Now, on the one hand, this may result in code that’s a little tatty, but on the other, the user doesn’t care. What they want is the functionality, and if it looks nice, works and is easy to use, they’re happy.

If it’s written in nice OOP code, or cobbled together from bits and bobs then they’re happy.

Now, I’m not advocating crappy code in any way. Oh God no, I’ve had enough problems with my own crappy code without writing more. But what I’ve realised is that more important than the neatness of the code is the richness of the application.

It’s much more important to get the functionality in there, make it work and tweak from there.

I realised this when putting together this function to return the group membership for a particular computer. It’s a little cobbled together, but it works. And now that I’ve got the functionality I can start tweaking it to make it work better and faster, and start identifying faults and fixing them.

I think people need to remember. We don’t code to write code. We code to solve a problem. 

FUNCTION GetMembers(Asset AS String) As String

DIM members

DIM objADAM As DirectoryEntry = New DirectoryEntry() 


DIM objSearchADAM As DirectorySearcher = New DirectorySearcher(objADAM)

objSearchADAM.Filter = “(&(cn=” & Asset & “))”

objSearchADAM.SearchScope = SearchScope.Subtree

DIM objSearchResults As SearchResultCollection = objSearchADAM.FindAll()

If objSearchResults.Count 0 Then

Dim objResult As SearchResult

For Each objResult In objSearchResults

DIM memberof AS Object =“memberof”).value

IF NOT IsNothing(memberof) THEN

DIM collectiontotal= objResult.GetDirectoryEntry().Properties(“memberOf”).Count -1

Dim member,adgroup, i

For i = 0 To collectiontotal

member = objResult.GetDirectoryEntry().Properties(“memberOf”)(i).ToString(

members = members & member


members = “There are no groups on this computer.”


Next objResult


members = “Computer could not be found.”

End If

GetMembers = members


At Least the Directories are Active (30/01/2012)

I may be struggling with my house situation, but life trundles onto.

I’ve been building my web application at work, which I’ve really been enjoying doing. It’s great to be totally in control of a project and just fix it however you like.

However, I’m writing it in ASP.Net, which is a language I don’t really know that well.

Today I a discovery. If the DNS is set up correctly, you can get the asset number of the machine that’s connecting to the webpage.

Assetnumber = System.Net.Dns.GetHostEntry(Request.ServerVariables(“REMOTE_ADDR”)).HostName

This is brilliant. It’s something I didn’t think you could do. But the header data contains the IP address, and if you do a Reverse DNS lookup, you can get the asset number.

Of course, it’s the full domain name, so you have to trim a bit off the end, but that’s easy:

Assetnumber = UCASE(LEFT(Assetnumber,INSTR(Assetnumber,”.”)-1))

Once you can do this, the possibilities are quite exciting. It means you know who the user is, and what computer they’re on, so you can really tailor the results back to them.

Arrogrance (29/01/2012)

I suddenly realised today that I’m quite arrogant.

Not in the sense that I go around saying “I’m the best”. But I do tend to think it. Which is strange considering how much time I spend thinking about the gaps in my knowledge (this is called “Less Stupid Than Yesterday” for example).

The problem is, I think, that deep down, I think I’m cleverer than a lot of people I meet. And that’s wrong. I know it’s wrong, and I’ve even discussed with myself how opinions about other people are wrong, and how you can’t really know how clever someone is until you really know them.

I need to remember this a bit more, as this is a bad trait.

Bad Days (28/01/2012)

I’ve had a rubbish day today. I’ve been flat-hunting, and I’ve been on an emotional roller coaster. One moment, every thing is sorted. The next, it’s all a mess. It’s difficult to keep a clear head and keep perspective when things are like this. But that’s what you’ve got to do: don’t give up, and don’t lose site of the goal.

Negative Feedback Loop (27/01/2012)

I had to tell someone off today.

It’s the first time I’ve ever done it. All my life I’ve been the pupil, the child, the employee – and generally I’ve struck a fine line between compliance and rebellion. (My English teacher once called me “subversive” which I took as a massive compliment. And knowing him, he probably meant it as one).

In the words of Jack O’Neil from Stargate:

I have spent my life sticking it to the man. Now I am the man.

But I think this is probably good. You want your people in authority to have a healthy distrust of authority. You want them to be challenging themselves and aware of what authority does to people.

I think I handled the telling off quite well. It struck the right balance, something L has always been good at at work, between chastising without getting personal.

The one thing I did forget to say was something along the lines of “this isn’t an exercise in fault finding, we just want to make sure it won’t happen again”. But I think that was the general impression.

I didn’t bulldozer quite as much as I have before, and in hindsight perhaps I should have a little bit more. But what I did right was leave it a few days. The “incident” (I’ve made it sound a much bigger deal than it was here) happened on Tuesday, but I left it until Friday, once everyone had calmed down, to have a chat about what had happened and to give the firm message that this wouldn’t happen again.

If you can keep your cool, I think you keep your respect as well. Fear isn’t any way to manage, and if you get too authoritarian, people will start coming up with ways to bypass you.

Unlocking the Scroll (26/01/2012)

Do you know, after all this time, it was only today that I discovered what the Scroll Lock key does. There’s been a couple of times in Excel when I’ve found that the arrow keys are scrolling the window rather than moving cell, and I’ve assumed that there was a setting on, but it was only today that I thought it might be scroll lock.

So scroll lock sets the arrow keys to scroll the active window. Simple, eh? But I’ve never realised that before. And, asking around the office, no one else had either.

Of course the question now is whether I can actually use this knowledge in anyway way. I suspect it’s not that useful, but at least I’ll know to turn it off when Excel starts behaving weirdly.

Never underestimate (25/01/2012)

There’s a couple of projects I’ve been working on that I thought were going to be really easy and were actually incredibly difficult. I’ve realised, there are so often so many unforseen circumstances.

I’ve realised that even though I’d read Jeff’s article on estimating before, I’m still rubbish at estimating how long things will take:

When you compare the original single-point estimates to the Best Case and Worst Case estimates, you see that the 11.25 total of the single-point estimates is much closer to the Best Case estimate of 10.5 days than to the Worst Case total of 18.25 days.

You’ll also notice that both the Best Case and Worst Case estimates are higher than the original single-point estimate. Thinking through the worst case result can sometimes expose additional work that must be done even in the best case, which can raise the nominal estimate. In thinking through the worst case, I like to ask developers how long the task would take if everything went wrong. People’s worst case estimates are often optimistic worst cases rather than true worst cases.

I need to start doing this in my projects, and, also, asking other people to do this as well.

I had to get angry with our outsourced IT partner this week as they came to a meeting having not done the one thing I asked them to do. I think I got the balance right – calm but very displeased. So we’ll see if they do it again.

Afterwards, they were so eager to please me that they said they’d get the next bit of work done within a week. I probably should have pushed more for best case/worst case estimates.

Tag Cloud