Dev Blog - Johan Danforth
I'm Johan Danforth and this is my dev blog - a mix of .NET, ASP.NET, Rest, Azure and some other random coding stuff.
-
File-sharing with Microsoft Max
If you haven't seen the Max demo or the video on Channel 9 yet, do it. The Max stuff is available for download on http://www.microsoft.com/max as well. As I understand it, you can only share photos so far with Max, but the technology sure lets you share all kinds of data - music, video... I love how Microsoft is making it easier for people to start sharing large data without the need for large ftp accounts :)
What is Max? This is what the Max-webby says:
"Microsoft® Codename Max is not like any other product. That's because it's not a product—it's your opportunity to try an exciting new user experience from Microsoft. Max is built on the next-generation WinFX Runtime Components technology that will drive the development of Windows Vista® applications. Today Max lets you make lists of your photos and turn them into beautiful slide shows to share with your family and friends. Tomorrow...who knows?"
UPDATE: Note that Max is not supported on any of the public Vista builds, so you have to run it om WinXP SP2 it seems. Also, some useful information about Max compatibility with older and newer versions of .NET and WinFX, taken from the Max web:
At this time, Max supports only the September CTP of the WinFX Runtime Components, which includes a Beta 2 version of the Microsoft .NET Framework.
What if I have an older version?
You must uninstall all previous versions of the WinFX Runtime Components and the Microsoft .NET Framework 2.0 Beta before you install Max.Note: If you have WinFX Runtime Components Beta 1 installed, you must also remove "Avalon" and "Indigo" via Add and Remove Programs. You should also follow these instructions to remove Windows Workflow Components Beta 1.
What if I have a newer version?
At this time Max does not support newer versions of the WinFX Runtime Components or the Microsoft .NET Framework 2.0. Stay tuned for a Max update that will support these versions. -
Some limitations in Outlook add-ins with VSTO
I had to code something, so a couple of nights ago I installed "the real" VS2005 and the VSTO toolkit and had a go at it. I've been trying out some Office-coding earlier but it has never been easier than what it is now with the integration with VS.
The first thing I noticed was the limitations you have for Outlook add-ins, especially if you want to add add or modify the left hand "navigation pane", you know the one with the big buttons on it saying Mail, Calendar, Contacts, Tasks and Notes and so on. As far as I understand it, you can't do it with the VSTO tools alone. Also, it seems pretty impossible to stick your own Windows Form into the big "information pane" where you list and read mails and such, you know where you do all the work. What you *can* do though is bring up a web page and put some HTML in there. Very limited...
I guess we'll have to wait until someone comes up with a neat trick or wait for Office Outlook 12.
There are loads of good code samples on the MSDN webby, and I'm currently playing with the My.Blogs DLL and the Outlook add-in for it. Very useful DLL and neat code to look at. Note that the Outlook sample does not include the DLL itself, you need to download that first and copy the DLL into the Outlook add-in solution. Also, if you're surfing through a web proxy, you will have to add this piece of proxy code to all Feed-classes where it says
client.UseDefaultCredentials =
TrueJust add this somewhere next to that statement:
Dim host As String = "your.proxy.host" Dim port As Integer = 8080 'your proxy port Dim proxy As WebProxy = New WebProxy(host, port)proxy.Credentials = CredentialCache.DefaultCredentials
proxy.BypassProxyOnLocal =
Trueclient.Proxy = proxy
Good luck!
-
Must...code...something...
Gah, I got to code something before I go nuts... What I do most of the days now is write Word docs, Powerpoint slides and a few "conceptual" and "high level" "architecture blueprints" and you know... things you do when you "move on" or "step up" from being a solution architect to program architect. Instead of writing class diagrams and code base classes you draw process chevrons and the closest thing you get to coding is a Word macro for pasting in unformatted text...
I'll probably code up something at home tonight... Perhaps dig out some of my old mod/mutator skills and hack up some rocket-boots for UnrealTournament :p
-
[Java] Lomboz Stable Build: S-3.1RC2
From the ObjectWeb Lomboz site. Seems that ObjectWeb has created a better Lomboz install package:
Lomboz Complete (All-in-one) Installation
The Lomboz Project focuses on a prodiving an easy install J2EE IDE tool that is prepackaged with all the necessary plugins that you can start using immediately in one package. Due to its content, this package can take a long time to download. It includes eclipse sdk 3.1, emf, gef, jem, wtp and lomboz all together. Dowaload it and you can get started right away.http://lomboz.objectweb.org/downloads/drops/S-3.1RC2-200508311616/
-
[Vista] Vista on VPC Cont.
I forgot to mention that I got Vista installed properly in the end - thanks to a few good blog posts out there. Basically - install Vista and end up with the terrible 4 bit graphics, start the installations of the additions and run it until it hangs near the end, go into the hardware drivers manager and just disable/remove the VGA display driver, restart and voilà - you got beautiful S3 graphics!
Note though that it is terribly, terribly slow, even if you got a gig of memory and a 3+ Ghz proc. I guess it's faster if you do a real install instead of VPC, but I don't want to ruin my current XP install. I wonder if the MS peep on the PCD were actually running the same Vista bits, coz their Vista-on-VPC where definitely running way faster than anything I've managed to install.
-
[Vista] Installing Vista on VPC... ZZzzzzzz.....
It took ages to install Vista on my VPC and som hassle getting past the disk formatting. Now I've tried to install the additions to it, and it has been running for some 3 hours. I wonder if it has stuck somewhere. Perhaps time to look at some of the Vista/VPC blogs out there....
Also need to do something about the display drivers. The supplied drivers did of course not work. I manged to get win2k drivers working on an older Longhorn installation, so I'll see if I can do the same trick again - download driver installation pack - unpack all the files from the cab/exe and point the driver install wizard at the unpacked files - install, reboot and hope for the best :D
-
Need to shrink your VPC .vhd file?
Just follow the steps outlined by Pablo in his blog.
My file shrunk from 10 GB to 7 GB, so it seems to work just fine. It targets Virtual PC 2004.
-
[.NET 2.0] Creating your own CatalogPart
In two earlier posts (here and here), way back in beta1, I showed how to create your own CatalogPart which could display a list of available web parts from a database or something. Some people will be quite happy to add web parts in a declarative way, but I wanted a solution which were more dynamic. In the future I'll try to write some sample code where you create web parts in a separate library and just drop them in a directory somewhere in the portal, and the web parts gets picked up automatically in the CatalogZone without the need to change the code. Just as a proof of concept.
Anyway, I noticed that the code changed somewhat in beta2 compared to how it used to work back in beta1. There are two ways (at least) you can add your own CatalogPart to a web page:
- Create your own CatalogPart and declare it in the CatalogZone, in the aspx-page. This is the simplest way. See sample below.
- Create your own CatalogZone and declare it in the aspx-page. This CatalogZone then adds your CatalogZone declaratively or in run-time. A bit more coding and there is no need to do it this way unless you plan on doing something special within your CatalogZone. What that may be, I don't really know :)
So, sample code for MyCatalogPart:
using System;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Collections;
namespace MyCatalogZones
{
public class MyCatalogPart : CatalogPart
{
public override WebPartDescriptionCollection GetAvailableWebPartDescriptions()
{
//Generate a list of available web parts that shows
//up in the catalog, each with a unique ID
//This sample code just adds one web part
ArrayList arrWpDescriptions = new ArrayList();
arrWpDescriptions.Add(wpDescription);
return new WebPartDescriptionCollection(arrWpDescriptions);
}
public override WebPart GetWebPart(WebPartDescription description)
{
//a bit of "dummy" code to add a specific web part
//which maps against "MyWebPartID" from the catalog
{
//returning an instance of the selected web part
MyWebParts.MyWebPart newPart = new MyWebParts.MyWebPart("My Web Part");
return newPart;
}
return null;
}
}
}
Note that in the code above, when you create the list, you may want to check if the user has already added an instance of the web part to his page before you add it to the list. This depends on if you want to let the users add a web part several times to the page or not. The web part may be such that it can be configured to show different content depending on its properties, so why not...
This is some sample code for adding your CatalogPart to a normal CatalogZone in an aspx-page:
<%@ Page Language="C#" AutoEventWireup="true" CodeFile="Default.aspx.cs" Inherits="_Default" %>
<%@ Register TagPrefix="jd" Namespace="MyCatalogZones" Assembly="MyCatalogZones" %>
<!-- lots of aspx code here... -->
<asp:CatalogZone ID="CatalogZone1" runat="server" >
<ZoneTemplate>
<asp:DeclarativeCatalogPart ID="DeclarativeCatalogPart1" runat="server">
<WebPartsTemplate>
<asp:label id="aPartInTheCatalog" runat="server" title="Catalog webpart">
<h2>Dummy part</h2>
<p>This is a part in the catalog.</p>
</asp:label>
</WebPartsTemplate>
</asp:DeclarativeCatalogPart>
<asp:PageCatalogPart ID="PageCatalogPart1" runat="server" />
<jd:MyCatalogPart ID="MyCatalogPart1" runat=server Description="My own dynamic catalog part" Title="My Special Parts Catalog" />
</ZoneTemplate>
</asp:CatalogZone>
<!-- lots of aspx code here... -->
You don't really have to have the DeclarativeCatalogPart and the PageCatalogPart there, but if you allow users to close your dynamically added parts, you may want to let them add them again, so the PageCatalogPart may be useful :)
-
XLINQ blows my mind
Just spent a couple of hours setting up a couple of VPC images with all "The Goods" we got from PDC'05. Last thing I installed was the LINQ tech preview. I've just spent a few minutes looking at the LINQ samples that comes on disk 4 and I've tried a few DLINQ stuff which was really impressive, but the XLINQ features just blows my mind. The whole style of programming seems so natural compared to the old XmlDocument way of doing things. Let me copy a few lines of code from the RssAggregator sample, a method which pulls Rss from a couple of feeds, extracts the items and returns a list of all these items:
static
IEnumerable<XElement> GetItems() { string[] feeds = { "http://blogs.msdn.com/cyrusn/rss.aspx", "http://blogs.msdn.com/mattwar/rss.aspx", "http://blogs.msdn.com/lucabol/rss.aspx", "http://www.pluralsight.com/blogs/dbox/rss.aspx", "http://blogs.msdn.com/jomo_fisher/rss.aspx"};
foreach (var str in feeds) {var feed =
XDocument.Load(str);var items = feed.Root.Element(
"channel").Elements("item"); foreach (var item in items) yield return item;}
}
I love the way you get hold of a specific element in the document with Element("nodename"). Not sure I'm comfortable with the "var" thing though. That's the "implicitly typed local variables" that comes with C# 3.0. I guess it's the way I read code. If you want to read about the new features in C# 3.0, you can download the spec from here.
-
Trying to install Windows Vista on VPC