Matt’s Blog

Matt’s Blog Just another weblog

7Oct/12Off

Install Ubuntu 12.04 LTS from USB, installer couldn’t mount CD-ROM

I recently attempted to install Ubuntu 12.04 LTS Server from a USB and encountered a weird problem. After downloading the Ubuntu ISO image, I utilized the Universal USB Installer from pendrive.com to make my USB stick bootable.

The USB stick booted fine and I began the installation process. However, very quickly, the installer presented me with the following error message,

Your installation CD-couldn't be mounted. This probably means that the CD-ROM was not in the drive. If so you can insert it and try again Retry mounting the CD-ROM?

I'm not sure what causes the above error, but, here is how to overcome this obstacle.

Copy the ISO image to the USB stick and attempt to install Ubuntu again. When the above error message appears, select "No" and then issue the following commands:

Press Alt+F2, <ENTER>
 
mkdir /media/usb
mount -t vfat /dev/sdb /media/usb
mount -t iso9660 -o loop /media/usb/ubuntu-12.04-server-amd64.iso /cdrom
 
Press Alt+F1

Where /dev/sdb is the device for your USB stick. You may have to explorer other devices. Try typing ls /dev/sd* to see the available drives if you encounter troubles here. The idea is that we'll manually mount the CD-ROM drive ourselves and then let the installer resume as if nothing out of the ordinary has happened. So, after the ALT+F1, simply select,

Load debconf preconfigruation file

from the menu and the installation will resume. Good luck.

Filed under: Guide No Comments
6Oct/12Off

bind9 with journal

I recently wanted to update my now journalized bind9 DNS server. This blog entry helped me update my zone which has been configured for dynamic updates.

http://www.aossama.net/orking-with-a-journal-ized-bind-zone

Here is the process for updating bind9 when using a journal,

sudo rndc freeze ZONE
...modify zone files...
sudo /etc/init.d/bind9 restart
sudo rndc unfreez ZONE

Filed under: Guide No Comments
27May/12Off

[Solved] Windows 7 High CPU Usage

After returning from Sleep or Hibernate on my Windows 7 desktop machine, I noticed high CPU usage on one of my cores. After tirelessly searching Google for a possible solution, I was unable to find one and wanted to publish the solution to my problem.

Utilizing Process Explorer, a tool developed by Microsoft which provides detailed information on running processes such as CPU utilazation, I discovered that the consumption was occurring in ntoskml.exe (I can't recall the exact method). This suggested that the culprit was the windows kernel, such as a driver module--not a rogue process.

To further debug the issue, I launched,

powercfg.exe -energy

from an elevated command prompt that generated an interesting report on my systems power management. Of particular interest were several errors associated with the USB subsystem. This crucial piece is what lead me to my solution.

It turns out the culprit was an old driver for my Creative Labs SoundBlaster X-Fi Surround external USB sound card. Updating to the latest drivers, found here, resolved my high CPU utilization problem. Good luck.

Filed under: Guide No Comments
27Nov/11Off

Clean implementation of static class instances

Sometimes an application requires a single static instance of a class for the duration of the life of the application. This is typically done by following the Single Design Pattern. One way to demonstrate such an implementation in C# is as follows,

public class Dog {
    private static Dog m_Instance = null;
    public static Dog Instance {
        get {
            if (m_Instance == null) {
               m_Instance = new Dog();
            }
            return m_Instance;
        }
    }
    // Dog implementation follows ...
}

However, can we do better? For instance, what if we have a number of classes which should have a single static instance? We would have to repeat the above code within each class to provide an Instance property. I was recently presented with this exact problem and realized that there is something quite common in the Instance implementation.

In fact, just about the entirety of the code is common except the invocation of the constructor for a particular type. Using generics and reflection we can abstract the Instance property by providing a single abstract class that implements the Instance property for any class type with a default constructor.

The following is a neat implementation of just that.

    public abstract class StaticInstance<T> where T : class, new()
    {
        private static T instance = null;
        public static T Instance
        {
            get
            {
                if (instance == null)
                {
                    instance = Activator.CreateInstance<T>();
                }
                return instance;
            }
        }
    }

Now, we can implement Dog as follows,

public class Dog : StaticInstance<Dog> {
    public Dog() { ... }
    // Dog implementation follows ...
}

which gives the Dog class the Instance property. Neat!

Filed under: Code No Comments