Nicholas Clarke

  • rss
  • Home
  • Articles
  • Downloads
  • Contact

Google Reader and Embedded Videos

Nick Clarke | February 19, 2008

I use Google Reader as my main RSS client. For me it has answered all of my problems I had with using a desktop client + it allows me to share posts that I think are interesting without having to write a post myself by just clicking a button. It does however have some oddities itself e.g. phantom posts that I can never find but are in my sidebar folder structure.

Yesterday I noticed another feature, someone shared a post of mine and I noticed that my embedded video was not displaying!

After hunting around and comparing a couple of other RSS feeds I noticed that Google Reader seems to be stripping out YouTube <object> tags. To fix the problem I had to use <embed>. After waiting for Google to refresh their cache it is now working + I also get a nice popout link (something they must add).

If you are also experiencing the same problem be sure to check out what html is being generated by your site and then subsequently removed by Google Reader.

Comments
No Comments »
Categories
Google, WordPress
Comments rss Comments rss
Trackback Trackback

If programmers were to make a plane

Nick Clarke | February 18, 2008

This is a great advert and very true if you develop on the fly (pardon the punt) or conform to Agile development e.g. Scrum.

Defiantly something I can relate to.

Comments
1 Comment »
Categories
Adverts, Development
Comments rss Comments rss
Trackback Trackback

FastSharp - Rapid C# Scripting

Nick Clarke | February 17, 2008

Today I had to update a regular expression that I have not touched in two years!

On first look I got the old hhmm where do I start :)

(?<Protocol>\w+):\/\/(?<Subdomain>\w+)\.(?<Domain>\w+)\.(?<tlDomain>[\w.]+)/(?<File>.*)

This matches:

http://subdomain.url.com/Default.aspx

And breaks it into:

Protocol: http
Subdomain: subdomain
Domain: url
tlDomain: com
File: Default.aspx

But the problem starts when you have a - (dash) in the subdomain:

http://a-subdomain.url.com/Default.aspx

This of course fails as I use \w to break up the subdomain string, which just matches alphanumeric characters. All I need to do is to allow - as well as a-zA-Z0-9 (\w).

The final expression was:

(?<Protocol>\w+):\/\/(?<Subdomain>[\w-]+)\.(?<Domain>\w+)\.(?<tlDomain>[\w.]+)/(?<File>.*)

- Change marked in red

Simple change but testing this takes some time as I either have to run my complete application or write a small test program.

Last week Matt Manela on the msdn blog shared a great application that allows you to test C# code without having to even write a class or create a project.

FastSharp is a great tool for testing out some code. It even goes as far as checking for compilation errors.

FastSharp Compile Error

This was caused by me not adding the correct library for the Regex class.

To fix this all I had to do was click settings and then add the using statement.

using System.Text.RegularExpressions;

FastSharp Success

My little code snippet then ran fine and I was able to test and adapt my change very fast.

Great tool be sure to check it out + for more in depth into why and how it was coded see Matt’s post.

Comments
2 Comments »
Categories
Development, Microsoft
Comments rss Comments rss
Trackback Trackback

Web Request from SQL Server via C#

Nick Clarke | January 16, 2008

Yesterday I was trying to think of a way to call a web page via a SQL Agent job and could not find a way to do it.

I could setup a scheduled job on the web server itself and use Windows scheduler to request the page on a set date and time, but all of my other scheduled jobs are within SQL Server, so I thought it would be best to keep them all in one place.

This stumped me until I remembered that its possible to create stored procedures and functions in C# or any other clr language.

In order to create a C# SQL Server function and allow it to connect to a URL I had to do quite a bit of research, so to save you the time I thought I would make a note of the steps I performed:

1 First create a database project in Visual Studio 2005 and then a C# SQL Server function:

using System;
using System.Data;
using System.Net;
using System.Data.SqlClient;
using System.Data.SqlTypes;
using Microsoft.SqlServer.Server;
 
public partial class UserDefinedFunctions
{
 [Microsoft.SqlServer.Server.SqlFunction]
 public static SqlString WebRequest(string URL)
  {
 	// Create a request for the URL.
 	System.Net.WebRequest request = System.Net.WebRequest.Create(URL);
 
	// If required by the server, set the credentials.
 	request.Credentials = CredentialCache.DefaultCredentials;
 
	// Get the response.
 	HttpWebResponse response = (HttpWebResponse)request.GetResponse();
 
	// Close open connections
 	response.Close();
 
	// Return the status.
 	return new SqlString("Response: " +
					response.StatusCode +
	 				" - " +
					response.StatusDescription);
  }
};

