How to expand a Virtual PC VHD

Today I wanted to install SQL Server 2008 on one of my demo images. The problem was however that I was running out of free space on my local C: drive. Too bad because upgrading SQL Server 2005 to SQL Server 2008 required some gigabytes. (Not sure how much it was exactly).

I did a lot of searching and using diskpart, GParted was suggested quite a lot ..However, nothing seemed to work exactly for me. Gparted just gave errors after a while of converting (took a long time too), diskpart just said that I could not extend the volume.

First things first: expanding the VHD. For this you need VHD Resizer from VMToolkit. You can download that following the link.

1) Select your original VHD file

2) Adjust the size

3) Click resize

With VHD Resizer, you create your new & bigger VHD.

Once created you need to go to Virtual PC – Settings and change your previous VHD with the new one.

Now comes the expanding part..it does require 3rd party tools. The good news is, if you are running XP, Vista or Windows 7 then the tool is completely free. If you are using a windows server OS then you’ll have to cough up the dough. But let me tell you something, I spent (wasted) a lot of time trying to expand the drive. I’m so happy about this tool that I just had to write about it. I opened the tool, selected the drive, selected the command, confirmed my actions and 5 seconds later my disk was expanded.

The tool that I’m talking about is EASEUS Partition Manager. You can download or buy the application on this link. Steps you need to take are:

1) Select your volume

2) Select the resize command in the toolbar

3) Adjust the size (using the unallocated size available) using the simple slider

4) Apply changes

5) Done

It’s quick and it works. Just the way I like it :)

Things to read: 12/05/2010

Visual Studio 2010 presentation posted to SlideShare

Earlier this month I did a presentation on Visual Studio 2010 for the company I work for. I kinda forgot to upload the slides right after. Busy period.

So here are the slides. If you have any question let me know.

This presentation covers the following topics:

- Visual Studio 2010 IDE enhancements/changes

- Architecture possibilities

- New debugging experience (IntelliTrace, Breakpoints enhancements, datatips)

- What’s new for Testers?

PS: If you want to have some more detailed information on testing in Visual Studio 2010 and TFS 2010, check out Slide Deck from Whats New for Testing in Visual Studio 2010 and TFS 2010. Webcast of this presentation can be found here: Whats New for Testing in Visual Studio 2010 Webcast

- Extending Visual studio

- Other new features

Looking for Crystal Reports for Visual Studio 2010?

Well Crystal Reports isn’t included in VS2010 by default any more. From now on you need to download Crystal Reports from SAP.com. The good thing however is that you will be able to download this free, without any registration required. That’s good news, right?

So if you want some more information on this new release for VS2010, check out Crystal Reports in Visual Studio 2010 on sap.com. Or if you don’t want to get started, you can download Crystal Reports for VS2010 here

Visual Studio 2010 has been released!!

It’s out there!!

from Soma’s site

The new release of Visual Studio 2010 has plenty of compelling new features and updates that will make every developer more productive.

· Visual Studio 2010 allows users target of the right platform for their application, including Windows 7, Windows Server 2008 R2, SQL Server 2008, SharePoint. Office, Windows Azure, and Windows Phone 7 applications using their existing skills.

· Visual Studio 2010 is a rich, personalized development environment. We know that software developers spend much of their time in the IDE, and features like the new editor and multi-monitor support make your time in Visual Studio more productive and enjoyable.

· Teams are able to work more efficiently using Application Lifecycle Management tools. We’ve done a great deal of work in Visual Studio 2010 to improve testing and debugging tools. Features like IntelliTrace and easy project management help your team ensure high quality.

It’s really cool that you could follow the keynote live and even ask questions via Twitter.

image

MS SQL Server Samples

Looking for some sample data to populate your database (SQL Server 2005/2008/R2, SQL Azure) with? Have a look at this link on CodePlex

10 Hands on labs for Sharepoint 2010 development

