Archive for the ‘Computers’ Category

I’ve just recently restored my blog from backups after having tried a few alternative blog engines. Well I’m back on wordpress and blogging again!

In restoring my blog I noticed my very first post from way back in 2005, it was all about my computer rack, which I way very proud of at the time. Looking back, it was all a bit OTT.

Anyway, I reckon it’s about time for an update!

I’ve gone through 2 different rack mount cases since 2005. Both 4U and very roomy. My MediaPortal TV server has been upgraded over the years to the state it is now, with 3 dual DVB-T tuners, a quad core AMD CPU and 4 gigabytes of RAM. Until recently it also had a 4 drive RAID5 in there with a hardware raid card. That is now retired (and soon to be appearing on ebay). It’s been replaced by a Drobo FS with 5 x 1TB hard drives and dual drive redundancy enabled.

My server is now in a Fractal Define XL case, but soon to be moved to a much smaller case because of the recent Drobo purchase no longer requiring me to house all those hard drives. It has also been moved out of the loft into a cupboard downstairs for easier access.

I have also upgraded the two network switches to a single 24-port gigabit switch. I have a separate 3com wireless access point for laptop/tablet use. Once I have moved my main PC out of the rack case it currently resides in, I will be dismantling the home made rack and moving all the network gear into a wall mounted rack case.

I’ve recently rebuilt my server and all my clients for my MediaPortal multi-seat configuration. I’ve been experiencing really slow access to the TV part of the software. When selecting TV from the main menu it would take 15-20 seconds before I could do anything else. I turned off my firewall initially, which seemed to fix the problem at first. But it only seemed that way because the delay was on the first access to the TV. So, we’ve been living with it for about a month now. Well, the other day I got a reply on the media portal forum that suggested disabling IPv6. Which I’ve not done on my server and 3 clients. The TV loads up with no delay at all now. So, I’m left thinking what use IPv6 is if it’s so slow. I admit I’m not an expert on networking, I’ve always done just enough to get it working for my own needs. It could be that my switches couldn’t cope with it, so windows was trying IPv6 first and failing and then falling back to IPv4.

Hooray! I have tonight, finally got DTS MKVs working reliably in MediaPortal. It was actually a very simple solution in the end. I did a little experimentation around using the SPDIF output in my existing audio filter. I found that if I told it to decode to 5.1 it worked fine. So it was a problem with the audio filter passing audio straight onto the SPDIF output. Since, I’d used AC3Filter in the past I simply installed that, set it up for my amp (just checking which rates my amp would support via the SPDIF check utility provided with AC3Filter), and I was away. So, I now have glorious DTS sound again, the only difference from the last time I used AC3Filter on my previous Media Centre PC is that this one can play back 1080p video files easily.

Update (3rd August 2010)
Actually they don’t work! I thought they did, but only a few select ones did. Oddly my other media PC works perfectly. So, I’ve swapped them around and the fully working one is now in the lounge. It plays everything back without any problems at all. The plan is to clone that hard drive in order to get the other PC to a known working state.

Update (4th January 2011)
I have it all working now, but only because I had an enforced upgrade of my TV Server (due to a power outage/spike which partially fried some gear). So, with MediaPortal 1.1.2 and Stand Alone Filters v4 (with hardware acceleration enabled). I have 1080p DTS MKVs playing back just fine.

I recently got myself (as a present) a nice new Denon AVR 1910 AV Receiver, which has HDMI video switching. So I duly plugged my HTPC into one of the HDMI inputs and hooked my HDTV up to the HDMI monitor out. All was well, everything worked as it did before. That is after I’d spent a few hours setting the amp up.

Whilst fiddling around with my new toy, I switched the amp to a different HDMI video input and then back to the HTPC input. Whoa, what’s this black border around the whole picture?! I have a Toshiba 42WLT66 which is a 1080i panel, that means it’s got a native resolution of 1920×1080 (albeit only capable of interlaced video). So, I’ve got my PC configured to 1920×1080 @ 25Hz. But when I checked the video settings, it had defaulted back to 30 Hz, hence the black border.

I found that if I switched the amp on first and let it go through the startup routine, then switch the TV on and then the HTPC all was well. Anything other than that order and the HTPC defaulted to 30Hz, which was useless for my purposes. So, I’ve since spent a lot of time researching different ways of fixing the problem on the web. I even installed the latest ATI Catalyst drivers and Catalyst Control Centre, but that just made matter worse. The black border was present on all three refresh rate that my HDTV supports (25, 29 and 30Hz). System Restore came to my rescue.