If you deploy the code to the DB now you will get all kinds of security errors, which I had to work through.

2 These are the steps that I had to perform to allow my function to be successfully deployed to the DB and runnable via SQL:

2.1 Change the Permission level to external in the project properties.

Solution Properties

Note: To be able to deploy the dll to the database you will also have to set the connection string.

For more information on these settings please see the msdn documentation.

2.2 Using SQL Server Management Studio enable CLR within your database:

sp_configure 'clr enabled', 1
GO
RECONFIGURE
GO

CLR integration is required to deploy and run the code above. It can also be enabled using the Surface Area Configuration Tool (SACT).

2.3 Set the database to be trustworthy:

ALTER DATABASE myDatabase
SET trustworthy ON

This tells SQL Server to trust the database. For more info see the msdn documentation.

2.4 Now deploy the CLR function into the database using Visual Studio’s deploy menu option

2.5 That should be everything and you should now be able to run the command below.

SELECT [myDatabase].[dbo].[WebRequest] ('http://--YourDomain--/runthis.aspx')

Hopefully you now get the response from the web request.

This approach works great and allowed me to schedule the running of some .Net code (within a aspx page) that couldn’t be placed in the database itself. As this is a generic web request you can use this approach to request any URL.

Source code for the CLR SQL function:
You will need to set the connection string to be able to deploy the dll.

Comments
No Comments »
Categories
Microsoft, SQL Server
Tags
Microsoft, SQL Server
Comments rss Comments rss
Trackback Trackback

324 toilet seats!

Nick Clarke | January 15, 2008

At work we just had the cleaning people in to break, sorry I mean clean our computers and this spawned into an interesting conversation into how effective it was.

Dave aka Mr Google then went off and found an online calculator to work out how many germs we all had!

I gave it a try only to find out that I had the equivalent of 324 toilet seats at my fingertips! Now that’s a happy thought just before lunch :(

My total was 1,617,840, click below to give it a try:

1,617,840How Many Germs Live On Your Keyboard?

Comments
2 Comments »
Categories
Personal
Tags
Germs, Keyboard, Toilet Seats
Comments rss Comments rss
Trackback Trackback

The truth behind the software project life cycle

Nick Clarke | January 11, 2008

Yesterday I installed the Stumbleupon Firefox toolbar as I ran out of unread blog posts and wanted something random to read. On my first click on the Show next page button I was taken to a great interpretation of the software project life cycle :)

Software project life cycle

I’m sure every developer can relate to this in some way.

Comments
No Comments »
Categories
Development
Tags
Software
Comments rss Comments rss
Trackback Trackback

Undisclosed WordPress feature

Nick Clarke | January 9, 2008

Tonight I logged into WordPress in order to clean up my spam comments and I noticed a new feature. I know that there was an unexpected release to fix a security issue, so I guess some new code was included when I upgraded :)

Filter on comments

When you select the Akismet Spam tab in the comments section of administration you now get the option to filter the items by their type. I have not had a real comment left since upgrading to see if it is also on the non-spam comments tab.

I looked at the change log and could not find this mentioned, so I wonder what else was included in version 2.3.2.

If I get change tomorrow I might take a peek into the code and see what I can find.

Comments
No Comments »
Categories
WordPress
Tags
WordPress 2.3.2
Comments rss Comments rss
Trackback Trackback

Disk space is a premium

Nick Clarke | December 7, 2007

While installing Visual Studio 2008 on my PC I started to get the not so friendly Windows low disk space pop-up. This was odd as I thought I had lot of spare space! So I opened up Windows Explorer to see what I could find only to find nothing. My PC has files all over the place put there by all kinds of programs.

Then I remembered WinDirStat, this program turned out to be my saviour.

After leaving it run for 10 minutes it came back with a very nice psychedelic version of my hard drive:

WinDirStat GUI Sample

Not my real hard drive

On closer inspection I found that I had many unused Virtual PC instances and old ISO images.

WinDirStat is broken up into three sections each of which offers a different view of your data:

  • TreeView

Shows the disk usage summary from a group of folders down to file level

  • Type list

Colour coded with the psychedelic view so that types can been seen easily.

  • Psychedelic colour view

This is by far the best view and with a quick glance you can see where all of your disk space has gone.

No matter what view you are in, selecting or hovering over any of the items will highlight the area in the psychedelic view and provide you with more information about the file. Its odd to see the same patterns repeated by user directories or the sheer size of virtual PC images.

