PhotoMetaData package now available

Saturday, July 17, 2010 by Sebastiaan Janssen

4735128485_ff558e1c32On Codegarden '10 I entered the package competition on a whim, after installing the shiny new Umbraco 4.5 on my laptop there. I was inspired to try and see if the package that I had not completely completed would work on 4.5 and when it did, I just added my name to the list. I ended up winning the third prize with it (a brand new Xbox 360 Elite)!

I've since polished the code a little bit and it is now available to download from the projects section at our.umbraco.org.

Of course I expect to get as many votes on Our Umbraco as during the package contest (you rock)!

The PhotoMetaData package will extract meta data from images that you upload in your media section. This works in both Umbraco 4.0.x and 4.5.

When you create a property with the correct name it will be filled as soon as you upload an image in the media section.

Here a video with a quick overview of the package.

Photo by the wonderful Douglas Robar

SEO optimizing in Umbraco

Wednesday, April 07, 2010 by Sebastiaan Janssen

Just a few weeks ago, someone showed me woorank, a very cool website analysis tool. Woorank tells you what you can improve on your website to help search engines find and evaluate your content better.

By giving you a score from 0 to 100, you can easily compare your site to others. The score is divided up in dozens of different indicators that all have a certain weight in the calculation of the score. All of the indicators are nicely explained to help you understand why they're there (and if you should care about them).

CaptureMy site actually scored pretty well (56 at the time). Of course I don't have an entry in wikipedia and my Alexa rank really sucks, so no points there. Fair enough.

I found that I could easily improve my score by tweaking some things in my site, mostly using content that I already had available anyway. Umbraco makes this really, really easy. No programming needed, mostly tweaks to my templates / XSLT files. Here's what I did (and what anybody could do!).

Sitemap

