Some stuff about Web and .NET development
RSS icon Email icon Home icon
  • [FR] Site Web : People & Business Development

    Posted on May 18th, 2010 Thibaut 3 comments

    Mon nouveau projet, réalisé en tant que freelance et en collaboration avec le graphiste Quentin Flamant, est le site web pour la société People & Business Development. L’objectif principal est d’assurer une présence en ligne de cette dernière, y compris dans les réseaux sociaux (tels que Twitter, Facebook et LinkedIn), afin de présenter son activité et ses services. Le surf sur mobile étant une tendance en vogue, une version optimisée pour l’iPhone et l’iPod touch a également été développée.

    Présentation de la société

    Actif depuis une dizaine d’années, People & Business Development est un bureau spécialisé en coaching, en formation et en conseil pour optimiser le potentiel humain des organisations et, en conséquence, le chiffre d’affaires. Leur liste de clients comporte des noms tels que Alstom, la Commission Européenne, Delta Lloyd Life, Securitas ou encore Gefco.

    Le site web

    Le site a été développé en ASP.NET et utilise jQuery comme librairie javascript ainsi que jQuery UI pour les composants graphiques. Des propriétés CSS 3 ont été utilisées pour embellir le site dans les navigateurs modernes sans affecter le rendu dans les navigateurs plus anciens via le mécanisme de dégradation gracieuse. En ce qui concerne le respect des standards du Web, chaque page du site passe la validation W3C XHTML 1.0 Strict.

    People & Business Development

    La version iPhone et iPod touch

    Ci-dessous, des captures d’écran de la version dédiée à l’iPhone et l’iPod touch. On notera notamment la détection de l’orientation permettant une lecture plus aisée de longs paragraphes de texte ainsi que l’intégration au menu de l’iPhone et l’iPod touch, permettant un accès direct au site web.

    Cliquez pour agrandir

    People & Business Development iPhone

    Cliquez pour agrandir

    Conclusion

    L’objectif de ce post, outre l’aspect publicitaire, est de présenter une application concrète de bon nombre de mes précédents posts, incluant :

    Bonne visite !

    Share/Save/Bookmark

  • W3C : Validate green in XHTML strict with ASP.NET

    Posted on March 2nd, 2010 Thibaut 4 comments

    ASP.NET is a fantastic technology for website development. It’s being used by major companies and it has already proven itself over the years. However, I recently encountered some strangy things. If you ever wondered “is it possible to develop a XHTML strict website in ASP.NET ?”, then my answer is : “yes it is, but not that straightforward”. Let’s discuss about that :

     

    1. ASP.NET pages should have the strict DTD by default

    ASP.NET pages have the transitional DTD defined. They should have been strict, in my opinion.

    • Transitional is for projects using legacy code and allows you to write code the bad way. It was useful during the transition phase from HTML to XHTML but it’s over for a good time now
    • Standards compliant websites have usually lighter markup, thus faster to display and easier to maintain due to separation of concerns
    • It’s about to become illegal, in some cases, to develop websites which are not standard compliant. It’s already illegal for an organization to discriminate against disabled people and it’s pretty easy to argue that inaccessible Web sites are discriminatory – that’s what happened in the Sydney 2000 case
    • A lot of other things but it ain’t the point of this article

    Fix this and get strict

    When you create a new ASP.NET page (web form, master page, …), Visual Studio uses template files. You can change these ones to specify a strict DTD by default. They’re located in C:\Program Files\Microsoft Visual Studio\Web\WebNewFileItems\CSharp.

    Here’s what the section above the <head> tag of a WebForm template should look like :

    <%@ Page Language="C#" %><?xml version="1.0" encoding="UTF-8"?>

    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">

     

    <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="fr" lang="fr">

    • Notice that the <xml version=”…” > tag is placed next to the Page directive. If it’s placed below, the XHTML output code will start with a blank line and as the W3C validator expects it to be on the first line, you’ll get an error :  Unable to Determine Parse Mode!
    • Don’t forget to adapt the lang attribute of the <html> tag. It’s set to french in the example
    • I recommend you to modify the MasterPage template as well to get rid of the transitional doctype definitely

     

    2. Configure the ASP.NET engine to generate XHTML strict markup

    By default, ASP.NET generates markup which does not conform to XHTML strict. One of the most obvious examples is the <form> tag. It’s written like this in the .aspx :

    <form id="form1" runat="server">

    And is rendered like this :

    <form name="aspnetForm" method="post" action="accueil.aspx" id="aspnetForm">

    Try validating this (XHTML strict of course) and you’ll get :

    Pretty annoying ! Hopefully there’s an easy way to fix this. In the web.config file, specify the xhtmlConformance setting :

    <system.web>

      <xhtmlConformance mode="Strict" />

    And you’ll no longer see the name attribute in the <form> tag anymore if you look in the source code with your browser. Try validating again, and you’ll get :

    What the hell !? will you say… Here’s the explanation :

    The W3C validator uses a custom browser which is not recognized by ASP.NET. Thus, it will downgrade the rendering process (legacy mode), generating again the same invalid code. And as the DOCTYPE is not changed and remains to strict, you’ll get that same error again. The solution proposed by Microsoft is to create a browser definition for the W3C validator in the App_Browsers folder of your Web project. Put the lines below in a w3cvalidator.browser file and you’re done with this.

    <browsers>

      <browser id="w3cValidator" parentID="default">

        <identification>

          <userAgent match="^W3C_Validator" />

        </identification>

        <capture>

          <userAgent match="^W3C_Validator/(?’version’(?’major’\d+)(?’minor’\.\d+)\w*).*" />

        </capture>

        <capabilities>

          <capability name="browser" value="w3cValidator" />

          <capability name="majorversion" value="${major}" />

          <capability name="minorversion" value="${minor}" />

          <capability name="version" value="${version}" />

          <capability name="w3cdomversion" value="1.0" />

          <capability name="xml" value="true" />

          <capability name="tagWriter" value="System.Web.UI.HtmlTextWriter" />

        </capabilities>

      </browser>

    </browsers>

     

    3. Learn to deal with ampersands

    In the text of your website, you’ll most probably use ampersands sometimes (&). You know that you shouldn’t type them as is, but rather as &amp;. Easy to do in regular files, but can cause problems sometimes. I recently encountered a “special” case when using master pages : the title is written in the title attribute of the @Page directive…

    <%@ Page Title="Title with an ampersand &amp;"

    …and ASP.NET automatically converts the &amp; to & in the <title> tag of the generated output ! And here’s the result :

    You could use &amp;amp; in this case to overcome the problem. But you’ll agree that it’s not convenient at all and error-prone. Maybe there is a “official” solution to this problem, but here’s my humble trick anyway :

    In the Page_Load event of the MasterPage, encode the content of the <title> tag.

    protected void Page_Load(object sender, EventArgs e)

    {

        this.Page.Title = Server.HtmlEncode(this.Page.Title);

    }

     

    4. Go green

    This is where the article ends. This is a vast subject and if you want to go deeper in this, check out the following MSDN article : Building ASP.NET 2.0 Web Sites Using Web Standards. But for now, with the stuff we’ve just discussed here, this should be enough for you to get :

    See you ;)

    Share/Save/Bookmark

  • In bulk #4

    Posted on September 9th, 2009 Thibaut No comments

    Share/Save/Bookmark

  • Custom paging in ASP.NET with ListView & DataPager

    Posted on July 23rd, 2009 Thibaut 7 comments

    1. Introduction

    In this article, we’ll see how to implement custom paging in an ASP.NET website. You most probably have already worked with some controls having native paging implemented (such as the GridView and FormView for example) but they’re not applicable in every case. First, custom paging will allow you to page everything you want the way you want, but also, if correctly implemented, it’s gonna be a lot lighter than using a heavyweight control with all its richness only to beneficiate from its native paging.

    So, to illustrate how to implement this, we’re gonna use the ListView, which enables you to define a template (much like the Repeater) for your display and the DataPager control to configure custom paging on it. And for those who read my article about implementing the Bing API (part 1 & part 2), it’s the occasion to see how I actually implemented the paging of the search results.

    2. The ASP.NET code

    <asp:ListView ID="lvwSearchResults" runat="server" ItemPlaceholderID="plhItemContainer" onitemdatabound="lvwSearchResults_ItemDataBound">

        <LayoutTemplate>

            <ol class="searchResults">

                <asp:PlaceHolder ID="plhItemContainer" runat="server" />

            </ol>

        </LayoutTemplate>

        <ItemTemplate>

            <li>

                <ul>

                    <li><asp:HyperLink ID="lnkSearchResultUrl" runat="server"></asp:HyperLink></li>

                    <li><asp:Literal ID="litSearchResultDescription" runat="server" /></li>

                </ul>

            </li>

        </ItemTemplate>

    </asp:ListView>

     

    <div id="pager">

        <asp:DataPager ID="dpgSearchResultsPager" runat="server" PagedControlID="lvwSearchResults">

            <Fields>

                <asp:NextPreviousPagerField ShowNextPageButton="False" ButtonCssClass="previousNextLink" />

                <asp:NumericPagerField ButtonCount="10" ButtonType="Link" NumericButtonCssClass="numericLink" />

                <asp:NextPreviousPagerField ShowPreviousPageButton="False" ButtonCssClass="previousNextLink" />

            </Fields>

        </asp:DataPager>

    </div>

    Let’s first have a look at the ASP.NET code. What’s noticeable here :

    • The 2 controls : ListView and DataPager, which references the ListView (PagedControlID property)
    • The LayoutTemplate (stucture) and ItemTemplate (content) regions of the ListView
    • A ol is used in the LayoutTemplate because it’s the more correct, semantically speaking, for an ordered list of search results. But you could also be using a ul
    • The reference to the PlaceHolder by the ListView (ItemPlaceholderID)
    • We’ll use here the ItemDataBound event, but of course the inline Eval would also work perfectly
    • There’s a Div surrounding the DataPager for CSS purposes
    • The DataPager is very flexible and powerful : you can set the paging to be numeric, to be next/previous/first/last, or a mix of them (the case here : previous / numeric / next, just like Bing or Google), to display it at the top or bottom, or even both. Take a look at the Smart Tag in design view and make your choice…

    3. The C# code

    protected void Page_Load(object sender, EventArgs e)

    {

        this.dpgSearchResultsPager.PageSize = PageSize;

    }

    In the Page_Load(), initialize the PageSize property of your DataPager. Here is the code from the Bing API context, where we had defined a constant for the page size. But it could also be hardcoded in your ASP.NET code.

    private void DisplayResponse(SearchResponse response)

    {

        . . .

     

        // Otherwise, perform databinding

        this.lvwSearchResults.DataSource = response.Web.Results;

        this.lvwSearchResults.DataBind();

    }

    For those who want to use paging in the Bing API context, here’s where to put the initialization code. For the others, just put these two lines in the Page_Load().

    protected void lvwSearchResults_ItemDataBound(object sender, ListViewItemEventArgs e)

    {

        if (e.Item.ItemType == ListViewItemType.DataItem)

        {

            HyperLink lnkSearchResultUrl = (HyperLink)e.Item.FindControl("lnkSearchResultUrl");

            Literal litSearchResultDescription = (Literal)e.Item.FindControl("litSearchResultDescription");

            ListViewDataItem dataItem = (ListViewDataItem)e.Item;

            WebResult searchResult = (WebResult)dataItem.DataItem;

     

            if (lnkSearchResultUrl != null && litSearchResultDescription != null && searchResult != null)

            {

                string url = searchResult.Url;

                string description = searchResult.Description;

     

                if (HighlightText)

                    description = description.Replace("\uE000", "<span class=’highlight’>").Replace("\uE001", "</span>");

                else

                    description = description.Replace("\uE000", string.Empty).Replace("\uE001", string.Empty);

     

                lnkSearchResultUrl.Text = url;

                lnkSearchResultUrl.ToolTip = url;

                lnkSearchResultUrl.NavigateUrl = url;

                litSearchResultDescription.Text = description;

            }

        }

    }

    And finally, the code from the ItemDataBound event. Again, it’s from the Bing API context but serves as a good example and is straightforward to adapt.

    4. The click-twice problem

    I’m dedicating a section to this problem as I noticed from a web search that many developers had the same problem. When you want to change the page (ie, click on a paging button), nothing happens and you’ve got to click the same button twice to get the expected result. Clicking another button results in an even more strangy behaviour. Here’s the solution :

    protected void Page_PreRender(object sender, EventArgs e)

    {

        // Workaround to prevent clicking twice on the pager to have results displayed properly

        this.lvwSearchResults.DataBind();

    }

    5. A touch of CSS to polish that

    When all this done, you can have fun styling all of that. I’m just listing here the more fundamentals styles to apply, that is, removing the list numbers and centering the pager

    ol, ul

    {

        list-style-type : none;

        margin-left : 0;

        padding-left : 0;

    }

     

    ol li, ul li

    {

        margin-left : 0;

        padding-left : 0;

    }

     

    div#pager

    {

        text-align : center;

    }

    6. The final result

    Final result

    7. Conclusion

    Implementing custom paging in ASP.NET is very easy and powerful at the same time. But as all the power resides in the DataPager, I encourage you to take a look at the functionalities it can provide (start by taking a look at the Smart Tag). Hope you enjoyed this and see you soon ;)

    Share/Save/Bookmark

  • Implementing the Bing API in a ASP.NET website (part 2)

    Posted on July 22nd, 2009 Thibaut 7 comments

    In my last post, we saw how to get started with the Bing API. But the MSDN code is lacking (intentionally) from the following things that you might find useful :

    • You want to use Bing from a website and not from a console application
    • You want to use Bing to search on a particular website and not the whole web
    • You might want to handle the different kinds of errors/informations the right way
    • Some paging would also be very useful to browse the results
    • And maybe simplifying the code, extracting constants to ease their setup

    That’s what we’re gonna see here by taking a look at my implementation. Let’s see what the code is all about, then we’ll discuss about it. The code will be splitted in several parts, so we can discuss about it step by step.

    1. Extracting hardcoded values into constants

    public partial class SearchResults : Page

    {

        private const string BingApplicationId = "YourAppIDHere";

        private const string WebsiteToSearch = "http://www.thibautvs.com";

        private const int MaxResultsCount = 50; // Max value : 50 (Bing API v2.0)

        private const int PageSize = 10;

        private const string SearchLanguage = "en-US";

        private const bool HighlightText = true;

        private const string BingApiVersion = "2.0";

    First, I extracted all the hardcoded values in the code into constants. That’s way easier to setup the values. I also added one which enables you to easily activate/deactivate text highlighting of the keywords in the search result and the PageSize constant to take into account the paging functionality. From experience, I noticed that the BingService throws a SoapException when the ResultsCount is too large. By experimentation, I noticed that the value must be max 50. You can take a look at the MSDN to get more info about this restriction.

    2. Initializing the search request

    protected void Page_Load(object sender, EventArgs e)

    {

        this.dpgSearchResultsPager.PageSize = PageSize;

        InitializeSearchResults();

    }

    In the Page_Load, we initialize the PageSize of our pager (which is a DataPager bound to a ListView in the aspx page) and call the InitializeSearchResults() method.

    private void InitializeSearchResults()

    {

        using (BingService service = new BingService())

        {

            try

            {

                SearchRequest request = BuildRequest();

                SearchResponse response = service.Search(request);

                DisplayResponse(response);

            }

            catch (System.Web.Services.Protocols.SoapException ex)

            {

                DisplayErrors(ex.Detail);

            }

            catch (System.Net.WebException ex)

            {

                Console.WriteLine(ex.Message);

            }

        }

    }

    Tthe InitializeSearchResults method makes use of the BingService, which implements the IDisposable interface (thus, used here with the using keyword) in order to :

    1. Initialize the search request
    2. Get a search response
    3. Display the response
    4. Handle a SOAP exception, if there is one
    5. Handle a network exception, if there is one

    private SearchRequest BuildRequest()

    {

        SearchRequest request = new SearchRequest();

     

        // Common request fields (required)

        request.AppId = BingApplicationId;

        request.Query = Request.QueryString["keyword"] + string.Format(" (site:\"{0}\")", WebsiteToSearch);

        request.Sources = new SourceType[] { SourceType.Web };

     

        // Common request fields (optional)

        request.Version = BingApiVersion;

        request.Market = SearchLanguage;

        request.Adult = AdultOption.Moderate;

        request.AdultSpecified = true;

        request.Options = new SearchOption[] { SearchOption.EnableHighlighting };

     

        // Web-specific request fields (optional)

        request.Web = new WebRequest();

        request.Web.Count = MaxResultsCount;

        request.Web.CountSpecified = true;

        request.Web.Offset = 0;

        request.Web.OffsetSpecified = true;

        request.Web.Options = new WebSearchOption[]

        {

            WebSearchOption.DisableHostCollapsing,

            WebSearchOption.DisableQueryAlterations

        };

     

        return request;

    }

    Again, the code shown by the BuildRequest() method is autodescriptive. Just a precision about the search query : the code here assumes that you’re passing a keyword to the page via the querystring and in order to restrict the search to a particular website, your query must have the following form :

    keywordToSearchFor (site:http://www.thesitetosearch.com)

    3. Displaying the results

    private void DisplayResponse(SearchResponse response)

    {

        // If no results were found, display message and return

        if (response.Web == null || response.Web.Results == null)

        {

            this.litInformationZone.Text = "No results found.";

            return;

        }

     

        // Otherwise, perform databinding

        this.lvwSearchResults.DataSource = response.Web.Results;

        this.lvwSearchResults.DataBind();

    }

    As a crash occured when I submitted to Bing a request having no result (response.Web.Results having a NULL value), the first thing I do here is to protect the code from that error and warn the user by a message that her search query has no result. The litInformationZone is just a simple Literal object (and thus why I prefixed this “lit”). If the search has results, we perform the databinding with our ListView.

    4. Displaying the errors

    As errors may always occur, we have to handle them properly and display them to the user in a more convenient form than a disgracious exception message. Another lesson that Steve Krug teaches us in his Don’t make me think book is always apologize for the inconvenience to the user and explain to her briefly the error she’s encountered. This is where I started creating my own ErrorPanel UserControl that I used here and can also be reused later, so I suggest you doing the same. This UserControl is reffered in my code as pnlError and has one public property : ErrorMessage.

    private void DisplayErrors(XmlNode errorDetails)

    {

        // Add the default namespace to the namespace manager.

        XmlNamespaceManager nsmgr = new XmlNamespaceManager(errorDetails.OwnerDocument.NameTable);

        nsmgr.AddNamespace("api", "http://schemas.microsoft.com/LiveSearch/2008/03/Search");

        XmlNodeList errors = errorDetails.SelectNodes("./api:Errors/api:Error", nsmgr);

     

        if (errors != null)

        {

            StringBuilder builder = new StringBuilder();

     

            foreach (XmlNode error in errors)

            {

                foreach (XmlNode detail in error.ChildNodes)

                    builder.AppendLine(detail.Name + ": " + detail.InnerText);

     

                builder.AppendLine(Environment.NewLine);

            }

     

            this.pnlError.ErrorMessage = builder.ToString();

            this.pnlError.Visible = true;

        }

    }

    5. Enjoying the final result

    Time to watch some screens about the final result of all this work :

    Search results

    You can see from this picture the paging feature (that we’ll cover more in detail in a future article) and the highlight of the search keywords in the description text. By the way, this is accomplished by replacing the delimiter characters by a span having a specific CSS class. Code to accomplish this is shown below :

    if (HighlightText)

        description = description.Replace("\uE000", "<span class=’highlight’>").Replace("\uE001", "</span>");

    else

        description = description.Replace("\uE000", string.Empty).Replace("\uE001", string.Empty);

    Of course, your website needs to be indexed by Bing in order to perform searches on it. To check if your website is indexed, type “site:yoursiteurl” into Bing (ex : site:http://thibautvs.com). If it isn’t indexed yet, it will propose you to submit the URL so it can index it.

    6. Conclusion

    And this is it ! As you can see, the Bing API is pretty cool and easy to implement (actually, I took me less than 2 hours to get a first, beta running version). And a lot more services such as searching for images, videos, instant answers, mobile web, ads, phone books, using spell checkers or translations, … are also available (more info on the MSDN). Hope you’ve enjoyed this article, don’t hesitate if you would have any questions about that.

    See you ;)

    Share/Save/Bookmark

  • Implementing the Bing API in a ASP.NET website (part 1)

    Posted on July 21st, 2009 Thibaut 11 comments

    Bing

    Foreword : as the title suggests, the Bing API was implemented here in a ASP.NET website, but as the code dealing with the API is in C#, it should be straightforward to adapt it in some other .NET projects such as Silverlight. Hope you’ll enjoy this article !

    1. Context

    On the ASP.NET website I’m currently working on, I wanted to implement a search functionality as that’s the kind of very important criterias for the users on today’s websites. Steve Krug actually lists the search engine in the top 5 needed functionalities in his Don’t make me think book. I had several possibilities to do this :

    • Use the Google API, which is the first solution I’ve thought about
    • Use Yahoo & IBM’s OmniFind
    • Implement my own search engine
    • See what other options are available

    2. Choosing the right search engine API

    Of course, I wanted a totally free solution. I don’t want to have to pay each month or year for the kind of functionality I expect being free. So as I said, I thought about using Google API at first. There’s a free version but with advertisements. You’ve got to pay about 100$ a year if you want them out. Ok we can already eliminate this one. One doesn’t really wants ads of his direct concurrents to appear next to the search results on her own website.

    I also listed the solution of developing a little search engine by myself. Although I completely agree that this kind of project could be very interesting, I needed a fast solution and why developing something that I knew a way better version would be available for free out there on the web. There was also the OmniFind option, but the installation, deployment and database configuration makes it heavier to use than a simple API. At this moment, I thought about Bing. I tested it at its release and was very impressed by the relevance of the results, especially by the image search. And they’ve got all what I need for free. Plenty of documentation on the MSDN about the API, in multiple programming languages including C# that I’m using. Perfect ! Let’s implement this !

    3. Implementing the Bing API

    3.1. Choosing the protocol

    The Bing API can be used with the 3 following protocols :

    • JSON
    • XML
    • SOAP

    So the first step is to decide which one you’ll gonna use. In our case, that is, working with the code behind in C#, the use of SOAP was according to me the preferred choice. Indeed, JSON is best used with Javascript and we’re working in C#, so we can eliminate this choice. Remains XML and SOAP. XML is nice but you don’t want to have your code filled with potentially long XPATH strings when you can work with strongly typed objects and accessing their properties. Also, we beneficiate from the intellisense support for every information we’ll want to access. (more info on the MSDN about these protocols). Let’s now see how to implement the API using SOAP.

    3.2. Obtaining a Bing AppID

    In order to gain acccess to Bing through the API, you must first obtain an AppID from the Bing Developer Center.

    Bing AppID Just click on the Create an AppID link to get one. You’ll have to fill in a little form, with information such as your company name, website and your country.

    3.3. Adding the Web Reference under Visual Studio

    Web Reference Then, in Visual Studio, right click on your web project and click on Add Web Reference from the context menu.

    Type the following in the textbox : http://api.bing.net/search.wsdl?AppID=YourAppId&Version=2.2 (replace your AppID in this url). Then you should get this :

    Method detectedYou can see that the Search method from the API was correctly found. You can still change the Web reference name, which is the one you’ll use in your code to reference the Bing service.

    3.4. Integration of the API into the code

    In the page(s) where you want to use the Bing API, first include the following using statement :

    using [YourProjectDefaultNamespace].[TheWebReferenceName];

    Ex :

    using sampleproject.net.bing.api;

    Then you can implement and adapt the code listed on the MSDN to your needs.

    4. Implementing the Bing API - Part 2

    When you’ll have a look at the code from the MSDN, you’ll see that some adaptations are necessary.

    1. First, there is little chance that you want to implement Bing as a console application.
    2. Second, you want to use it to search on a particular website and not the whole web.
    3. You may also wish to handle the different types of errors the best way possible.
    4. And maybe you would like to have some ASP.NET code illustrating the implementation.

    This is exactly what’s coming next, where we’ll have a look at my implementation of the API in a ASP.NET website. So be sure to check out the part 2.

    Coming soon…

    Share/Save/Bookmark

  • In bulk #2

    Posted on July 15th, 2009 Thibaut No comments

    Share/Save/Bookmark

  • Thales Workgroup : which ASP.NET event for what ?

    Posted on May 30th, 2009 Thibaut No comments

    The topic of the last Thales workgroup was ASP.NET events. Almost every ASP.NET developer knows about the events of the page life cycle (otherwise, check out this article on the MSDN) so we wanted to go deeper in order to dress a list of what to do and when…Below, the summary of the discussion we had about that :

    1. PreInit : master page change, culture change, ….
    2. Init : base.Init() creates all the controls defined in the .aspx. QueryString parsing can be done here as well as persistence
    3. InitComplete : instanciation of business objects with possibly database calls behind it
    4. PreLoad : we didn’t discuss about this event
    5. Load : format validations, events handling, …
    6. LoadComplete : initialize control values with business objects
    7. PreRender : javascript registration, callbacks management
    8. SaveStateComplete : tasks that require view state to be saved
    9. Render : modifications on the XHTML markup to be generated
    10. Unload : we don’t really use it, but it could be used to clean resources (opened files and DB connections)

    And here it is ! See you ;)

    Share/Save/Bookmark

  • Back from the Techdays

    Posted on March 16th, 2009 Thibaut No comments

    Here is a summary of the sessions I assisted at the Techdays on Wednesday 11th.

    Techdays 09

    Introduction

    • Evolution of software : SOA trend and cloud computing advent
    • Demo of Blend : the graphist and the developer work at the same time on the same project, the graphist makes some modifications and the developer gets the result when launching the app the next time (and vice-versa)
    • Demo of Surface : very impressive, visit the official website to watch the videos. Easy to make apps for surface as that’s WPF with just one lil’ layer onto it
    • Video of Microsoft’s future vision for apps in 2019

    .NET continuum: ASP.NET, AJAX, Silverlight and WPF (by Laurent Bugnion)

    • From the less powerful to the most : ASP.NET, AJAX, Silverlight then WPF
    • Shows how to interact with a WCF service with ASP.NET MVC (postback), ASP.NET AJAX (asynchronous, better UI reaction), Silverlight (only asynchronously, subset of .NET power) and WPF (asynchronous or synchronous, full .NET power)
    • Description of the Model/View pattern
    • Introduction of Dr WPF, a blogger very active in the WPF world

    Silverlight CoreCLR: Bringing the power of .NET to the net (by Andrew Pardoe)

    • Demonstration of the performance of Silverlight, compared to a Javascript application. Chess game, averaging 420,000 nodes per second in Silverlight vs. Javascript at 23,000 nodes per second in the search tree. Complete source code is available for the doubtful guys
    • Anything that can host ActiveX can host CoreCLR
    • Sandboxed execution : one execution domain per Silverlight app. Security increased
    • Same application model between browser and desktop : very easy to port a desktop-WPF app to a browser-Silverlight one
    • Dynamic Language Runtime (DLR) : language interoperability. App written in Python or Ruby can interact with the CoreCLR. Ex : IronPython or IronRuby

    WPF performance & best practices (by Dirk Primbs)

    • First advice about performance : focus on scenario and customer expectations. Do not try all the new visual effects on the same page or it obviously risks to slow down your app
    • The visual tree (containing all the controls and parts of them) can become too large. Use Snoop, a very powerful tool, that enables you to visualize that tree
    • Use optimized controls. For example, the VirtualizingStackPanel instead of the StackPanel, will render its content only when visible (suppose you have a lot of elements, and only a portion of them are visible through scrolling, rendering all of them in your page load isn’t a good solution)
    • Picture processing : try to avoid using large pictures and use caching options such as BitmapCacheOption
    • WPF Performance Suite : great tool for measuring performance of WPF apps
    • Hardware acceleration : 3 tiers (tier 0 : old pc, < DX7, tier 1 : between DX 7 and 9, tier 2 : DX >= 9). App can be set to run at a determined tier to simulate behaviour of less powerful machines and thus tune the perfs of your apps

    Under the hood in Silverlight’s controls skinning framework (by Gill Cleeren)

    • Speaker showed how to create a skin for a button (a purple ellispe with gradient brush)
    • Styling vs. skinning : styling is limited, skinning is completely new look, visual tree and properties
    • Parts & states model : separate logic from visual, contract between coder and designer, supported by Blend. Enables you to add new properties to existing ones on a control
    • Part : the working thing. Eg : a button has no part since the button is itself the part, but in a slider, the part is the little thumb that can be dragged
    • States : the different states of a control, such as mouseover, pressed, etc

    Windows 7 for developers (by Katrien De Graeve)

    • New features for consumers but also for developers
    • Showed the new features for the consumer (the docking features, etc, many articles available on the web about that)
    • Developer point of view : multi monitor support, even when remoting. Problem step recorder : screenshots of every steps of a bug reproduction are taken and then submitted to the developer
    • Compatibility : what works on Vista will work on Win 7 almost for sure

    And that’s all about this very interesting day. See you next year ;)

    Share/Save/Bookmark