Use these 10 hands-on lab manuals for SharePoint 2010 to get started learning SharePoint 2010 development. Each lab is available in C# and Visual Basic.
HOL01 - Developing a Visual Web Part in Visual Studio 2010
This hands-on lab introduces the Visual Studio 2010 SharePoint development environment. It shows how to build a Visual Web Part using LINQ to SharePoint, and how to connect one Web Part to another Web Part on the page.
HOL02 - Developing a List Definition and Event Receiver in Visual Studio 2010
This hands-on lab walks you through building a list definition for SharePoint 2010 in Visual Studio 2010. It also shows how to build an event receiver for the list in Visual Studio 2010 and deploy it to SharePoint. After the list and event receiver are deployed, you can use the developer dashboard to evaluate the performance of the event receiver.
HOL03 – Developing Advanced Web Parts for SharePoint 2010 with Visual Studio 2010
This hands-on lab shows how to build a Web Part using several SharePoint-specific controls in Visual Studio 2010. Investigate advanced built-in Web Parts, including the Data View Web Part.
HOL04 – Developing with LINQ to SharePoint in Visual Studio 2010
This hands-on lab explores a variety of LINQ queries on SharePoint 2010, going into more depth than the introductory hands-on lab. It also walks you through an exercise of creating a custom content type in Visual Studio 2010.
HOL05 - Developing for SharePoint 2010 with the Client OM and REST in Visual Studio 2010
This hands-on lab introduces the Client object model for use in calling SharePoint 2010 APIs from a client machine. It also shows the use of ADO.NET Data Services to call REST services in SharePoint 2010.
HOL06 – Developing a BCS External Content Type with Visual Studio 2010
This hands-on lab walks you through building an external content type for Business Connectivity Services using Visual Studio 2010. It also builds a form for Microsoft Outlook and shows the data being edited offline in Outlook.
HOL07 – Developing a SharePoint 2010 Workflow with Initiation Form in Visual Studio 2010
This hands-on lab walks you through building a workflow in Visual Studio 2010 for SharePoint 2010. You add an initiation form to the workflow and use an external data exchange activity in the workflow.
HOL08 - Developing SharePoint 2010 User Interface with Silverlight in Visual Studio 2010
This hands-on lab walks you through building Microsoft Silverlight applications for use in SharePoint 2010. You will access SharePoint 2010 data in Silverlight using the Client object model.
HOL09 – Developing SharePoint 2010 Sandboxed Solutions in Visual Studio 2010
This hands-on lab walks you through building a Sandboxed Solution Web Part for SharePoint 2010. It will also add code to the Web Part that overloads the limits placed by the sandboxed solution, and you will review how the solution is shut down.
HOL10 - Developing SharePoint 2010 User Interface Ribbon and Dialog Customizations
This hands-on lab walks you through adding a custom action to the SharePoint 2010 ribbon, and creating a Web Part that uses the Dialog Framework.

Download them on Microsoft Download

Employee Info Starter Kit (v4.0.0) with HttpException

So I wanted to have a look at the new Employee Info Starter Kit. This sample application covers some of the new technology that you can use with ASP.NET Webforms. You can download the sample application here. So I extracted the package, set the correct start up project and started the application. All of a sudden, before the application actually started up, I’m greeted with this exception:

System.Web.HttpException (0×80004005): Session state has created a session id, but cannot save it because the response was already flushed by the application.\r\n   at System.Web.SessionState.SessionIDManager.SaveSessionID(HttpContext context, String id, Boolean& redirected, Boolean& cookieAdded)\r\n   at System.Web.SessionState.SessionStateModule.CreateSessionId()\r\n   at System.Web.SessionState.SessionStateModule.DelayedGetSessionId()\r\n   at System.Web.SessionState.SessionStateModule.ReleaseStateGetSessionID()\r\n   at System.Web.SessionState.SessionStateModule.OnReleaseState(Object source, EventArgs eventArgs)\r\n   at System.Web.SessionState.SessionStateModule.OnEndRequest(Object source, EventArgs eventArgs)\r\n   at System.Web.HttpApplication.SyncEventExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute()\r\n   at System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously)

Seems like there is something wrong with the session. Opened up my favourite browser and did some searching. Some minutes later, I had found the solution and here it is..

Open Global.asax and make sure the Session_Start method looks like this:

protected void Session_Start(object sender, EventArgs e)
{
   string sessionId = Session.SessionID;

   if (!Eisk.DataAccessHelpers.ConnectionStringManager.IsConnectionStringOk())
       Response.Redirect("~/public/install.aspx");

}

That should solve the problem! More info can be found here

Failed to install ASP.NET MVC2 with Visual Studio 2010 RC

Today I wanted to experiment a little bit with ASP.NET MVC2. I downloaded the bits from Microsoft Download and clicked on the executable. Unfortunately an error occurred and the installation was stopped.

No worries, this is an easy fix. If you click on Details, then you’ll see what’s going on. From my previous Visual Studio 2010 release, I still had an older version of ASP.NET MVC.

image

image

I just removed ASP.NET MVC 2 and then tried to reinstall, this time it succeeded!

image

Phil Haack has some more information on this on his blog

Entity Framework 4.0 – Part4: How to use your own POCO’s

These tutorials are built using Visual Studio 2010 RC and .NET 4.0. RC. This means that Entity Framework 4.0 is used. At the moment of writing this, VS2010 and .NET 4.0 are not yet released as RTM so information provided in this post could change in the future.