Of course I already have a sitemap on my site thanks to my own fantastically simple sitemap package (it's just a bit of XSLT, really, have you voted yet?).

However, woorank told me that a sitemap was missing. Of course, I have no link to the sitemap anywhere and it's not called sitemap.xml. So I thought I'd find out how to let search engines (and woorank) know that I have one available to crawl.

First of all, you can include a meta tag in the head of your HTML. Easy enough, just add it to the template, but this won't always work. Google, for example, relies on the sitemap being in your robots.txt file. Unfortunately, the robots.txt can't be edited from within Umbraco, so I had to make this improvement by updating it manually.

Microformats

Jeff Atwood of Coding Horror and StackOverflow fame wrote a blog post in December about making crappy HTML even more crappy by putting extra crappy HTML in it to support microformats. In the end though, he concludes that it's too easy not to do.

I don't really see the added value at the moment, but it can't hurt to implement some of it.

The only microformat that I could think of would make sense on my site was the contact information, using the hCard format. So off I went, added some div's and spans in my footer XSLT and in the HTML on the contact page.

Dublin Core

What's this you ask? I had no idea either. As it turns out Dublin Core meta data is very structured information about the page you're currently on. Although, it seems only slightly better than the normal meta description / keywords tag.

As with the microformats, it doesn't hurt, so I spent 5 minutes updating my main template to include Dublin Core data (title, description, creator & publisher). This data was easily accessible from Umbraco and I'd already used most of it in the other meta tags, so a quick copy & paste in the template did the trick.

Geo Meta Tags

Oh boy, even more meta tags. Alright, geographic information. The content of my site isn't targeted at a specific geographic location, nor does it show any data that belongs to a location. I suppose it's nice to know that I'm in The Hague. Once again, too easy not to do, so I added the placename, region and coordinates to the template.

Conclusion

There is a lot of meta data out there. And apparently, search engines actually look for that information. I do get the impression, though, that there is too many different formats. Can we just pick one and stick with it? Oh wait, it's the web, when has that ever happened?

It took me a few hours to figure out what information was needed everywhere, but once I did, Umbraco made it painless for me to update my entire site using existing data.

This will be even more fun when I start adding the geo information to the site I'm currently working on that shows panorama pictures. Each picture already has GPS coordinates so it'll be a really quick XSLT addition.



Convert between VS2008 and 2010 projects, automatically

Tuesday, March 16, 2010 by Sebastiaan Janssen

Recently, I was told that I was being a bother and that I shouldn't develop in VS2010. Sure, the current RC is not the final version, but it's a release candidate, not much will change between now and the RTM (unless something really bad happens). But sometimes you need to conform and give people what they want. Back to VS2008 I went.

I love working with the latest and greatest though, so in a few spare hours just now I have been plotting and scheming and came up with a brilliant solution to thwart the command of my opresser, muhahaha!

Yes, I did it, I created a tool that can convert my complete VS2010 project back to a VS2008 project so that I can commit my code without my opponent knowing worked in VS2010.

This is done, very simply by replacing a few strings in the .sln and .csproj files. Now, this is a simple approach and it will throw away some information that is new to VS2010. However, it works for my purposes and I'm sharing it here so that people will be able to build upon it if they wish, or use it as is.

Mind you, there is NO GUARANTEES and I'm sure this is going to kill your project if you're not careful!

Was that proper warning? Okay, well here it is: two old-school batch files and a tool to do the string replacements (which I got from programmersheaven).

You can now download the fully automated VS2008 to VS2010 converter, enjoy.

Oh HAI Gerben, didn't know you were going to read this...

funny-pictures-cat-goes-on-the-naughty-list

Umbraco - Object reference not set..

Monday, March 08, 2010 by Sebastiaan Janssen

Today, I had a little problem after adding some properties to a document type in Umbraco. I've had this problem before and I keep forgetting how to fix it.

When opening a node of this document type (in Umbraco's Content area, not the document type editor), I get the following (rather generic) error:

server_error

I must add that while creating some new properties on this document type, the property was added, but I did get and SQL time-out. Not sure why that was, but it must have interupted an update process on existing nodes.

This is probably the reason that the current nodes are now corrupt. As you can see in the exception, there was a problem adding a control to the page.

The solution is easy, you have to publish all of the nodes and its subpages to fix the error. Voliá!

Richard Soeteman adds some extra information on a similar error while deleting a property on a document type. The issues could be related, so if you still have problems, check out his blog post as well.

Umbraco MVP - Don't vote for me

Friday, February 05, 2010 by Sebastiaan Janssen

Wow, who would've thought 10 months ago when I was introduced to Umbraco that I would be nominated to be an MVP? I sure didn't expect that!

I'm not asking for votes, I'm proud to be listed among giants and you can make your own decisions.

However, I would like to promote the others on the list:

vote-706542Chris Houston was the first one to reply on my first blog post and I love how active and involved he is in the community. I can't wait to see the cmsMailer package that he's involved in. Vote for Chris!

Chris Koiak has made some cool packages and seems to be a great developer with a passion for Umbraco. Besides, he's from Glasgow, he must have a great accent. Vote for Chris (no, not the other one, this one)!

Dan Drayne must have a very high accept rate on our.umbraco, his forum replies are always very helpful. Vote for Dan!

Darren Ferguson's source code makes me jealous! Awesome packages, I have a lot to learn from this guy. Vote for Darren!

Dirk De Grave is always helpful on the forum, always there (does he ever leave his computer?), patient beyond belief even though some people test his patience sometimes. Vote for Dirk!

Douglas Robar really is the best teacher I've ever met. His posts on the forum are long and complete, with amazing attention to detail. Vote for Douglas!

Jan Skovgaard also always seem to be online, helping out, asking questions. Plus he seems to like Dutch people, perfect! Vote for Jan!

Jesper Ordrup seems to be taking Umbraco to new heights with the projects he's involved in. Let's hope he keeps sharing his insights. Vote for Jesper!

Lee Kelleher is a busy bee, he seems to be everywhere at the same time and should be rewarded for all of his efforts in the community. Vote for Lee!

Lee Messenger's ideas to change the our.umbraco forum from "just" questions and answer to even more thought provoking conversations are great, keep up the good work. Vote for Lee (THIS one)!

Morten Bock: uForum, need I say more? Awesome coder. Vote for Morten!

Nik Wahlberg I don't know so well unfortunately, but he must be awesome 'cause he's wearing sunglasses, just like Niels. Vote for Nik!

Peter Dijksterhuis should win because he works on a farm one month a year. Also, he made the great calendar package, good stuff. Vote for Peter!

Petr Snobelt thumbs up for the MemberControls package, and his avatar. Vote for Petr!

Richard Soeteman is the number one Umbraco fanboy from The Netherlands. This guy might be singlehandedly responsible for the rise in popularity of Umbraco in the last year or so.. ;) Vote for Richard!

Ron Brouwer another fellow Dutchie and a very helpful guy, love his work. Vote for Ron!

Thomas Höhler must be the loneliest Umbracian in Germany, but that's great, gives him time to help everybody out on the forum and on Twitter. Also makes cool packages. Vote for Thomas!

Tim Saunders always helpful with a different take things, I love seeing alternate solutions. Vote for Tim!

Warren Buckley well, what's not to love about this guy, CWS is awesome, he's always looking to add value to the community, and it's working. Vote for Warren!

... I really can't choose, I might as well vote for myself now!

Of course, this is all a clever ploy to get everybody to vote for me anyway.. I trust you will all not find me out. ;-)

 



