Welcome to RenEvo Sign in | Join | Help
in
Home Wiisis Blogs Forums Photos Downloads About

Developer

  • Facebook Site Thumbnails Tutorial

    Here is a quick tutorial for all you Facebook users.

    It annoyed me that when I added links from my website, the images that were given were “eh” at best, and usually from some random blog post. I had followed a tutorial that I found on using the image_src meta, but it just didn’t work for me.

    Here is my process

    First thing I did was open up my site in my browser, I then “zoomed” out a bit to get more content in the view (I use a widescreen monitor).  I then took a decent centered screenshot (OneNote screen clipping is awesome), in Photoshop I tweaked it a bit to my liking so that it was nice and centered.  I then exported as a 200x175 png file and named it “renevo.thumb.png”

    Uploaded to my web site, then added this tiny bit of HTML to the site header.

    <img src=”/images/renevo.thumb.png” alt=”” style=”display:none;” />

    This doesn’t effect my website’s layout at all, and since it is set to display:none “most” browsers will not download the image.

    And, for the result when sharing a link on Facebook.

    image

    So… super easy way to add a 100% available website thumbnail.

  • A bad approach to adding RemoveAt to a Queue<T>

    Tonight on Stackoverflow a gentlemen asked if it would be possible to add an extension method to the Queue<T> class to remove an item by index. Anyone who has worked with this class knows that there is no Add or Remove methods, but instead a Dequeue and Enqueue pair of methods. Well, the problem with Dequeue is that it only removes an item from the end of the queue, so that's not really going to work for this guy.

    "I thought of a quick and dirty solution: Inherit from the Queue class and add your own RemoveAt method."

    Hey! Bloody brilliant, right? Wrong. The catch 22 is that there is no way to remove an item from the queue class itself except from the Dequeue method, which simply doesn't cut it. So to get around this I had to enumerate through all the items, add each item to a new queue, skipping the index we want to remove. Well, this is a neat solution, however it creates a new queue everytime you need to remove an item by index.

    It doesn't sound so bad, but consider the code:

    Custom Queue<T> class

    queuea

    Test Code in Main()

    queueb

     

    I knew as soon as I wrote this that it would be a significant performance hit, but I didn't realize just how bad until I looked a bit deeper. Essentially this means that each time RemoveAt is called, the queue is enumerated, and a new queue is created. If we have a queue with 5000 items, and we needed to remove 2500 of them, this would result in 12,502,500 calls to the Count property, and 12,410,000 calls to the Enqueue method. A lot, much? I didn’t get this data out of thin air though, I used Visual Studios performance tools, so let’s take a look at the actual benchmarks:

     

    perfs

     

    Ouch! Approximately 9 minutes to remove 2500 items from a queue with 5000 items.. That is definitely not performance savvy. So I ran a comparison using a generic list.

     

     

    perfs2

     

    4.36 milliseconds… What a time difference! So you can see that a small “innocent” “work-around” can be absolutely detrimental to your applications performance. Oops! Luckily I thought ahead of time and told the guy someone else would probably post a better solution, and it was as simple as recommending a generic List<T>. :P

  • Integrating Paypal into ASP.Net

    There's no reason to write a whole lot of backend code, workarounds, or use third party Paypal controls just to get Paypal to work with ASP.Net. Actually, it only takes two lines of code in the Page_Load event. Let's take a look.

    Form.Action = "https://www.paypal.com/cgi-bin/webscr";

    Form.Method = "post";

    Using the above two lines of code in your codebehind, you can now just plop the input markup for the Buy Now, Add to Cart, or Donate buttons in your .aspx page. The reason copying and pasting the Paypal markup doesn't work in the first place, is because ASP.Net is nothing but forms. And you can't have a form inside a form. Of course using this method, the page has to be dedicated to submitting the data to Paypal, but you wouldn't normally have more than one form on a page anyway, so it doesn't really matter.

    This is the most elegant solution as far as I know. After my many hours of Googling around, I never found an easy solution until I realized I could just manipulate the main form.

    Important things to know

    You only need to use the Page_Load event if you are using MasterPages, otherwise you can just use the form tag in the individual .aspx page.

  • Upcoming Site Developments

    I have two websites that I am about to embark on doing, below is a scratch list of the technology that I will be using, as well as any additional brain dump info on them, there will be much more information coming later on these, but for now… Enjoy my tech.

    Base Framework

        ASP.Net MVC
    http://www.asp.net/mvc/default.aspx

        LinqToSql
    http://msdn.microsoft.com/en-us/library/bb425822.aspx

        jQuery
    http://jquery.com/
    http://plugins.jquery.com/

        Possible?
    http://ui.jquery.com/

        WMD
    http://wmd-editor.com/

        HTML Sanitation
    http://refactormycode.com/codes/333-sanitize-html
            Allowed Tags
                <a>
                    href=""
                    title=""
                <b>
                <blockquote>
                <code>
                <del>
                <dd>
                <dl>
                <dt>
                <em>
                <h1>, <h2>, <h3>
                <i>
                <li>
                <ol>
                <p>
                <pre>
                <s>
                <sup>
                <sub>
                <strong>
                <strike>
                <ul>
                <br/>
                <hr/>
                <img>
                    src=""
                    width="" (up to 999)
                    height="" (up to 999)
                    alt=""
                    title=""

        Prettify
    http://code.google.com/p/google-code-prettify/

            jQuery to Prettify
                function styleCode() {
                    var hascode = false;
                    $("pre code").parent().each(function() {
                        if (!$(this).hasClass('prettyprint')) {
                            $(this).addClass('prettyprint');
                            hascode = true;
                        }
                    });
                    if (hascode) { prettyPrint(); }
                };

    Authentication

        .Net Open Id
    http://www.codeplex.com/dotnetopenid
    http://www.hanselman.com/blog/TheWeeklySourceCode25OpenIDEdition.aspx

        RpxLib
    http://code.google.com/p/rpxlib/
    http://www.blechie.com/wtilton/archive/2009/01/03/Implementing-OpenId-and-more-with-ASP.NET-MVC-and-RPXNow.aspx

    Spam Protection

        ReCaptcha
    http://recaptcha.net/
    http://recaptcha.net/plugins/aspnet/

        Akismet
    http://akismet.com/
    http://www.codeplex.com/AkismetApi

    User Customization

        Gravatar
    http://www.gravatar.com
    http://en.gravatar.com/site/implement/url

            Sample:
    http://www.gravatar.com/avatar/1822257954fd46d7ab7732998776a80a?s=128&d=identicon&r=PG

            Construct:
    http://www.gravatar.com/avatar/md5ofemail?s=size&d=defaulticon&r=rating

            --Probably use the wavatar

        Default User Stuff
            Name (Pre-populated from openid)
            Email (Not displayed, used for gravatar)
            Real Name (Pre-populated from openid)
            Website
            Location
            Birthday (never displayed, used to show age)
            About Me (Markdown)

  • Reason for the Zune 30gb Bug

    Well, the source code has been found that caused the December 31st Zune Brick.

       1:  //------------------------------------------------------------------------------
       2:  //
       3:  // Function: ConvertDays
       4:  //
       5:  // Local helper function that split total days since Jan 1, ORIGINYEAR into 
       6:  // year, month and day
       7:  //
       8:  // Parameters:
       9:  //
      10:  // Returns:
      11:  //      Returns TRUE if successful, otherwise returns FALSE.
      12:  //
      13:  //------------------------------------------------------------------------------
      14:  BOOL ConvertDays(UINT32 days, SYSTEMTIME* lpTime)
      15:  {
      16:      int dayofweek, month, year;
      17:      UINT8 *month_tab;
      18:   
      19:      //Calculate current day of the week
      20:      dayofweek = GetDayOfWeek(days);
      21:   
      22:      year = ORIGINYEAR;
      23:   
      24:      while (days > 365)
      25:      {
      26:          if (IsLeapYear(year))
      27:          {
      28:              if (days > 366)
      29:              {
      30:                  days -= 366;
      31:                  year += 1;
      32:              }
      33:          }
      34:          else
      35:          {
      36:              days -= 365;
      37:              year += 1;
      38:          }
      39:      }
      40:   
      41:   
      42:      // Determine whether it is a leap year
      43:      month_tab = (UINT8 *)((IsLeapYear(year))? monthtable_leap : monthtable);
      44:   
      45:      for (month=0; month<12; month++)
      46:      {
      47:          if (days <= month_tab[month])
      48:              break;
      49:          days -= month_tab[month];
      50:      }
      51:   
      52:      month += 1;
      53:   
      54:      lpTime->wDay = days;
      55:      lpTime->wDayOfWeek = dayofweek;
      56:      lpTime->wMonth = month;
      57:      lpTime->wYear = year;
      58:   
      59:      return TRUE

    If you didn’t catch it, December 31st was day 366, therefore the there was never any code in what to do if days == 366.  Woops…

  • New code snippet plugin for Live Writer

    I am trying out a new code snippet plug-in for Live Writer.

    Public Class CommitDB
        Public Function GetCommitStatusAll() As DataSet
            ' Create Instance of Connection and Command Object
            Dim myConnection As New SqlConnection(ConfigurationManager.AppSettings("NorthstarConnectionString"))
            Dim myCommand As New SqlDataAdapter("GetCommitStatusAll", myConnection)
    
            ' Mark the Command as a SPROC
            myCommand.SelectCommand.CommandType = CommandType.StoredProcedure
    
            ' Create and Fill the DataSet
            Dim myDataSet As New DataSet
            myCommand.Fill(myDataSet)
    
            ' Return the DataSet
            Return myDataSet
        End Function
    End Class
    Lets see how it looks on the blogs!
  • PDC 2008 – For The Poor and Ill Located

    As you all know, or should have known, Microsoft’s Professional Developer Conference, or PDC, took place recently.  For those of us not in a position to visit, Microsoft has been so kind to post videos of all the sessions as well as their accompanying power point presentations.

    You can visit this Microsoft Blog Post to download and watch.

  • The Tools of the Trade

    So, as a .Net developer, there are a few “primary” tools I use, all for under $100.

    I thought I would spend a quick blog post to describe these tools a bit, how I use them, as well as what they are.

    Notepad
    image

    First and foremost, over my many years of development, notepad has been my friend, some people will say “notepad++” or “notepad2” or some other derivative of the same application with a bunch of extra functionality.  But to be honest, sometimes I prefer the simplicity of notepad over a lot of other applications for simple scripting, html programming, PHP programming, as well as quick build of applications (more on that in another post).

    Some great features for notepad are number one, the speed, the application is super fast with a super small memory foot print. There are restrictions on the size of files, and it is possible to crash the application, but by far, it is probably one of the most stable programs on my computer.  Another great feature is the line/column position that shows up in the status bar, *you do have to enable it from the View menu*.

    OneNote
    image

    This is literally another “have to have” applications. For about $40, you can’t beat the basic feature set. I use this program for taking notes during meetings with staff, customers, or just for myself to remember. With the ability to have multiple notebooks with multiple categories that contain multiple pages with the addition of sub-pages to those pages, it really helps my organizational pet peeves really find a home.  Each notebook is stored in a single “always saved” file, it can be shared, or ran locally, as well as transported between multiple computers with much ease. The “always saved” feature basically means, you never have to press save, you just click and type and its saved. As far as simplicity and ease of use, this is “the” note taking software.  I am actually writing my book in this application, then when I finish chapters, I transfer them over to Word (formatting is kept).  You get simple formatting, everything that you would expect from a Microsoft text editor, as well as full customization of the background and templates.  Finally on the note taking part of the application, you simply have to press WIN+N to open up a new note, or WIN+SHIFT+N to open the last notebook you where editing.

    Another HUGE feature for the application is the screen capture utility, simply press WIN+S and all screens get an opaque overlay that allows you to select any area on the screens.  From there you have a few options in how that data is captured, it can either be saved to the clipboard only, placed in a new “note” and kept on the clipboard where it then displays, or simply “filed” in a new note and kept on the clipboard. This has been THE tool that I use for making tutorials, some people rave about other screen capture tools, but for me, this is the easiest for me, one key stroke, and I can quickly choose what I want a screenshot of. By the way, all screenshots in this blog are taken with OneNote.

    The application runs in the Tray, and has a “light” memory footprint (250k), for what it does, I would rather run this than the alternatives.  The tool is so great, that it replaced Notepad for my note taking tasks.

    MSN Messenger
    image 

    Some people will definitely argue with this one, but this is a key communication point for myself, whether working with people in the office, or people working remotely, this application is much better than a phone call or getting up to walk across the office to speak to someone who might not be there.  For most “non-critical” communication I will simply fire off the question to the person I need to talk to, and when they come available, or online.  The offline messaging ability for the newer messengers really allow me to communicate better with people, especially those in other time zones.  Sometimes questions or communication is so small that an email just isn’t necessary. I log everything that I say or do in MSN Messenger, which makes it easier to go back previous communications, and I backup all of my history.  I have literally 6 years worth of MSN Messenger logs that I can pull back to search for questions I have asked other people, links people have given me, or simply try to remember some specific communications.

    I turn off a lot of options, specifically the window flashing and sound notifications, as when I am programming I don’t like to get interrupted with flashy distractions.

    Microsoft Visual Studio
    image

    This one is kind of one of those no-brainers. If you are doing .Net development, you are probably going to be using Visual Studio. The great thing about this piece of software is that you can get some stripped down “Express” editions for free from Microsoft, and shelling out a few hundred bucks, you can pick up the standard edition with multi-programming language solution support. I’m not going to really go into detail why I use this software, but it does grant a mention in this post as it is one of the “tools of the trade.”

    .Net Reflector
    image

    .Net Reflector, recently purchased by Red Gate Software, is a tool that allows you to disassembly and read reverse engineered code from .Net assemblies in all supported managed programming languages.  If you ever wanted to know how someone did something, simply use this tool to view the source code in your own programming language.  There are a few issues where you cannot copy/paste source code directly from the disassemble and compile it, but you shouldn’t be stealing source code anyway, this tool is for educational purposes, as well as debugging only. There are MANY plug-ins for the application available open source from Codeplex. I personally use the Code Search Add-in. Red Gate promises to keep the software free, but you probably will never find the source code for the application available to the public.

    Bug Tracking Software
    image

    I’m going to cover this as fast as possible, but basically you “must” use bug tracking database of some sort, Joel Spolsky of Fog Creek Software says so in his 12 Steps to Better Code, and me, I believe him.  But no really, using bug tracking software helps you identify, track, and plan features and application bugs. Depending on your bug tracking software, you can get a lot more, or a lot less. If you don’t have the extra money laying around to afford some huge software bundle (such as Test Track, or FogBugz), use notepad, use OneNote, use something, period.

    Source Control Software
    image

    This is another one of those “if you don’t have it, you are wrong” pieces of software.  Also discussed in the 12 Steps to Better Code.  A good source control package should contain at the minimal, versioning, rollback support, “some” sort of integration into either your file system (such as CVS and SVN), or into Visual Studio (Surround SCM, Team Foundation Server). Source control is another subject less talked about, but most needed, and in later articles I will go over some of the practices that I have implemented as the Source Control “master” for my company.

    And there you have it, those are the tools that I use on a daily regular basis, without these tools, I literally would just be lost and unable to function, they are that important to me.  There are some other tools that I use as well, such as this application (the one I am typing this blog with) Windows Live Writer.  It allows me to easily publish blogs, and spend as much time as I want tweaking them, writing them, etc… with local draft support, and multiple blog posting from a single post.

  • Power Testing

    What happens to your company when you lose power for say, 2 minutes?

    Until today, that question was never really asked at our company, like many others, we assumed full faith in Edison that our power will be stable, well, at least that’s the measures that we took to prepare.

    This morning, around 9:00am, our power flickered off then back on, probably due to the massive winds gusting up to 65mph. The experience thus far has literally been a nightmare. First off, the “few” computers that have APC battery backups beeped like mad, that is what they are supposed to do, but when the power came back on, they kept beeping, the batteries, having finally been used, have been destroyed.  Most of these backups are 5-10 years old, and have been used once or twice at most. This was the start of what I like to call, productivity hell.

    1. Phone Systems are down, not a big deal, but the computers that run them did not restart with the power coming back on (those old computers with non-state power buttons).
    2. Domains servers are down, one of them is not even on an APC, had one of those nagging “non-state” power buttons, you know the type, a home made PC that was used as a domain controller, and even though our company has upgraded almost every other PC in the building, these didn’t get updated.
    3. DNS is gone, once again, one of those “computers that stay off” when they lose power. Turns out our DHCP server (generally goes with the domain controller) took a dump when the system was shutdown improperly. Did I mention our Domains are still running Server 2000?
    4. Internet down, ok, this is an expected one, but when you have a help desk that uses internet to access the customers for support (via remote connections), as well as perform remote upgrades, then you have an entire development department that relies on internet and intranet for source control and bug tracking, it hurts. Not to mention the development that depends on 3rd party web services, which cannot be accessed. Not to mention those Hosted Solutions, about fifteen customers without access to the software we host for them.
    5. Source Control Down, as mentioned above, this one while not being effected by the nasty non-state power button on the computer, was completely locked out because of some “still unknown” router/switch issue that is preventing access to the source control, even by IP address.

    So, here it is nearly 7.5 hours after the “tiny” power flux and development is at a halt as we have a policy against working offline, due to junior developers never connecting back up, then submitting fixed bugs, and “oops I did a full get and overwrote my changes”, we have no internet to browse to at least do research while we are unable to program (ever hear that story about those things called books?  most of our developers refuse to read something that may cut them.) Our tech support and help desk departments are at a near halt, our phones are working, but the internet is up for a minute or two, then down for five to ten minutes at a time.

    The moral of the story? I would like to see power tests about once a quarter, monthly would be nice, but the scheduling requirements for that have a pretty big effect. What happens during the power test?

    • Power is cycled to the building for 20 seconds in the middle of the night during off-peak hours (three of four am)
    • On restoration of power, document every step to get the systems back and running to 100%.
    • After steps are documented meet with the nerds of the company to figure out how to reduce those steps and/or automate them.
    • Implement changes to reduce down time.

    With this type of preparing you are going to know what to expect, so when it happens during peek hours you have reduced and documented the full restoration of the system to 100%.

    Oh, Solitaire is a great filler for time!

     

    *Edit: Turns out this was an all day affair.

  • iGoogle Beta Access

    So, have you heard of the iGoogle beta yet?

    Basically, it is a newly updated view for the iGoogle home page that moves the tabs to the left side pane, adds the Google chat to the main page, as well as much more robust reading ability of gadgets.  For example, you can now browse each gadget independently to get a full view; like for instance if you navigate to the Gmail gadget, you get full Gmail interaction, without visiting the site, also any RSS gadgets will be expanded to allow you to read the posts within the expanded gadget.

    Back to the point, the iGoogle beta is currently a “developer” only beta, the good news is, you can try it by simply trying out the Google sandbox, answering a few questions (like your name), and having some fun.

    Turn on with this link

    Turn off with this link

    And that’s about it, personally I have been using the iGoogle home page almost since it was announced as beta, and without my little “clean” dashboard, I would go out of my mind.  Below is a screenshot of my iGoogle page, what’s yours look like?

    image

    Gadgets:
    Weather
    Bookmarks (link list)
    Gmail
    Ctrl+Alt+Del comic RSS Feed
    Coding Horror RSS Feed

    Want a RenEvo iGoogle gadget?

  • C# Background Compiling!!!!

    With Visual Studio 2008 SP1 (now in beta), C# gets one of those huge features that turned me off to the language in the first place, Background Compiling!

    What does this mean???

    Simply put, when you type in an error in the code, you know about it without having to compile, for example.

    Product is an invalid object, so therefore it gets a red squiggly without compiling, which is a huge step.

    Another example:

    Wrong return types, which is nice.

    This feature alone will probably get me into C# a lot faster then I was originally planning, this is what dynamic spell checking did for Microsoft Word in my opinion.

    Great feature add, and I can't wait for the "official" release of .Net 3.5 SP 1 as well as Visual Studio 2008 SP 1.

  • Web 2.0 Text - The Easy Way

      This tutorial will quickly outline the way to make a "Web 2.0" styled header image with minimal effort.

      What you need:

      • Photoshop CS3 (CS2 may work, not sure, been a while since I have used it)

      Open up Photoshop, and create a new document with the following settings:

      clip_image001

      Next, add a black background just so you can get your bearings, and set the transparency to about 50%, this will keep the grid in the background, but tame it down quite a bit to make the top layers a bit more visible.

      Now, using the text tool, click anywhere and type in "Web 2.0 Logo". I use white in this tutorial since I can create an overlay later to change the color. For your font, set it to Segoe UI (or your other favorite font) and a size of 48. Now resize the text area so that your text is snuggly inside of it, this allows you to better position it later.

      Your logo should looks something like this now:

      clip_image002

      Now comes the fun part, lets duplicate the text layer, name it "Reflection", select the Move tool, click on "Show Transform Controls" and simply drag the top of the middle gizmo down until you get a semitry that you like, see the bottom image for how I chose to lay it out. This sets up your "flat area", so the angle you use will force the eye to see the reflection at that angle. The longer the text is in the "reflection" side, the larger the slant will appear to your eyes for the reflected surface.

      clip_image003

      Next we are going to add a layer mask to our reflection layer, click on the Square with the Circle in it on the Layers toolbox as highlighted below:

      clip_image004

      By default, the layer will have 100% opacity (i.e. solid white).

      Select the layer mask on the Reflection layer to select it, choose the Gradient tool, press "D" on your keyboard to reset your colors. We want to select the Gradient brush that is white on the left, and black on the left.

      clip_image005

      Now, using the gradient tool on the layer mask (you selected it right?), put your mouse cursur just below the loop in the upside down G, and drag the mouse downward while holding the right mouse button and the SHIFT key (this makes it a straight line), you want to drag it until about 3/4 of the way through the upside down text. Once you release the mouse, it should look something like this:

      clip_image006

      Now, lets go over what type of surface we want to "reflect" on. Generally most reflective surfaces are not perfect copies, right now, ours is. There are some small adjustments that we can do, as well as some blending properties we can set that will give it a better look, without killing the actual text that is in the reflection, making it easier to update and change the colors as we please.

      So that we can get a better look at our reflection, lets change the background layer's opacity back to 100%.

      Not the most impressive logo yet.

      Move the reflection layer below the logo layer, go to the blending options for the Reflection layer, and add an outer glow with the following settings:

      clip_image007

      This will now give us a Gaussian blur look without actually rasterizing our reflection layer.

      And finally, change the opacity of the reflection layer to 50%, this will tone it down and blend it into the background a bit better. Now your image should look a bit like this:

      clip_image008

      That looks much better, but our logo is still way too high, lets move the reflection layer down a bit, so that it doesn't look like it is sitting on the surface, a good rule of thumb is to not cross the under case letters too far, else it will look like the letters are going "through" the bottom. After adjusting the height of the reflection, lock the two layers together so when you move one, you aren't separating them.

      So there we have it, a quick to update Web 2.0 Graphic that didn't take a lot of fancy tricks.

      With some small work to the background, adding some foreground text and a quick logo, you get a nice appearance to the graphic.

      clip_image009

       

      Download the PSD

  • The daily mental thought - Yes or No?

    So I spend a good portion of my day bouncing back and forth between C# and VB.Net.  I have been a VB programmer since vb5 and even earlier writing VBA and VB Script as well as ASP.  Lately though it seems that no matter how hard I try, filling the software department at work is a challenge.  There are just so few .Net programmers who want to work in VB.

    With a new framework being built, as well as a web framework being built, it keeps popping into my head, do I just start farming for C# developers, and switch the house language over?  Do I run a mixed house of C# and VB? Or do I keep with the die hard thought of VB.Net is an easier language to read and understand, as well as the massive amount of right pinkie work I would need for C#.

    If you want proof of this issue, head to your local book store, you will find a huge array of "Start programming now in VB.Net!", or "Write a VB.Net program", and even the faithful "VB.Net for dummies", while across the shelf you will find more of "Pro C# Development in .Net 3.5" and "Expert Development in C#" etc... The quality of the books that are carried by book stores will show you what people are buying, as well as a good hint at what people are writing.  There are just more people working with C# and adapting it over VB.

    I am one of the favored arguers that C#, J#, VB.Net, Managed C++, etc... all compile to the same IL code, but when you look at the resources available to you, C# just proves to be more supported, not easier or more powerful (although the unsafe blocks in C# technically does make it more powerful, then again you have background compiling in VB.Net which makes it more powerful in design time, the list really does go on and on for the pros/cons).

    Anyway, I picked up two new books from Apress last night for ASP.Net 3.5 in C# and C# 2008 & .Net 3.5.  Ironically, they have sections devoted to VB.Net, so I guess I am not the only one out there who is seeing this pattern as well.

    Oh, and another quick thought, who decided that no one writes sockets and remoting in VB.Net to not have mentioned it, other then a quick "this is a socket, and this is how to send "hi" back and forth". Yet in the five C# books I own, they are extensively covered, including a lot about how the Marshaling actually happens, downs and ups, as well as different situations to use them.

  • The importance of Virtual PC

    Up until about 2 months ago I had not realized what I was missing out on.

    Microsoft Virtual PC is not only extremely useful, it is Free. Granted you have to pay for the operating systems you install, that is still one hell of a deal when you compare the cost of a test machine, the power to run it, as well as the KVM or storage locations for it.

    So, what is Virtual PC?  Virtual PC is a computer emulator that you can run on your desktop computers.  It loads up like a computer, it uses virtual hardware, and you can install Operating Systems on it.

    Why is this so important you might ask?  Well lets think of this phrase "It works on my machine...".  This has been a software mantra for quite a few years, and admitidly I used to over use it myself.

    During the software development process you don't find a lot of developers who will take the time to test it on multiple operating systems, clean machines, or other configurations that are common for your target audience.  Instead, you fix the bug, run it from the IDE, if it doesn't crash again from the Replication steps (if you had any), then you sign it off as good and either deliver a patch to the customer, or send it to QA. Let us hope you are doing the latter.

    Now, lets investigate this situation.  You do the following on your Windows Vista box, you send it to your QA guy, who also happens to be using Windows Vista, he signs it off as fixed, and it is deployed to the customer. Except the customer is using Windows XP, and that bug still exists in Windows XP because for some reason the Users folders are in totally different locations.  You never tested it in that environment, so you have no idea what is going to happen, yet again the customer lets you know that it is broken, and it comes back to you.

    How do you solve this customer loop back?  Very easily actually, you simply use Virtual PC to test on a few different environments before you send it to QA or the customer.

    Below is my list of Virtual PC's that I have setup, and use daily.

    • Blank install of Windows XP SP2 - Always up to date.
    • Windows XP SP2 with the Point Of Sale we integrate into.
    • Windows XP SP2 with Office 2003 - Always up to date.
    • Blank install of Windows Server 2003 R2 w/IIS & SQL Server 2000
    • Blank install of Windows Server 2003 R2 w/IIS & SQL Server 2005
    • Blank install of Windows Server 2003 w/IIS (non-R2)
    • Blank install of Windows Vista Business - (for 32bit testing, as I run Vista 64 bit)

    As you can see from the list above, it targets my entire client base.  We restrict our software to only be installed on XP SP2, Server 2003, Server 2003 R2, and Vista. At any time I can load up one of these PC's and do a quick test of the issue that is being reports on the operating system configuration that the customer is complaining about, and find the issue much faster, and make sure it doesn't happen on ANY of the configurations again.

    I suggest taking the time, as well as the Hard Drive space (each OS is about 5 gigs) and get this setup, once you have your targets, do a monthly burn to DVD to keep a clean backup with the latest updates so you can always regress back to a non-damaged environment.

    Note: Game development, or graphic heavy development will most likely require real computers for the graphic processing speeds, these are for more business development needs.

    Good luck!

  • Creating Automated Builds

    One of the stresses of working in software development is getting the applications built on a regular basis.  Generally builds are done on a Sr. Developers workstation, then sent off to testing attached to the bug software, via email, or a link to a shared resource.

    Getting automated builds up an running is a tricky thing, and with some complex projects requires a lot of scripting and knowledge of the internal software as well as some licensing issues with the software.

    When requested to get "Automated Nightly Builds" working by the VP of Software Development in a recent meeting, I looked at our 10+ software products and just shuddered. Below is a list of software that we use.

    Microsoft Visual Studio 2003, 2005, and Visual Basic 6 for Code
    Seapine Surround Source Control Management (SCM)
    Seapine Test Track Pro for Bug Tracking
    Install Shield 12 for some of our software installation media
    WinRar for patch packaging
    MSBuild from the .Net 2.0 Framework for OneClick installation generation and Satellite Resource File Compilations

    As you can see, building integration between a lot of those products and kicking off event driven automated builds is going to be tricky.  Although I have recently downloaded and implemented Cruise Control .Net for remote builds of one of our products, putting together the rest are going to be tricky.

    Let me explain the game plan that I will be attempting, and I will blog my progress with the pitfalls of the system.

    Pulling from source control

    The hardest part of this is going to be getting the code out of source control, granted it is just a quick pull of the files into a directory, but managing which branch to work out of is the trickiest.  Surround SCM allows you to do multiple branches of source code and we have implemented an implementation that allows our Junior developers to work on sub-branches, while I, as the only Senior developer at the moment, work in the main branch of the code.  On a daily basis, or as needed, I review the code and promote it from the Junior level sub-branch, retrieve the code, then check for a stable build.  This is obviously a process that can not be automated.  So firstly, I am going to have to create two builds, one for the in-testing code, which would be from the sub-branch, and a second for release code, which is pulled from the main branch.

    Compiling the code

    With the third party tools that we are currently using, some unique licensing has to be in place in order to compile the applications.  Although using command line compilers and not running out of the IDE might be able to just imbed current licensing, I am pretty sure that the licensing scheme of some of our assemblies will prove to require additional licensing.  A good example of this is the activation based Red Gate tools that we are using.

    Building the applications

    We have three different scenarios with the products that we produce. The first being the easiest, is a completely self contained application, all of the source code is stand alone, and requires no other shared projects.  The second scenario are web sites, these are going to require that we only pull the releasable files, such as ascx, aspx, asax, and binaries for instance. And the third is the most difficult, this one is our framework based applications.  We have a shared framework based on the Composite UI Application Block from Microsoft so that we can accommodate modular based application design.  When we want to add a new product, we simply create a new set of modules that load into the application framework.  Then we can distribute them and only turn them on if the client has licensing for them.  This is also the way that we are trying to move all of our applications into, our "OneSource" for applications, which also happens to be the name of our framework.

    Creating the OneClick Installs

    With our newest framework applications, we are using the OneClick technology from Microsoft that is built into .Net 2.0.  This is an outstanding way to get updates out to our customers without calling or emailing them to update their software. The largest problem with OneClick installations though is that they are statically bound to an install location so if you configure the OneClick to install from http://www.domain.com then you have to have to deploy it FROM that location.  This extra step is going to require that we additionally setup multiple staging environments for the OneClick installations.  The first staging area will be our internal developer only install.  This is used primarily for internal review of the latest software by the VP, Analysts, as well as Technical writers.  Secondly, we will want to create a Beta, or Pre-Release tab, this will need to be publicly accessible and could potentially be given to customers, the CEO, Project Managers, and the Help Desk for training on new features, as well as approval and additional QA.  The final staging that will need to be built is the Release staging.  This will basically be the released version of the software for everyone to install and will be made available via a public domain.

    Building the Install Media

    This one is by far one of the trickiest ones.  Due to the fact that files could be added or removed from the installations, knowing what to add, as well as adding it to the installer in the correct place before compiling, is going to prove to be extremely tricky.  To be honest, this is the area that I am least knowledgeable about how to do, and will be doing a lot of research on it when I get there.

    Building the Patch Media

    This one is pretty easy, basically we take the build directories for the software, add it to an SFX via a huge command line to WinRar.exe and it creates a nice little patch for us.  I could probably take it one step further generating a CRC32 compare list and only adding changed files, but this is a nice way to "Magic Zip" update previous installations that might not be completely up to date.

    Notifications

    Of coarse this entire process needs to be logged and sent to the right people if something goes wrong. Luckily this is where Cruise Control .Net is going to come into play, as it will log the entire process (by redirecting the standard output when it calls all of the executables) and save them to XML in the working directories of the builds. Myself and the VP also run the Cruise Control client application in the Tray that displays the status of each build, last build time, and any additional messages.  When a build is finished, we get a little popup in the bottom right hand of the screen letting us know if it was successful or not.  Obviously this is ok for working hour builds, but I would prefer to have more information.  So I will be setting up SMS alerting and Email logs to the end of the build.

     

    Basically that's it... not much work, if you like this sort of thing, but unfortunately I still have to maintain the constant stream of new features, updates, and bug fixes to the current software.

    I will keep you up to date.

More Posts Next page »
Powered by Community Server, by Telligent Systems