So, I decided to write a little piece of software to reset the refresh rate. That, when combined with the MyPrograms plugin for MediaPortal, gives me a way of setting the HTPC back to 25Hz refresh rate via my remote control

So, here is how I did it…

Firstly I needed to use a few functions in user32.dll, so I created the following class…

class User32
{
    [DllImport("user32.dll")]
    public static extern int EnumDisplaySettings(string deviceName, int modeNum, ref DEVMODE devMode);

    [DllImport("user32.dll")]
    public static extern int ChangeDisplaySettings(ref DEVMODE devMode, int flags);

    public const int ENUM_CURRENT_SETTINGS = -1;
}

The User32 class needs the DEVMODE struct …

[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Ansi)]
public struct DEVMODE
{
    [MarshalAs(UnmanagedType.ByValTStr, SizeConst = 32)]
    public string dmDeviceName;

    public short dmSpecVersion;
    public short dmDriverVersion;
    public short dmSize;
    public short dmDriverExtra;
    public int dmFields;
    public int dmPositionX;
    public int dmPositionY;
    public int dmDisplayOrientation;
    public int dmDisplayFixedOutput;
    public short dmColor;
    public short dmDuplex;
    public short dmYResolution;
    public short dmTTOption;
    public short dmCollate;

    [MarshalAs(UnmanagedType.ByValTStr, SizeConst = 32)]
    public string dmFormName;

    public short dmLogPixels;
    public short dmBitsPerPel;
    public int dmPelsWidth;
    public int dmPelsHeight;
    public int dmDisplayFlags;
    public int dmDisplayFrequency;
    public int dmICMMethod;
    public int dmICMIntent;
    public int dmMediaType;
    public int dmDitherType;
    public int dmReserved1;
    public int dmReserved2;
    public int dmPanningWidth;
    public int dmPanningHeight;

    public static DEVMODE Create()
    {
        DEVMODE dm = new DEVMODE();
        dm.dmDeviceName = new string(new char[32]);
        dm.dmFormName = new string(new char[32]);
        dm.dmSize = (short) Marshal.SizeOf(dm);
        return dm;
    }
}

Since all I wanted to do was to reset the refresh rate, I just created a console application …

static class Program
{
    [STAThread]
    static void Main(string[] args)
    {
        int refreshRate;

        if (args.Length == 0 || !int.TryParse(args[0], out refreshRate))
        {
            refreshRate = 25;
        }

        bool silent = args.Length > 1 && args[1].ToLower() == "silent";

        string deviceName = Screen.PrimaryScreen.DeviceName;
        if (!silent)
        {
            Console.WriteLine("Device Name = " + deviceName);
            Console.WriteLine("Press [Enter] to proceed, or any other key to abort");
        }
        if (silent || Console.ReadKey().Key == ConsoleKey.Enter)
        {
            DEVMODE dm = DEVMODE.Create();
            User32.EnumDisplaySettings(Screen.PrimaryScreen.DeviceName, User32.ENUM_CURRENT_SETTINGS, ref dm);

            if (!silent)
            {
                Console.WriteLine(string.Format("Press [Enter] to set refresh rate to {0}Hz, any other key to abort", refreshRate));
            }

            if (silent || Console.ReadKey().Key == ConsoleKey.Enter)
            {
                dm.dmDisplayFrequency = refreshRate;
                User32.ChangeDisplaySettings(ref dm, 0);
            }
        }
    }
}

The primary screen name is fetched …

string deviceName = Screen.PrimaryScreen.DeviceName;

The User32.EnumDisplaySettings is called in order to fill in the DEVMODE struct, as all I wanted to do was to change the refresh rate …

DEVMODE dm = DEVMODE.Create();
User32.EnumDisplaySettings(Screen.PrimaryScreen.DeviceName, User32.ENUM_CURRENT_SETTINGS, ref dm);

Next, I set the refresh rate to what I want and call User32.ChangeDisplaySettings …

dm.dmDisplayFrequency = refreshRate;
User32.ChangeDisplaySettings(ref dm, 0);

It works a treat in combination with the MyPrograms plugin for MediaPortal, with the command line of “25 silent”.

My computer installation isn’t what you could call typical. I have a home made 19″ rack in my loft where I keep a bunch of stuff (including my router, network switches & patch panel, server PC, router and my main PC).

Up until now my “power switch” for the main PC has come in the form of setting up a wake on lan user on my router and logging on to that page using my PSP. That has worked great except for the times when the PC plays up and I need to press the reset or power button directly. When the needs arises for that I have to climb up in to the loft to get to the PC.