Screencast: Installing Umbraco

Monday, February 01, 2010 by Sebastiaan Janssen

Rather than making a long post with a lot of images, I decided to do something new for this post: a nice little 6 minute screencast!

It's just a quick run through of how I create a new Umbraco installs on my dev machines. It's easy!

I noticed after the recording that I didn't change the path for the database files. During the creation of the new database, you can easily change the path of where the database files are stored here (buttons marked yellow):

 

newdatabase

 

I tend to mumble a little, I'll work on that for future screencasts (also, I didn't shave, sorry). ;-)

Hopefully this will help some people setting up their Umbraco install manually.

Dropbox as a Git central repository

Sunday, January 03, 2010 by Sebastiaan Janssen

If you've been reading my blog, it should be clear by now that I'm a bit of a fan of the Git version control system.

I've been hosting some projects on Unfuddle for a while now, but have not been very happy with fiddling with SSH keys and setting up the central repositories through the Git Extensions for Windows. It works, but that's all I can say.

Another issue I was not looking forward to tackling was setting up TeamCity to pull from Unfuddle. I haven't tried, and for all I know it might work great, but if there's a perfectly good shortcut that I can take, I'll take it!

A few days ago I saw some tweets from people mentioning Git and DropBox as a combo. Unfortunately, I can't find the messages any more as Twitter's retention policy seems to be very aggressive. So I decided to try doing it myself.

The advantages of having a Git repository in DropBox are that:

  • it does not rely on a service that (for all I know) might go out of business one day;
  • it prevents me from having to create SSH keys as credentials;
  • it makes it easier to point TeamCity to a central git repository (which is in fact on the local disk);
  • the central repository is always synced to all of my dev machines and to the DropBox server, so there is multiple backups in case of catastrophic failure;
  • you will always have the ability to push changes to a central repository, even if you have no (or intermittent) internet connectivity;
  • if you have to work without internet connectivity, but with network connectivity, you could just set-up a network share and push and pull to each of the repositories that way.

I'm wildly enthusiastic about the distributed nature of the Git version control system, it really does allow me to work from anywhere and in any way that I want.

Setting up Git with DropBox on Windows

I am assuming that you have DropBox installed and that you are using the Git Extensions that I've mentioned in earlier blog posts on Git.

I've created a folder somewhere in my DropBox folders that will hold my Git repositories. In there, I've created a folder called "Example.git".

Next, I created a new Git repository using the Git Extensions. When you start Git Extensions, choose "Initialize new repository" from the "Commands" menu.

I created a "Central repository, no working dir" in the "Example.git" folder.

gitdropbox01

Then, in the folder that holds my Example project, I created a personal repository, as I would do normally when putting you project under version control (again through "Commands", "Initialize new repository").

gitdropbox02

This will open up the repository in Git Extensions. The first thing I like to do is hit the "Edit .gitignore" button, add the default ignores and commit that as the initial commit.

gitdropbox03

With that inital commit out of the way, I will add a remote from the "Remotes" menu.

I've name the new remote "DropBoxExample" and instead of entering a URL, I point to the "Examples.git" folder that I created earlier.

gitdropbox04

After clicking the "Save" button, Git Extensions will ask if I want to automatically configure the default push and pull behavior, I've skipped this step because the folder on the disk is not actually a server that understands commands. Then I closed the "Remote repositories" window and start pushing the master branch to the remote.

gitdropbox05

And got a confirmation message, it worked!

gitdropbox06

Now I am able to actually set the pull defaults, so I go back to managing the remote, go to the "Default pull behavior" tab to choose the defaults from the dropdown lists and clicked "Save".

