Innovative Perspective

Code Camp ‘09

Posted in .Net, Events by mohammednour on February 7, 2009

dotNetWork will organize a day called: “Code Camp ‘09″. The day will allow the development professional to introduce several technologies and new Microsoft products. dotNetWork is promising that the day would be one of the biggest events they have ever organized before.

Code Camp ‘09 is a two day event. It will be held on: Thursday, February 19 and Friday, February 20, 2009. To have more information about the event and the agenda, please visit the event website: Code Camp ‘09

.network.org user group is a group of youth who share the same passion for the development on .Net platform in Egypt. The group started in the last December 2007 with several technical events during the last year. For more information about the group, visit their website here.

ASP.NET MVC Routing Using XML Custom Configuration Settings

Posted in .Net, ASP.NET, MVC by mohammednour on November 22, 2008

In ASP.NET MVC application, you need to add some routing code in the Application_Start of the Global.asax file to define your routing criteria. These lines of code take a shape of configuration settings for the MVC application and I was thinking if we can transfer these configurations line of codes to be XML settings in the web.config file. My target is to make the routing configuration in the web.config file as following:

As you can see, the later configurations define the Ignore and Routing lists of the MVC application. In the “Ignore” list, you define the URL criteria to be ignored by the MVC routing. In the “Map” list, you specify a list of the routes including the route name, controller and action. You can also define any optional parameter mappings for your actions.

To do that, I have to create a custom configuration section: MvcRouteConfigurationSectin. The section has a IgnoreCollection – inherited from ConfigurationElementCollection class – of IgnoreItem and another RoutingCollection of RouteItem.

The solution will also add an extension method for RouteCollection object so that you will be able to map the configuration section in the web.config directly to your RouteTable.

To use the project, you just need to include the MvcXmlRouting.dll in your MVC web project. Then you add the following line inside the configSection Tag in web.config:

You then define the ignore and the routing configurations for your web application as defined earlier in the web.config. Finally, you will need to edit the RegisterRoutes method in the Global.asax file to add a couple of lines as following:

Now all your routing configuration will go to the web.config file. No need to edit the Global file anymore. However, changing the routes in the web.config still need to reset your IIS as the routing is registered in Application_Start.

Download: Binary | Source Code

The project is implemented using ASP.NET MVC Beta 1 and Visual Studio 2008. It’s not guaranteed that this project or the related assemblies will properly work in earlier or newer version of ASP.NET MVC Framework.

kick it on DotNetKicks.com
DZone – Vote Up!

Ping Back Links:
- http://blog.51mvc.com/view/20

Hewitt Middle East Best Employer Study

Posted in Software Industry, Surveys by mohammednour on November 13, 2008

In the last December 2007, this blog hosted a quick survey to measure the different aspects of the software employers inside Egypt. I am glad to announce that there is another independent initiative showing up these days. Hewitt – a provider of HR outsourcing and consulting services – launches the Best Employers in Middle East 2009 study. The study aims to honor the leading organizations of Middle East as outstanding places to work. Hewitt conducts its Best Employer research in a number of markets, including Eastern Europe, Canada, Latin America and Asia. This survey is designed to be the largest employee research project ever undertaken in Middle East. Hewitt invites all the employers in the Middle East to participate in this survey. The survey will show how effective is your organization and wither it provides a workplace that engages the intellectual and emotional commitment of your employees or not. The study will provide a level of confidentiality so that the names of all participating organizations will be strictly confidential at all points of time. The exception will be those organizations that will be honored as a Hewitt Best Employer in Middle East.

On Finding the Arabic Needle in the e-Haystack

Posted in Events by mohammednour on November 12, 2008

Lack of information is an issue, but lack of ability to reach the information is a much more serious issue. With internet getting appended everyday with million of new information pages, search engines become unconsciously mandatory to use.

CuttingEdgeClub organize a seminar in ITWorx to elaborate how search engines operates and to highlight the status of the rapidly growing Arabic-Web in particular.