So, last week I did a little experiment with an old momentary PC switch and a length of CAT5 cable. I wired up the CAT5 cable straight through (ie – not to any standards). I made two “patch cables”, one for the PC end and one for the PC end. I just used one of the 4 pairs and basically spliced it into the middle of my spare momentary switch. Since I already had a spare RJ45 socket in my study I just plugged the switch end into that, and plugged the connector end into my patch panel for that socket. I then plugged the connector into a spare PC’s motherboard.

I climbed back down my loft ladders and pressed the button, climbed back up into the loft and hey presto the PC was booting up. My experiment was a success; I could use my existing CAT5 wiring to control my PC.

So, I purchased a few bits’n’bobs from farnell and another shop called the mod blog and made myself a little switch box with power and reset buttons on it. Oddly enough, my PC locked up during boot up this morning, so I had to use the reset button. It worked perfectly.

The wiring in the PC isn’t great as I’m not the worlds best solderer, but it works and because I bought the right bits, I didn’t actually need to splice into anything in the PC. The wiring sits between the normal power and reset switches in the case and the motherboard. So, I can power on/off and reset either from my little box in the study or from in the loft directly on the PC.

Parts List

Description Code Cost Supplier
Project Box 301-322 £2.15 www.farnell.co.uk
Red Switch 163-4627 £1.23 www.farnell.co.uk
Green Switch 163-4632 £1.23 www.farnell.co.uk
Cable Gland 117-8960 £1.86 www.farnell.co.uk
4 pin fan header CONF-4HWhite £0.40 www.themodblog.co.uk
10 Way Rainbox IDE Ribbon Calbe RID-10R £0.40 www.themodblog.co.uk
2 Way PC Header Connector (with Crimp Pins) CONKK-02 £1.26 www.themodblog.co.uk
Total £8.53

So, the next project is to do it again for another computer!

The components, 2 switches, cable gland and boxThe back of the finished boxThe finished item

The back of the finished box

The finished item

I have decided to have a play with Ruby on Rails. I had a go about a year ago but got nowhere as I had problems installing rails on my Windows Vista PC.

This time around I decided to forego the one click install and do everything manually. I followed the instructions from this page.

To summarise ….

  1. Install version 1.8.6 r26 of ruby, downloaded from here
  2. Open up a command prompt
  3. Confirm you have ruby installed by running ‘ruby -v‘, you should see a message like this ‘ruby 1.8.6 (2007-09-24 patchlevel 111) [i386-mswin32]
  4. Check which version of gem you have installed by running ‘gem -v‘. You’ll need version 1.0.1 or higher, to updgrade just run ‘gem update –system
  5. I already had subversion installed, so didn’t need to follow that part of the instructions
  6. I also wanted to use MS SQL as I already have that installed and am familiar with it, so I skipped the next section
  7. Next I installed rails and it’s dependencies by running ‘gem install rails capistrano mongrel mongrel_cluster
  8. As I am only trying this all out locally I didn’t bother installing a SSH client
  9. The final step was to get the MSSQL adapter working. To get that working I followed the instructions in a book I have

Getting the MSSQL adapter working

  1. Create a new ADO folder under your rubylibrubysite_ruby1.8DBD folder
  2. Download the source distribution of Ruby-DBI
  3. Unzip the ADO.rb file in the srcibdbd_ado folder within that zip/gz file

Creating your first Ruby on Rails application

  1. Open up a command prompt if you don’t already have one open.
  2. Go to the folder where you’d like to keep all your ruby projects in.
  3. Run ‘rails blog‘, this will create your application.
  4. Change into the newly create folder by running ‘cd blog
  5. Start the server by running ‘ruby script/server‘, wait until you see this message appear, ‘** Use CTRL-C to stop.
  6. Check that your application is working correctly, by opening up your web browser and navigating to ‘http://localhost:3000‘, you should now see a welcome screen.
  7. Click the ‘About your application’s environment‘ link to check everything is working.

I was actually trying to follow this tutorial video when I got slightly stuck on the database and web server side of things. So I’m about 22 seconds into that tutorial !!

If you’re using MSSQL you will probably see an error message relating to the database connection. To correct this you will need to edit your database.yml file, this is found in the config folder of your project folder. In my case that was blogconfig. You will need something along these lines…

development:
  adapter: sqlserver
  database: blog
  host: .
  username: <username>
  password: <password>

Oh, and don’t forget to actually create the database.

Now close your application by going back to the command prompt and hitting Ctrl-C. Now run ‘ruby script/server‘ again. Refresh your browser and try click the ‘About your application’s environment‘ link again. Hopefully, you should see some useful information instead of an error message.