gitdropbox07

All done!

I went to my other machine and created the same "D:\Dev\Example" folder.

I opened up Git extensions and initalized the folder as a personal repository. Then I was able to add the remote repository in exactly the same way, instead of entering a URL, I pointed to the "Example.git" folder in DropBox, saved the remote and pulled from it.

To my delight, I saw the .gitignore file appear immediately and noticed that I had received the commit history from the other machine. Success!

Of course I then proceeded to add a Visual Studio project, pushed it to the central repository, pulled it in on the other machine, and again, everything appeared as I hoped it would. Success!

A basic backup strategy

Wednesday, December 30, 2009 by Sebastiaan Janssen

I'm running a very simple web server for Cultiv and some other projects. It's a virtual server to which I have full remote desktop access. This means that I am the administrator and I decide what goes on at the server, no interference by my hosting provider. But, as always, with great power comes great responsibility…

I believe my hosting provider makes a backup of the whole server every night, and at best, I can have them restore a 1-day old backup. One day of retention is not something that I feel comfortable to rely on, by far!

Recently Jeff Attwood (of Coding Horror and StackOverflow fame) had a big scare and the resulting discussion that followed, lead to a blog post by Joel Spolsky (of FogCreek and StackOverflow fame) pointing out that backing up is not the problem, restoring usually is.

Well, since I had NO backup strategy, whatsoever, I figured it was about time to change that.

My current server specs are: A Windows Server Web - (2008 Hyper-V VPS) with IIS7 and Microsoft SQL Express server. It's that simple!

What to backup?

The question of what to backup seems like a simple one to me:

  • my websites (including file/folder permissions);
  • the website's MS SQL databases;
  • the IIS configuration for the websites;
  • the IIS log files, so that I could maybe reconstruct what happened in case of a catastrophe.

How to backup?

Websites and meta content

The websites are all in one folder, so that's easy (I'll talk about the permissions later).

I had to look a little bit to find a way to backup the configuration files, but a post about IIS configuration history was a great resource.

To backup the current IIS configuration, I included the %windir%\system32\inetsrv\config\ folder and I love that the configuration changes are being written automatically to the %systemdrive%\inetpub\history directory. That way, I could recover and older configuration if needed, cool!

Finally, I included the %systemdrive%\inetpub\logs file for the sake of it.

SQL Express

At first, I was backing up SQL's ".mdf" and ".ldf" files, which is an utterly stupid idea, as I learned from StackOverflow postcast 78. So I needed a different strategy for that. SQL Express doesn't offer the ability to create automated back-ups, so I had to look for extra software. This was difficult, nothing really did what I wanted it to do: give me a bunch of .bak files. Everything I found was either too fancy or didn't work.

My colleague pointed me in the direction of an article on ServerFault and I was able to construct a decent enough solution out of this.

I took the SQL script in the ServerFault post and modified it a little, now the backup files are zipped using 7zip instead of zip and at maximum compression ratio (7zip can compress text really, really well, so why not). I put it in the folder C:\DatabaseBackup as per the default for the script.

Next, I set up a scheduled task in Windows, to run the script every day. The action is "Start a program", the program/script is "sqlcmd" and the arguments are:
-i C:\DatabaseBackup\backup.sql -o C:\DatabaseBackup\output.txt -S .\SQLEXPRESS
Where .\SQLEXPRESS is the name of my (you guessed it) SQL Express server. You might need to do add some login credentials to these arguments, have a look at the sqlcmd documentation for the details.

Finally, before running the script for the first time, I had to enable the xp_cmdshell option in SQL Express. Make sure to read up on the security implications when you do so.

