Archive

Archive for June, 2009

MVC and Continous Learning

June 10, 2009 Leave a comment

Finally, yesterday I did some work on ASP.NET MVC 1.0 and managed to create (and run) a sample application. (I follow Scott Gu’s blog and I was eyeing at this MVC thing for a long time. But my work pressure kept me off until now). I am in a very early stage of learning ASP.NET MVC. I was following a tutorial – I have mentioned this in my previous post – from ASP.NET site and as all the tutorials are, this is incomplete. People with minimal programming experience will find this tutorial tough and not working as expected. They might think MVC is tough and complex. In reality it is.

I remember my days when I worked with Spring and Hibernate for a very small but very well structured company called iMocha. I worked there only for 2 months, but I loved the work culture and the way they do things.

Since I was working with ASP.NET web forms for about 4 years, I can’t really grasp what is the need for such a complex framework like MVC. (If I had jumped directly from Spring and Hibernate to ASP.NET MVC framework, probably I wouldnt had this doubt). Certainly this is not suitable for rapid development and small projects. I wanted to know, the real benefits of using ASP.Net MVC Framework. I got this link. (I liked Plip’s creativity: the image that shows ASP.NET with in jail bars!) Don’t just read the post; the comments are more interesting than the post.

While trying to run this application, the thought of “continous learning “ (Martin Fowler has a definition?) suddenly struck me. As a core application developer I will have to learn and embrace new technologies as they evolve. This is a long process and will continue until I quit the software field. I saw this question in Stackoverflow.

The passionate guys never quit.

Advertisements
Categories: MVC Tags: , ,

ASP.NET MVC 1.0 – Model Item error

June 8, 2009 3 comments

Just to get the hang of it, today I started to learn what really ASP.NET MVC is. I have Visual Studio 2008 and Framework 3.5 SP1. I installed ASP.NET MVC 1.0 from the asp.net site. I learnt that Entity Framework comes with SP1. I also wanted to explore the entity framework.
I tried this tutorial.

Also I didn’t get this _db.MovieSet.ToList().Somehow my intellisense didn’t pick up this MovieSet. I was unable to compile. After that I changed the code to _db.MovieMaster.ToList() where _db represents my entity and MovieMaster is my table. The application compiled well But when I run the application and browsed to my URL, aha, I got the following error.

The model item passed in to the dictionary is of type ‘System.Collections.Generic.List’1…but this dictionary requires a model item of type..

MVC-Error1

I searched through Google and I found a guy who has exactly asked the same question. But he didn’t get the answer for that. I even tried the free book http://weblogs.asp.net/scottgu/archive/2009/03/10/free-asp-net-mvc-ebook-tutorial.aspx which I found in ScottGu’s blog. Really that book appeared complex to me.

After going through the searches and getting little frustrated, that thought struck me. The error appears to be like there are some handshake problem with Controller and View. Controller gives a collection object while view expects a Model item.

At first, I created the view from the Controller class when I was in the middle of the code.

public ActionResult Index()
{

return View();
}

I right clicked Index in controller and generated the View. As you see, View is just empty. The View Content dropdown in Add View pop-up was disabled. So when I created the View, I didn’t have the HTML to show the list or anything. The View was empty.

I changed my code to this:

public ActionResult Index()
{

return View(_db.MovieMaster.ToList());
}

I deleted the existing View for Index and recreated the view.

MVC-AddView

Now my View content drop down is enabled and I selected List from the dropdown. My newly created View had the entire HTML to show the List and everything worked fine!

Categories: ASP.NET, MVC

SQL Server 2008 : Prevent Saving changes

June 7, 2009 Leave a comment

Today I was working on a pet project and got this weird problem. I have worked with SQL Server 2005 but this is my first experience with SQL Server 2008. On the first very attempt with SQL Server I got this error from Visual Studio Management Studio.

SQLError-1

My change involves changing the column type from Nullable to Non-Nullable. So naturally SQL Server will have to drop the table and recreate the table. I understand.

But it is obvious that this message comes from Management Studio not from SQL Server. There must be some setting in Management Studio that does not allow me to do this change. I searched in the Tools  Options menu and aha I have struck gold.

SQLError2

Just uncheck “Prevent Saving changes that require table re-creation”. That’s it.
By the way, any good web3.0 project ideas for a asp.net pet project? Share with me

Resizing hard disk in a VM

June 4, 2009 Leave a comment

Today my virtual PC (Microsoft Virtual PC), on which I am running windows XP pro, was out of space. It had only 3MB free space available in its C drive. I wanted to increase the space. How to do it effectively without buying any software? I googled and within minutes I had a solution in front of me. Follow this link and this works like a charm http://kb.dutchalps.com/microsoftvirtualpc.htm
The idea is this:
1. Create another virtual hard disk by resizing (actually by using vmToolKit)
2. Add it as second disk to the existing VM. Now this second disk has free space (resized space – original space). But still this available space is unusable for the VM.
3. Boot the VM and Use DISKPART CMD line tool to extend the newly created VHD to the full available space.
4. Change the setting of the VM to boot from this second disk. Discard the first one.
Today I achieved this very easily. My VM is resized so that I can happily start filling up the rest of the space 🙂

Share if you know an easy way.

Categories: Virtual PC Tags:

Free ASP.NET 4.0 beta hosting

June 1, 2009 Leave a comment

ORCS web is offering a free plan to host your ASP.NET 4.0(beta) applications with SQL Server 2008. The plan is called “VS2010 and Web Deployment Tool Beta Program“. Sign up! This plan is available until October. (via)

Categories: ASP.NET 4.0

Black Screen in Windows 7

June 1, 2009 Leave a comment

Today I faced a weird problem. I have Windows 7 RC in my laptop. My laptop is HP Pavilion dv 1000. I have number of software development tools installed in my PC from Visual Studio 2005, 2008, 2010 to Flex Developer. I installed Microsoft Network Monitor 3.3 today. I downloaded from here.

After I installed this small piece of software that monitors the network, my wireless internet connection went down. Now I have to say another fact that I had some internet connectivity problems in the past week(I didnt know if it is because of Windows 7). A guy from Starhub(my internet provider) came to my house and fixed the problem by setting WPA security access to my wireless network. After this, my internet connection worked fine, except that the connection is closed whenever Windows went to hibernate mode. Once this happen, I can no way reconnect to my wireless network except to restart the machine. I am doing this for a while now.

So when the internet connection went down after installing Network Monitor I thought as usual that the problem was with the wireless connection and I restarted my machine. Windows 7 booted up normally, asked for the password and the circle rotated for a long time before it showed a black screen. Just a Black screen, that’s it. In the last line of that black screen there was “Windows 7, evaluation copy” thing; nothing more than that. I restarted the machine and restarted it again, in vain. Still I was getting the black screen. I switched to safe mode. Unfortunately I didn’t activate my restore options. Note that machine backup and restore option is not activated by default. So my restore option is void.

I realize that the problem causer was the Network Monitor. I tried to uninstall that piece of software. But later I realized that you will not be able to install/uninstall any software when Windows is in safe mode, because Windows Installer service will not be started in safe mode. In order to install/uninstall a software in safe mode, you will have to add a registry key as said here. A back door entry to start the windows installer service.

But I did not want to touch my registry by myself. After some Googling I came across a software named SafeMSI that changes the registry entry in such a way that you can run Installer service even in safe mode and so you will be able to install/uninstall any software.

After I uninstalled Network Monitor my laptop booted without a problem. Windows 7 is running quite fine. I still have to figure out why this Network Monitor has caused this trouble.

If you know the answer share with me.