Welcome to Sol 3 Sign in | Join | Help
CS Search | Live Search Search

Sol 3

Home of Barrows Software Solutions, LLC

Keith Barrows

Subjects range from Personal to Technical.

  • VS2008 & Win 7 x64 – Compatible?

    Can anyone reproduce this sequence of events?

    1. I added 6 lines of code to  of my data model view.
    2. I compile – no warnings, no errors, build successful.
    3. I run the app and the lines of code I added DO NOT EXECUTE!
      In fact, I am getting an error that my code is different than the last time I compiled.  Yet, I compiled when I hit F5 to run.  :(
    4. OK – remember that sometimes the temp cache can foul things up so delete the temp cache.
    5. Restart VS2008, load project, hit F5 and – what the hell?  It still will not execute those lines and I still get the temp dll does not match error.
    6. So, go flush everything again, reboot, reload, rerun and – what the hell?  It still will not execute those lines and I still get the temp dll does not match error.

    The definition of insanity is doing the same thing over and over again and expecting different results.

    Here are screen shots along the way:

    2009.03.29.VS2008.00

    2009.03.29.VS2008.01

    2009.03.29.VS2008.02

    UPDATE:
    I was running in Debug/x86 mode.  I changed it to Debug/Any CPU and what do you know – the above problem went away.   I can’t wait to get my laptop back from the shop so I can install Win 7 x86 and run this code in both environments to see if there are really differences…

  • VS2008 (MVC) & Win 7 x64 – Compatible?

    I am currently developing on a Win 7 (build 7000) x64 box using the newly released MVC addition for ASP.NET.  While the promise of MVC is great, the reality that this developer has been experiencing for the last 2 weeks is not at all what I expected.  For instance, trying to get my routes to behave.

    Code:
    Routes01

    Results:
     Routes02 

    Compare the data in the “Route Data” table to the “All Route” table (“Defaults” column). 

    Now, I run it without the route debugger and this is what I see when I step through this particular URL:
    Routes03

    Routes04

    Now, I change the route to http://localhost:1620/Catalog/nav I see this when I inspect the variables:
    Routes05

    The position element should be null.  It is not. 

    So let’s take this one step further.  Let’s navigate to http://localhost:1620/Catalog/LifeStyle and inspect the variables again:
    Routes07

    Now mind you, this is a running instance of VS2008 and I have the Locals window open to the right of my code window.  The inspector object on the left has different values than the Locals window!

    This is but 1 of many, many examples of what is acting in a very strange way on my machine.  It has brought my productivity down to nearly zero.

    Anyone else having “weird” problems running VS2008 (MVC) on Win 7 x64?


    28 Mar 2009 - Today is a new day and I just hit another weirdness in VS2008.
    VS2008-01

    I am playing with the various parts of a menu system, working at meeting client needs (and learning of course).  I am “handling” pagination in a more manual method for the moment.  The Red circled bits are what I see in the code while stepping through it.  The Blue circled code just plain does not run.  While stepping it passed over them and did not execute them.  :(

  • Late Notice – MVC has been released.

    newdotnetlogo_2_thumb_3 New machine, new OS, new this and new that I forgot to post a blip on the hottest release from Microsoft – MVC!  I’m not going to hammer on it so feel free to read the following:

    Note:  To get the latest information, including tutorials, sample code, design galleries, and discuss groups, check out the official site at http://www.asp.net/mvc.  You can download it right now here.  MSDN Documentation for MVC is also now available here.

  • Snow Day

    100_0319

    My wife and I were supposed to go to her Doctor’s appointment today.  After nearly 15 minutes of driving we had made it about a mile into a 30+ mile drive.  Time to turn around and try it another day.  Nasty, nasty day today.  White out conditions, 8-12 inches of snow already with more on the way.  Even here in Colorado where rural schools are rarely closed due to snow, the whole county is shut down. 

    Hot chocolate, a warm fire and a couch are beckoning.  But – I have a home office so it is back to work for me.  I’m working on an MVC project currently – what are you doing today?

  • MVC RC2 Released

    Microsoft’s ASP.NET team has been hard at work.  Phil Haack just blogged on the latest release of MVC – which is Release Candidate #2.  Make sure to read all of the requirements as they have changed a bit since RC1.  More later.

  • MVC, Master Page, Extension Methods and Controlling your menu items

    I am working on an application using MVC and discovered quite quickly that there is no documented way to control my main menu’s looks while it is in the master page.  After searching for an hour or more I knew there had to be a way to overcome this without resorting to adding a code-behind file.

    I found a couple of java-script solutions but wanted something more robust.  I queried out to several tech lists, including my favorite on http://aspadvice.com/lists and got some quick hits back.  I think my favorite was “extension methods are your friend. :)”.  Thanks Paul – I’ve never used Extension Methods.

    So, on to Extension Methods – which are wickedly cool!  MSDN says this about Extension Methods:

    Extension methods enable you to "add" methods to existing types without creating a new derived type, recompiling, or otherwise modifying the original type. Extension methods are a special kind of static method, but they are called as if they were instance methods on the extended type. For client code written in C# and Visual Basic, there is no apparent difference between calling an extension method and the methods that are actually defined in a type.

    So, after a couple of false starts and a few blog entries that were semi-complete I finally have my first Extension Method working!  It is not very clean yet so feel free to suggest ways to make this code block better:

    using System;
    using System.Web;

    namespace System.Web
    {
    public static class HtmlExtensions
    {
    public static string GetSelected(this HttpRequest Request, string id, string target)
    {
    if (target.ToUpper().IndexOf(Request.Url.ToString().ToUpper()) > 0)
    id += "active";

    return id;
    }
    }
    }

    To use this I am twiddling the ID attribute on my <LI> elements.  The CSS uses a PNG image with offsets (a sprite I believe it is called) and is looking for either the CSS tag of navA or navAactive.  So, in my code for my menu bar I now have this:

    div id="main_nav">
    <ul>
    <li id="<%= Request.GetSelected("navA", "") %>"><%= Html.ActionLink(" ", "Index", "Home")%></li>
    <li id="<%= Request.GetSelected("navB", "Product") %>"><%= Html.ActionLink(" ", "Index", "Product")%></li>
    </ul>
    </div>

    Now, depending on what URL is being passed through the Master Page the Extension Method will pull out the URL from the Request object (which is the object we are extending), check to see if the target is in the string. and if it is, append the active token to the id that was passed in.   Obviously this is a site specific Method Extension so I added it to a folder called libraries under my MVC app directory.  I also changed the namespace to System.Web so I don’t need to prefix it when I use it, nor do I have to add a reference for it in any page.

    Comments?

  • Starting a new gig...

    I am finally back to working with modern technologies - and for myself.  I am no longer an employee of a corporation!  I am so looking forward to being on the cutting edge again after a year of classic ASP and some .NET 2.0 Win Services.  I can't go into too many details on what the project(s) entail but it looks like I'll be diving deep into MVC and LINQ to get to point B.  Big Smile
  • Windows XP Pro x64

    I am biting the bullet now.  I have a desktop that is running an AMD Opteron (Dual Core) and have never run a 64 bit OS.  I have Win XP Pro x64 on my MSDN subscription so decided to repave this desktop and install it.  Several false starts later I finally have it up and running.  Getting the drivers to work was no where near the nightmare so many have said it was.  Nvidia had the x64 drivers for my geForce 6200 card and the other drivers I needed were on the motherboard's CD.  MY motherboard is an ASRock 939Dual-SATA2.  Then onto installing the software.  Because of certain add-ons I run in Outlook I opted for Outlook 2003.  VS2005 and VS2008 went on smoothly once I figured out how to properly mount ISOs in the 64 bit environment.

    I'll try to post out here as this experience progresses...


    Note #1:  I installed the .NET 1.1 Framework and got this message before installing it:

    Microsoft .NET Framework 1.1
    Microsoft


    Issue Description:

    This software has known incompatibility with IIS services on this platform. To maintain IIS functionality,

    we recommend that users complete the following steps after the software install is complete:

    1- From the Start menu select Run then press the Enter key

    2- In the "Open" edit field enter the following command:

    "cscript %SystemDrive%\inetpub\AdminScripts\adsutil.vbs set w3svc/AppPools/Enable32bitAppOnWin64 1"

    3- Press the Enter key


    Note #2 - Seems none of the Microsoft Live pieces will run on XP Pro x64.  According to the system requirements page:

    Operating system: Windows XP with Service Pack 2 (32-bit edition only), Windows Vista (32-bit or 64-bit editions), Windows 7 Beta (32-bit or 64-bit editions), or Windows Server 2008. Note: Windows Live Movie Maker is not supported on Windows XP

     

  • Missed my High School Reunion :(

    Wish I had thought to google for this.  Another classmate just left me a message on MySpace and the link to my HS Reunion site.  <sigh/>

    With all of this technology at hand it is still hard to know when periodic events like this happen.  How does everyone else stay abreast of events like this?
  • Loading XML with accented characters breaks System.XmlDocument.Load()

    It took me a bit of time but I finally found a solution for loading a XML file that has accented characters (like áéíóúâä) into a UTF-8 format.  I'm loading data for a client and it ended up having a name in it with an accented e character.  For the first time on this project System.XmlDocument.Load() was blowing up.  With a lot of Googling I finally found a link that gave me, what I hope, is the solution for this problem.  For now it is working so I'll go with it.  The link to the article I found is in the code sample below as well as the image to the left.  The magic happens by reading in while enforcing a double-byte encoding then saving out in an encoding that gives the visual representation we, in the US, would expect.

    Hope this helps someone else.


       1:  #region Fix Character Encodings
       2:  // Need to drop accented characters back to normal characters...
       3:  // reference:  http://www.codeproject.com/KB/cs/EncodingAccents.aspx //
       4:  StreamReader sr = new StreamReader(_pfInfo.WorkingFile, Encoding.GetEncoding("iso-8859-1"));
       5:  string fileContents = sr.ReadToEnd();
       6:  sr.Close();
       7:  sr = null;
       8:   
       9:  StreamWriter sw = new StreamWriter(_pfInfo.WorkingFile, false, Encoding.GetEncoding("iso-8859-8"));
      10:  sw.Write(fileContents);
      11:  sw.Flush();
      12:  sw.Close();
      13:  sw = null;
      14:  #endregion
    .csharpcode, .csharpcode pre { font-size: small; color: black; font-family: consolas, "Courier New", courier, monospace; background-color: #ffffff; /*white-space: pre;*/ } .csharpcode pre { margin: 0em; } .csharpcode .rem { color: #008000; } .csharpcode .kwrd { color: #0000ff; } .csharpcode .str { color: #006080; } .csharpcode .op { color: #0000c0; } .csharpcode .preproc { color: #cc6633; } .csharpcode .asp { background-color: #ffff00; } .csharpcode .html { color: #800000; } .csharpcode .attr { color: #ff0000; } .csharpcode .alt { background-color: #f4f4f4; width: 100%; margin: 0em; } .csharpcode .lnum { color: #606060; }
  • Managed Extensibility Framework (MEF) is on CodePlex

    The Managed Extensibility Framework (MEF) is a new library in .NET that enables greater reuse of applications and components. Using MEF, .NET applications can make the shift from being statically compiled to dynamically composed. If you are building extensible applications, extensible frameworks and application extensions, then MEF is for you.

    I've been doing a few projects with a plug-in architecture and am going to be playing with this to see how I can benefit from it. Hopefully, I'll post some stuff out here as well on this new journey.

  • SQL Not In Revisited

    I always seem to struggle with a NOT IN clause when there are more than one column to compare.  This, of course, comes up when I am trying to get records from one set that are NOT IN another set and the comparison has to be done across multiple columns.  For instance, if I want to compare table 1 (users) against table 2 (importedUsers) and I want to see if the mandatory fields are there and *NOT* work with those that fail I usually ended up doing a cursor.  But - there is a much easier way to do it and it does need a cursor!  Thanks to David Penton for pointing me in this direction!

    DECLARE @impUsers TABLE(empID VARCHAR(50), hireDate SMALLDATETIME, userNew BIT, userChange BIT, userTerm BIT)

    INSERT INTO @impEmpTbl
    ( [empID]
    , [hireDate]
    , [userNew]
    , [userChange]
    , [userTerm]
    )
    SELECT i.empID, i.hireDate, 0, 1, 0
      FROM [ImportUsers] i
    INNER JOIN Users u ON i.[empID] = u.[empID]
    WHERE NOT EXISTS (SELECT 1
                         FROM [Users] u2
                        WHERE u2.[empID]         = i.[empID]
                          AND u2.[lastName]      = i.[lastName]
                          AND u2.[firstName]     = i.[firstName]
                          AND t2.[countryInfo]   = i.[countryInfo]
                          AND t2.[emailAddress]  = i.[emailAddress]
                          AND t2.[region]        = i.[region])

    Sweet, simple and elegant.  The above query will produce a new record in the temp table for each record that has one or more changes across the 6 fields I am comparing in the NOT EXISTS clause.  What is happening inside the parenthesis is the elegant part.  The SQL Query Engine is comparing one row from the Import table to all rows in the Users (2) table.  If it finds a match then it returns 1 - which means it does exist.  This negates the overall WHERE clause and does not insert it into the temp table.  When doing this in a cursor it was taking 30-45 seconds.  As a T-SQL query it takes less than 3 seconds.  That's an order of magnitude faster!

  • SQL XML - TreeView

    I sometimes forget how to do an XML output formed in a tree when dealing with a single table parent/child relationship.  There is a great explanation on SQL Server Central on *how* to do this.  I am mainly capturing the link and the SQL I just generated to do this.  This query will drill down 12 levels at the most.  Just alter the case statement (pivot) to go deeper.

    ALTER PROC getOrgUnitTreeAsXml
    AS
    BEGIN
        ;WITH OrgUnit1
        AS
        (
            SELECT
                0 AS [Level],
                [OrgUnitId],
                [orgUnitParentID],
                [orgUnit],
                CAST( [orgUnitID] AS VARBINARY(MAX)) AS Sort
            FROM [orgUnit]
            WHERE [orgUnitParentID] IS NULL
            UNION ALL
            SELECT
                [Level] + 1,
                p.[OrgUnitId],
                p.[orgUnitParentID],
                p.[orgUnit],
                CAST( SORT + CAST(p.[orgUnitID] AS BINARY(4)) AS VARBINARY(MAX))
            FROM [orgUnit] p
            INNER JOIN OrgUnit1 c ON p.[orgUnitParentID] = c.[OrgUnitId]
        )
        ,  OrgUnit2 AS
        (
            SELECT
                [Level] + 1 AS Tag,
                [OrgUnitId],
                [orgUnitParentID],
                [orgUnit],
                sort
            FROM OrgUnit1
        )
        , OrgUnit3 AS
        (
            SELECT
                *,
                (SELECT Tag FROM OrgUnit2 r2 WHERE r2.[OrgUnitId] = r1.[orgUnitParentID]) AS ParentTag
            FROM OrgUnit2 r1
        )
        SELECT Tag, ParentTag as Parent,
        CASE WHEN tag = 1 THEN [OrgUnitId] ELSE NULL END AS 'OrgUnit!1!id',
            CASE WHEN tag = 1 THEN [orgUnit] ELSE NULL END AS 'OrgUnit!1!name',
        CASE WHEN tag = 2 THEN [OrgUnitId] ELSE NULL END AS 'OrgUnit!2!id',
            CASE WHEN tag = 2 THEN [orgUnit] ELSE NULL END AS 'OrgUnit!2!name',
        CASE WHEN tag = 3 THEN [OrgUnitId] ELSE NULL END AS 'OrgUnit!3!id',
            CASE WHEN tag = 3 THEN [orgUnit] ELSE NULL END AS 'OrgUnit!3!name',
        CASE WHEN tag = 4 THEN [OrgUnitId] ELSE NULL END AS 'OrgUnit!4!id',
            CASE WHEN tag = 4 THEN [orgUnit] ELSE NULL END AS 'OrgUnit!4!name',
        CASE WHEN tag = 5 THEN [OrgUnitId] ELSE NULL END AS 'OrgUnit!5!id',
            CASE WHEN tag = 5 THEN [orgUnit] ELSE NULL END AS 'OrgUnit!5!name',
        CASE WHEN tag = 6 THEN [OrgUnitId] ELSE NULL END AS 'OrgUnit!6!id',
            CASE WHEN tag = 6 THEN [orgUnit] ELSE NULL END AS 'OrgUnit!6!name',
        CASE WHEN tag = 7 THEN [OrgUnitId] ELSE NULL END AS 'OrgUnit!7!id',
            CASE WHEN tag = 7 THEN [orgUnit] ELSE NULL END AS 'OrgUnit!7!name',
        CASE WHEN tag = 8 THEN [OrgUnitId] ELSE NULL END AS 'OrgUnit!8!id',
            CASE WHEN tag = 8 THEN [orgUnit] ELSE NULL END AS 'OrgUnit!8!name',
        CASE WHEN tag = 9 THEN [OrgUnitId] ELSE NULL END AS 'OrgUnit!9!id',
            CASE WHEN tag = 9 THEN [orgUnit] ELSE NULL END AS 'OrgUnit!9!name',
        CASE WHEN tag = 10 THEN [OrgUnitId] ELSE NULL END AS 'OrgUnit!10!id',
            CASE WHEN tag = 10 THEN [orgUnit] ELSE NULL END AS 'OrgUnit!10!name',
        CASE WHEN tag = 11 THEN [OrgUnitId] ELSE NULL END AS 'OrgUnit!11!id',
            CASE WHEN tag = 11 THEN [orgUnit] ELSE NULL END AS 'OrgUnit!11!name',
        CASE WHEN tag = 12 THEN [OrgUnitId] ELSE NULL END AS 'OrgUnit!12!id',
            CASE WHEN tag = 12 THEN [orgUnit] ELSE NULL END AS 'OrgUnit!12!name'
        FROM OrgUnit3
        ORDER BY sort
        FOR XML EXPLICIT
    END
    GO

  • Microsoft's Velocity - Caching turned up a notch

    velocity

    Microsoft just released it's CTP-1 of a new caching product code named Velocity.  It is a distributed caching technology that should add extra velocity to your ASP.NET applications.

    Summary: “Velocity” is a distributed in-memory application cache platform for developing scalable, available, and high-performance applications. “Velocity” fuses memory across multiple computers to give a single unified cache view to applications. Applications can store any serializable CLR object without worrying about where the object gets stored. Scalability can be achieved by simply adding more computers on demand. “Velocity” also allows for copies of data to be stored across the cluster, thus protecting data against failures. “Velocity” can be configured to run as a service accessed over the network or can be run embedded with the distributed application. “Velocity” includes an ASP.NET session provider object that enables ASP.NET session objects to be stored in the distributed cache without having to write to databases. This increases the performance and scalability of ASP.NET applications (17 printed pages)

    Some more resources:

  • VS 2008 and .NET FX 3.5 SP1 (Beta)

    The beta has been released.  Scott Guthrie has a huge list of what to expect.

    (The image should link you directly to the download page.)

     
More Posts Next page »

This Blog

Syndication

News

Disclaimer
About me

Locations of visitors to this page
weblogs.asp.net/kbarrows
BlogMailr Enabled <script type='text/javascript' src='http://track3.mybloglog.com/js/jsserv.php?mblID=2008010310421330'&gt;&lt;/script> <script type="text/javascript" src="http://pub.mybloglog.com/comm2.php?mblID=2008010310421330&amp;c_width=180&amp;c_sn_opt=y&amp;c_rows=5&amp;c_img_size=f&amp;c_heading_text=Recent+Readers&amp;c_color_heading_bg=005A94&amp;c_color_heading=ffffff&amp;c_color_link_bg=E3E3E3&amp;c_color_link=005A94&amp;c_color_bottom_bg=005A94"></script>
CS Build: 2.1.61129.2
1999
Listed on the CS Listings Powered By Community Server Themed by nb development