Archive for September, 2006

Dynamic Images from Web Parts

What are you mad !! You can’t do it, how on earth are you going to suddenly be called again as an image and write binary data out.  

If you’ve read previous posts you will see that I have been writing a web part that gets SiteUsageData and displays it.  It uses some nasty COM+.  I got to thinking how on earth am I going to graph this dynamic data that changes per site?

HttpHandlers – for a bit more info on HttpHandlers see here on Scott Hanselman’s blog.

Now your up to speed on them, how can we use them with a part. 

First we have to spit out the IMG tag in your render section.

textWriter(“<img src=’_layouts/MyWebPartImage.ashx/’>”);

Of course that on its own does nothing, but note the url “_layouts”, not “/_layouts” this is very important as your part will run in the Site context of “/” if you do, instead of the current site.

Second you need to register this HttpHandler in web.config

<add verb=”GET” path=”MyWebPartImage.ashx” type=”Binaryjam.MyWebPartNs.MyWebPart, Binaryjam.MyWebPartNs, Version=1.0.0.0, Culture=neutral, PublicKeyToken=5**************d” />

Replace those details with your own namespace, typename, public key.  Ahh Did I say you need to GAC this part.  I haven’t experimented with not GACing this feel free to but to be sure GAC More >

Goggles

This is a fantastic mashup of with google maps.

Goggles

Fly your plane over, wherever, and shoot at it. 

Installing the COM+ .NET component

A couple of posts ago I talked about a GetUsageData webpart and how to access the data when not a site admin by using COM+ to retrieve the data.

But of course this needs to be installed.  Luckily for me we have a MSI library that Dan developed, which does all the sharepoint web part installation, as well as a host of other web based installation tasks that do not come out of the box with MS’s installation project.  But this only helps me with the webpart.

The earlier articles mention using Regsvsc to register the COM+ component or to allow lazy regristation.  Whilst manually registering is certainly better than lazy its still yet one more task that could be done as an MSI.

Here is a great article about registering COM+ components from start to finish with multiple methods. There is a section on writing an MSI installer class to acheive this using the .NET Library RegistrationHelper, it won’t take a genious for you to figure out how you can extend this to install your web part.

Note specifically the custom actions bit,  also look at custom action data as this is how you can get data into the MSI from the command line enabling unattended installations.  More >

How not to charge an iPod

I love gadgets, I have a few.  Like most they are USB devices that require charging.  I tend to charge them from my PC, when Im using it, or with the proper charger.

The proper charger, especially for my windos phone, charges in record time, the PC charges a lot slower and so I only PC charge when at work.

There is a reason for this, a USB socket from the PC will output 500ma at 5v, thats a power consumption of 2.5 Watts.  (If there are any electric engineers who want to correct this please do, but its the next part thats the kicker).

Tuesday I get a call from my mate saying we’re not going drinking he’s got back late and knackered, a sometimes regular occurance and a symptom of working in the games industry, but during this he tells me he is going to have words with his son.  Apparently when he got home he found his PC on, a device with a 450 Watt power supply and all the bells and whistles and uber gfx card, as you would expect for a games write, left on with the screen saver running maybe not the full 450watt consumption but a damn site More >

Blood Sweat and Tea

Earlier this week I was late for work, which is no big deal and it gave me the chance to listen to radio 4 programming that is not the news.  I was listening to Midweek with guests like Rupert Everett two and two artists and the last guest was a man who has a blog.  I enjoyed the other guests but this last guest was intriguing. 

He is an inner city London ambulance driver who for the past two years has kept a blog.  Quite a popular blog, but until this interview I had not come across it.  Some bright spark publisher has had the idea to take this man’s writing and turn it into a book. 

Blood, Sweat and Tea: Real Life Adventures in an Inner-city Ambulance

Now this isn’t the first time I’ve heard of blogs being turned into books so far I have heard of two

1. The confessions of a Video Store Clerk (Yes that kind of video store)2. The Best Software Writing I: Selected and Introduced by Joel Spolsky

I have read the blog of number one and own number 2 (which I wish I didn’t as whilst the writing is good I am undecided about how I More >

Sharepoint GetUsageData In a WebPart

  So you want the world to see your sites Usage data, except you have a problem, access to the reports is only provided to the administrators of a site.  Well you could give everyone administrator rights and you could gnaw off your own foot but neither is a good idea the administration one less so.

So I know I’ll do this in a web part and just call some impersonation stuff, you know that WindowsImpersonationContext object will do fine. So you build a part, do the “Mike Yarwood” and whoooah now no one ‘cept you, can see your site.

So this is the point you get stuck, and think “google”.  After some searching I found Patrick Tisseghem’s blog with a post on this very subject.

First he solves your “Bang” no one see this, which could come in handy for Admin only web parts

SPControl.GetContextSite(HttpContext.Current).CatchAccessDeniedException = false;

But then comes up with good a old .NET running under COM+ example.  His example shows a webs.count usage, but UsageData works in the same way.

Another helpful article I found later in trying to get this mare to work ( I just love mixing Sharepoint, Gac, Com+  IISReset is your friend!!!)  was found here.  This article fills in some More >

Parenting

When you hear this from your four year old you have to wonder is this a good thing or bad.

Dad, have you seen my boba-fet ?

I need my light sabre !

sung – “Sherree da di da da, bop the cat bah”

I don’t care that the lyrics aren’t right but the fact that my kid is trying to sing rock the cashbah – The Clash at the top of his voice was great.

Down side

Macdonalds spoiling all my good work by giving out crappy pop music players

We don’t do MacD’s very often but the one time we do, damn.

Core2Duo Upgrade

Well I finally upgraded my home PC, its been a while I was making do with an AMD XP1900+ and whilst faster than my previous PC it never behaved like the workhorse that was promised.  I mean take video encoding or picture manipulation, it was slow, real slow, primarily due to the lack of extensions in the chip that the intel had.

Living with the AMD was also a problem, it was so loud and cost to make it cool quitely was a little steep so it stayed upstairs in the backroom.  You could hear this thing from outside the room with the door closed.

This new chip though, talk about small, talk about cool, talk about quiet.  Hey I’m just using the standard components that come, admittedly the graphics card I have at this minute is passive cooled, but this new build is almost totally silent.  I have it in the lounge and you cant hear it above the TV, Sky+ box and of course the wind tunnel that is the xbox360.

Anyway a little advise for those thinking of upgrading to a core2duo.  BEWARE.  Hardly anyone else has one and when your build goes wrong for whatever reason there is no More >

Bionic Woman

Source BBC News

A former US Marine has become the first woman in the world to be fitted with a “bionic” arm that she can control by her thoughts alone.

Its a start, but a pretty amazing one.

tags:

XNA Physics API

Can’t speak for it but I found the link on the forum and thought I’d publish it, just to raise its profile a little more.

Project is here

tags: , ,