I mentioned in a previous post that I had recently updated the Interlude theme for BlogEngine.NET 2.5, this is a post to make you aware that you can use it and to give an idea of how you can do something similar.

Almost the first thing I did after setting up the new BlogEngine.NET 2.5 site locally was to pull across my site theme. For the most part it was fine, but there were a few niggly bits that I wanted to fix. Previously I took the approach that I would modify some core files, to my mind titles are titles and not p tags with a class applied that makes them look like titles. Also I didn’t like how the Comments are ‘floating’ on the page below a post and previously I’d edited the code to wrap that in a div so I could style it to look like the other sections of a page. One of the new features of 2.5 is the integration with the gallery; you can browse themes and install them directly from the admin tools - this is a great feature!

Updating the theme

I wanted to add Interlude to the gallery and that meant I really couldn’t take the approach of modifying the core files, everything needed to be done from within the theme folder itself. At the same time I thought I’d update the underlying mark-up a little. Using one of the pre-packed themes (I used TitaniumX) for inspiration I tweaked my theme, I did consider using one of the Razor based themes but didn’t see any advantage in that (at this time). There were a few api changes I took advantage of (mostly around how paths are provided), but that was about it. In order to deal with the ‘floating’ comments section I used a single line of jQuery to wrap the elements I wanted in a div which used the same styling as the rest of the site. That way I didn’t have to make changes to the file, granted it might take a little longer to run… but meh it’s no biggie!

$('#comment').next('div').andSelf().wrapAll('<div id="comments">');

Adding the theme to the gallery

So with that done I tested the theme again, all looked good to me, next I wanted to share the theme with others and have it show up as nicely as other themes. If you look in the admin tools, Settings, Themes you will now see the themes in use, a link to browse the gallery (which also lets you download themes) and the option to set as current theme any of your installed themes.

admin-themes

As you can see the themes have a nice thumbnail as well as description and author name. This is all contained in a theme.xml file (as well as an image.png), and while you can either modify an existing set of files there is a really handy tool by one of the main developers. Theme Packer is a breeze to use, the instructions are easy to follow but essentially you point this tool at your theme, fill in the boxes and it creates a file for you to upload – sweeet!

You need to contribute the theme to get it to show up on the gallery, for which you need to create an account or login. Again you need to fill in some boxes (name, name of theme etc.) after which your theme is uploaded and added and available for others to install and use. Previously I have hosted a zip version of the theme and linked to it in my posts, but having the theme hosted on the gallery is much better; I don’t need to worry about the file, bandwidth, my site going down etc.… and there’s a single place for people to find the theme. At the time of writing this the theme has been downloaded 67 times and that’s in the 7 days since I uploaded it – which I think is quite good. Take a look and let me know what you think.

Tags: , , | Categories: SiteNotice

I have recently upgraded to BlogEngine.NET 2.5, it was fairly painless and the new version adds some nice features which I’m quite impressed with.

Of course I wanted to upgrade to 2.5 as soon as it was released but previous problems with my hosting provider (Go Daddy)’s upload process made that a lot harder than it should have been. Anything that was sent through ftp was corrupted, so I had to manually update each file by hand using their online tools… it was horrible! My hand was forced recently though, I was sent an email (quickly followed by a phone call) from go daddy to say that

We noticed that this account had been over utilizing the shared hosting resources. We have disabled the hosting account for the time being to alleviated the over utilized resources.

in order to re-enabled your hosting account, we request that you respond with the following:

  1. A statement that you have reviewed and agree to abide by the terms of the “Web Site and Shared Hosting Service Agreement, “
  2. A statement of what you will do to prevent this activity from happening again.

Well I wasn’t too happy to find that my account was disabled and I was pretty keen to get it all working again, but I had no idea what was causing the CPU to spike at around 90%. Unfortunately they wouldn’t provide me with any assistance, no logs or anything that might help me identify the cause.

I suggested that I upgrade to 2.5 as this would mean a fresh install, that way the problem could not exist in any of the files, just in case there was a memory leak or the account had been hacked and someone added some malicious code.To be honest that really wasn’t likely… but we agreed and so I had the ‘kick up the arse’ I needed.

The upgrade was pretty simple (follow the upgrade instructions), I downloaded the latest version from codeplex and extracted it and fired it up in Visual Studio. Then migrated my theme over and tried it out – almost right, it needed a bit of work, which I did (more on that in another post). The admin tools has integration with the BlogEngine.NET Gallery, so installing a new theme is really nice now; you can browse for something you like, select it and the theme is downloaded and set up for you. I made a few other changes to the local copy to see how it worked, then merged my web.config and tested it with real posts (fixed up the theme as I’ve already said). Next I backed up my hosted site and deleted all the files, ran the SQL upgrade script and uploaded the new version – I was actually surprised to see the site load first time. Hey after all this time I’ve come to expect I’ll make at least 1 big mistake with any code!

I moved some images back into the relevant folders (so if you notice any broken links on old posts please let me know and I’ll hunt them down, but everything should be there now). Made a few changes to the site through the admin tools and made a post. Amazing!

I like 2.5, it’s not vastly different to 2.0, which I was on before, but as always it gets better each time. The Gallery integration is a great feature and I quickly took the chance to fix up the theme I use on the site and it is now available for download through the gallery. So far there haven’t been any reports from Go Daddy that my site is causing the problems it was before.

Tags: | Categories: SiteNotice

I've just been given a DSLR for my birthday, the Sony Alpha DSLR-A200 (thank you everyone who contributed Laughing). I've been saying for some time that an artistic hobby might help balance me out; I spend so much time playing with code that I neglect my creative side and photography is a blend of the technical (have you seen how many options and settings this thing has!!!!) and the aesthetic.

Anyhow I wanted a way to share my photos, I have a flickr account and that's a pretty neat place to store my photos plus you can set permissions on who can see what and CDN's are all the rage at the moment. Turns out the clever people at flickr have already thought this might be a good idea and so have made it quite easy to post a blog entry directly from your flickr account. The options are a little hidden away so I thought I'd post up how to set this up for BlogEngine.Net.

  1. First you need to go to your Account and select "Extending Flickr" set up your blog options
  2. Next click "Configure your Flickr-to-blog settings" and then "Set up your Blog"
  3. Flickr can handle posting to many of the popular bloging engines; but the one we're interested in is the "MetaWeblogAPI Enabled Blog"Choose the MetaWeblogAPI Enabled Blog option in the drop down list
  4. Now you have to tell flickr where to find your blog and how to access it, in other words its time to enter your admin username and password (or other publishing account). There is an axd file that you need to direct flickr to (similar to WebResource.axd) only this is called "Metawebblog.axd"details of blog publishing account
  5. Then you get a chance to confirm those details, and say whether you want to save your password - if you don't then you will need to supply it each time you make a post. confirmation screen
  6. That's it - you are now configured for use!
  7. In the Layout options you can choose a preset layout or monkey about with the html yourself for each blog entry if you want. They have some placeholder variables you can use in your html if there's nothing that floats your boat. You can also send a test post to make sure that you've got things set properly or add another blog engine if you want.flickr showing a configured blog
  8. Lastly, to actually post a photo find the photo, make sure its public and then select the "Blog this" button to start. Give you post a name and write what you think is a good blog - when you're done flickr will automagically create a new post for you on your blog. (note Photoshop is not one of my strengths as this childish highlighting effect shows Tongue out)
  9. Have a cup of tea - you've earned it by now
Tags: | Categories: Tips&Tricks | Development