Saturday, February 18, 2006

 

Got it working: my new laptop displaying MSDN TV and the .NET show on my old living room TV

A few weeks ago, I decided to finally get myself a laptop as a experimental development environment. The virtual machine solution got too slow and I didn't want to risk the desktop machine to crash on me (my girlfriend is writing her PhD thesis on it as well). So I decided to go for a relatively small form factor: 13.3" wide screen. This allows me to work on it on the train. The machine I purchased also sported an S-Video port. This got me thinking: "that should allow me to watch streaming stuff from internet on my TV". There are a few types of content that I now tend to watch on my desktop PC, but that I'd rather see from the couch: MSDN TV, .NET show and the likes (when my girl is out :)), "Uitzending gemist", a site by the dutch public TV that shows a lot of the formerly broadcasted programs (except for purchased drama, for obvious juridical reasons) on demand and for example right now, the Winter Olympics are broadcasted online through 6 different channels, so you can pick your sport (as long as it's curling). So, with my brand new laptop under my arm, I bought an adapter cable to go from S-Video to SCART, the only thing my TV understands. Alas: the laptop seemed to work just fine, but it showed only black-and-white on screen. This seems to be a common problem: most normal TV sets do not understand the S-Video signal. If I had researched this properly, I would have known. Turns out that the SCART specs include the S-Video signal, but most older TV sets do not implement this (I am not much of an early adopter, I still don't own a DVD player!). So I ordered a new adapter from this shop that was supposed to do this trick. I got it in the mail yesterday and it works like a charm. I have just been watching the MSDN TV episode on Atlas. Pretty interesting. Thumbs up to svideo.com!

Friday, February 10, 2006

 

Step by step Gantt chart setup

Some people were having trouble setting the Gantt chart web part up on their WSS sites, so I thought I'd better show a little how-to. We will create a new list, create a Gantt chart for it. Then we will do the same for a custom created view on the data. This step-by-step guide assumes that you have managed to install the part in your site. Step 1, create a new list based on Task (you can use any list, but the nice thing of Task is that it includes a Start Date and Due Date field, which we need):

Step 2, we add an instance of the Gantt web part to the page:

Note that the part initially doesn't find a list named "". You must pass it the name of the list it should work with. When you do that it will look like this (check out the message in the web part): Note that the View field is still empty, but the error message is about a missing start date. The part automatically uses the default view (in this case 'All Tasks'), which does not include the Start Date. So we add it to the view (step 3):

Now, when you enter the right values for the web part (step 4), it will work like a charm:

Now let's do an extra thingy: we create a new view for the list, showing the 'Created By' and 'Created' fields and grouping by the status field: I added the status field to the list as well. The Group By field must be included in the rendered fields. This may seem odd, but the part needs it. I may fix this requirement, but not right now.

Labels:


Wednesday, February 01, 2006

 

Note to self: how to calculate week numbers in .NET

Today was certainly not the first time that I had to calculate week numbers for a DateTime in C#. I know that the problem is rather complex, but that the .NET framework knows how to do it. Still, every time I need it, I have to use Google to find the way to do it and to my amazement, the first 3 or 4 solutions I find are always hand-coded, bad solutions. These handcoders never take into account that the week number calculation is done differently in different countries. Some countries have weeks start on monday (which seems at least biblically correct) and others on sunday (which seems to be more like the Torah). Then: which week is the first week? Is it the week of January 1st? Is it the first week that falls mostly in the new year? Or the first that falls fully in the new year? Not only does .NET a good job in the calculation, it also knows what rules apply in which culture. So for once and for all, this is the way:

 

New version of Gantt part: Group By and Year/Month/Week views

I have been making some enhancements to the Gantt chart web part. There are basically 2 new features:

Shots

This is the classic month/day view, but now using groupings:

This is the new month/week view. Keep in mind that week numbers are fairly complex stuff and that the outcome depends on the local culture settings of your server. My development server uses Dutch settings and therefore the week numbers in this image reflect ISO week numbering:

And finally the year/month view:

Apart from the really new features, I also added some more robust error handling, preventing the web part to crash when a wrong or misspelled view name is entered. I hope that this will make the part more usable.

Download and Installing

Download the binaries and sources here. Then install the part on your server using the contained dll and dwp files.

Check out this manual for how to install a web part when you have no installer, but only the dll and dwp files.

When configuring the web part, you'll have to manually enter the list name, view name, start date field, end date field, title field and finally the Timebar mode (valid values are YearMonth, MonthWeek and MonthDay).

Labels:


 

How to manually install a SharePoint web part when you have only the DLL and DWP files

When I posted my Gantt chart web part, some people asked for more guidance on how to deploy web parts that don't come with an installer. In my opinion, a professional web part should come with an installer, but sometimes people post samples or demos and don't have the time (or motivation) to build an installer for you and you are stuck with a DLL file and a DWP file. This post describes how you get it to work.

Prerequisites

Placing the files in the right folders

You will have downloaded a ZIP file containing at the very least a DLL file and a DWP file. These two files are the bare necessities for installing your web part. In a default WSS installation, you will have a folder C:\Inetpub\wwwroot\wpcatalog. Place the DWP file in this folder. Place the accompanying DLL file in the C:\Inetpub\wwwroot\bin folder.

The new web part will now appear in the catalog when you browse for new web parts, but you have to change some settings before you actually use it.

Trusting the part

By default, SharePoint will distrust all DLLs that are placed in its folders. We have to tell SharePoint that our specific web part can be trusted. To achieve this, you open the web.config file in the C:\Inetpub\wwwroot folder. This is an XML file and you must be very careful editing it: when your edit results in invalid XML, the whole WSS system will stop working (if you have no idea what invalid XML is, this post is not for you). Also: every time you save the web.config file, the web server will restart itself (the AppDomain, really). Don't do this casually on a production system. Remember to make a backup of the old web.config. In the XML file, you will find a section <safecontrols> that contains a list of trustworthy web parts. Normally, the web part author will provide you with a snippet that should be added to the list.

Once the web.config is updated, your web part should be ready to roll. Some web parts may need additional steps, but these will then be described in detail by the part's author.

Labels:


This page is powered by Blogger. Isn't yours?