Category Archives: Technology

This all-encompassing category covers hardware, software and anything fun in-between

Developer Q&A Part 1

Last week I wrote about the set of developer questions posted by Scott.  Well, as promised, here are the first few that I’ve got through…thumbnail

Q1.  Describe the difference between a thread and a process

A1.  A process is a container of threads (having a least one thread of execution).  It has its own memory space.  A process can have multiple threads that share the same memory space and program code.  A thread is a single thread of execution.

Q2. What is a Windows Service and how does its lifecycle differ from a “standard” EXE?

A2.  A Windows Service runs under the control of the SCM (Service Control Manager).  They run in the background under the SYSTEM account and do not require interaction with a users desktop therefore they can run independently of a user (hence they do not require a user to be logged on for them to run).  When the system boots any services marked as “automatic” are started and when Windows shutdowns they are terminated.

A standard EXE is invoked by a user post logon and runs under the security privileges of the current desktop user.  A user may close the EXE at which point the program is terminated, otherwise the program is terminated at log off (which can occur without a shutdown).

OK, more of these later.  In the mean time I’m developing my .NET product showcase site.

Advertisements

Media Fun and the Great Outdoors

This weekend I started my duties as best man by organising Pete’s stag do.  We spent the weekend in the Forest of Dean, raft building, learning survival skills, building shelters, making fires and generally having a good time at Pete’s expense.

Pete’s flat is lush and has given me some ideas on the media front.  Behind his TV stand lies an Acer PC, running Windows Vista Ultimate.  This includes the Vista upgrade to Windows XP Media Center Edition.  In the machine is a dual tuner TV card, so he can record TV and watch it at the same time.  The PC then connects to the TV with ease, so you get full media center capabilities plus Windows Vista on the TV when you want it.

Coupled with all of this is the flashy Microsoft Media Center remote, which brings the whole lot together very nicely.

So I’m doing some sums on the media front…eBuyer’s cheapest Acer PC comes in currently at £235 and includes Windows Vista Home Premium (the other SKU of Vista to include Media Center).  Couple that with a TV card and the Microsoft remote, the Xbox 360 and the home server, you get a nice package.

But then there’s always the surround sound, HD TV….the list goes on.  So I’ll be content with the fun of the new Xbox for the time being.

My photos from the weekend are now on Facebook.

London and Life

I was in London yesterday in glorious Spring weather – slightly cold, but bright sunshine.  I snapped the following on my phone whilst crossing Waterloo Bridge:

IMAGE_128

It reminded me of my marathon experience last April and got me thinking again about running…

In the mean time I’ve been tweaking system performance, improving our caching through the use of HTTP headers in ASP.  RFC2616 details the HTTP 1.1 status codes, which can be used to control the caching of certain items.

Our problem is that a table of contents sometimes grows to over 1Mb and every time a user visits the site they pull back this huge file.  In order for this file to be cached, we send back a HTTP header LAST-MODIFIED, equal to the last modified date on the ToC file.

Now if the browser already has this item in its cache, it will send a header HTTP_IF_MODIFIED_SINCE containing the last-modified timestamp from the cache.  On static files, IIS (the webserver), takes care of looking for this header and responding appropriately.

However for dynamic files that serve semi-static content (like the ToC in my case), you have to handle things yourself.  If the HTTP_IF_MODIFIED_SINCE header is detected, then the timestamp is checked against the file on the server.  If nothing has changed, then just report the HTTP-STATUS as 304 Not Modified.  It is then up to the browser to use the version from it’s cache.

A couple of useful articles on this:

http://www.15seconds.com/issue/970911.htm

http://www.web-caching.com/mnot_tutorial/how.html

After implementing these changes we saw a huge reduction in request timeouts and dropped network connections.  Well worth building into future work.

Time Away

It’s been a crazy couple of weeks, hence no posts.  Firstly, my laptop finally gave up the ghost.  Whilst trying to reimage it from my Windows Home Server, the power unit just kept cutting out.  And then I was getting blue screen memory errors.

So my new Dell Latitude D630 arrived, all shiny and fast, and boy is it nice to work with!  I went for the 9-cell battery which, after my tests, will run for just over 5 hours on normal usage.  It comes with a light sensor inside the lid so it can automatically adjust the brightness of the screen to suit your surroundings, thereby saving battery power and making sure you don’t strain your eyes.

It’s a 2.4 GHz dual core Intel, 160GB hard drive (the largest I could get), DVD R/W, 4 USB 2.0, modem, WiFi etc.  It also comes with a smart card reader should you need it for work.  Anyway I’m very pleased with it.

d630

Then I had a crazy week of work, culminating with a 10 hour day in London, the afternoon of which I spent frantically working in Costa Coffee on the WiFi, trying to drink my cappuccino medo as slowly as possible!

Then the Pioneer Leaders Conference in Letchworth, then spoke at Open Heaven, then had a meal to welcome new people to the Church and tonight I’ve got a consultation team meeting on a building we are looking at buying.

To keep me sane I’ve been having fun with the various bits of technology around the house, getting the WHS backup going.  My next step is to test the remote access…

Time for some work now!

Building the van, rebuilding the laptop

One of my favourite Christmas presents this year was a “build your own” VW campervan.  I’ve jokingly said that I’d like one some day to tour around Europe.  Well, now I have one sitting in my lounge which I can look at every evening!

campervan

Opposing my success with the van, is the regression with my laptop.  After running defrag my laptop power cut out every time.  So I decided to take the plunge and rebuild it (software wise).  After finishing the full NTFS format the power cut again.  Arrgh… There must be some overheating problem going on and when the PSU detects this it just shuts down to prevent the whole thing bursting into flames.

After much waiting and frustration I’ve now reloaded Windows XP, Office 2003 and now I’ve got to wait while Windows Update downloads the hundreds of updates and service packs….zzzzz

(More visits to Lenovo today)

Laptop Struggling

My laptop is over 4 years old now, purchased from Novatech after my Compaq died and I did rather well on the insurance.  It has served me very nicely, running most of my development software and the long list of essential utilities I have now amassed.  During my time at Xerox, it went through a couple of upgrades, the most interesting of which was repacking the battery.

A mate of mine at work discovered a place in the Far East where you could order the individual cells from so I jumped in with him and we ordered a whole batch between us.  They came with the rather daunting warning of being highly explosive if punctured!  It rejuvenated the battery for a year and I can still get an hour out of it, so not bad for a £50 investment.  Here I am re-soldering the pack:

repacking_battery

I’ve left it defragmenting the hard drive – 24% defragmentation over 30GB of data, no wonder it’s been chugging a bit.  It’s got more serious problems though, the power keeps cutting out, which I think must be to do with the location of a temperature probe and the surroundings getting too hot, so the power unit just switches off as a safety mechanism.  I’m loathe to dive into that circuitry and given that it will run happily from AC without the battery I might turn it into a portable desktop.

My browser history is starting to fill up with visits to Lenovo 🙂

MS Log Parser

Today I’ve been working on logging and auditing for our web app. We’ve already got it logging major events (searches, views, updates) but today I’ve added in auditing of any changes that a user makes.

This leads to one thing – huge log files. But help is at hand in the form of Microsoft’s LogParser tool. It is a command line applicatioon which provides a very powerful SQL like query syntax. You map an input source through the query onto an output source, which include charts created with Microsoft Office Web Components and even your own template files (useful for HTML reports).

As an example…

Say my log file contains data in the following format:

Date,Time,Operation,Object

I can easily create a report of the distribution of hits during the day:

> logparser.exe “select to_string(time,’hh’) AS Hour, Count(*) AS Hits FROM mylog.csv GROUP BY Hour” -iTsFormat:”hh:mm”

Which gives me:

Hour Hits
—- —–
00   1
08   2782
09   8098
10   10710
11   13233
12   11048
13   10257
14   12467
15   11411
16   8304
17   2864
18   1216
19   610
20   52
21   10
22   1

I can then drive a nice bar chart like so:

> logparser.exe “select to_string(time,’hh’) AS Hour, Count(*) AS Hits INTO chart.jpg FROM mylog.csv GROUP BY Hour” -iTsFormat:”hh:mm” -chartType:Bar3D -chartTitle:”Hits by Hour”

Example Chart

So very cool and very powerful. I’m now wading through the tool’s author’s book.