jvance.com

.net, c#, asp.net, linq, htpc, woodworking

Jarrett's Tech Blog - For June 2009

  1. Tiny HTPC Movie and Hulu Box Part 5 Conclusion

    The two 50mm fans arrived and I put them into their new home.  To line them up in the back, I raised them up on a small piece of wood and tie-wrapped them into place. They are the perfect height for the case.  I used some aluminum to fill in the blank spaces.  I got lazy at the end and used a wood block to plug the last space.

    Hulu Box 006 Hulu Box 013

    The HTPC made too much noise with these new fans so I made a couple modifications:

    • Change fans to run from 5 volt instead of 12 volt (from 5000rpm down to 2100rpm) see here
    • Remove some of the metal blocking the PSU fan

    The noise is now on par with the original Xbox.  I plan to replace the PSU fan with a silent 40mm fan from FrozenCPU to further reduce the noise.

    Hulu Box 035

    I also removed the casing over the PSU and organized the wires for better air flow. I taped over some of the rear holes so the air would enter from the front and travel across the motherboard.

    Hulu Box 009  Hulu Box 010

    Temps CPU 1 CPU 2 Northbridge
    Idle 32 C 33 C 48 C
    Load 58 C 60 C 55 C

    The Rear

    The motherboard IO panel fit perfectly between the top and bottom of the case.

    Hulu Box 038

    The Front

    I lightly sanded the sharp edges of the black plexi-glass.  I did not have any extra fine sandpaper so I used a buffing pad to get a smooth matte match with the case.

    Hulu Box 024

    The keyboard is a Logitech diNovo Mini and compliments the case really well.  The Zotac ITX motherboard allows you to enter the BIOS using the Delete key.  So even though the keyboard doesn't have function keys, it will still work in the BIOS.

    Hulu Box 041

    Here it is in it's final resting place on the fireplace mantel.  You can see the Wii on the right for comparison.

     Hulu Box 046

    I'm very happy with how the custom modded case turned out. The motherboard, PSU, fans, buttons, and black plexiglass all came together much better than I expected.  It is a cool, quiet, and beautiful computer.  Most of all, it plays every file format and can run video from any website perfectly.

    I recently installed Boxee and I've been watching some 1080p files and listening to Pandora all within the same interface.  Boxee is definitely the future of the HTPC.

    Posted by JarrettV on June 27 at 10:03 PM

  2. Tiny HTPC Movie and Hulu Box Part 4 Assembly

    I created the front from a scrap piece of black plexi-glass found at a local glass supplier: Eastern Shore Glass.  They cut it for me by scoring and snapping it. They were extremely nice and helpful. I got two pre-cut pieces and some scrap all for $8.

    Hulu Box 008

    I drilled holes in the plexiglass for the buttons and LEDs.

     Hulu Box 007

    Drilling a hole in plexiglass greater than 1/4" is tricky.  I needed to start with a smaller bit and keep increasing the size to keep shards from breaking off.

    On the back side of the black plexiglass I created a frame from aluminum that I could use to mount it to the case. I used brass screws to match the case feet.

    Working with aluminum is fun as it is a fairly soft metal that is easy to drill and cut.

    Hulu Box 021

    The buttons are held in place with wood and hot glue. The LEDs are simply hot glued in place.

    Hulu Box 027 Hulu Box 032

    I bolted the plexiglass aluminum frame to the case.  On the bottom of the case, I drilled and cut holes for air intake.  The cool air enters from below and travels across the motherboard to exit out the rear via fans.  There are no vents on the top or sides.

    Hulu Box 012

    I mounted the power supply in the case using a single bolt which keeps it from sliding backward when plugging in.  I used wood spacers covered with a thin layer of foam to allow the PSU to be sandwiched between the top and bottom of the case.  A small bracket made from aluminum provides enough friction to keep the PSU firmly in place.

    Update: I've since removed the power supply circuit board from the casing and created a new solid backplate so I could reduce the number of fans needed in the case.  I also added additional holes below the PSU circuit board to bring in cool air.

    Hulu Box 028

    I mounted the motherboard by drilling four holes and using small bolts.  The rubber feet act as standoffs to raise the motherboard up to the desired height.  It also allows air to easily travel below and around the board.

    Hulu Box 034

    In the next part, I'll mount the fans, round the edges of the plexiglass and show the final photos of it in action.

    Posted by JarrettV on June 23 at 12:13 AM

  3. Jackson

     

    Jackson 016

    Jackson

    Posted by JarrettV on June 22 at 11:21 PM

  4. Tiny HTPC Movie and Hulu Box Part 3 Hardware Test

    The parts arrived from Newegg and I put it together.  The Intel fan that came with the CPU was not very tall. The fan may have fit the short height of the case, but it would have been tight.  I'm glad I ordered the other fan.

    Here is a picture of it after I turned it on.

    Mini ITX Build

    I rescued some buttons, LEDs, and speaker off of an old case.

    Buttons and LEDs

    I fired it up, loaded Windows 7 RC1 and the new Hulu Desktop app.

    Hulu Desktop App on HDTV

    Unfortunately, watching fullscreen Hulu is choppy.  I've played many different video formats (MKV, Bluray, DivX) and they all play smooth regardless of resolution (720p, 1080p, etc). This is definitely a bug in the Hulu desktop app as even CBS, Youtube, and Vimeo HD videos playback fine.  I plan to try some various changes to resolve the Hulu video stuttering.

    Update: Hulu is only choppy within the desktop application.  It is smooth when played through the browser.

    Update2: Found a thread in their forum: Lag in fullscreen mode

    It is also mentioned in many other threads so this seems to be a common problem.  Let's hope they fix it soon.

    In the next part, I'll mount the parts into their tiny new home (see part 1) and fabricate a front-panel.

    Posted by JarrettV on June 14 at 1:02 AM

  5. Unzip Nested Zip Files While Streaming

    I recently encountered a scenario where I needed to unzip all the files in a zip file and also any files from internal zip files.  The source data is streaming in through an HTTP POST via IIS into BizTalk. The zip files can be large (up to 200 MB) and there can be multiple posts happening at the same time.  This is too much data to fit in memory.  Also, I needed to avoid unnecessary network traffic so using temporary files is not an optimal solution.  Therefore, I needed a forward-only streaming solution.

    To accomplish this, I turned to #ziplib. The ZipInputStream object looked like the perfect solution to this situation. Here is an example of how to use this class:

    using ( ZipInputStream s = new ZipInputStream(stream)) {
      ZipEntry theEntry;
      while ((theEntry = s.GetNextEntry()) != null) {
        int size = 2048;
        byte[] data = new byte[2048];
        size = s.Read(data, 0, data.Length);
        if (size > 0) {
          Console.Write(new ASCIIEncoding().GetString(data, 0, size));
        } else {
          break;
        }
      }
    }
    

    As the raw data is streamed through the ZipInputStream, it gets unzipped.  The GetNextEntry() method sets the position to the beginning of the next file.  Then we just read from the ZipInputStream to get the unzipped file data.  So to unzip nested zip files, I came up with a function I could call recursively:

    public static void NestedUnzip(Stream stream, string targetPath)
    {
      ZipInputStream s = new ZipInputStream(stream);
      ZipEntry entry;
      while ((entry = s.GetNextEntry()) != null) {
        //when internal zip file, unzip it
        if (Path.GetExtension(entry.Name).ToLower() == ".zip") {
          NestedUnzip(s,
            Path.Combine(targetPath, Path.GetFileNameWithoutExtension(entry.Name)));
        } else {
          //make sure target path exists
          string path = Path.Combine(targetPath, entry.Name);
          Directory.CreateDirectory(Path.GetDirectoryName(path));
    
          //write the data to disk
          using (FileStream fs = File.Create(path)) {
            byte[] buffer = new byte[1024];
            int read = buffer.Length;
            while (true) {
              read = s.Read(buffer, 0, buffer.Length);
              if (read > 0) fs.Write(buffer, 0, read);
              else break;
            }
          }
        }
      }
    }
    

    Now this would work great for my needs as it process the data as a forward-only read-only stream.  However, whenever a nested zip runs out of entries (i.e. GetNextEntry() == null) the ZipInputStream calls close on the underlying stream.  This results in the unzip process ending prematurely.

    To fix this, I commented out the Close() call within the GetNextEntry() method of the ZipInputStream class:

    if (header == ZipConstants.CentralHeaderSignature ||
      header == ZipConstants.EndOfCentralDirectorySignature ||
      header == ZipConstants.CentralHeaderDigitalSignature ||
      header == ZipConstants.ArchiveExtraDataSignature ||
      header == ZipConstants.Zip64CentralFileHeaderSignature) {
      // No more individual entries exist
      // -jv- 11-Jun-2009 Removed close so it can support nested zips
      //Close();
      return null;
    }
    

    Of course, the calling method should properly close the source stream so this is a safe change to make. For example:

    using (Stream s = inmsg.BodyPart.GetOriginalDataStream()) {
      NestedUnzip(s, unzipLocation)
    }
    

    The result is a perfect streaming solution with low memory usage and no need for temporary files.

    Posted by JarrettV on June 13 at 11:33 AM

  6. Tiny HTPC Movie and Hulu Box Part 2 The Parts

    HtpcParts2

    I ordered the parts today from Newegg.

    The video is built into the motherboard and I plan to reuse a hard drive I already have.  I'm hoping to get away with just using a Media Center remote control or a smaller bluetooth keyboard once things are setup.  Also, I will leave open the option of adding a full-size DVD/Bluray drive in the future.

    These parts are powerful enough to do everything I need.

    In the next part, I'll assemble the parts and load the OS to test out the components.

    Posted by JarrettV on June 09 at 9:00 PM

  7. Tiny HTPC Movie and Hulu Box Part 1 The Case

    Introduction

    I'm planning to build a tiny computer for watching Hulu and HD encoded movies.  The computer needs to be:

    • Shallow enough to easily fit on the fireplace mantel next to the TV
    • Powerful enough to play 1080p video's and HD online videos
    • Pretty enough to make the wife happy
    • HDMI, Bluetooth and internal PSU to minimize cable and power bricks

    The Case

    The case is from an old Dolby Digital decoder box from before that technology was built-in to receivers.  It is dusty and needs to be cleaned.

    Mini HTPC 001 Mini HTPC 005 Mini HTPC 008

    Dimensions

    16.6"W x 2.25" H x 8.25" D

    The inside has plenty of room for a Mini ITX motherboard and there is probably enough room for a Slim Bluray drive and a Hard drive.  I'll likely custom fabricate the front out of plexi-glass and reuse some of the old buttons.

    In the next post, I'll look at the hardware I will fit in this tiny case.  I'm currently looking at either the Intel platform with a Zotac GF9300 motherboard or the AMD platform with the Jetway 780G motherboard.

    Update

    Here is a picture of it cleaned up:

    denon_avd2000_1

    It would be nice if I could reuse the old face including the LCD screen and the LEDs and knob but I lack the time to explore how to communicate with those electronics.

    Posted by JarrettV on June 01 at 1:53 PM

© Copyright 2024