Archive for the ‘General’ category

Wonderful Wednesday

November 25th, 2009

Working hard… sorta of – it’s the day before Thanksgiving and many people aren’t working today – makes for a long weekend for many.

Well, I’m still working, so thought I’d post some updates from the week since my last ‘Saturday Splash’.

Couple of items this week of interest:

Saturday Night Live : ‘China Cold Open’

http://www.hulu.com/watch/110317/saturday-night-live-china-cold-open

Telerik ASP.NET MVC Controls

Telerik has some free open source mvc controls available: http://demos.telerik.com/aspnet-mvc/

  • Pure ASP.NET MVC components

    Built on top of ASP.NET MVC to leverage its values – lightweight rendering, clean HTML, separation of concerns, and testability.

  • Completely Open Source

    The Extensions are licensed under the widely adopted GPLv2. A commercial license with support is also available.

  • Exceptional Performance

    No postbacks, no ViewState, and no page lifecycle. The Web Asset Managers optimize the delivery of CSS and JavaScript, so no precious HTTP requests are wasted.

  • Based on jQuery

    Telerik Extensions draw on the power of jQuery for visual effects and DOM manipulations.

  • Search Engine Optimized

    The Extensions render clean, semantic HTML, which is essential for indexing your content in the major search engines.

  • Cross-browser support

    Telerik Extensions for ASP.NET MVC support all major browsers – Internet Explorer, Firefox, Safari, Opera and Google Chrome.

  • One of the biggest concerns for those hooked (more like stuck – lol) on webforms is ‘but what about my controls’?’.  Sad but true, however, with asp.net mvc it’s much easier to create controls.  Combine those with a powerful javascript library like jQuery and it can be magic.

    Take for instance the Telerik grid (by the way, you can get a similiar grid from MVCContrib, which I use, which this code is nearly the same… hmm… wonder if the same guy made them for Telerik – lol):

    <%= Html.Telerik().Grid<Order>(Model)
            .Name("Grid")
            .Columns(columns =>
            {
                columns.Add(o => o.OrderID).Width(100);
                columns.Add(o => o.Customer.ContactName).Width(200);
                columns.Add(o => o.ShipAddress);
                columns.Add(o => o.OrderDate).Format("{0:MM/dd/yyyy}").Width(120);
            })
            .ServerBinding(serverBinding => serverBinding.Action("FirstLook", "Grid", new { ajax = ViewData["ajax"] }))
            .Ajax(ajax => ajax.Enabled((bool)ViewData["ajax"]).Action("_FirstLook", "Grid"))
            .Scrollable(scrolling => scrolling.Enabled((bool)ViewData["scrolling"]))
            .Sortable(sorting => sorting.Enabled((bool)ViewData["sorting"]))
            .Pageable(paging => paging.Enabled((bool)ViewData["paging"]))
            .Filterable(filtering => filtering.Enabled((bool)ViewData["filtering"]))
    %>
    
    

    Simple to use, and very powerful… and free. Check out the link above to view the other available controls.

    Update: http://blogs.telerik.com/AtanasKorchev/Posts/08-11-06/ASP_NET_Ajax_Controls_in_ASP_NET_MVC.aspx

    From that link above:

    …I am glad to inform you that RadScriptManager provides support forASP.NET MVC view and master pages. What this means is that RadControls for ASP.NET Ajax can be used in ASP.NET MVC…

    
    

    (Learn more from Atanas Korchev’s blog here – he has some good posts surrounding asp.net mvc with Telerik)

    
    

    RIA Services: A DomainService IS A WCF Service – Add Service Reference

    Brad Abrams has a good post on showing how a RIA.NET Domain Service IS a WCF Service:

    http://blogs.msdn.com/brada/archive/2009/11/22/ria-services-a-domainservice-is-a-wcf-service-add-service-reference.aspx

    This is a recent change in RIA.NET – and I should add, several other services like ADO.NET Data Services – where they are using WCF ‘under the covers’ as their communication protocol.  I think this is a good move – it provides a very standard way to communicate across the wire regardless of which flavor you choose.

    Using JsonP with WCF and jQuery

    Ben Dewey has an excellent blog post on how to use JsonP with WCF and jQuery in the new release of .NET 4.0.  As he explains, the WCF team has added support for JsonP.  Since jQuery ships with a getJSON ajax function, it makes this a piece o’ pie  :)

    ASPNET MVC from Basic to Tips and Tricks

    Michael Johson has a good writeup on tips and tricks with asp.net mvc.  I think he is spot on in all his recommendations.  Much of what he write about is best practices with asp.net mvc.

    As more and more asp.net developers see the light of mvc, we’ll need more posts like this to keep them writing good mvc code  :)

    Refactor or Rewrite

    Another good infoq article – this one on ‘refactor or rewrite’.   I’ve had this same conversation several times in my career – as I’ve seen projects really expand and bolt more and more functionality, which ends up changing the overall scope of the application – making it harder to maintain and understand.  Obviously many companies are scared to rewrite an app from scratch.

    Other

    Google: Last but not least, I’ve really enjoyed my switch to using google products.  I switched my email address over to gmail, I’m using google reader, google docs, etc…  and finally I’m using Google Chrome in full force now.  I miss two items from Firefox that I’m looking for replacements… (1) Firebug –which is the greatest and best web dev tool ever… and (2) FireFTP.  For now, I just pop open Firefox when I need it.  I think Chrome is more stable, uses less memory, and is faster.

    I deployed a test of the Google chrome on a web project.  This enable me to keep chrome as the website engine, and allow the client to use IE still as the main browser.  Certain pages, like reporting services, just use vanilla IE to print reports, etc..

    Lastly, I had a good talk with a member of the Microsoft Patterns and Practices team last week.  I had been critical in a blog post about their releases, etc…  As always, talking directly to someone helps tremendously.  We were able to voice our concerns (I invited a few coworkers) and where we think they could do better.  It was well taken.  That team is very customer focused, and they want and value community feedback.  This helped change some of my views.   One area I want to get more involved with is growing their web client guidance – expanding it to asp.net mvc – and their Prism for Silverlight.  Just wanted to express that the P&P team is hard at work and I was able to get more clarification on the role they play at Microsoft.  As fyi – they are an extension I believe of the product teams, and yet rather than just one product, they have several under their belt – that keeps them quite busy  :)

    That is all for this week – I hope everyone has a Happy Thanksgiving.  This is my favorite holiday – family and good food, time to be thankful for all we have.  The Lord has been good to my family and myself.  Just pray for all those that don’t have a family to be with and for those less fortunate.  I also pray for those out of work to be able to find some work.  This economy has been very hard on our community.  God Bless!

    PropertyChangedEvent using Static Reflection (Expression)

    February 15th, 2009

    Feel free to correct me if this is a bad way of going about using static reflection… but I had a change to remove a ‘magic string’ and figured I’d use static reflection as a way around it.

    I was working on a Silverlight sample of Two-way binding and re-reading some of John Papa’s Data-Driven Services with Silverlight 2 book where he is showing that in order to use two-way binding, you must implement the INotifyPropertyChanged interface.

    In his book he shows a way to wrap up the duplicating code into a base class, ie:

    image

    To use this, the following must be done to the entity:

    image

    The problem I had with this is the ‘PropertyChangedHandler’ taking in a string that is to be the property name.

    I’m sure there is a better way to handle this, but I decided to use some static reflection to hand it the property name:

    image

    Now, I can use this to replace the above “magic string”:

    image

    IE 8 – Emulate IE 7

    October 8th, 2008

    This is a good one – as I’m sure many, including my own applications, aren’t quite ready for IE 8.   The nice part of this is it’s possible to tell IE 8 to emulate with IE 7. 

    A good post on this can be found here:

    http://blogs.msdn.com/ie/archive/2008/06/10/introducing-ie-emulateie7.aspx

    There are two ways to implement this tag:

    On a per-site basis, add a custom HTTP header : X-UA-Compatible: IE=EmulateIE7

    On a per-page basis, add a special HTML tag to each document, right after the <head> tag :

    <meta http-equiv=”X-UA-Compatible” content=”IE=EmulateIE7″ />

     

    I was able to use the per-page on some pages, which forces the IE Emulate.  Then later, I can go back and find out what craziness is going on and remove the tag.

    This is much better than trying to add yet another browser check in javascript as far as I’m concerned!

    Json.NET 3.0

    August 25th, 2008

    Has been released!  I’m a big fan of this library, it’s one of those ‘it just works’ projects  :)

    Of greatly added benefit is that he has now added support for Silverlight.

    Awhile back when I was playing with Silverlight, I was working with Json serialization, and the support within Silverlight didn’t work, but this library would.

    Thanks again to James Newton-King for this release!

    Key features:

    • Silverlight Support
    • LINQ to JSON even easier to use
    • Serializer Improvements

    Document Map Margin

    August 21st, 2008

    So I saw this in my VS studio ‘news’:

    http://blogs.msdn.com/charlie/archive/2008/08/15/future-focus-document-map-margin.aspx

    Now, I had to laugh, as I hadn’t read the actually post yet, but the synopsis is:

    Developers frequently work with huge source files that are difficult to navigate. The proposed DMM feature is designed to make it easier for you to find and track important features in your code and to visualize the overall structure of your file.

    So… my first thought was: why don’t they refactor it so you don’t have ‘huge source files’  :)  

    The real problem in my opinion is that rather than add a ‘document map’, how about we add better refactoring tools to help developers learn to get rid of these ‘code smells’ ?

    ie. Resharper is good – but cost an arm and a leg as far as I’m concerned – meanwhile, the VS refactoring tools are kind of crappy – sure, it’s better than nothing, but they don’t even come close to what Resharper or Eclipse has.

    Address the real issue  :)

    Some String Formatting Examples with C#

    August 20th, 2008

    First, check out this good blog post:

    http://blog.stevex.net/index.php/string-formatting-in-csharp/

    So, my example was that a flat file I’m parsing contains the social security number, but with no “-” dashes. 

    ie. 111223333

    (note this is a string in the flat file).

     

    string ssn = String.Format("{0:###-##-####}", Int32.Parse(swipe.MemberID));
                    

    The format is expecting a number, so I convert the “111223333″ into number, then feed it into the String.Format.  Works like a charm…

     

    EDIT: Bug fix alert! Although the above does work – it does not take into account of leading zero’s!  The fix is:

    string ssn = String.Format("{0:000-00-0000}", Int32.Parse(swipe.MemberID));
     
    This will preserve any leading zeros

     

    Here is another fun one, I have a date in CCYYMMDD  (yyyyMMdd)

    DateTime serviceDate = DateTime.ParseExact(swipe.TransactionDate,
     "yyyyMMdd", new CultureInfo("en-US"));
    

    Last little gem:

    taking a int of 0 or 1 and making it ‘yes’ or ‘no’ :

    String.Format(”{0:yes;;no}”, value)

    => yes if value == 1
    => no if value == 0

    That is handy  :)

     

    John Sheehan has a nice ‘cheat sheet’ section of his website: .NET Format String Quick Reference

    Service Pack 1 for .NET 3.5 and Visual Studio 2008

    August 11th, 2008

    MSDN Link for Download

    Jonathon Allen mentions some of the updates included:

     

    “While called a “service pack”, the sheer number of new features makes this release as significant as .NET 3.0. These include the controversial ADO.NET Entity Framework and the much demanded improvements to C#’s real-time syntax checker.

    Other features include:

    ASP.NET Dynamic Data: This wizard auto-generates database-backed web sites without the need for any hand-written code. From there developers can use it as-is or customize it as if it were any other ASP.NET based project.

    ADO.NET Data Services: This framework makes it easier for developers to create REST-style interfaces for querying and update data. A key advantage over Web Services is that is has a URL-based query language is built directly into the framework, eliminating the need to invent a new one for each application.

    .NET Client Framework: This drastically smaller version of the .NET Framework contains only the APIs that client applications tend to use. Tools built into Visual Studio will determine if your application is a candidate for the version. This feature is most suited to ClickOnce style deployments where the user is expected to download the framework over the Internet.

    There are also numerous enhancements to the IDE in areas such as Website deployment, JavaScript/AJAX coding, and WPF form design.

    This release also includes .NET 2.0 SP2 and .NET 3.0 SP2, which means regression testing is in order.”

    Edit:

    Also available : With the release of SP1 for Visual Studio 2008 today, the Silverlight team has also updated their tools for Silverlight 2 Beta 2

    Learn more here

    Ankhsvn 2.0

    July 18th, 2008

    I’m installing Ankhsvn 2.0 today – I had tried earlier versions but the new one looks good.  Here are some screenshots.

    Check out the 2.0 final release comments to learn more of the changes, features, etc…

    Ruby and Visual Studio – Sapphire Steel

    April 25th, 2008

    http://www.sapphiresteel.com/-Blog-

    This might be the occasion to really jump in and try Ruby.  Sapphire Steel has Ruby integration with Visual Studio, including drag and drop UI for building forms, etc…

     

    Update:  I didn’t realize this wasn’t opensource.  I will pass on it for now.  If anyone has a good recommendation for a ruby ide let me know

    Posting comments and WordPress Themes

    April 10th, 2008

    I’ve switched back to more of an original wordpress theme, it appears the one I was using has problems with comments.

    I know the problem with the default is that the text runs off to the right, so I’ll have to investigate that next.

    So, you might see the themes change as I experiment with WordPress  :)

    Thanks