Tuesday, December 29, 2009

Windows Virtual PC: Where is it?

Windows Virtual PC is Microsoft Virtual PC next version. It runs on Windows 7, but it is NOT part of it - you have to download it. The download page is http://www.microsoft.com/windows/virtual-pc/download.aspx, although the page title is "Download Windows XP Mode". You have to fill in the two dropdowns, and the page shows you two links. If you don't want Windows XP Mode, just click the second link, download and install the update to Windows 7 - it's Windows Virtual PC that's being installed.



Before you download it, you have to check if your's computer processor supports hardware virtualization technology (check out the links on Intel and AMD on the article). Most of the newer processors (post 2006-) ship with it. Some don't (for example, the T6670 on my Dell Vostro 1310 does not :-P). You can run the Hardware-Assisted Virtualization Detection Tool from Microsft to confirm that your processor supports VT (virtualization technology). If it doesn't, download Virtual PC 2007, the previous Windows Virtual PC version. It has less features, but it's disks are compatible with Windows VPC.

Thursday, December 24, 2009

Disk space used by an Windows 2003 Clean Install

Old one, but just for the record: a fresh Windows 2003 Standard + IIS + SP2 takes 5.74 Gb on the disk. In case you need to build a VM with that.

Friday, December 18, 2009

SELECT * FROM Table JOIN... ListBox???

A Linq way to retrive rows from one table based on rows from a related table whose lines are loaded into a listbox.

The ASP.NET test WebForm:



I want all products related to the selected categories (ListBox.SelectionMode = Multiple). The project is an ASP.NET Web App on VS 2010 Beta 2, and it contains an Entity Data Model on the Northwind sample database.

The LinkButton code:

    Protected Sub LinkButton1_Click(ByVal sender As Object, ByVal e As EventArgs) Handles LinkButton1.Click
Dim data As New NorthwindEntities
Dim selectedCategoriesProducts As New List(Of Products)
selectedCategoriesProducts = _
(From line As Products In data.Products
Join item As Integer In (From x In ListBox1.Items Where x.Selected = True Select x.value)
On line.CategoryID Equals item
Select line).ToList()
GridView1.DataSource = selectedCategoriesProducts
GridView1.DataBind()
End Sub
The Linq (to Entity) query joins the Products table (data.Products) to a integer list (Join item As Integer). The integer list is generated by a Linq (to Objects) query that selects the values (Select x.value) from the listbox options (ListBox1.Items) that are checked (Where x.Selected = True). The returned Products object list is then shown on the GridView.

In other words, we joined the Products table on Nortwind database with the ListBox selected items from an webform. Well, talk about data source abstraction... :-)

"Linq Is Fun!!!"
Buda On Using Linq To Query Data