Homepage | About Me | Testing ASP.net Book | Best Blog Posts | Personal Projects | Follow me on Twitter | GitHub | SlideShare | RSS
Blog.BenHall.me.uk

no such file to load -- mkmf

Tuesday, September 29, 2009

Today I was attempting to install a package on my ubuntu machine and I received the following error:

extconf.rb:1in 'require': no such file to load -- mkmf (LoadError)

To solve the problem, I simply installed the ruby1.8-dev package, this was done by the command:

sudo apt-get install ruby1.8-dev

I could then happily install the package I wanted.

Labels: ,

Making my blog suck less - Syntax Highlighting

Following on in the series of how I have improved my blog, its time to address the issue of syntax highlighting. I admit, this is something which I think has really let me down and something which is long overdue.

There are a number of difference approaches available to solve this problem, however the best approach I came across is from http://alexgorbatchev.com/wiki/SyntaxHighlighter. This is a javascript+css library which can be installed on your blog, which thankfully is a very simply task. The CSS you need to reference are the following:

	
	

The javascript I have referenced in shown below.

		
		
		
		
		
		
		
		
		
		
		
		
		
		

In my posts, I can then simply wrap the snippet in a pre block and assign the appropriate brush class to highlight the syntax.

public string test()
{
return "abc";
}

The following are a list of brushes for the different languages I have referenced.

C# - c-sharp
CSS - css
JavaScript - js
Java - java
Ruby - ruby
Python - python
Scala - scala
SQL - sql
Xml - xml

For those who are using Windows Live Writer, there is a plugin to make syntax highlighting even easier! This is available to download from http://www.codeplex.com/precode

Hopefully this should make code much easier to read in the future. Another approach I was tempted by is using GitHub Gists. Gists are snippets of code hosted on github which you can then embed into your posts, as shown below.

The reason I didn't go down this route is that it makes it difficult to insert code when writing a blog 'offline' and when GitHub is down. As a result, I decided to stick with the classic approach for now. But what do you think?

Labels:

Making my blog suck less - Retweet (via @Tweetmeme)

Monday, September 28, 2009
For those of your who haven't come across Tweetmeme before, they are a Reading (UK) based startup aggregating all the links which are retweeted on twitter. Many say it is 'digg for twitter'. While my blog posts generally don't get retweeted, I wanted to include a retweet button as an experiment to see if it will have any difference on the traffic, tweets of blog posts or my followers count. To add the tweetmeme button onto my posts, I simply include the following javascript. Note, I've made some adjustments, firstly I have gone for the compact style, I have also manually set the url which the button relates to which is set by the blogger platform and finally set the retweet to come from me.
	< script type="text/javascript" >
		tweetmeme_style = 'compact';
		tweetmeme_url = '<$BlogItemPermalinkUrl$>';
		tweetmeme_source = 'ben_hall';
	
	< script type="text/javascript" src="http://tweetmeme.com/i/scripts/button.js" >< /script >

Labels: ,

Making my blog suck less

While I've been blogging for a number of years, my theme and layout has never really had my full attention. This has resulted in a number of issues, poor experience and finding older content more difficult than it needed to be. As such, I've decided to give the site a face-lift. A lot of this has been inspired by Scott Hanselman and the tips he has given to improve his blog.

This post covers the initial changes I have made, why I've made them and some tips you could apply to your own site if you wished.

1) Added a notice bar

At the top of every page I have added a notice bar with links to various internal and external pages which I would like my readers to pay attention to and visit. These include various social sites such as GitHub and Twitter with the hope that by having them in the notice bar people will be able to more easily identify them. Of course, there still needs to be excellent content on those sites, but making it easier for readers to access should be a high priority.

2) Making my favourite personal posts easier to find

There are a number of posts which I'm proud of which new visitors might be interested in and as such I wanted to make it easier for people to find. The aim is to reduce the bounce rate of visits from search engines, but also ensure that this content can be accessible to anyone who might be interested in what I have written previously.

3) Clean HTML

One of my personal bug bears at the moment is having clean(ish) HTML and CSS. I used to let this slide, but over time I've come to realise just how important it is. Not only does it improve compatibility across different browsers, but it also improves the load-time as the HTML is more streamlined as well as allowing for a more consistent look across the blog. The added advantage being that the html is now in a maintainable state meaning I'm not scared of updating the template like before. The problem with this is that things might not look 100% correct - if you notice any problems with formatting, then please let me know.

If you visit my homepage, you hopefully will notice a number of other changes some of which I'll cover in later posts. I'm hoping you will find some benefit in my new changes. If you think there is anything else I need to change, then please let me know.

Labels:

Mono XSP == OSX ASP.net Web Server

Tuesday, September 22, 2009
Over the weekend I required a very simple web server on my MacBook to allow me to play around with some iPhone Web App development. It didn't need to do much, simply accept requests and serve webpages. While I've created web servers before, after sending a tweet out I was reminded about Mono XSP. XSP is an ASP.net web server developed under the Mono project banner allowing you to serve web pages and asserts (javascript, css, images etc) to clients. Simply - it's great! After installing Mono, to launch a server simply navigate to the directory where your pages resides using a Terminal (command prompt), and type in XSP. This will start a full webserver on port 8080 serving pages from the directory. Now, within seconds, I can quickly make any directory on my laptop accessible over HTTP! On OSX, the execution simply looks like this: Pretty:Base Ben$ xsp
xsp2
Listening on address: 0.0.0.0
Root directory: /Users/Ben/SourceControl/iPhoneWebApp101/iWebKit/Base
Listening on port: 8080 (non-secure)
Hit Return to stop the server.

Great for prototyping and rapid development and while I haven't tried it, it should work on Windows equally as well.

Labels: