Monday 30 March 2009

[Fix] Notepad has status bar option greyed out

The issue of windows notepad not showing it's status bar had been bugging me for ages.

The status bar option under 'View' is greyed out. The status bar is very useful as it gives line numbers which I find useful when debugging html code.

I finally found a fix for it. It is quite simply fixed by turning off word wrapping under 'Format'.

Yes thats it. Just turn off word wrap.

As a bonus you can use [ctrl+G] or [Edit -> Goto] to quickly go to a specific line number, when word wrap is switched off.

Sunday 15 March 2009

SQL Server 2005 Profiler Tip

Was at a course last week and found a tip that I didn't know about before.

So I thought I should share it.

Before SQL Server 2005 the only way to compare Profiler logs and System Resource Logs (Performance Logs) was to put them side by side and then manually try to match up events. This was frustrating and annoying.

Now with SQL Server 2005 a new feature exists in Profiler 2005 that allows you to import performance logs into profiler. You can import logs by going to File -> Import Performance Data.

When the log is imported you can navigate the log by either clicking on entries in the SQL Profiler Trace or by clicking on points on the performance log graph. Both ways will synchronise the logs so that they show the system event when a sql event happened or the sql event happening at a system event.

Please note that you may have to restart Profiler if Import Performance Data is greyed out

More information can be found at MSSQLTips.

Thursday 5 March 2009

Delphi TDBGrid Add Duplicate Row

Recently I had to develop a delphi method that would allow users to select one or more rows in a DBGrid and create duplicates of the selected rows in the same grid.

The factors that made this non trivial were the facts that you had to add the rows to the same grid as the source rows, there was a auto incrementing field in the grid and some of the field had to be left blank in the duplicate rows.

Things that I had to think about

I tried to get all the values into an array. This was fine but when I tried to use the array as the parameter for Dataset.AppendRecord, I got a compile error which stated that it was looking for an Array but was given a dynamic array. So I had to change the way I did it and had to add another forloop to insert all the values from the source row to the duplicate row.

I had to move the Auto Incrementing field to the end of the the clientdataset so that I didn't have to specify a value for it. If I tried to specify a value for it or tried to assign 'null' to it, then the code didn't compile. This is the reason for -2 in the for loop.

Here is the code

procedure TFrmFoodDetails.ActionCreateSampleExecute(Sender: TObject);
I, J : Integer;
ArRec : Array of Variant;

for I := 0 to DbgResults.SelectedRows.Count -1 do
SetLength(ArRec,CdsResults.FieldCount); // set length of array to number of fields in client dataset
// For loop with -2 as need to ignore 'AutoInc' field
// Double forloop one to get cell values and one to insert cell values
for J := 0 to CdsResults.Fields.Count -2 do
ArRec[J] := CdsResults.Fields[J].Value;
// second for loop
for J := 0 to CdsResults.Fields.Count -2 do
CdsResults.Fields[J].Value := ArRec[J];

// Remove information that will be different in new record

// End insert

// Remeber to release resources
ArRec := nil;

This may not be the best way to do it but it worked for me. If you have any comment s then let me know

Wednesday 4 March 2009

Budget Media centre Setup - Part 2 - Media Centre Software

This is the final part of a two part article. In Part 1 I talked about the hardware and operation system that I chose for my media centre and the reasons for the choices.

In this part of the arcticle I will be talking about the media centre software that can be used to control your media.

The options that I looked at were.

  • Vista Media Center
  • Media Portal
  • Sesam

Vista Media Center
I was optimistic in trying Vista Media Center on my media center (Laptop with 1.6 AMD Processor, 512Mb RAM, 20Gb Hard Drive). It really was too slow a machine to cope with Vista. Even so I was impressed with what I saw of the software. It seemed very slick. I don't know who copied who but it looks similar to the PS3 interface with items on two axises. I have had a play with Win XP Media Center 2005 and it is a big improvement on the older version.

Media Portal
I had to go back to Win XP from Vista so I looked around for some free media centre software. The first one that came up from my searching was Media Portal. I remember looking at this before but at that stage it was very buggy and didn't work correctly. The current version of Media Portal is so I was optomistic that it would be more stable. It started off promisingly, the interface was slick very useable. On startup it came up with an error stating that the VRM 9 version was outdated. Eventually I found out that it was due to not having Win XP SP3. After installing Win XP SP 3 the error disappeared. When using Media Portal it came up with some other strange errors. When I looked on their forum it stated that installing .Net Framework 2.0 and 3.0 may fix the problem. I reluctanctly installed both frameworks. Unfortunately Media Portal continued to be unstable. Maybe it was the hardware I was trying it on but there was something intrinsinctly buggy and unstable about Media Portal which made it unusable for me. This is a pity because Media Portal did seem to have most if not all the features that I required.

This is an old media server that I have also looked at before. It looks a bit old fashioned but worked really well. The interface is very slick and it is the only media centre that I have seen that can be controlled exclusively using four arrow keys and the ok button on a remote. This may seem like a small issue but when your using a remote and have to use the mouse for certain functionality then it quickly becomes frustrating.


My system maybe a special case as it is quite a low specification but my conclusion is that media centre software should be stable and very easy to use. It shouldn't be compared to other computer software as it's usage is completely different. It should be compared to other home entertainment equipment like DVD players or Hi-Fi systems. So would you be happy if you had to use a mouse to get to certain functionality of your DVD player or would you be happy if you had to restart your DVD player because it was constantly crashing. In my opinion media centre software is a tool to get to your media. It doesn't need super fancy graphics, it just needs to be designed to get to your media quickly and efficiently. If you are like me then I would recommend Sesam. The only issue with Sesam is the fact that it is not being developed anymore so useful features like plugin's for YouTube will probably never happen.

Tuesday 3 March 2009

JHove Batch Processing

What is JHove?

JHove is a java utility that can be used to identify document types. It is used extensively in the digital preservation field.

The problem

At work I was set the task of getting JHove to batch process all files in a folder. It does individual documents correctly using the GUI however there were no examples of it being used through the command line on a batch of files. After looking at it for a while it seemed that we would have to build a separate application in order to call JHove for each file in a folder.

Finally we worked out how to do batch processing by using JHove alone.

Here is the batch file we created

java -jar c:\jhove\bin\JHoveApp.jar -o c:\output.xml -h audit -c C:\jhove\conf\jhove.conf "C:\Documents and Settings\DigitalArchives\Desktop\testjhove"


Send the results to c:\output.xml
-o c:\output.xml

The type of output you what to have. You need to set it to 'audit' in order to do batch processing
-h audit

Use the configuration file c:\jhove\conf\jhove.conf (This is the default config file and it can be changed to specify which types of files you want to test for)

-c c:\jhove\conf\jhove.conf

The folder that contains the files to audit
"C:\Documents and Settings\DigitalArchives\Desktop\testjhove"


Thing to improve the process are as follows

  • Allow multiple folder to audit
  • Create a front end for the process that will allow you to pick a folder to audit and choose an output file.

Please let me know if you are using JHove and how you are using it.