Once you have found what you are looking for the application allows you to clean up the files directly by using the delete key or the clean up menu.

This is a great application and I have since seen some of my colleagues running it and playing with the psychedelic view.

Comments
No Comments »
Categories
Development, Software
Tags
Software, WinDirStat
Comments rss Comments rss
Trackback Trackback

Microsoft running at full steam

Nick Clarke | December 6, 2007

It seems that you can wait ages for something to finally be released by Microsoft. For example I started .Net with Visual Studio 2005 beta only to wish for the RTM version and then SP1. SP1 came along only for me to wish that I had 2008. All of this due to bugs and missing/cut features.

It seems that Microsoft is coming to the end of a massive development cycle as there are lots of projects starting to stick their heads above water (Microsoft Firewall).

These are some that I have noticed including some links:

Silverlight 2.0 - Beta Q1 of 2008
ASP.Net 3.5 Extensions - Public release due
IIS 7.0 – Coming early 2008 with the new version of Windows Server
ASP.Net MVC – Preview any time now with the supported release in the first half of 2008

  • ASP.Net MVC Framework Part 1 - Overview
  • ASP.Net MVC Framework Part 2 - URL Routing
  • ASP.Net MVC Framework Part 3 - Passing ViewData from Controllers to Views

Windows Vista SP1 – Just got RC so RTM will not be too far away
Parallel FX – Preview out now

  • Programming in the Age of Concurrency - Anders Hejlsberg and Joe Duffy: Concurrent Programming with PFX
  • Daniel Moth Parallel Extensions
  • Parallel FX Team Blog

Visual Studio 2008 – Out now for MSDN subscribers with the official release being February.
.Net 3.5 – Out now
.Net Source Code – Coming soon
LINQ – Out now

  • Architecting LINQ to SQL applications, part 1 - Architecture for LINQ to SQL
  • Architecting LINQ to SQL applications, part 2 - What is LINQ?
  • Architecting LINQ to SQL applications, part 3 - DAOs and Repositories
  • Architecting LINQ to SQL applications, part 4 - Dynamic Queries

Volta - Technology preview
Expression Service Packs – Out now
XNA Game development platform – RTM Coming Soon

I’m sure I have missed some, but even so this is quite an impressive list to release at the same time especially when some of these are linked.

All of this makes me wonder what Microsoft is working on that we have not yet heard about. Oh how great it would be if I could to be a fly on their wall. As this is not possible I guess the next best thing is Channel9 :)

So I guess the wait continues. I’m looking forward to the first half of next year.

Comments
No Comments »
Categories
ASP.Net, Development, Microsoft, Visual Studio
Tags
Microsoft, Roadmap
Comments rss Comments rss
Trackback Trackback

Managing Humans

Nick Clarke | November 16, 2007

Looking for a unique way to sell a book!? Well this definitely caught my eye.

The book is called “Managing Humans” and is written by the same author who wrote “The Nerds Handbook“. The promotional site has got a really nice touch that you have to click through a series of cool slides telling a little story to get the actual pitch.

I may add this to my Amazon wish list, as it sounds quite interesting.

Managing Humans

Comments
No Comments »
Categories
Books, Development
Tags
Managing Humans, The Nerds Handbook
Comments rss Comments rss
Trackback Trackback

« Previous Entries

Pages

  • Articles
  • Contact
  • Downloads

Categories

  • Adverts (4)
  • Books (2)
  • Business (3)
  • Development (21)
  • Google (4)
  • Microsoft (15)
    • ASP.Net (1)
    • SQL Server (1)
    • Visual Studio (3)
  • Music (3)
  • Personal (16)
  • PHP (2)
  • Software (1)
  • WordPress (3)

Archives

  • February 2008 (3)
  • January 2008 (4)
  • December 2007 (2)
  • November 2007 (13)
  • October 2007 (25)
  • September 2007 (1)

Google Reader Shared Items

  • Smashy The Alien Icon Set
  • Western Digital intros 2.5-inch 10,000RPM VelociRaptor HDD
  • Ripple rolls out Atom-based Mini Chocolate desktop
  • Knol is open to everyone
  • ReactOS - What's the point ?
  • Private Clouds
  • 7 damn fine wineries
  • By Ricardo Soto
  • Night Drive
  • .NetMap - Released - visualize your Networks (Social, etc) from Excel
Shared Items
rss Comments rss valid xhtml 1.1 design by jide powered by Wordpress get firefox