Archives

Archives / 2007
  • A Better way to Query RSS

    Recently Scott Guthrie posted a really good article on querying an RSS feed with LINQ to XML.  After an initial run through of the article, I felt like something was missing.  A good buddy of mine (Dave Yancey), were working on an RSS control and we didn't like having to query the RSS twice.  Not to mention we really wanted the Title, description and link of the parent RSS - not just each of the items.  our initial query looked something like this:

  • Converting Sql.LINQ.Binary to Byte()

    Just a real short entry today.  I had some trouble with this one - took me a little bit to figure out so I figured I would post a quick note about it.  Mostly to remind myself how I did it next time I need to. 

  • DLINQ + Solving the Many to Many problem

    A while back, Scott Guthrie posted in the comments, that LINQ didn't support, or had trouble with Many to Many relationships.  I'm not sure if the code-base has changed, or I haven't considered a full scope, but I've managed to get it to work, and it's slick!  I'll jump straight to the magic here. 

  • Thoughts from the flip side

    I'm a little bit off topic this evening, but after all, it's thanksgiving weekend, I think I'm still burping turkey on Sunday night, and I guarantee I'll wage a war worthy of a movie called 400 trying to put my pants on tomorrow morning for work.  Just no give in dress slacks, did polyester stretch?  I just finished watching 60 minutes, first I'd like to say:  I felt the High Tech - Heist article was grossly misrepresented.  Why is it, that you can take any highly intelligent reporter, ask them to talk about technology, and they turn into blithering idiots.  If I had to listen to her say "The WPA Code" one more time, I was going to trip my TV off it's stand and launch it. 

  • Conference Internet is not an option!

    This subject is sure to spawn hate mail abound.  I'm sure that there's an entire camp that will tell me that I'm at a conference or convention, for the conventions subject material - and to get the most out of it, I should leave work, family, friends, interests...<put your item here> behind.  You see, I already know what you're going to say, so save it.   I'm attending DevConnections - In Las Vegas.  With the MVP Discount I believe it cost me somewhere around 1100 dollars to be here and attend sessions.  Another 500+ for my hotel room for a week, meals, plane tickets, not to mention a week of work that continues to go on back at the office. 

  • Leaving...on a jet plane

    A little John Denver anyone?  I'm sitting here in the Denver Airport thinking that thus far, my luck has been really good.  No weather issues, no flight problems -  Even a situation that would normally spell disaster for the wayward traveler was victoriously avoided somehow.  

  • Important Information regarding Visual Studios 2008 Beta 2

    We know many of you have been testing the Visual Studio 2008 Beta 2 VPC images, http://msdn.microsoft.com/en-us/vstudio/default.aspx.  It has been brought to our attention that the current Visual Studio 2008 Beta 2 VPC images will expire on November 1, 2007, rather than March 15, 2008 as originally announced.  It is strongly encouraged that you take all necessary steps before November 1, 2007 to back up all your projects and move your Team Foundation Server data to an alternate location.  For instructions on moving your TFS data please refer to the article Moving Team Foundation Server, http://msdn.microsoft.com/en-us/library/ms404879(vs.90).aspx, located on the MSDN Library.

  • HDC07 - A big success!

    What a great time to be had a development conferences.  Putting that many smart people in one room should be illegal honestly.  Two solid days of .NET energy (and one adobe flex talk, ...<blink>) - Culminated with a 4 hour presentation by Scott Guthrie on the new Visual Studios 2008 / .NET 3.0 and 3.5 features. 

  • Ajax Service Methods: Returning Strong types or lists.

    In all the examples we've seen so far, we've returned simple strings, integers, or a standard type / value.  That's all fine and good, until we have something a little more complex to return, or need to return a list or array of something, or a list of type.  In the following example I'll demonstrate through code how to accomplish just that.

  • Windows Server 2008 (longhorn) Review

    Ok, so I finally bit the bullet and scheduled some time to sit down and take a look at Microsoft's up and coming server platform currently code-named Longhorn.  I almost exclusively use Virtual PC 2007 for this type of testing, and this was no exception.  The OS gave me no issues installing in this environment and greeted me after a few reboots with a healthy logon screen that is similar but somewhat less decorated than the Windows Vista logon screen.

  • Creating an Efficient UI in ASP.NET. Part 2

    In the first installment of this series, we discussed the reasons for creating a clean and efficient UI, and some of the methods behind it.  If you haven't read the first part I suggest you do so here.  In this article we are going to go over some of the basics in getting setup to provide a streamlined user interface in a business sector.  Examples of use would be an intranet application, a Contact management solution, or some similar file / information store.  We'll discuss the pro's and con's of a few model types and ultimately choose a method and start our design.  The goal at the end of this article is to provide an interface "shell" that can be reused across different application types.  This shell should be similar to a template, but more extensible. 

  • Creating an Efficient UI in ASP.NET. Part 1

    I've tried to be as thorough as possible in this series of articles,  this articles assume above beginner knowledge of CSS, ASP.NET controls, and AJAX Control Toolkit items.  The series is scheduled for 5 parts and at the end of the series I will provide a link to an example project that incorporates and demonstrates the items we'll talk about throughout the series. 

  • CRINETA - Thanks again!

    I just wanted to take a moment to thank the Cedar Rapids branch of the INETA user group for the warm welcome.  I enjoyed speaking to the group tonight, and I hope some useful information was had by all.

    I'm in the process as we speak of converting the video I took to a web format, and I'll make it available as soon as I can get it converted to something web friendly.

    I look forward to further meetings. 

    To those that had extended questions - I'll get emails out to you, as soon as I can work up some good examples. 

    To clarify a few points:

    At one point during the presentation I mentioned that PHP was not a high performance platform.  I should stand corrected (with a little help).  What I should have said was - any I could write under PHP wouldn't be high performance by any means. 

    One of the most significant questions of the evening was:

    'What do you see are the downsides to using Ajax' (non verbatim). 

    Anyone that has comments about that topic - feel free to post.

    Thanks again,

    Bryan Sampica

    Microsoft MVP

  • About Shadows! Ajax Control Toolkit DropshadowExtender

    I've always wished that the Ajax control could create a "fuzzy" shadow.  don't get me wrong, I think it's GREAT that it's included in the toolkit as is, but it's a little lacking.  In a previous blog entry I had shown a small hack using recursive extenders to create a fuzzy effect.  Here's a simplified result:

  • Fixed Width Blog :(

    Filed Under:

    Ok, I've started migrating content over from my personal blog to this one - and I'm seeing an issue...it's cutting my code off on the right hand side.  I'm not quite sure why this is happening but I'm guessing it's the <pre> tag I use to encapsulate code.

    I'll get it worked out in the next few days, so that future code is not cut off.

    As a temporary solution you can copy and paste the code from the code blocks directly into your environment, or into notepad or something similar, and it does get it all.

     

    Bryan Sampica ( Freakyuno )

  • Extending Service Methods: Part 3

    Returning single bits of data is nice, as seen in the previous examples.  Doing it async is even better - but what we really want to do is make this useful for business, and in business we use objects.  In this example I'll demonstrate how to use serialization methods, to return an object (serialized to an array) to our calling JavaScript proxy - and then bind that to area's of our page.  The goal of course being to do something useful in a business application, giving the user a nice Ajaxian style experience, and gathering / displaying the information we need at the appropriate time.

  • Ajax Update Progress: Modified

    Depending on your design, it may or may not work to have your atlas progress rendering inline with your other content.  This is actually kind of a pain.  My situation included a gridview being rendered that may require the user to scroll, clicking a paging link at the bottom.   Clicking this link triggers the update progress template at the TOP of the page - But does almost nothing to inform the user who has now scrolled down and doesn't see it.

    We need a way to inform the user that an Ajax panel is getting data from the server, and is actually doing anything.  Surprisingly enough, the "page flash" that we all hated in a standard browser application, did serve as instant user feedback - where as Ajax update panes leave the web page drooling and blinking at the user.  In some cases they may not even be aware that data has changed or updated. 

    Solution:

    Enter JavaScript - yea I know what you're saying.  Your application is managed, and you don't want to clutter it up with JavaScript.  Believe me, you are preaching to the choir here, but it's pretty painless. 

    Concept:  We are going to declare a DIV inside the progress template.  We are then going to set the div inside the panel to a CSS class that positions it absolutely.  Then with a little JavaScript we are going to keep it on the mouse cursor, so that when it appears - it's in a position that will give feedback to the user. 

    Ok - so lets get started eh?

    For this example, I'm going to return a DateTime string, and set it to the label in my page.  I'm going to do this in some code that forces a delay so we can see the update Progress template work. 

    Go ahead and get your page setup like this to get us started. 

    You can get some free Ajax Update type animated GIFS from this site. I went ahead and grabbed the Roller.gif for this example.

    http://mentalized.net/activity-indicators/

    <div>    
        <asp:ScriptManager ID="ScriptManager1" runat="server" />    
        <asp:UpdateProgress ID="UpdateProgress1" runat="server">        
            <ProgressTemplate>            
                <div id="updateDiv" style="position: absolute">                
                    <img src="roller.gif" />            
                </div>        
            </ProgressTemplate>    
        </asp:UpdateProgress>    
        <asp:UpdatePanel ID="UpdatePanel1" runat="server">        
            <ContentTemplate>            
                <asp:Label ID="lblDateTime" runat="server" Text="" /><br />            
                <asp:Button ID="btnUpdate" runat="server" Text="Update" />        
            </ContentTemplate>    
        </asp:UpdatePanel>
    </div>
     
    Protected Sub btnUpdate_Click(ByVal sender As Object, ByVal e As EventArgs) Handles btnUpdate.Click    
        'THREAD SLEEP should never be used in production applications    
        System.Threading.Thread.Sleep(4000)    
        lblDateTime.Text = System.DateTime.Now
    End Sub
    

    Again, nothing special here.  We simply created a button click event that updates our labels value.  The progress template we setup will kick in as soon as that thread sleep starts ticking.

    Go ahead and test your project at this point.  Not very useful to say the least if your page scrolls at all.  Enter JavaScript (our superhero).

    JavaScript:

    Ok, I wont overly explain this JavaScript.  Usually my requirement is not to understand it, just that it works.  This goes between the Head tags of your page.

    <script type="text/javascript" language="javascript">       
    
    var IE = document.all?true:false      
     // If NS -- that is, !IE -- then set up for mouse capture       
    if (!IE) document.captureEvents(Event.MOUSEMOVE)       
    // Set-up to use getMouseXY function onMouseMove       
    document.onmousemove = getMouseXY;       
    // Temporary variables to hold mouse x-y pos.s       
    var tempX = 0       
    var tempY = 0       
    // Main function to retrieve mouse x-y pos.s       
    function getMouseXY(e) {           
    if (IE) { 
    // grab the x-y pos.s if browser is IE               
    tempX = event.clientX + document.body.scrollLeft              
    tempY = event.clientY + document.body.scrollTop           
    } 
    else 
    {  
    // grab the x-y pos.s if browser is NS               
    tempX = e.pageX              
     tempY = e.pageY      
     }   
    // catch possible negative values in NS4 
    if (tempX < 0){tempX = 0} if (tempY < 0){tempY = 0}   
    // show the position values in the form named Show 
    // in the text fields named MouseX and MouseY 
    var divToMove = document.getElementById("updateDiv") 
    divToMove.style.left = tempX 
    divToMove.style.top = tempY return true  
     
    </script>
    

    And Wa-lah!  Go ahead and render your page and click the button.  You're progress now stays on your mouse, and gives the user instant feedback that something is going on.  In a follow-up we'll examine two different methods of accomplishing this, that also could be useful. 

    Happy Coding.

    Bryan Sampica - ASP.NET MVP.

  • Progress Indicator when using Ajax Service Methods

    I have to say, that sometimes I really feel the infancy of the Ajax controls.  I love them, don't get me wrong, but some of this stuff seems like it should have been thought of.  Needless to say, recently I found myself needing to use Service Methods for a project, and on several occasions when data was being pumped in from my webservice to my proxy I was left thinking - what's it doing?  The solution of course was easy, since Service Methods run on a JavaScript backbone already there wasn't much work to do at all.  On to the code!

  • First a thanks!

    I'd like to thank Joe S, and the ASP.NET team for taking their time to setup this blog for me.  I intend to put it to good use.  Over the next few days I'll be migrating content from my previous blog located at http://bryan.proessent.com to here.  Both should remain active though.