The seminar is scheduled to be on Wednesday, 19th November, 2008 at 5:30 PM in ITWorx – Free Zone. The session will be provided by Hany Abdelkawi – Project Manager, Link Development.

CuttingEdgeClub is an ITWorx Club aims to share information about the latest technologies among the IT community by organizing technical sessions and seminars in a regular base.

.NETWork.org 9th Gathering – Coming Out This November

Posted in .Net, Events, MVC by mohammednour on November 8, 2008

.NETWork.org announced the next 9th Gathering to be held in 29th November. The event will be in CIC – Canadian International College and four speakers from ITWorx and Raya Software will be giving the sessions. Here is the list of the topics and speakers:

BizTalk – SharePoint Integration.
Hossam El-Deen M. Barakat
Senior Software Developer | Raya Software
Information Architecture
Mostafa Mourad
Team Leader | ITWorx
IIS 7
Hossam Kamel
Senior Software Engineer | ITWorx
Applying Domain Driven Design on ASP.NET MVC
Mohammed Meligy
Senior Software Developer | Raya Software

.network.org user group is a group of youth who share the same passion for the development on .Net platform in Egypt. The group started in the last December 2007 with a total of eight technical events during the last 10 months. For more information about the group, visit their website here.

PRG Pattern – You’re Already Doing it

Posted in Design Patterns, MVC, Tips by mohammednour on November 8, 2008

Have you ever had this message dialog asking about resubmiting the data when you try to refresh a web page? This actually happen after submitting a form or enter your login information.

One of the good practices when developing web application is to redirect the user after a successful posting request. This practice is refereed as PRG pattern (Post/Redirect/Get). The target is to avoid duplicate post requests from the client and providing a smooth navigation through the web application.

What actually happen in PRG is that the browser try to send an HTTP 303 redirect request along with HTTP “Location” header. It’s nice to know that something you’re used to make as a default practice is actually a pattern. The following is a sample code in ASP.NET MVC illustrating the usage of the pattern:

[Authorize]
[AcceptVerbs(HttpVerbs.Post)]
public ActionResult ChangePassword(string currentPassword, string newPassword, string confirmPassword)
{
    if (ModelState.IsValid)
    {
        MembershipUser currentUser = Provider.GetUser(User.Identity.Name, true /* userIsOnline */);

        // Attempt to change password
        bool changeSuccessful = currentUser.ChangePassword(currentPassword, newPassword);

        if (changeSuccessful)
           return RedirectToAction(“ChangePasswordSuccess”); //PRG Pattern recommendation
    }

    return View();
}

NeatUpload – File Upload Open Source Library

Posted in .Net, AJAX, Tools by mohammednour on October 1, 2008

NeatUpload is a very nice open source ASP.NET component which allow you to make file uploads to file system or database storage with customized AJAX-like progress bar indicators. The library is made in .NET and it works under Mono’s XSP/mod_mono or Microsoft’s ASP.NET implementation. You can easily download the source code and even modify it to match the required behavior of your project.

The library features 2 custom web controls: InputFile allows the user to select a file to upload, and ProgressBar displays the upload progress either inline or in a popup. ProgressBar uses AJAX-style refreshless updates on modern browsers when JavaScript is available, but also allows users without JavaScript to see upload progress. HttpModule is included as well to get the upload progress and handle the upload context states.

You can download and give it a try from this link: Brettle Development NeatUpload

Microsoft and jQuery Engagement

Posted in Javascript, Tech. News by mohammednour on October 1, 2008

It seems that Microsoft is going to include jQuery by default in the new releases of Visual Studio and ASP.NET MVC in the near future. jQeury is a very nice and handy Javascript library which has an increasing acceptance recently in the web development community. Here is a part of the John Resig post in jQuery Blog about this news:

Microsoft is looking to make jQuery part of their official development platform. Their JavaScript offering today includes the ASP.NET Ajax Framework and they’re looking to expand it with the use of jQuery. This means that jQuery will be distributed with Visual Studio (which will include jQuery intellisense, snippets, examples, and documentation).

