FON community wireless network

FON! I posted earlier about the FON community wireless network project. The idea is that members of the network share a proportion of their bandwidth for the benefit of other members. Well yesterday my free FON router arrived; setup was a breeze & their is now a wireless hotspot at my address! So it you are ever in the Greenham area of Newbury & you need wi-fi access, you know where to come!

MSDN Library Sidebar Search Gadget

Ditto!

How did I do without this??

Using WPF/E to simulate Vista

I’ve been meaning to blog about this for a while now, and am actually quite late to the game as loads of people have already commented on it.

‘This’ is a WPF/E application using the new(ish) FebCTP which emulates Windows Vista, it is an astounding example of what WPF/E can do.  There’s the glass effects, the sidebar clock tells the correct time, the window snapshots work when you hover over an item on the taskbar and you get balloons popping up intermittently.  The best bit by far though is the picture gallery and media player.

Have a look, there are two versions, one based in the home SKUs and one based on the business SKUs.

ReorderableListBox re-revisited

Update:
This now actually reorders the list.  I’d originally intended the consumer to handle the reordering of the items but I’ve tried to get the control to reorder internally; to be honest it’s a bit of a hack as you never know what type of list is going to be bound to the listbox.  I’ve create an ArrayList called internalList and do the reordering in that, reassigning it to the ListBox’s ItemsSource at the end.

Known Issues:
If you click on an item and then click/drag the same item what you are dragging around is actually the item after the one you’d expect.  It’s fine if you click/drag a new selection though; I’ll try and work that one out tonight.

Jim posted a comment asking if I had the source code for my ReorderableListBox sample.  The answer was no, now it is yes.  I’ve rewritten it against the RTM release of WPF, it still uses bits from Marcelo’s DragDropAdorner so thanks again to him.

You can get it from here.

The usual caveats apply, if you use it or modify it please keep the copyright notice with it and stick my blog address somewhere in your app.  If it doesn’t work don’t come running to me because it only took a couple of 4 hours :)

Have fun!

Posted in Samples, WPF. 1 Comment »

Atomic Blography 2.0

Missing a ‘g’ but, I suspect, none of the genius, Karl has moved his blog to WordPress.  The question is though, will he keep it up? I hope so as I enjoy reading it.

Check it out, http://karlhulme.wordpress.com!

Stormhoek Select Rosé…

Hugh from GapingVoid has been using blogging to promote the Stormhoek vineyard that he’s involved in; by all accounts, it’s going quite well. 

I am not usually a fan of rosé, but having seen his distinctive cartoon style on a shelf in Tesco I decided to give it a try. It’s not half bad either!  Eminently quaffable.

Go buy some.

Technorati tags: , ,

DDD5 Announced!

Craig Murphy has just announced the date for DDD5

It’s scheduled for Saturday 30th June 2007 with a call for speakers on the 24th March.

Stick it in your diaries everyone!

Posted in IT. 4 Comments »

My first WSS 3.0 WebPart

As I said earlier, I’ve been playing with WSS as a blogging platform, and one thing I wanted that I could find was a web part which displayed the top 5 latest posts across the entire site.

So, I set about writing one to do the job (source code).

Now first off this took me a couple of hours to do so no complaints about scalability, I do realize it won’t, but it’s a starting point!

First you’ll need the WSS 3.0 SDK

Once you’ve installed that, open up Visual Studio, create a new project and select the WebPart template from under C#->Sharepoint.

You’ll next need to create a DTO to store the post summary.   

public class PostSummary { private string title; private string summaryText; private string postDateString; private DateTime postDate; private string author; private string permalink; private string sitelink; public PostSummary( string title, string author, string summaryText, DateTime postDate, string sitelink, string permalink) { ... } }

 This class also does some string manipulation to get the post time in a decent format and also overrides ToString() which we use to output the HTML we want to render for each post summary. It’s not important here, but is included in the source code.

Next we’ll look at the actual web part.  This is basically a class which inherits from ‘WebPart’ and overrides it’s ‘Render’ method. We need to do 3 things in the render method.

  • Loop over every site and identify those that use the blog template.
  • Build a list of post summaries and sort it based on date, youngest first.
  • Write our list out as HTML.

So