In the previous articles I mainly talked about things you could already do with eelier version of Entity Framework. EF4.0 has some better tooling, we saw this already with the complex types. With the new version of Entity Framework there is also out of the box support for POCO (Plain Old CLR Objects). This I personally like very much because I’m not such a big fan of generated classes. Previously you didn’t have much choice. You had to work with the object’s that EF generated for you. Did you have some specific logic in your property getters or setters? Then you had to find another solution. Remapping your objects to something else was one of them. You could not rely on these generated classes to contain custom business logic. If you rebuilt the edmx, your custom logic would be removed and the classes would be regenerated. There were however some clever tricks to get POCO support working before EF4.0. For instance have a look at: Persistence Ignorance (POCO) Adapter for Entity Framework.

In EF4.0 we have POCO support, so we can use our own business objects, domain objects. so let’s jump into the code and see how we work with that. I’ll use the same database as I used before.

- Create a new console application

- Add a new file to the project, choose ADO.NET Entity Data Model

image

- Here we see the same screen as we did before. Again we’ll create a model based on the database. This is not obliged. You could create the model yourself, but for this I would just let EF generate the classes for you. You will save yourself a lot of time.

image

- Now we should select our data source, I’ll choose the same database that I used before

image

- It’s time to select the tables we want to work with. I’m just going to use the Article for this.

image

- If everything is fine, you should end up with the following diagram

image

-So let’s summarize what happened:

- EF retrieved the information on the database
- Retrieved specific information on the table where you want to create entities for
- Based on these entities, EF created the CSDL, SSDL and MSL
- EF created the entities for you to access your data in the underlying table
- For these entities, EF generated some classes

image

- These generated classes are the objects that we want to replace with our own objects

- Let’s first stop the auto generation process. Select your .edmx file in the solution explorer and press F4 to open the properties window. There you should see the property “Custom Tool” with the value: EntityModelCodeGenerator. Go ahead and delete that value. Just make the field empty. If you rebuild now, you’ll see immediately that the generated code behind file will go away.

image

- OK let’s start by creating our POCO. One thing to remember is that this has to be EXACTLY the same as your entity. Do it wrong and you WILL get exceptions…I’ll go over this later

- First let’s create the Article class

    public class Article
    {
       public int Id { get; set; }
       public string Name { get; set; }
       public string Description { get; set; }
       public Double Price { get; set; }
       public int Stock { get; set; }
    }

- As you can see this matches to my entity shown in the previous image

- Now we need a way of connecting to the model. The bridge between your POCO and the edmx file containing the mapping schema etc is the ObjectContext class. This class uses the connection string in the App.Config file to connect to the edmx file and the underlying table. The connection string is one of the parameters we need to pass to the base constructor of the ObjectContext. In this ObjectContext implementation we’ll also define the entities. This is called an ObjectSet, that’s what we are adding to the ObjectContext. Let’s have a look at this now:

public class ArticleModel:ObjectContext
    {
        public IObjectSet<Article> Articles { get; set; }
        public ArticleModel()
            : base("name=DemoDBEntities","DemoDBEntities")
        {
            if (Articles == null)
                Articles = CreateObjectSet<Article>();
        }
    }

- I don’t think much explanation is needed anymore. The first parameter that I pass to the base constructor of the ObjectContext class is the connection string, the second one is the name of the container. There are some different ways that you can do this..the Object Browser tells you how:

image

- OK we’re almost done! Now let’s test run what we just created

    class Program
    {
    static void Main(string[] args)
    {
        var am = new ArticleModel();

        foreach (var art in am.Articles)
        {
            Console.WriteLine(art.Name);
        }
        Console.ReadLine();
    }

image

Exceptions

Now something short on exceptions because exception can occur while working with your own POCO’s.

- Make sure your object properties are the same as the properties in your EF entity. If you don’t have the same properties, then you’ll receive an InvalidOperationException saying something like: Mapping and metadata information could not be found for EntityType ‘EFPOCO1.Article’. I don’t like these kind of errors because they do not show which column is wrong. You have match every property and see which one is different.

- Make sure your App.Config can be read. If the ObjectContext can’t locate the App.Config or the name of the connection string is incorrect then you’ll receive an ArgumentException saying something like: The specified named connection is either not found in the configuration, not intended to be used with the EntityClient provider, or not valid.

OK as you can see it isn’t that hard to use your own POCO’s. I’m not saying EF generated classes are bad, it’s just that if you have some specific logic that you want to have in your objects, then you’re kind of stuck and need to be creative.

Anyway, hope this was informative.

Shout it
kick it on DotNetKicks.com

« Vorige paginaVolgende pagina »