Additionally Microsoft will be developing additional controls, or widgets, to run on top of jQuery that will be easily deployable within your .NET applications. jQuery helpers will also be included in the server-side portion of .NET development (in addition to the existing helpers) providing complementary functions to existing ASP.NET AJAX capabilities.

Javascript – Access Denied When Calling Window Opener

Posted in Javascript, Tips by mohammednour on October 1, 2008

We usually use the “open” method in the window object to open a new window in Javascript. However, sometimes you need to change some values in the parent window depending on the changes of the new window elements values or you may need to call a method in the parent window from the child one. To do so, you can use the “opener” property in the window object to access the parent page elements. The following Javascript statement access an input element in the parent window with “txtEmail” ID and update its value:

window.opener.document.getElementById(“txtEmail”).value = “mohammedn@mailhost.com”;

You can even call a method direct in the parent window from the new opened one:

window.opener.SomeMethodInTheParentWindow();

However, you may get “Access Denied” or “Permission Denied” message when trying to access the “opener” property in the popup window. This usually because you call the window.open with the full path of the pop window:

window.open(‘http://www.domain.com/accounts/register_popup.aspx’);

To resolve this issue, use the relative path of the popup page instead of the full path when opening it and you will be able to safely access the opener property of the window.

window.open(‘accounts/register_popup.aspx’);

TeamCity – Continuous Integration Server and Build Management Tool

Posted in Tools by mohammednour on September 5, 2008

TeamCity is a continuous integration & build management solution for both .NET and Java development. TeamCity is developed by JetBrains – the producer of the famous Resharper – and shipped in two editions: Professional Edition and Enterprise Edition. The Professional Edition of the team city is free and you can use it without a need for any kind of licenses. This edition is more than enough for small and medium size company or teams.

Build Servers are very useful tool in any development environment where you need to track the build state of your team code. It make sure that all the committed code is not in a breaking state. The integration with the build servers and the continuous integration tools like SVN and sourcesafe help you to assign the responsibilities of the breaking code to specific developer to fix.

TeamCity is a a very powerful build server which has many features to facilitate your project building process. You can download the last version of TeamCity from here. I have downloaded the last version and played a little bit with it and it seems very interesting tool. When you run it for the first time, you will be asked to make a new account. Then you will have to create a new project by entering the main project information. Afterwords, you will be asked to enter the general settings of the project. Then, you will have to enter a new build configuration. You can have more than one build configuration in the same project allowing a kind of switching for the build needs and requirements for your project.

In “Build Configuration” step, you need to define the build numbers format. You can have your own format for the builds numbers like “CG-01″ or “MX-01″ or whatever suitable format. You can define the criteria of the build failing. For example, you can define the failing criteria if the building execution itself failed, the project test failed, error reported by the build runner and/or the build take more than a specified number of minutes (timeout).

Also in this page there is a nice feature called “Status Widget”. This means you can include the status of your build in any external web page or whatever external tracking site you may use internally. When you enable it, you will have to copy and paste small HTML and CSS tags inside this external page to show your build status.

Then you will be asked to enter the build runner information in “Build Runner” step. In this step, you need to define the platform you will use to build the project. Team City provide several build runners for .NET and Java projects as well. I am working with .NET so I choose MSBuild as a build runner. Then I specified the build file virtual path which is the solution file of my project (ex. teamcitytest.sln). When you select MS Build, you define the suitable .NET Framework version for the build. You also define more command line parameters for MSBuild.exe if required.

Then, you will enter the version control settings like the checkout path if it’s different than the default directory of the agent. You can also make automatic labeling if the build succeeded.

There is another nice setting in TeamCity which allow you to run the build periodically. You set it by clicking “Edit Configuration Settings” in the top panel of the build progress screen. Then in the left tabs, choose “Build Triggering”. Select “Other Triggering”. Check “Automatically start a new build when the previous build failed.” and specify the time intervals between the builds.

This was a very quick walkthrough for TeamCity. I really like it and recommend it for your development team as a very efficient and customizable build server.