Now, this will not give you any notifications when the SQL script is unable to backup the databases. On another server, I installed Vale Express Agent to get notifications when the SQL fails. To do this, make sure to paste the SQL directly into a new backup job (don't use sqlcmd to call the script!).

Where and how to backup?

I've been working with Amazon S3 lately and S3 was also mentioned in the podcast that I mentioned earlier. Basically, Amazon makes sure that your data is in at least two locations in the world at all times. Also, S3 is terribly inexpensive, so it seemed like a good idea to backup to their servers.

Enter JungleDisk. I'd heard about JungleDisk before, it can backup all of my data to S3 and it is dirt cheap. It's only $5 a month for a server edition (which runs the backup as a Windows service), this includes the first 10 GB of storage for free! Great deal, as I currently only have a few hunder megabytes to backup anyway.

JungleDisk also natively supports backing up NTFS file permissions, which is exactly what I need.

Setting up was quite easy, however I was suddenly stuck in a "looking for server" screen after entering my JungleDisk credentials. As it turns out, the first time you set up the software, you have to start "Set License Key for Jungle Disk Server Edition" first. After that, it was easy to add the folders I needed and exclude .mdf/.ldf files.

How to restore?

Apparently, this is the most important part of my backup strategy… And I'm being dumb about it, because I haven't tried restoring at all. I mean, yes, I've restored a JungleDisk backup to see if I can get my files back, but that's it.

I am prepared to spend a few hours rebuilding my server if something happens to it. Currently I don't have much data and a simple deployment strategy, so this should not be a big problem.

I'll revisit the restore part once I have to move to a much bigger server, but by then, I'll probably also have to revisit the backup strategy. As I said, it's basic.

10 PRINT "REALLY BASIC"

20 GOTO 10

RUN

Released: Media cache package

Sunday, December 20, 2009 by Sebastiaan Janssen

Recently, I've been working on a site that presents 30 to a 120 items from Umbraco's media section in the frontend of the website.

In the past few weeks, I've been tweaking the site for performance and noticed that there were an aweful lot of SQL queries being performed in the database. As it turns out, calls to the umbraco.library:GetMedia() method are being sent directly to the database. This meant that for each media item, three queries are being performed. Times a 120... That starts to hurt a little.

Also, it is impossible for us to turn on caching on this macro completely because updating the media item with a new image would not expire the cache.

I had to come up with something else that would cache calls to the media library. So today, I'm presenting you the Cultiv MediaCache package.
This package provides an XSLT extension that provides a caching mechanism for calls to the "GetMedia" method.

It's very easy to use:
In your XSLT files, instead of doing calls to umbraco.library:GetMedia(), you do them to Cultiv.MediaCache:GetMedia().
That's it! Told you it was easy.

Read all about it on the project page, download it, use it, vote it up. Okay, thanks! :-)

Tiny update dec 20, 2009 - 17:28: Now compatible with .net 2.0 installs of Umbraco (previously only worked on .net 3.5).

Version control in Git - Part 3 (a central repository)

Tuesday, October 06, 2009 by Sebastiaan Janssen

So now that you've started using Git, you might want to share your repository with your team using a central repository. I'll show an example of how to do that by using a free account at Unfuddle.com.

Sign up for Unfuddle and log in to your account (through your_account_name.unfuddle.com). Go to "Repositories" and create a new Git repository.

Now you have to create an authorization key, to be able to log in to the Git repository remotely.

2009-10-05_193837

Go back to Visual Studio and click Git's "Browse repository" (the folder icon) button again. Then in the menu go to "Remotes" > "PuTTY" > "Generate or import key".

2009-10-06_120359

Make sure the settings for generating the key are correct, the key needs to be 2048 bits.

2009-10-05_090458

After you've generated the key, change the key comment to your e-mail address, and enter a passphrase for the key. Now, make sure you copy the key from this window! Saving the public key generates a slightly different format, but Unfuddle really needs the format as it is in this window.

Save the public and private key somewhere anyway, you'll especially be needing the private key later.

In Unfuddle go to "People" > and edit the Account admin. In the bottom left you can enter a "New public key...".

When that key is accepted, go back to the "Repositories" tab and find the repository server, under your repository title (something like git@your_account.unfuddle.com:your_account/abr.git), copy this address.

Now you can set up the remote server in Visual Studio. In the menu bar, click "Git" > "Manage remotes". Give your remote server a name (no spaces) and paste the address you just copied.

Browse the private key that you stored earlier and choose hit "Load SSH key". Enter the password for that key and then you can save the connection. For some reason the "test connection" button fails for me ("ERROR:gitosis.serve.main:Need SSH_ORIGINAL_COMMAND in environment."), it still works though.

So now you're ready to push whatever is committed in your current branch to the remote server, use the blue up arrow ("Push changes to remote repository") to do so. You could also then push all branches and tags, or do a pull first to resolve any merge conflicts if you want.

In the next part of this series, I'll give a quick rundown of branching and merging.