Profil von philPhil Harvey's .NET SpaceBlogListen Extras Hilfe

    I'm posting with w.Bloggar - and so can you!

    MSN Spaces now supports the metaWeblog API! This means you can post using a client application such as w.Bloggar. Dare has all the details here.
    27 Oktober

    Talking about Six Rules of Unit Testing

    Charles Miller has 6 rules for good unit testing. Click the link for an examplanation of each rule. If you don't know what unit testing is, shame on you (and google it). 

     

    Quote

    Six Rules of Unit Testing
    Charles' Six Rules of Unit Testing

    • Write the test first
    • Never write a test that succeeds the first time
    • Start with the null case, or something that doesn't work
    • Don't be afraid of doing something trivial to make the test work
    • Loose coupling and testability go hand in hand
    • Use mock objects
    04 Oktober

    Talking about: Allocation Profiler

    This tool is great at working out why your tiny .NET utility is using 80MB of memory! It lets you graphically see what objects have been allocated and quickly see where your memory leaks are.

    Of course, the CLR should control this sort of thing, surely? Having to use this tool breaks any contract of trust a developer should have with the CLR. If you are having memory leak problems even after garbage collection then somewhere in your code you must have references to instances of objects that you have long forgotten about! Either that, or *anything* to do with unmanaged code (COM Interop, Win32)

    Quote

    GotDotNet User Sample: Allocation Profiler
    Allocation Profiler is a tool for visualizing and analyzing allocations on the GC heap. It presents the data from this log file in a variety of interesting and useful views. It can be used to verify program execution (e.g. ensure you've allocated only the objects you thought) and to detect possible memory leaks. Simply launch AP, point it at your EXE and click a button.

    More MSN Spaces Hacks

    I take credit for being one of the first to 'hack' msn spaces, with the 'EditIt' button. This is obsolete since MSN decided to include the <HTML> button in the standard editor. Smart move.
    Since then, and whilst I've been ignoring the community, theres been loads more people getting involved with customising MSN Spaces beyond the imagination of Microsoft.
     
    Visit http://spaces.msn.com/members/d3vmax/ to get a feel of what people are getting up to.
    19 September

    BizTalk Server 2004 getting started guide

    I've been getting up-to speed with BizTalk Server 2004, however the learning curve is quite steep. The examples Microsoft ships with the SDK are woefully undocumented making the talk of making your first "Hello, world" style project a real mission.

    However, I found this article over at msdn blogs which really helps. Its got links to getting started guides, webcasts and tutorials. If you want to learn BizTalk then follow through the course outline and you'll come out the other end much wiser.

    Quote

    BizTalk ChalkTalk : The QuickStart Guide to Learning BizTalk Server 2004
    Are you getting started with BizTalk Server 2004? If so, this QuickStart guide is a great place to start! OK, so nothing is really "Quick" with BizTalk Server, but it has little to do with the product. Most of it has to do with the complex business problems that the product is trying to solve and all of the technologies that one must be familiar with. For instance, somebody that has some level of understanding of programming (XML, XSL, WSDL, .NET, C#, etc.), server technologies (Windows Server, IIS, SQL, WSS, etc.), and general Enterprise Application Integration (EAI) concepts will learn at a much faster rate than somebody who possesses less. However, that's not to say you can't!
    09 August

    Driving! Yay!

    Hurrah! Today I passed my driving test. 3 minors - not so shabby. Just thought I'd brag a bit, sorry.
    11 Juli

    Talking about Contemplations : How To F*ck Spyware Right In The Ear...

    The Cerebrate discusses an interesting alternative to the usual methods of blocking the spyware threat. He outlines the use of security policies to block spyware from executing, and stopping spyware before it infects you. Always a better option than than having to remove the spyware only after it has gotton a foothold.

    Some interesting points are made regarding how 'good computing' can significantly reduce the threat of infection - that is, not running as local administrator while surfing the net!

    Quote

    The Cerebrate's Contemplations : How To F*ck Spyware Right In The Ear...
    To do this, we use a rather nifty little feature of Windows XP called "Software Restriction Policies". What they do is intercept calls to the operating system's loader when it's asked to run an application, check it against the rules defined in the policies, and only allow applications to run if they match the policies. Normally, they're used as yet another steel-shod baton of sysadmin tyranny, but their power can also be used for good.
    29 Juni

    Why the National ID Card scheme is a waste of tax-payers money

    The UK government has plans to introduce ID cards for the whole of the UK population.  They are proposing to use biometric data to confirm the identity of the card holder. On the 25th May the Home Office published the results of a trial into the service.
    The UK Passport Service Biometrics Enrolment Trial report was published on 25 May. The trial gave more than 10,000 people across the country the opportunity to experience face, fingerprint and iris enrolment, sought their views on the experience, and surveyed their attitudes towards the use of biometrics.

    The full report is available at http://www.homeoffice.gov.uk/c­omrace/identitycards/. Some of the findings of this report suggest their are serious deficiencies with the proposed use of biometric data to support the system. Here is a summary: 

    • Facial recognition - 31% of the population failed to verify against
      their own facial image, rising to 52% failure amongst disabled people.
    • Iris recognition - 10% of the population could not even get their
      irises to record successfully, rising to 39% failure rate amongst
      disabled people. For those who did succeed in recording an iris image,
      4% failed to match when they were re-scanned.
    • Fingerprint recognition - 19% of people in the trial did not match
      against their own fingerprint biometric. And in 12 cases the database
      found false matches against other peoples fingerprints and rejected the
      new fingerprints as fraudulent!

    Scale these figures up to the entire UK population and it becomes apparent that millions of people will fail to record and/or match against their own biometric data. The figures look particularly foreboding for disabled users. It seems this program needs to be thought out in a lot more detail before the government strong hands the bill through parliament, however this is what they are currently doing. The national ID card scheme will cost the tax payer a massive amount of money - too much to go ahead without more guarantees the program will be successful. The failure of this will program will make over government IT disasters (Passport Office, Air Traffic Control, Child Support Agency, Criminal Records Bureau, etc, etc)  look like minor slip-ups.

    16 Juni

    Develop Managed Outlook Add-ins with VSTO 2005

    Yes! Visual Studio 2005 has a decent way of creating managed Outlook Add-ins!! If only I had this stuff 12 months ago my life would be so much simpler. Still, at least the future looks bright for new Outlook projects I might undertake.

    Microsoft has unveiled VSTO (Visual Studio Tools for Office). Follow the link below to find out all about it.

    Quote

    Srinath Vasireddy - Online journal : Develop Managed Outlook Add-ins with VSTO 2005
    After several weeks of hard work, at TechEd we announced our latest work – Yes, you can now easily develop managed outlook add-ins with VSTO 2005.
    02 Juni

    Big Brother 6 desktop news alert

    Its Big Brother time again (if you live in the UK). I've got into a bit more than in recent years, mainly by chance of leaving E4 on constantly now its on FreeView :D

    I, like many others, will be checking the Big Brother website throughout the workday to check-up on in-house events. To me this is essential, to everyone else its skiving. The solution was to write a tool that let me know when new news was available. Bring on Big Brother 6 Desktop News Alerts.

    This little tool will display an icon in the system tray that blinks when new news is available. Fantastic! Get it here.

    16 Mai

    Talking about Article: Integrating an ASP.NET e-commerce system with PayPal's Instant Payment Notification (IPN)

    This article demonstrates how to validate PayPal IPN requests in asp.net. My only comment is once you have received the validation response from PayPal you need to check it equals "VERIFIED". Otherwise, it might have returned "INVALID", which probably means someones messing about you.

    Quote

    Article: Integrating an ASP.NET e-commerce system with PayPal's Instant Payment Notification (IPN)
    PayPal IPN is an example of business to business system communication via HTTP. Essentially, IPN enables your system to receive real time notification of a payment from PayPal.The primary requirement for IPN to work is to accept a HTTP post from PayPal containing information on a transaction, and then to return the same HTTP post back to PayPal (as a receipt) with an additional element appended.Receiving information is done using the form collection: Request.Form. Posting back programmatically is the part that this article covers.In the world of ASP and COM, the standard approach was to use MSXML to send HTTP posts programmatically. While this approach is still available for a .NET based system because all COM components can be accessed via .NET COM interop, it is strictly not a pure .NET solution.In the world of .NET, the desired functionality can be achieved using the classes System.Net.HttpWebRequest and System.Net.HttpWebResponse. These classes enable you to interact directly with the HTTP protocol.
    10 Mai

    Talking about Roland Weigelt's GhostDoc

    Here is a great little visual studio add-in to make xml code commenting a little bit less tedious. GhostDoc will automatically attempt to document any method or property by simply right clicking the code and choosing "Document This". Its not 100% perfect but its certainly a lot less work than documenting from scratch.

    Quote

    Roland Weigelt's GhostDoc
    GhostDoc is an add-in for Visual Studio .Net 2003 for automatically generating those parts of a C# documentation comment that can be deduced from name and type of e.g. methods, properties or parameters.
    28 April

    Talking about Sysinternals FileMon

    This is a great tool for debugging! It just saved my pants when I couldn't figure out a problem with GoldMine CRM for months and we were getting worrying close to a release date without solving the problem. Someone suggested I use this tool to monitor file IO and try and see where the problem was. FileMon displays a list of all file access, read, write, not found, etc operations on the system. You can then set a filter to only see what is relevant. I quickly realised I needed to add trailing backslashes to a path and voilà - we're good to go. I'll give it five stars for usefulness .

    Get it here

    Quote

    Sysinternals Freeware - Utilities for Windows NT and Windows 2000 - FileMon
    FileMon monitors and displays file system activity on a system in real-time. Its advanced capabilities make it a powerful tool for exploring the way Windows works, seeing how applications use the files and DLLs, or tracking down problems in system or application file configurations. Filemon's timestamping feature will show you precisely when every open, read, write or delete, happens, and its status column tells you the outcome. FileMon is so easy to use that you'll be an expert within minutes. It begins monitoring when you start it, and its output window can be saved to a file for off-line viewing. It has full search capability, and if you find that you're getting information overload, simply set up one or more filters.

    Rick Strahl blogger genius

    Rick Strahl has one of the best .NET web logs around (RSS). Just to let you know. But if you didn't know that already, then shame on you. I like to read it when I'm bored, he has great technical insight into .NET issues we all understand.

    22 April

    Talking about Multiple IIS Virtual Servers on XP Pro

    Stefano talks about a workaround for the one web-site/virtual server limit on IIS under Windows XP Pro. This limit has annoyed me for ages, and this workaround sort of helps. IIS will still only let you run one virtual server at a time which sucks! If anyone has a hack to get it working please let me know and I'll be a happy developer again :p

    Quote

    Multiple IIS Virtual Servers on XP Pro
    A great tip that comes directly from Steven M. Cohn's Blog... how to enable multiple IIS Virtual Servers on Windows XP Pro. The tip is above:When Microsoft released Windows XP Pro they pushed it as the next development platform, superceding Windows 2000 Workstation. The reality, however, is that it is nothing more than a very slightly enhanced version of Windows XP Home edition. One of the major development features that didn't make it from 2000 to XP was the ability to host multiple virtual Web servers on a single machine. Essentially, Microsoft disabled (hid) the menu item in the IIS Management Console that allows you create a new virtual server.
    19 April

    Brace yourselves!

    One of the most passionately argued schools of thought among software developers is bracing styles. Braces ({ and }) are used in many programming languages to logically segment blocks of code. There is however no exact standard to the use of braces, with the developer free to surround them with as much white space as they like. A good choice of brace formatting can lend itself greatly to the overall readability of a programs source code.

    I found an interesting discussion here on the most common forms of brace formatting and the reasons and advocates behind them, and have posted the different styles below.

    'K&R style' -- Named after Kernighan & Ritchie, because the examples
    in K&R are formatted this way. Also called `kernel style' because the
    Unix kernel is written in it, and the `One True Brace Style' (abbrev.
    1TBS) by its partisans. In C code, the body is typically indented by
    eight spaces (or one tab) per level, as shown here. Four spaces are
    occasionally seen in C, but in C++ and Java four tends to be the rule
    rather than the exception.
     
    if () {  
       
    'Allman style' -- Named for Eric Allman, a Berkeley hacker who wrote a
    lot of the BSD utilities in it (it is sometimes called `BSD style').
    Resembles normal indent style in Pascal and Algol. It is the only style
    other than K&R in widespread use among Java programmers. Basic indent per level shown here is eight spaces, but four (or sometimes three)
    spaces are generally preferred by C++ and Java programmers.
     
    if ()
    {           
     
    'Whitesmiths style' -- popularized by the examples that came with
    Whitesmiths C, an early commercial C compiler. Basic indent per level
    shown here is eight spaces, but four spaces are occasionally seen.
     
    if ()
            {            
       
    'GNU style' -- Used throughout GNU EMACS and the Free Software
    Foundation code, and just about nowhere else. Indents are always four
    spaces per level, with `{' and `' halfway between the outer and inner
    indent levels.
     
    if ()
      {

    The style I tend to use is Allman, mainly because Visual Studio nicely forces this format upon me by default. It must be a Microsoft thing. Apparantly Whidbey (Visual Studio 2005) will let you choose what code formatting styles it applies to your code.

    18 April

    Set file permissions from an Installer custom action

    A common task for using an Installer action in your Visual Studio deployment project would be to change the file access permissions on some of the files you have just installed. Currently, the .NET framework does not provide any mechanism for managing access rights on files - although this will change in version 2.0 (Whidbey). In the mean time, there's a download at gotdotnet.com called Win32Security (Download Now). This community library lets you manage file security attributes on NTFS file systems. 

    Download and build the project, and reference it to your Installer custom action class. The following code sample will add the "All Access" privilege to the ASPNET user on the web.config file.

    If you are new to installer custom actions I strongly suggest you read this article before trying to understand the code below.

    Note: You will need to pass the install directory to the custom action by setting the "CustomActionData" parameter of the custom action to /dir="[TARGETDIR]\".

    Installer custom action class to set the file permissions on the web.config file

    using System;
    using System.ComponentModel;
    using System.Configuration.Install;
    using System.Collections;
    using System.IO;
    using Microsoft.Win32.Security;

    namespace InstallDemo.Installer
    {
      /// <summary>
      /// Sets the permissions of the web.config file.
      /// </summary>
      [RunInstaller(true)]
      public class WebConfigInstaller :
         
    System.Configuration.Install.Installer
      {
         
    public WebConfigInstaller()
          {
          }

          /// <summary>
          /// Gets the file name of the web.config file.
          /// </summary>
          protected string WebConfigFilename
          {
            get
            {
              return Path.Combine(this.Context.Parameters["dir"], "web.config");
            }
          }

          public override void Install(IDictionary stateServer) 
          {
            base.Install(stateServer);
      
            FileInfo configFile = new FileInfo(this.WebConfigFilename);

           if (configFile.Exists)
           {
             // Give "ASPNET" user full access
             SecurityDescriptor secDesc =
               SecurityDescriptor.GetFileSecurity (
                 configFile.FullName,
                 SECURITY_INFORMATION.DACL_SECURITY_INFORMATION);

             Dacl dacl = secDesc.Dacl;

             dacl.AddAce (
             new AceAccessAllowed (new Sid("ASPNET"),
             AccessType.GENERIC_ALL));

             secDesc.SetDacl(dacl);

             secDesc.SetFileSecurity(
               configFile.FullName,
               SECURITY_INFORMATION.DACL_SECURITY_INFORMATION);
          }
        }
      }
    }


     

    12 April

    Talking about MSN Spaces - "Released to Web"

    MSN Spaces has officially moved out of b3ta (even though it still says b3ta in the banner space)! Mike Torres has the run down of whats new at his blog.

    New features include new themes and 30MB of storage for photos. My favorite new feature which Mike hasn't mentioned is the inclusion of RSS views in the page statistics section. Top stuff!

    See:

    http://spaces.msn.com/members/mike/Blog/cns!1pG4qKNdtRA5Nl-UhvZI_1rQ!1470.entry

    http://spaces.msn.com/members/mike/Blog/cns!1pG4qKNdtRA5Nl-UhvZI_1rQ!1387.entry

    http://spaces.msn.com/members/mike/Blog/cns!1pG4qKNdtRA5Nl-UhvZI_1rQ!1386.entry

    11 März

    Bloggers block & future projects

    I've had a spot of bloggers block lately. I guess I've working hard lately with this and that, but I don't want to say too much about any current projects until I have something to release.

    Outside of work I've been working on some object persistence stuff using reflection which is quite exciting. The key to this project is high performance scalable indexed object persistence. Who needs SQL, eh? Should have something to play with next month. Oh and coming to think of it I've learned a lot about binary file IO in .NET lately. I'll blog about this soon.

    Byeee for now