[Guid("4535f021-7e6e-46d4-b821-7a98007357ee")] public class SiteWideRSSRiver : WebPart { protected override void Render(HtmlTextWriter writer) { List<PostSummary> postSummaryList = this.findPosts(); postSummaryList.Sort(new PostSummary.PostSummaryComparer()); this.WritePosts(writer, postSummaryList); } }

Ok, so now lets define those three bits.

Find Posts

We get the current Sharepoint site context and from that a collection of all the webs.

We iterate over that collection for each site, and then over that for each subsite and as we go we check if the title contains “Posts” (there’s probably a better way of determining what the template is but I couldn’t find it).

Once we have a blog templated site we get the latest post and work out the permalink and the site url and pass that into a new PostSummary along with the title, author, body text and publish date and add the new PostSummary to a list.

private List<PostSummary> FindPosts() { SPSite mySite = SPContext.Current.Site; SPWebCollection subSites = mySite.AllWebs; List<PostSummary> postSummaryList = new List<PostSummary>(); for (int i = 0; i < subSites.Count; i++) { SPListCollection lists = subSites[i].Lists; for (int j = 0; j < lists.Count; j++) { if (lists[j].Title.Contains("Posts")) { SPListItem spListItem = lists[j].Items[lists[j].Items.Count - 1]; string defaultViewUrl = ResolveClientUrl(lists[j].DefaultViewUrl); string sitelink = defaultViewUrl.Replace(this.PostDefaultViewPath, string.Empty); string permalink = defaultViewUrl.Replace("AllPosts.aspx", "Post.aspx?ID=") + spListItem["Permalink"]; postSummaryList.Add(new PostSummary(spListItem.Title, (string)spListItem["Author"], (string)spListItem["Body"], (DateTime)spListItem["Published"], sitelink, permalink)); } } } return postSummaryList; }

Once we have the list of latest posts from across the Sharepoint Site we need to sort it.

Sort the list

I created a child class inside PostSummary called PostSummaryComparer which just does a DateTime.Compare on the postDate field of the PostSummary and multiplies it by -1.  This way we get the youngest post at the top, oldest at bottom.

public class PostSummaryComparer : IComparer<PostSummary> { public int Compare(PostSummary x, PostSummary y) { return DateTime.Compare(x.postDate, y.postDate) * -1; } }

Render it

Then it’s just a case of rendering it all out using the HTML Writer.  I’ve hard-coded the number of posts to display at 5, but you can easily make this a property of the WebPart

private void WritePosts(HtmlTextWriter writer, List<PostSummary> postSummaryList) { int postsToShow = 0; if (postSummaryList.Count < 5) { postsToShow = postSummaryList.Count; } else { postsToShow = 5; } for (int i = 0; i < postsToShow; i++) { writer.Write(postSummaryList[i].ToString()); } }

And that’s all; I admit it’s a bit nasty but you get the gist!

 

Technorati tags: , ,
Posted in IT. 1 Comment »

Help build a free Wifi network…

Sarah blogged yesterday about the FON network which is a free wireless networking community.  It’s their first birthday and they are offering free routers for the first 2500 people who sign up.

I’ve ordered mine.

Technorati tags: , ,

Look at what the academics are doing!

As some of you will know I have a few friends who are still busy little bees at university.  One of them, Dr Darren Myatt, who’s skills include breaking £30,000 microscopes, trumping rocket scientists at their own game and generally being far too clever for his own good, has developed a cool little app called ‘Neuromantic’.  I don’t claim to know what it does, but if you copy this and save it to an .swc file, it sure looks pretty when you open it up (hint: click the big ‘3D View’ button).

Oh and as of about 5 mins ago, he can say it’s Vista Compatible.

This post has next to nothing to do with my normal topics of conversation other than to say; ‘As a community we really need to improve the way we talk to academia’.  ‘Neuromantic’ is built using Borland C++ Builder, it’s a low footprint app which runs pretty much anywhere and has no fiddly install procedures.

So whilst I am sure C++ is faster than .NET in some scenarios, we really need to start getting across to people that the slight performance drop is more than made up for by the leap in productivity and that deployment doesn’t have to be an issue. There needs to be some education about modern development practices and I think we need to concentrate on promoting to this vast group of talent outside of the beer and pizza fueled evenings where I for one struggle to get my point of view heard.

 

Posted in General, IT. 2 Comments »