Author: George

  • Ubuntu 10.10 with Multi-touch Touchpads: Solution!

    Certain multi-touch capable touchpads on notebooks behave erratically under Ubuntu (and perhaps other flavors of Linux). Here’s a simple solution to solve that, at least for Synaptics-based hardware:

    This has been tested on Ubuntu 10.10, but it may work on other versions.

    1. Launch Terminal (Applications – Accessories – Terminal), then run the following two commands (add utouch repository and install Synaptics driver).
    2. sudo add-apt-repository ppa:utouch-team/utouch
    3. sudo apt-get update && sudo apt-get install synaptics-dkms
    4. Restart the system.
    5. Open System – Preferences – Mouse, and enable “two-finger scrolling” in the touchpad tab.
    You will now have a touchpad that behaves itself, and you’ll also notice that two-finger scrolling is also available! Note that for the touchpads that have integrated buttons (like some HP and Apple models), this will not enable right click. However, in the Mouse configuration menu, you can enable right click via press-and-hold delay. Shorten it, then right-clicking will work when you hold the button down.
  • Windows Server Update Services Without a Domain (aka WSUS at home)

    If you’re like me and have a number of Windows PCs at home, and dread the time and bandwidth that is spent running Windows Update on each “patch Tuesday”… there is a solution! Set up a WSUS (Windows Server Update Services) server, download & cache the updates once, then enjoy downloading updates fast from your LAN.

    WSUS is intended for PCs on a domain, under Active Directory. However, it is possible to use it without a domain controller of any kind, and without Active Directory. All you need is a machine to run WSUS (3.0 SP2 in this case), a LAN, and a few dozen GBs of extra storage space.

    First, download WSUS 3.0 SP2 from Microsoft, and install it. The step-by-step wizard will guide you through the process and allow you to decide with products you would like to receive updates for, and for which languages. I suggest enabling auto-approval rules in the Options menu, so that you don’t have to manually approve each and every update every time.

    Once WSUS is configured, and synchronization is complete, you’ll have to configure each machine to receive updates from your WSUS server. The easiest method is to use the Local Group Policy editor in Windows. The entries you need to edit are located in Local Computer Policy > Computer Configuration > Administrative Templates > Windows Components > Windows Update (see below for what values need to appear there). However, if you are using Home versions of XP/Vista/7, you may not have access to the Local Group Policy editor. In that case, you must manually make the following changes to the registry:

    1. Launch Regedit from Start > Run, and navigate to:
      HKEY_LOCAL_MACHINE\SOFTWARE\Policies\Microsoft\Windows
      First and foremost, right click on the “Windows” folder (key) on the left side, and click “Export”. This will back up this section of the registry, so that if you break something you can change it back to the way it was (aka working).
    2. Create the “WindowsUpdate” key in “Windows” if it does not exist. Most likely, it will not exist.
    3. Also create the “AU” key in “Windows Update” if it does not exist. Again, it probably won’t be there already.
    4. You should now have the following path in existence (and listed at the bottom of regedit): HKEY_LOCAL_MACHINE\SOFTWARE\Policies\Microsoft\Windows\WindowsUpdate\AU
    5. Move up one directory, to just the WindowsUpdate key. Create the following entries:
      Create a DWORD named AcceptTrustedPubliserCerts with value 1
      String named WUServer, value http://YOURSERVER (put your server’s IP address or DNS name here)
      String named WUStatusServer, value the same as above (http://YOURSERVER)
    6. Navigate into the AU key, and create the following entries:
      DWORD named EnableFeaturedSoftware, value 1
      DWORD named IncludeRecommendedUpdates, value 1
      DWORD named UseWUServer, value 1
    7. Restart the computer.
    8. Launch Windows Update, and check for updates. If your server is configured correctly, has finished synchronizing and downloading all updates (make sure they are all approved!), the computer should receive updates internally now!
    For more information on WSUS, please see Microsoft’s WSUS page.
  • Recursive Directory Listings for ASP.NET in C#

    A good, recursive directory lister can come in handy. Especially since IIS’s built-in directory lister doesn’t always cut the mustard. Or, maybe you require this functionality as part of a larger project.

    The issue of finding a flexible way to do directory listing, and with recursion, led me to writing my own. Take a look at the (commented!) code below. Feel free to comment with how you’ve implemented this, or even if you have any improvements.

    The code below is designed for accepting parameters, in case you have different root directories you’d like to call and list separately. To remove this functionality, simply remove any use of DirParam (and that first if statement).

    Here’s my C# code:

    public void Main()
    {
        string DirParam = Request.QueryString["d"]; //Check for: http://localhost/list.aspx?d=[variable]
        if (DirParam != "tools" && DirParam != "drivers"//Check if someone tried something other than 'tools' or 'drivers', in my particular installation
        {
            Response.Write("No valid directory selected!"); //Can only use 'tools' or 'drivers'
            return//Quit
        }
        DirectoryInfo rootDir = new DirectoryInfo(Server.MapPath("." + "/" + DirParam)); //Set root directory to be server root with selected directory from address bar
        WalkDirTree(rootDir); //Begin walking the tree
    }
    public void WalkDirTree(DirectoryInfo workingDir)
    {
        long FileSizeCheck = 0, FileSize = 0;
        string FileSizeUnit = null;
        FileInfo[] files = workingDir.GetFiles("*.*"); //Files found in directory collection
        DirectoryInfo[] subDir = null//Sub-directories found in directory collection
        Response.Write("<li><b>" + workingDir.Name + "</b></li><ul>" + "\n"); //Write first line in bulleted list (root dir name)
        if (files != null//Keep going until we run out of files
        {
            foreach (FileInfo item in files) //For each individual file in collection...
            {
                FileSizeCheck = item.Length; //Store size of file in memory so we don't access file more than once
                if (FileSizeCheck > 1073741824)
                {
                    FileSize = FileSizeCheck / 1024 / 1024 / 1024; //File is larger than 1.00GB, simplify to GB units
                    FileSizeUnit = "GB";
                }
                else if (FileSizeCheck > 1048576)
                {
                    FileSize = FileSizeCheck / 1024 / 1024; //File is larger than 1.00MB, simplify to MB units
                    FileSizeUnit = "MB";
                }
                else if (FileSizeCheck > 1024)
                {
                    FileSize = FileSizeCheck / 1024; //File is larger than 1.00KB, simplify to KB units
                    FileSizeUnit = "KB";
                }
                else
                {
                    FileSize = FileSizeCheck; //File is smaller than 1.00KB, show size as-is
                    FileSizeUnit = "B";
                }
                Response.Write("<li><a href=\"" + MapURL(item) + "\">" + item.Name + "</a> [" + FileSize + FileSizeUnit + "]</li>" + "\n"); //...list and create hyperlinks
            }
            subDir = workingDir.GetDirectories(); //Collect sub-directories in current directory
            foreach (DirectoryInfo dir in subDir) //For each directory found in current directory...
                WalkDirTree(dir); //...recursively walk the tree
        }
        Response.Write("</ul>"); //End this sub-directory's list
    }
    public string MapURL(FileInfo item)
    {
    string ServerRootPath = Server.MapPath("."); //Determine server root
    string url = item.FullName.Substring(ServerRootPath.Length,item.FullName.Length-ServerRootPath.Length); //Subract entire server-side path from server root to determine local URL
    return url.Replace("\\""/"); //Transform Windows-style path to HTTP-style by replacing \ with /
    }
  • Hello, Digital Kitchen

    I’ve finally jumped onto the blogging bandwagon…

    Welcome everyone! The purpose of this blog is to have a place to store and share various useful tidbits of information I’d like to have around… For example, recipe experiments and results, programming tidbits, server tips, and so on. Think of it as a clipboard to store useful information/tools that I acquire or create as time goes on.

    Thanks for reading, and please contribute via comments!