Monday, September 29, 2008

CRUD with ASP.NET

For the past week, I have been looking at ways of building CRUD interfaces in .NET. I wanted something that would couple with Entity Framework and automatically generate grid views and insert / edit interfaces. This of course done by reading metadata from the Entity Model code which could be customized by the developer.

Enters, Dynamic Data Framework for ASP.NET. It looks promising and flexible enough. This week will be dedicated into implementing Dynamic Data into an existing ASP.NET Web Site, customizing templates and modifying templates for individual tables.

Wednesday, September 24, 2008

Recover Deleted Linux files and Folders

Today, among all the load I had on my head, someone from my team happened to delete the data folder for oracle database server on one of our remote rack servers. I still remember all the pain I had setting oracle on this 64-bit Fedora 6 Core machine, with kernel incompatibilities and missing libraries. All in all, it took me two weeks to set it up correctly using the GUI from oracle install with an uprate of 1 mbps.

So in order to avoid doing it all over again, i decided to have a look at how i could restore deleted files and folders under linux. I knew that linux stored deleted files in trash when using GUI (Gnome or KDE) but through command line, it seems that the file was not recoverable using ext3 partitions other than looking at blocks and inodes one by one.

After loads of despair, i found out that PhotoRec was one of the best tool that was able to solve such problems. So here i go with this tool, trying to recover all my oracle database files and hoping that it will all be sorted out :(. With 24hours estimated time for completion, I really hope all my files will be restored. God bless !

Tuesday, September 23, 2008

Windows Vista DHCP Problems

I have been having problems recently with DHCP on Windows Vista. It seems that Vista is not able to obtain an ip address through DHCP when changing networks. I noticed that on linux, DHCP worked like a charm on the same machine (did not surprise me :P).

A quick look on the net and I found at that Microsoft brought in a change into the way an ip address was queried for using DHCP. I wonder whether they got to know about such a thing called Backward Compatibility !!

Anyway, have a look at this site and download the useful tool mentioned there to get a quick fix.

http://www.reviewingit.com/index.php/content/view/29/2/

Friday, September 19, 2008

Starting with Entity Framework and LINQ

 

So, here I am starting to try out LINQ and Entity Framework. I have been using Hibernate for the past two years can say that there has been many hurdles throughout the learning process of this process of this open source ORM tool. However, Hibernate was a first glance at the power of modern ORMS. I expect the same robustness from LINQ.

After about a week of research (1 hour daily :P) and some patches (download and installation) relevant to VS 2008, .Net Framework 3.5, ADO .NET Entity Framework, I finally managed to have a proper platform to start with LINQ. My aim is to use something similar to Hibernate in C#.

I first created my tables (models) in SQL Server 2005 Express and added some values to it.

imageimage 

 

A console application was sufficient to demo Entity Framework. Note that in order to have Entity Framework Tools in VS 2008, I had to download a few stuffs including patches. Instructions can be found at http://oakleafblog.blogspot.com/2007/12/entity-framework-beta-3-available-for.html.

In my VS2008 console Application, I added an ADO.NET Entity Data Model named EntityFrameworkDemoModel.edmx. A wizard was presented to me and I chose to Generate my models from Database. The next screen allowed me to choose my Datasource and store my Connection String in my App.config

 

image

 

In the next screen, I chose the models I wanted to generate:

image

When finished, the following was presented to me :

image

The models was automatically generated in a class. As opposed to hibernate, all models were regrouped in one single class. Now to test, whether using LINQ, I could obtain all data in my tables through my Business Objects which have been generated, I ran the code below:

 

using System;
using System.Collections.Generic;
using System.Linq;
using System.Data.Objects;
using System.Text;

namespace EntityFrameworkDemoApplication
{
    class Program
    {
        static void Main(string[] args)
        {
            Console.WriteLine("ADO .NET Entity Framework Demo");

            DemoDBEntities demoDb = new DemoDBEntities();
            ObjectQuery<UserRole> userRoleQuery = demoDb.CreateQuery<UserRole>("SELECT VALUE u FROM UserRole as u");

            foreach (UserRole userRole in userRoleQuery.Execute(MergeOption.NoTracking))
            {
                Console.WriteLine("User Role is " + userRole.UserRoleName);
            }
            Console.ReadLine();
        }
    }
}

 

And my result is as follows:

image 

 

I must say, its not bad at all for now. My next step will attempt building (if it does not exist already) a generic class that will handle CRUD operations for all class.

Wednesday, September 17, 2008

.NET at a Glance

Over the past two and a half year (add ONE more year if university is accounted for :P ), I have been working strictly on JAVA and Linux platforms. There has always been some sort of animosity between our open source JAVA & LINUX teams and our Microsoft slaves (.NET Team). However, one of my workmate who has had shots at both JAVA and .NET kept insisting at how easy it was to do things in .NET rather than in JAVA. Throughout the past 6 months or so, I have been researching at what would be the next best language for me to learn. I had a dig around a year or so at PHP and it really has been a cruise. But PHP for me is meant to develop simple, lightweight applications. While some may argue that PHP is being used for Large Scale Enterprise applications, I do believe that its not where its got its strongholds.

So here I am finally embarking on my Final Year Project for my Post Graduation at the University of Technology of Mauritius. My choice for Final Year Project came to development of a University Timetabling and Scheduling software that would be used by UTM. This as a recognizance of what the UTM gave me as a student and also as a 99% guarantee that my software would be used in a production environment.

I have already set up the .NET Framework 3.5, with Visual Studio 2008 (along with SP1 ) and am now digging deep in "Beginning ASP.NET 3.5 in C# 2008 - From Novice to Professional". Hopefully, my quest for .NET insights will be satisfied.

My First Blogger Post

 

I recently register for a blogger account in order to post all my research and findings relevant to MSC Final Year Project. So here ya goes with my very First Post (not one to remember though :P ). I hope that this blog helps me and others as well.