With the recent announcements and demos for the new Microsoft Surface I've noticed a few people talking about the version 1 sdk, and the fact they can't install it on their x64 Windows 7 boxes, so I thought I'd give a quick bulletpoint guide to how to acheive this.
To get up and running you will need the following:
XNA 2 Redist
http://www.microsoft.com/downloads/en/details.aspx?FamilyID=15fb9169-4a25-4dca-bf40-9c497568f102&displaylang=en
Windows SDK
http://msdn.microsoft.com/en-us/windows/bb980924
Surface SDK 1.0 SP1
http://www.microsoft.com/downloads/en/details.aspx?FamilyID=3db8987b-47c8-46ca-aafb-9c3b36f43bcc&displaylang=en
1) Once you have the above, install the XNA 2 Framework and the Windows SDK
2) Go into the windows sdk bin directory (probably C:\Program Files\Microsoft SDKs\Windows\v7.0A\Bin or similar) and run Orca.msi
3) Run Orca and open the file SurfaceSDKWE.msi
- Locate LaunchConditions in the tables list on the left
- Delete the rows 'Installed OR NOT VersionNT64'and 'Installed OR VISTASKU<>"Starter"'
Also, if you are using Visual Studio 2010 and do not have any installation of Visual Studio 2008 then you will want to also delete the following:
-'Installed OR (VS2008SPLEVEL AND VS2008SPLEVEL >= "#0") OR (VCSEXP2008SPLEVEL AND VCSEXP2008SPLEVEL >= "#0")'
-'Installed OR (VS2008SPLEVEL AND VS2008CSPROJSUPPORT) OR VCSEXP2008SPLEVEL'
Save the file and close orca
4) In a command prompt extract the msi file either using 'msiexec /a SurfaceSDKWE.msi /qb TARGETDIR=C:\Temp\SurfaceSDKWEExtract'
5) Open the msi in the extract directory using orca and remove the launch conditions again
5.5 - optional) If for whatever reason you are not using the visual studio command prompy set your machine's PATH environment variable to include the windows sdk bin directory, or alternatively prefix the corflags commands below with the full path
6) Run an administrator level command prompt and navigate to the directory you extracted the msi to, then in to \Microsoft Surface\v1.0\ and run
'corflags setupcustomaction.exe /32bit+ /force'
7) Run the installer you have just modified
8) Using the command prompt navigate through the install directory and its children and run the corflags command against each of the executables
You should now be able to run the demos etc, but if you want to build and run the code samples yourself you will need to ensure that the project settings are targetting x86 CPUs explicitly
9) HAVE FUN
General postings on bits and pieces of ASP.net and other Microsoft development that may be of use out there
Thursday, 20 January 2011
Tuesday, 18 January 2011
It takes all sorts
Just to show that there are all sorts in the industry I just thought I'd share one link I came across the other day (and no, I was not searching for it) - http://www.ibm-m4.com/
It really does take all sorts
It really does take all sorts
Sunday, 5 December 2010
Just to let you know, for updates on the blog, and useful links to development tips and tricks as I find them I am on twitter as delradie - http://twitter.com/#!/Delradie
Using Linq to remove duplicate data from a DataTable
In response to a question on experts exchange I just wanted to do a quick post on data cleanup using Linq
Linq has a lot of very useful operations that can be used to reduce the complexity of array (or dataset) operation.
In this instance the operator .Distinct() can be used to remove duplicates in a datatable, with a small priviso:
If you call the method on the datatable (using the call .AsEnumerable() to get it in to a form you can work with in linq) with no parameters you will find that it returns all rows - this is because by default it does an object comparison, and of course all the records have their own memory address, and therefore are considered to be different. The trick is to tell it to use the default DataRowComparer which will get it to do a column by column value check.
One final point to watch out for is in getting the data back in to datatable - remember that datasets/tables/rows are reference types, so clearing down the tabe will actually cause problems, so the trick is to take a copy of the datatable, clear the original, operate on the copy, then reimport the rows to the cleared down table.
All put together, the following function will handle this for you:
/// <summary>/// Removes duplicate rows from the target table/// </summary>/// <param name="sourceDataSet">Dataset containing the table to operate on</param>/// <param name="targetTableName">Name of the table to operate on</param>
{public void GetUniqueRows(DataSet sourceDataSet, String targetTableName) //Check there is data to operate on
//Take a copy of the table so clearing does not affect the operation
//Run the distinct operation
//Clear all data from the target table sourceDataSet.Tables[targetTableName].Clear();
//Re-import the distinct rows to the 'live' table
{
sourceDataSet.Tables[targetTableName].ImportRow(DistinctRow);
}
} foreach (DataRow DistinctRow in OutputRows) DataRow[] OutputRows = (from rows in OperatingData.AsEnumerable() select rows).Distinct(System.Data.DataRowComparer.Default).ToArray() as DataRow[]; DataTable OperatingData = sourceDataSet.Tables[targetTableName].Copy(); if (sourceDataSet.Tables[targetTableName].Rows.Count == 0) return;
Friday, 3 December 2010
If you've found any of this information useful
I know that everyone is pretty much charitied out, but if you've found any of the information presented here useful, or just have a good heart, please support a cause that is very dear to me:
Happy Staffie Rescue (http://www.happystaffierescue.org.uk/), based in the west midlands, are a breed rescue for Staffordshire Bull Terriers - a much maligned but very loving breed (we have 3 of our own).
If you can spare even a small amount this would help make a big difference for some wonderful dogs that really do deserve much better than the hands that life has dealt them.
You can donate online via http://www.happystaffierescue.org.uk/id123.html
Merry Christmas
Happy Staffie Rescue (http://www.happystaffierescue.org.uk/), based in the west midlands, are a breed rescue for Staffordshire Bull Terriers - a much maligned but very loving breed (we have 3 of our own).
If you can spare even a small amount this would help make a big difference for some wonderful dogs that really do deserve much better than the hands that life has dealt them.
You can donate online via http://www.happystaffierescue.org.uk/id123.html
Merry Christmas
Monday, 29 November 2010
Vertical GridViews in ASP.net - Part 2c: Plumbing in the custom rendering
Now, as promised, how to plumb in the custom rendering code for the cell level rendering:
The key function you will need to work in is an override to the RenderChildren function in your inherited gridview (protected override void RenderChildren(HtmlTextWriter writer)).
First off, you need to create a dictionary of your custom row renderers, one for each row in the controls Rows collection (of type GridViewRowCollection), indexed by the original row id (or a list of them in the same order as the original collection. As set up previously, the 'row renderer' is constructed by passing in the gridviewrow.
As you're overriding the child controls the one drawback is that you have to manually set up that table, using the htmlwriter to output the various rendering parameters:
if(this.BorderWidth != null)
writer.AddAttribute(HtmlTextWriterAttribute.Border, this.BorderWidth.ToString());
writer.AddAttribute(HtmlTextWriterAttribute.Cellspacing, this.CellSpacing.ToString());
writer.AddAttribute(HtmlTextWriterAttribute.Cellpadding, this.CellPadding.ToString());
if (this.CssClass != null)
writer.AddAttribute(HtmlTextWriterAttribute.Class, this.CssClass.ToString());
writer.RenderBeginTag(HtmlTextWriterTag.Table);
then the important bit - for the moment we'll go with the simplified case that you are displaying all your datarows in one long row (I'll cover wrapping in a future post).
Firstly, iterate over the columns in the GridView's Columns collection (of type DataControlFieldCollection) - there is one entry in this collection for every field (BoundField,TemplateField, etc.) specified in the markup using the gridview.
Within this loop you then need to:
- Tell the html writer to write out the <TR> tag:
writer.RenderBeginTag(HtmlTextWriterTag.Tr);
- Loop over the rows in renderer list/dictionary, and within that call your renderer's custom cell Render Method:
Renderers[RowIndex].Render(writer, ColumnIndex, IsHeader);
- Tell the htmlwriter to write out the closing </TR> tag:
writer.RenderEndTag();
After the loops you then need to tell the html writer to write the closing </TABLE> tag with a final call to writer.RenderEndTag()
With the code detailed about you now have the full basic solution. I will post more on some additions that you will most likely want - wrapping, empty cell handling, and Custom CSS properties, all of which are used in the featured product grids on http://public.presalesadvisor.com/ - but hopefully this is enough to get you started.
The key function you will need to work in is an override to the RenderChildren function in your inherited gridview (protected override void RenderChildren(HtmlTextWriter writer)).
First off, you need to create a dictionary of your custom row renderers, one for each row in the controls Rows collection (of type GridViewRowCollection), indexed by the original row id (or a list of them in the same order as the original collection. As set up previously, the 'row renderer' is constructed by passing in the gridviewrow.
As you're overriding the child controls the one drawback is that you have to manually set up that table, using the htmlwriter to output the various rendering parameters:
if(this.BorderWidth != null)
writer.AddAttribute(HtmlTextWriterAttribute.Border, this.BorderWidth.ToString());
writer.AddAttribute(HtmlTextWriterAttribute.Cellspacing, this.CellSpacing.ToString());
writer.AddAttribute(HtmlTextWriterAttribute.Cellpadding, this.CellPadding.ToString());
if (this.CssClass != null)
writer.AddAttribute(HtmlTextWriterAttribute.Class, this.CssClass.ToString());
writer.RenderBeginTag(HtmlTextWriterTag.Table);
then the important bit - for the moment we'll go with the simplified case that you are displaying all your datarows in one long row (I'll cover wrapping in a future post).
Firstly, iterate over the columns in the GridView's Columns collection (of type DataControlFieldCollection) - there is one entry in this collection for every field (BoundField,TemplateField, etc.) specified in the markup using the gridview.
Within this loop you then need to:
- Tell the html writer to write out the <TR> tag:
writer.RenderBeginTag(HtmlTextWriterTag.Tr);
- Loop over the rows in renderer list/dictionary, and within that call your renderer's custom cell Render Method:
Renderers[RowIndex].Render(writer, ColumnIndex, IsHeader);
- Tell the htmlwriter to write out the closing </TR> tag:
writer.RenderEndTag();
After the loops you then need to tell the html writer to write the closing </TABLE> tag with a final call to writer.RenderEndTag()
With the code detailed about you now have the full basic solution. I will post more on some additions that you will most likely want - wrapping, empty cell handling, and Custom CSS properties, all of which are used in the featured product grids on http://public.presalesadvisor.com/ - but hopefully this is enough to get you started.
Friday, 26 November 2010
Databound google sitemaps with repeaters in asp.net
I thought I'd put out another use for the xml databinding as described in the earlier post on RSS feeds.
The basic principle can be used for anything, but one use we've put it to on the Pre-Sales Advisor site is to generate a databound xml sitemap for google submission (for full details of the format see the official site at http://www.sitemaps.org/).
In most data driven websites the data pages you really want found are displayed by calling a standard page with the correct querystring (e.g. http://public.presalesadvisor.com/Common/BuildByFamily.aspx?identity=2141&dso=en-US for Bladecenter HS22, http://public.presalesadvisor.com/Common/BuildByFamily.aspx?identity=3013&dso=en-US for system x3630 M3s). As long as you can pull out a list of valid identities through a datasource then all you need to do is set up your repeater templates as follows:
<HeaderTemplate>
<urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9"
xmlns:image="http://www.sitemaps.org/schemas/sitemap-image/1.1"
xmlns:video="http://www.sitemaps.org/schemas/sitemap-video/1.1">
</HeaderTemplate>
<FooterTemplate>
</urlset>
</FooterTemplate>
<ItemTemplate>
<url>
<loc><%# Server.HtmlEncode(String.Format("http://www.yoursite.com/page.aspx?id={0}", DataBinder.Eval(Container.DataItem, "IDENTITYCOLUMN")))%></loc>
</url>
</ItemTemplate>
and there you have it. For an example of what it comes out like have a look at the xml site map linked from http://public.presalesadvisor.com/sitemap.aspx (incidentally, if you have a look at the global part map that uses basically. the same data sources and repeater setup).
The basic principle can be used for anything, but one use we've put it to on the Pre-Sales Advisor site is to generate a databound xml sitemap for google submission (for full details of the format see the official site at http://www.sitemaps.org/).
In most data driven websites the data pages you really want found are displayed by calling a standard page with the correct querystring (e.g. http://public.presalesadvisor.com/Common/BuildByFamily.aspx?identity=2141&dso=en-US for Bladecenter HS22, http://public.presalesadvisor.com/Common/BuildByFamily.aspx?identity=3013&dso=en-US for system x3630 M3s). As long as you can pull out a list of valid identities through a datasource then all you need to do is set up your repeater templates as follows:
<HeaderTemplate>
<urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9"
xmlns:image="http://www.sitemaps.org/schemas/sitemap-image/1.1"
xmlns:video="http://www.sitemaps.org/schemas/sitemap-video/1.1">
</HeaderTemplate>
<FooterTemplate>
</urlset>
</FooterTemplate>
<ItemTemplate>
<url>
<loc><%# Server.HtmlEncode(String.Format("http://www.yoursite.com/page.aspx?id={0}", DataBinder.Eval(Container.DataItem, "IDENTITYCOLUMN")))%></loc>
</url>
</ItemTemplate>
and there you have it. For an example of what it comes out like have a look at the xml site map linked from http://public.presalesadvisor.com/sitemap.aspx (incidentally, if you have a look at the global part map that uses basically. the same data sources and repeater setup).
Subscribe to:
Posts (Atom)