darrylbraaten.com

Software Development and System Architecture

 

Welcome to darrylbraaten.com Sign in | Join | Help
in Search

Darryl's Homepage

Random Ramblings

  • Gale Force Nine 5 Piece Diamond Micro File review

    I picked up the Gale Force Nine 5 Piece Diamond Micro File set because my current files are getting a bit old.  As I was buying some other items Paul from Dice Bag Games gave me the files if I wrote a review on them.  
     
    I liked the files because they are small and the set had a half moon file which is really the only style of file I really use.  The five files include a half moon, flat, round, square, and triangle. The files turned out to be a bit too small, well too short really you really need to use very short strokes.  
     
    The files are covered in fine sand like coating, the diamonds I guess.  When using the files this results in a finish that has fine scratches instead on a normal wavy flat file pattern.  I found it difficult to get a smooth finish.   They also take of material slightly slower than normal files, this seems to be mostly due to the shorter length of the diamond files. The files worked better on metal then on plastic pieces, the scratchy finish was worse on plastic.  One nice thing about the files is that they do not look like they clog up easily as there are no grooves.
     
    The diamond files will be added to my collection of tools as they are small enough to get into places my normal files can reach. If you need small files I would look for other options before buying these.  I do not know how long the diamond finish will last. 

  • http://downforeveryoneorjustme.com/

    This is a very cool service.  It lets you check if a site is reachable from their servers if you can't get to it. 
  • AskTog has a new column first one in over a year

    Apple's Flatland Aesthetic, Part1: The Mac is pretty good. It covers a lot of the difficulty I have with Apple's OSX and iPhone. Actually his second article this year, I missed the first as I only check his site every few months.

    Tog doesn't publish very often but his articles are usually very good. For usability guidance I also like to read Jacob Nielsen's Alertbox articles.

  • Wow installed new video driver, no reboot

    That was impressive. 
  • W00t running Windows 7

    The upgrade did not work, but it seems to have installed on my second drive without breaking anything there.
  • I seem to be upgraded

    I think it is finished, well sometime on Saturday it finished.  It would have been nice if there was some indication of progress during the upgrade. The black screen eventually went away and I could log in from the console.  For a while things stopped working, but that was because the upgrade activated the Windows Firewall which I had turned off. 

     While it was on the black screen I could remote desktop in, do somethings, but not start stopped services unless they started on boot. At some point  it activated the FW cutting off remote desktop and some things I was using, but not SQL server or IIS they survived the FW activation.  Possibly their installation automatically put in the correct FW rules.

    Overall the upgrade went ok, but it took a really long time.  If I had the HW to spare I think it would have been better to install from scratch. 

    I am leaning to not finished yet.  The upgrade really needs some kind of progress bar. 

    Things are looking ok if a bit strange, and I am unsure if the upgrade is actually complete.  The strangeness is that the local console has a blank screen with only a mouse cursor, but I can remote desktop in without any problems.  The machine is running at 100% CPU so something might not be finished. 

    Things to note when doing an upgrade from Windows 2003 to 2008.  Run adprep before starting.  adprep can be found on the 2008 disc.  You may also need to set your Domain to  be 2003 native.  It seems that by default it is set to 2000 mixed. It can be changed via the AD domains and trusts program.  Also make sure all the remote desktop sessions are shut down, you will not be allowed to upgrade if there are multiple people logged in. 

    Things that are now working yet, Apache which I use for SVN, is not starting up.  

    Things that are working, SQL 2005, my blog, and my site that prompted the upgrade.  Once it is finished enough for the public I will publish the url, for now it is private. 

  • Wish me luck, upgrading to Windows 2008

    If my server is offline for awhile this is why. 

    The reason I am upgrading is that the new stuff I am playing with i.e. ASP.NET MVC works much better on IIS7. 

                    Total    Copied   Skipped  Mismatch    FAILED    Extras
         Dirs :       678       678         0         0         0         0
        Files :    218482    218482         0         0         0         0
        Bytes : 368.533 g 368.533 g         0         0         0         0
        Times :   9:41:17   9:38:01                       0:00:00   0:03:15
        Speed :            11409697 Bytes/sec.
        Speed :             652.868 MegaBytes/min.
        Ended : Wed Nov 05 01:34:50 2008
    

    Things are getting slower as my backup drive fills up

                    Total    Copied   Skipped  Mismatch    FAILED    Extras
         Dirs :     15276     15276         0         0         0         0
        Files :    138615    138615         0         0         0         0
        Bytes : 104.223 g 104.223 g         0         0         0         0
        Times :   4:34:45   4:23:13                       0:00:00   0:11:32
        Speed :             7085832 Bytes/sec.
        Speed :             405.454 MegaBytes/min.
        Ended : Wed Nov 05 13:25:40 2008
    
                    Total    Copied   Skipped  Mismatch    FAILED    Extras
         Dirs :      2400      2400         0         0         0         0
        Files :     31959     31959         0         0         0         0
        Bytes : 114.065 g 114.065 g         0         0         0         0
        Times :   2:34:44   2:32:51                       0:00:00   0:01:53
    
        Speed :            13354671 Bytes/sec.
        Speed :             764.160 MegaBytes/min.
    
        Ended : Wed Nov 05 19:22:19 2008
    
  • New Computer with 8GB RAM

    I jumped a little ahead and didn't wait for any price drops.  Boy am I happy with my new machine it is very very fast.  There have been a few minor issues with Vista 64bit but overall it has been good. 

    I purchased it assembled from NCIX, just used there configuration on one of the higher end machines.   This way it cut down on the time needed to research individual parts.

    1 x Intel Core 2 Duo E8500 Dual Core Processor LGA775 3.16GHZ Wolfdale 1333FSB 6MB Retail
    1 x Arctic Cooling Freezer 7 Pro LGA775 2500RPM 45CFM
    1 x EVGA Nforce 780I SLI LGA775 ATX 3PCI-E16 1PCI-E1 2PCI SATA2 RAID Sound GBLAN 1394 Motherboard
    2 x Corsair XMS2 DHX TWIN2X4096-6400C4DHX 4GB DDR2 2X2GB PC2-6400 DDR2-800 CL 4-4-4-12 240PIN Memory Kit
    1 x GeForce GTX 280 OEM 602MHZ 1024MB GDDR3 2.214GHZ PCI-E DVI-I
    1 x Antec P182 ATX Black Mid Tower Case 4X5.25 1X3.5 6X3.5INT No PS Front USB Audio Firewire
    1 x Corsair CMPSU-620HX 620W ATX Triple 12V 50A 24PIN ATX Modular Power Supply 120MM Fan
    1 x Microsoft Windows Vista Ultimate Edition 64BIT DVD OEM
    1 x Seagate Barracuda 7200.11 1000GB 1TB SATA2 7200RPM 32MB Cache NCQ Hard Drive OEM
    1 x LG GGC-H20L BLU-RAY HD-DVD Reader BD-ROM 6X HD DVD-ROM 3X DVD+-RW 16X8X6 DL 4X Black SATA Software
    1 x nGear Flash Card Reader 3.5IN Internal USB Black CF/SM/SD/MMC/MS/XD 18IN Cable Seperated Connectors
    1 x Microsoft Natural Ergonomic 4000 Keyboard & Mouse USB PS2 Black OEM Single Pack
    1 x Western Digital Velociraptor WD3000GLFS 300GB SATA2 10000RPM 5.5MS 16MB 3.5IN Hard Drive

     

  • StackOverflow is now live/open beta

    Stackoverflow is now live,  very cool.  Getting one of your answers marked best is great. 
  • Vista 64bit Experience

    The Good
    • Lots of Memory, my regular usage is just over 4GB, so no swapping with 8GB of real RAM.  
    • Most things work with out any issues.  This is much improved over my experience trying 64 bit in beta.
    • Very fast file transfers, between two my two main machines I got up to 50MB a second.  Drive to drive on the new machine I have gotten over 100MB a second for large files.  This is probably more this being a new faster machine then 64 bit.  
    • No problems with the games I have tried, but that hasn't been many, or for very long.

    The Bad
    • Windows Easy Transfer doesn't work, I was trying to move things from my old machine but it just crashes
    • Windows Media Player crashes on first run, the second time you run it, it works fine.  Microsoft blames nVidia and suggest new drivers, new drivers do nothing.New drivers released Sept 12, 2008 fixed this issue.
    • Edit and continue doesn't work in VS.NET for 64bit processes.  On the plus side it doesn't matter to much because everything is so fast.
  • StackOverflow is getting pretty good

    I got into the beta for stackoverflow.com a couple of weeks ago.  I have been answering a few questions and asking a few over that time.  Even with just shy of 4000 users it is a very effective place to get answers to your programming questions.  

    I was having trouble figuring out how to read directly from a device in .Net today so I decided to ask the question on stackoverflow. Within a few minutes I got the answer use CreateFile call in Win32, and the person helpfully linked to the MSDN article for CreateFile which had an example in it for what I wanted to do.  Surprisingly the offline MSDN article for CreateFile leaves out this information.  I had also forgotten that CreateFile is the master call for opening things in Win32, files, pipes, com ports, pretty much any device that moves bits around.  Though it is a bit hard to find it in the help if you don't know that to open files you need to call create.  


    With that information I was able to create a little program to read the information I needed. 
    using System;
    using System.Runtime.InteropServices;
    using System.IO;
    using Microsoft.Win32.SafeHandles;
    namespace ReadFromDevice
    {
    public class DeviceStream : Stream, IDisposable
    {
    public const short FILE_ATTRIBUTE_NORMAL = 0x80;
    public const short INVALID_HANDLE_VALUE = -1;
    public const uint GENERIC_READ = 0x80000000;
    public const uint GENERIC_WRITE = 0x40000000;
    public const uint CREATE_NEW = 1;
    public const uint CREATE_ALWAYS = 2;
    public const uint OPEN_EXISTING = 3;
    // Use interop to call the CreateFile function.
    // For more information about CreateFile,
    // see the unmanaged MSDN reference library.
    [DllImport("kernel32.dll", SetLastError = true, CharSet = CharSet.Unicode)]
    private static extern IntPtr CreateFile(string lpFileName, uint dwDesiredAccess,
    uint dwShareMode, IntPtr lpSecurityAttributes, uint dwCreationDisposition,
    uint dwFlagsAndAttributes, IntPtr hTemplateFile);
    [DllImport("kernel32.dll", SetLastError = true)]
    private static extern bool ReadFile(
    IntPtr hFile, // handle to file
    byte[] lpBuffer, // data buffer
    int nNumberOfBytesToRead, // number of bytes to read
    ref int lpNumberOfBytesRead, // number of bytes read
    IntPtr lpOverlapped
    //
    // ref OVERLAPPED lpOverlapped // overlapped buffer
    );
    private SafeFileHandle handleValue = null;
    private FileStream _fs = null;
    public DeviceStream(string device)
    {
    Load(device);
    }
    private void Load(string Path)
    {
    if (string.IsNullOrEmpty(Path))
    {
    throw new ArgumentNullException("Path");
    }
    // Try to open the file.
    IntPtr ptr = CreateFile(Path, GENERIC_READ, 0, IntPtr.Zero, OPEN_EXISTING, 0, IntPtr.Zero);
    handleValue = new SafeFileHandle(ptr, true);
    _fs = new FileStream(handleValue, FileAccess.Read);
    // If the handle is invalid,
    // get the last Win32 error
    // and throw a Win32Exception.
    if (handleValue.IsInvalid)
    {
    Marshal.ThrowExceptionForHR(Marshal.GetHRForLastWin32Error());
    }
    }
    public override bool CanRead
    {
    get { return true; }
    }
    public override bool CanSeek
    {
    get { return false; }
    }
    public override bool CanWrite
    {
    get { return false; }
    }
    public override void Flush()
    {
    return;
    }
    public override long Length
    {
    get { return -1; }
    }
    public override long Position
    {
    get
    {
    throw new NotImplementedException();
    }
    set
    {
    throw new NotImplementedException();
    }
    }
    /// <summary>
    /// </summary>
    /// <param name="buffer">An array of bytes. When this method returns,
     the buffer contains the specified byte array with the values between offset and 
    /// (offset + count - 1) replaced by the bytes read from the current source. </param>
    /// <param name="offset">The zero-based byte offset in buffer at which to begin storing the
     data read from the current stream. </param>
    /// <param name="count">The maximum number of bytes to be read from the current stream.</param>
    /// <returns></returns>
    public override int Read(byte[] buffer, int offset, int count)
    {
    int BytesRead =0;
    var BufBytes = new byte[count];
    if (!ReadFile(handleValue.DangerousGetHandle(), BufBytes, count, ref BytesRead, IntPtr.Zero))
    {
    Marshal.ThrowExceptionForHR(Marshal.GetHRForLastWin32Error());
    }
    for (int i = 0; i < BytesRead; i++)
    {
    buffer[offset + i] = BufBytesIdea;
    }
    return BytesRead;
    }
    public override int ReadByte()
    {
    int BytesRead = 0;
    var lpBuffer = new byte[1];
    if (!ReadFile(
    handleValue.DangerousGetHandle(), // handle to file
    lpBuffer, // data buffer
    1, // number of bytes to read
    ref BytesRead, // number of bytes read
    IntPtr.Zero
    ))
    { Marshal.ThrowExceptionForHR(Marshal.GetHRForLastWin32Error()); ;}
    return lpBuffer[0];
    }
    public override long Seek(long offset, SeekOrigin origin)
    {
    throw new NotImplementedException();
    }
    public override void SetLength(long value)
    {
    throw new NotImplementedException();
    }
    public override void Write(byte[] buffer, int offset, int count)
    {
    throw new NotImplementedException();
    }
    public override void Close()
    {
    handleValue.Close();
    handleValue.Dispose();
    handleValue = null;
    base.Close();
    }
    private bool disposed = false;
    new void Dispose()
    {
    Dispose(true);
    base.Dispose();
    GC.SuppressFinalize(this);
    }
    private new void Dispose(bool disposing)
    {
    // Check to see if Dispose has already been called.
    if (!this.disposed)
    {
    if (disposing)
    {
    if (handleValue != null)
    {
    _fs.Dispose();
    handleValue.Close();
    handleValue.Dispose();
    handleValue = null;
    }
    }
    // Note disposing has been done.
    disposed = true;
    }
    }
    }
    }
    using System;
    using System.Collections.Generic;
    using System.Linq;
    using System.Text;
    using System.IO;
    namespace ReadFromDevice
    {
    class Program
    {
    private const int MB = 1024*1024;
    static void Main(string[] args)
    {
    var reader = new BinaryReader(new DeviceStream(@"\\.\PhysicalDrive3"));
    var writer = new BinaryWriter(new FileStream(@"g:\test.dat", FileMode.Create));
    var buffer = new byte[MB];
    int count;
    int loopcount=0;
    try{
    while((count=reader.Read(buffer,0,MB))>0)
    {
    writer.Write(buffer,0,count);
    System.Console.Write('.');
    if(loopcount%100==0)
    {
    System.Console.WriteLine();
    System.Console.WriteLine("100MB written");
    writer.Flush();
    }
    loopcount++;
    }
    }
    catch(Exception e)
    {
    Console.WriteLine(e.Message);
    }
    reader.Close();
    writer.Flush();
    writer.Close();
    }

    }
    }
  • DD-WRT v24 SP1 is very cool

    I just upgraded from v23 SP2 to the new v24 SP1 firmware from dd-wrt.   I am hoping my internet connection is more stable with the new release, since I moved I have been having intermittent issues where the connection drops for a few seconds throughout the day.  Dd-wrt doesn't seem to produce comprehensive release notes so here is my list of things I like in the new version.

    • MAC address are linked to the IEEE vendor search so you can click on a MAC address and find the vendor of the Ethernet card. 
    • There is now a bandwidth monitor with a very cool scrolling graph, three graphs actually LAN, WAN & wireless.
    • Active IP Connections now has a popup that lists all the connections. It would be nicer if you could sort by connection type, all the stale connections are not so interesting. 
    • There is a traffic counter for the wan link, in the last 32 minutes I have downloaded 8MB and uploaded 1MB of stuff. And a bit more in the picture.


    That is all the flashy stuff they added.  Other things that I am interested in that look improved are VPN support, and hopefully a fix for my mysterious network issues.  My ISP says no issue on their end, not that they are trust worthy in that regard.  And I can't really phone them up when the connection goes down because it would be back up before I would be able to get through to anyone.   So I am crossing my fingers that the problem is on my end and therefore fixable.  

  • Trying hard to justify a new computer

    Going over my receipts for the last year in preparation for doing my taxes I realized I haven't upgraded my computer in a couple of years.  My current machine is almost 4 years old, but since I first bought it I have upgraded the CPU and video card.  The CPU is a AMD 4400+ and can't really be upgraded again since AMD changed the chip socket since after I bought my motherboard.  My video card is a 7950 GX2 which I went a little overboard on when I bought it, I wanted one a couple models down but it was the only one actually purchasable when I was shopping.  

    Looking at what is out now, nVidia has their new GTX 280 cards at the high end, but Tom's Hardware doesn't have it in their GPU comparison chart yet they are missing the prior 9000 series cards also.  My current card is still fast compared to the other cards on the chart.  It is also really hard to make direct comparisons as all the review sites always use the latest hardware when looking at video cards, even the resolutions tested are now going up, the old standard was 1024x768 but most monitors now support much higher resolutions, I currently run everything at 1920x1200 for example.  Making even manual comparisons between the 7950gx2 from the chart and the latest gtx 280 review impossible.  

    Looking at Tom's CPU charts comparing my 4400+ to the E8500 Intel processors it looks like things are looking up.  Most of the benchmarks show the current generation of CPU's having double or more the performance of the 4400+, and the 4400+ they are using is a slightly better version then the one I have, or at least it has the new socket.   PC Mark CPU for example the 4400 rates 4531 and the E8500 gets 8103, almost double.  But for the Windows Experience Index the 4400 rates 5.2 and the E8500 5.9. On my actual machine I get 5.0 for the 4400+.  Processor and memory are my two lowest scores at 5.0.  

    One irony is while I focus on video cards quite a bit while shopping for a new computer is that I don't really play games on my desktop anymore.  A little playing around with Age of Conan, and I will probably play Spore when it comes out in Sept. But it is really more of a work machine.  It might also be time to try ATI cards again I have had bad experiences with them in the past and have found nVidia to support their cards much better.  I don't know if things have changed since AMD bought them a couple of years ago. The Radeon HD 4870 compares quite well to the GTX 280 and is much cheaper, about the same prices as the GTX 260.

    One thing I will do for sure with a new machine is run a 64bit install of Vista, my current machine has 3G of memory not all of it is usable as my video card takes up 1G of address space on it's own.  With 64bit Vista I will be able to have 4G or more of memory and have the machine use it all. Most of the time memory is not an issue but if I need to run a virtual machine to play around with stuff it is.  I have been using my server for VM's but it only has 2G of memory which limits my VM memory size a lot.  When playing around with Commerce Server 2008 it likes 1G on its own for example.  

    Most of my research was done on www.tomshardware.com I also like www.anandtech.com but their site is really slow and www.extremetech.com.  

    I will look at things in another three months or so and see if I can put together a machine I like for under $2000, pricing out everything I would like seems to be hitting between 2200-2600 right now.  Three months might give me another CPU or GPU generation to evaluation also.  

  • Unit Testing with Linq to Sql

    I am working on a small personal project to learn some new things.  One my objectives is to follow the test first methodology. Something I just discovered was using SQLExpress to dynamically create databases on the fly, which makes setting up unit tests really easy. You can provide a connection string to a local database create it and add any data required for testing.  When you are finished just delete the database.

    Using Nunit you can structure your tests in a couple of ways, you can have a setup per class, or you can do setup per test. This is accomplished with the TestFixtureSetUp, and SetUp attributes respectively.  When doing setup you should also do clean up, this is done via TestFixtureTearDown, and TearDown.
        private CollectionsDataContext db = null;
        [TestFixtureSetUp]
        public void SetupTests()
        {
            db = new CollectionsDataContext(Utilities.CollectionDb);
            if(db.DatabaseExists())
                db.DeleteDatabase();
            db.CreateDatabase();
            var user = new aspnet_User
                           {
                               ApplicationId = System.Guid.NewGuid(),
                               UserId = System.Guid.NewGuid(),
                               UserName = "TestUser",
                               LastActivityDate = DateTime.Now,
                               LoweredUserName = "testuser"
                           };
            db.aspnet_Users.InsertOnSubmit(user);
            db.SubmitChanges();
        }
        [TestFixtureTearDown]
        public void Cleanup()
        {
            db.DeleteDatabase();
        }
        [Test]
        public void GetUser()
        {
            var user = from u in db.aspnet_Users select u;
            foreach (var user1 in user)
            {
                Assert.AreSame("TestUser",user1.UserName);
            }
        }


    One thing not to do is delete the database from the file system, it will then be in never never land. Using the Linq DeleteDatabase method removed the files from removed the files from the file system.

    The database location is pulled from the app.config which currently looks like this for the Nunit tests.
    <connectionStrings>
        <add name="CollectionLib.Properties.Settings.CollectionsConnectionString"
                connectionString="e:\temp\collections2.mdf"
                providerName="System.Data.SqlClient" />
    </connectionStrings>

    In the actual application it will point to a database on a server.

  • Integrated Testing with NUnit; Resharper or TestMatrix

    Update: I decided to go with Resharper. It is just a bit slicker then TestMatrix, and I decided the refactoring tools are worth more then the profiling tools in TestMatrix. 

    For some reason if you have the Architects version of Visual Studio you are not allowed to write unit tests with Visual Studio.  I guess Microsoft things that Architects shouldn't test the code they write.  On one of my past projects I used both Nunit, and the Microsoft test framework.  The Microsoft framework is not as large as Nunit, but it looks like it does everything that I need.  But because it is currently unavailable to me I am using Nunit for a new project I am starting.  

    One thing that I don't like about Nunit is does not have any Visual Studio integration by default. This makes it rather tedious to use.  Previously I have used a free version of JetBrains Resharper to get around this. JetBrains doesn't seem to offer the free version anymore.  Resharper does a bunch of other things in addition to running unit tests, actually unit tests seems to be one of its minor features.  Resharper costs $199.  Looking around the net for other solutions one that came up the most was TestMatrix by ExactMagic, actually what comes up is TestRunner, TestMatrix is the most resent version, it clocks in at $129.

    My decision now is between, Resharper a refactoring, best practice enforcing tool, or a dedicated unit testing plugin, that does a little profiling and code coverage.  

    Resharper Pros
    Full Refactoring tool
    Suggests best practices for you to follow
    Run individual tests from an icon in the coding window.
    Will run tests marked ignore if you explicitly run them.
    Resharper Cons
    The old version anyway slowed VS down a lot.  Not sure about the new version yet.
    Profiling is a $199 add on.

    TestMatrix Pros
    Code coverage
    Profiling is included
    Nice visual around tests showing their success or failure.
    TestMatrix Cons
    Can not manually run tests marked ignore
    No in editor icons for running tests

    Decisions decisions, resharper is very cool. I like being able to run individual tests even if they are marked ignore. Though this is probably not a best practice, I tend to write utilize these as debug entry points that do something I wouldn't normally do in a test.  TestMatrix has profiling, something I really like, but there are free profilers out there that give pretty good results(Nprof).  

    I have a few days on the free trials and will add pros and cons and I find them.  

More Posts Next page »