That is as far as I have got, which to be honest is a lot further than I got the last time I tried my hand at this. So, I think that’ll do for “Part 1″ as it’s getting late and I have to get up early tomorrow morning for rowing training :)

As detailed in previous posts I have a slightly non-standard setup with my PC. The PC itself it mounted in a 19″ rack (home made) and I have cabling for the Video and USB to my desk. I did originally have a headphone extension lead, but for some reason that only worked in mono. So, I ditched that and now use a pair of Logitech Z-10 USB speakers. I also have a USB keyboard, mouse, headset, card reader and DVD drive.

Anyway, the video cable was originally a 10 metre DVI cable I had spare. Somehow I managed to run that down to my desk, despite it having an enormous connector and RF suppression sleeve. I got quite a few wierd video interference artifacts using that. Mainly in the form of horizontal blue or yellow lines. I lived with it for a few months as I could get them to dissappear by changing whether my applications were full screen or just made almost the size of the desktop. It got to the point where I’d had enough, so I invested in a couple of 7 metre shielded HDMI cables. Apparently HDMI was designed to be run through walls, or at least the connector was. And it shows. The cables I’ve bought are also sheathed in woven nylon, so they pull though far easier than the rubberised DVI cable.

So, I now have a perfect picture on my monitor. I bought another cable, just in case I decide to go dual monitor in the future.

So in conclusion, DVI is *NOT* good for running through walls, HDMI is.

I used to do all my software development (amongst other things) on my trusty HP laptop. It wasn’t what you’d call a normal laptop. It had 2 gigabytes of RAM and a fast dual core Intel processor. I also had a docking station for it so I could use my lovely Hyundia W240D LCD display and my normal desktop keyboard and mouse. So for all intents and purposes it was a desktop replacement. That is, apart from the speed of the thing, especially when it came to the day-to-day use I put it to as a development machine for working on a large ASP.NET and ASP website project. It seemed to me as a long time builder of my own PCs that the bottleneck was the disk subsystem. For all the right reasons, well one, my laptop was specified with 5400 rpm hard drives. In a laptop that’s a good choice as 7200 rpm hard drives are typically much noisier.

So, I made the decision to build myself a new uber-computer. But me being me, I took it a step further. So, here I am writing this on a completely silent PC. I say silent, but in actual fact it’s not silent, I just can’t hear it. Since I already had a number of devices mounted in a home-built rack, I decided to put my new machine in there and run cabling to my office. All I needed was a DVI lead, USB and an audio extension lead. Anyway, I’ve already detailed the actual build in another web page. This post is about my epic struggle to get vista to a point where I could use it to develop software.

I have decided to gather all my solutions to various problems that stood in my way, both as a future reference and in the hope that it my spare some poor soul from the same stress that I had to go through!

Website Projects/Solutions under Visual Studio 2008

When working with a website in Visual Studio 2008, it needs to be run with elevated privileges. This can be done in a number of different ways, first a temporary solution …..

  • Right-click the shortcut in the Start Menu
  • Select “Run as Administrator”

A permanent solution …

  • Right-click the shortcut
  • Select “Properties”
  • Select the “Shortcut” tab
  • Click the “Advanced” button
  • Tick the “Run as administrator” box
  • Click the “OK” button on both dialogs

There are other ways, such as enabling the administrator account and using that. But the two above ways keep the UAC intact.

Event Logs

Vista is locked down in terms of Event Logs, but there is only a problem when trying to create a new Event Log Source. This is easily solved by manually creating the required Source(s). This is achieved by a little regedit use.

Within the HKEY_LOCAL_MACHINESYSTEMCurrentControlSetServicesEventLog key there should be a key for each log.

To create the log …

  • Right-click the EventLog key
  • Select “New” – “Key”
  • Enter the name of your log
  • Press <Enter>

To create the sources …

  • Right-click the HKLMSYSTEMCurrentControlSetServicesEventLog<log name> key
  • Select “New” – “Key”
  • Enter the name of the Source
  • Press <Enter>

Enable ASP Error Messages

By default IIS7 doesn’t send ASP error messages to the browser. Obviously, for development purposes, these are very useful. So, to enable them …

  • Load the IIS Manager
  • Navigate to your website
  • In the “Features View”, double-click the “ASP” icon within the “IIS” section.
  • Open up the “Compilation” section
  • Open up the “Debugging Properties” section
  • Set the “Send Errors To Browser” property to “True”

Enable ASP Parent Path References

In order for ASP to refer to parent folders …

  • Load the IIS Manager
  • Navigate to your website
  • In the “Features View”, double-click the “ASP” icon within the “IIS” section.
  • Open up the “Behavior” section
  • Set the “Enable Parent Paths” property to “True”

Enable ActiveX Controls

ActiveX controls can only be used in 32-bit mode. So, if your website makes use of them you will need to change your website to run as a 32-bit application. To do this …

  • Load the IIS Manager
  • Navigate to the “Application Pools” section
  • Right-click your website’s application pool
  • Select “Advanced Settings…”
  • Open up the “General” section
  • Set the “Enable 32-Bit Applications” property to “True”

Javascript error – ‘Telerik’ is undefined

This one is specific to using Telerik controls. Add the following to the web.config file in the <system.webserver> <handlers> section

<add name="Telerik.Web.UI.WebResource"  path="Telerik.Web.UI.WebResource.axd" verb="*" type="Telerik.Web.UI.WebResource, Telerik.Web.UI" />

This is by now means an exhaustive list, it’s just a small collection of the things I needed to fight my way through before I could use my machine in anger as a development workstation.

Javascript error when using Microsoft ReportViewer control

This is similar to the above in that it needed the following adding to the web.config file in the <system.webserver> <handlers> section

<add name="Reserved-ReportViewerWebControl-axd" path="Reserved.ReportViewerWebControl.axd" verb="*" type="Microsoft.Reporting.WebForms.HttpHandler, Microsoft.ReportViewer.WebForms, Version=9.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a"/></pre>

The solution was found here

So, I started work today ready to try and fix yesterdays lingering problems. I load up Visual Studio 2008, click on my website link in the start window, it starts to load getting as far as telling me I have 11 projects in my solution, then it exits. What ??!?!?!?

No error message, no visible crash of any kind, not even a BSOD (Blue Screen of Death). So after 5 minutes of cursing and chuntering at the sheer stupidity of what just happened, I started looking for a solution. My first port of call was the Event Viewer, I found this error:-

.NET Runtime version 2.0.50727.1434 – Fatal Execution Engine Error (79FEC5F0) (80131506)

On googling it I find that many other people are having the exact same issue. What’s more there didn’t seem to be a common solution that fixed the problem for all. The first thing I checked was for the existence of any Manifest tags in any of my included csproj files, as that was suggested as a possible cause. No joy there. Next stop was Add-Ins, specifically Resharper as I’d seen that mentioned a few times in my google search results. I disabled the three add-ins I have installed and tried reloading the website solution. Eureka!! it loaded.

So, it was one of my add-ins. I re-enabled them one at a time, re-loading the website solution each time. Well, it turned out to be Resharper causing the problem after all. So, it’s now disabled. I’m very frustrated by this, as I built a new development PC with enough raw grunt to be able to run things like that. My development laptop just grinded to a halt with Resharper installed. So, I’m basically back to square one.

Anyway, I hope this helps someone out there get past a very annoying and frustrating problem. I still cannot believe the stupidity of just having a program, whether it’s visual studio or even something as simple as notepad, just silently close itself down with no indication of what went wrong. Having to look in the Event Viewer to find the solution is next to useless. I’d have though a piece of software such as Visual Studio would be more likely to throw up an error, as the people using it are by definition more technically minded.

Rant over, and back to work.

I have recently built a new PC for my general use, but mainly to use as a fast PC for software development. I’ve not taken the normal route for this. Rather than having a PC in the office, I have built a rack mounted PC and added it to my existing 19″ rack. I have run an active USB extension cable through the walls into the office, along with a headphone extension cable (which will go straight into my speakers) and a DVI extender. The extender takes the DVI signal from the PC and sends it to a receiver box in the study over CAT5e cabling. So far it seems to be working brilliantly. The only downside is that it’s eerily quiet! It’s a very wierd sensation to have all that computing power with absolutely no noise. It’s so quiet now that I can hear a faint buzzing noise from my LCD monitor.

The specification for the PC (so far) is :-

CPU Intel Q6600 Quad Core
Memory 8 GB DDR2 800
Motherboard Gigabyte GA-EP35-DS3P
System Hard Drive 2 x 160 GB Western Digital SATA2 in a RAID1
Graphics Sapphire 512MB Radeon HD 3650

The next step will be to build a RAID0 for the data drive. But I am not sure how many hard drives to put in it. I have the option of going for up to 6 drives, but there is a trade off with the reliability of it. The more drives the more vulnerable it is to failure. But, it’ll be data that will be backed up elsewhere anyway.

Update – 15th September 2008
I have moved this to a web page (rather than a blog post).