Tigraine

Daniel Hoelbling-Inzko talks about programming

New blog engine, this time my own

It's been some time since I did write a blog post, and I must say it was not for a lack of ideas. It was mostly the prospect of having to write these posts in HTML into my Wordpress interface that led me to abandon the idea.

And I think that's the main problem: I believe HTML is a bad format for writing posts. And no amount of WYSIWYG will change that, for all the subtle codehighlights I like in my posts the Wordpress WYSIWYG is just not the least bit useful. And don't get me started on posting source.

There are basically 2 solutions I had with my Wordpress installation: Either use a clientside syntax-highlighter or rely on Gist to post code in a human-readable fashion that's also easy on the eyes.

And I hated that.. I hated doing the back and forth between Gist and the site, and fixing errors in the code was always a pain. And as much as I like the syntax-highlighter script, it slows the page down a lot. Especially the front-page, even when the user may not be looking at a post with code at the moment code on the page will still be parsed.

A good solution to this problem seemed to be Jekyll, where you write your posts in simple markdown or textile and code gets syntax highlighted automatically on the server. I tried that some years ago, but for my style of writing it turned out to be even worse than Wordpress.

Why? Simple: I didn't start from scratch but rather imported my whole Blog into Jekyll when I started the experiment. So I was running Jekyll with syntax highlighting on on about 300 posts all the time. And the compilation did run for about a minute every damn time! To add insult to injury: at the time I didn't have a rsync capable hosting setup so I had to FTP the whole site.

So a few weeks ago I started to tinker around with Ember.js, and naturally I found myself writing a sample blog application. And that's when it hit me: writing a blog is f***ing easy. There is a reason any web frameworks worth it's salt is demoed using a blog engine.

And it turns out, what few features I want from my blog engine are usually all covered by these very simple demo apps :). So I ditched all the Ember.js experiments and started to write my own blog engine that had to do the following things:

  • Look exactly as my old blog
  • Accept Markdown input
  • Provide syntax highlighting
  • Let me schedule posts to appear at a later date
  • Preserve permalinks

And that's it - almost laughable how simple my requirements actually are. I decided to ditch some more complexity I felt no longer required (since RSS is dead) and built a really simple rails application ontop of the awesome libraries rouge and redcarpet. So my blog now accepts GitHub Flavored Markdown - all with less than 5 lines of code.

And the results are really awesome:

puts "I <3 Ruby"

So I sat down and built the blog in probably half a day. Maybe a bit more since I wanted to have some shiny like: nice tagging with autocompletion, real time post preview while typing and drag & drop file upload for images.

I'll post the code once I cleaned up the deployment mess I created (no secure database.yml management, secret.rb in git etc) but once done I'll post it here anyways.

Next up for me is trying to figure out a good way to make the blog theme-able. I'd love to experiment a bit with Rails engines and how this can be leveraged to separate themes from applications. And now that I've got my own little Rails playground once again it's the perfect opportunity to do so :).

Oh, and I need to leverage caching. After a cursory exploration today it seems caching would turn this blog into a statically generated static site. Only problem seems to be the cache invalidation, but I am sure I can devise some scheme to get around that that (short of doing 5 rm -rf calls).

Filed under rails, ruby, blog, site-news

Site migrated - more awesome - more root!

The title actually says it all. I just finished the migration of my blog to a new server I am now administering myself (wether that's a good thing or not still remains to be seen).

Last week I noticed that I could get a full root server for the same money I am paying for the 100 megs of PHP4/MySQL4 hosting at my old provider. So I jumped at the opportunity and got a nice little Debian Squeeze VM from my good friends at CoUnity.at.

I've now spent two days configuring the heck out of that machine and I must say I am impressed, so here are some notes that may help when you are migrating/setting up.

Git

It's ridiculous how easy it is to install gitolite. You just follow this little guide here and you are up and running your own private Git server in 5 minutes tops.

I actually just canceled my paid GitHub account since I can now host my private Git repositories on my own server now.

Apache / MySql

It's almost kind of silly and feels totally outlandish to anyone who has ever gone through a IIS and SQL Server 2008 install, but getting the full stack running on Debian was once again a two liner on the shell:

apt-get install mysql5
apt-get install apache2

Ruby

One of the main reasons why I wanted my own root server was so I could run my own little rails projects I had nowhere to put before. So naturally I checked for the apt packages on ruby and found out that they are horribly outdated. Since I primarily wanted Rails3 I installed Ruby 1.9.2 through RVM.

Once again, so easy that any Windows Sysadmin will weep:

bash < <(curl -s https://rvm.beginrescueend.com/install/rvm)
#restart the prompt
rvm notes
#Read through the notes as it will tell you what packages ruby 1.9.2 requires
#and install them through apt-get
rvm install 1.9.2
rvm use 1.9.2 --default

The rvm install will take about 10 minutes since it's actually compiling ruby 1.9.2 from source and installing it to /usr/local/rvm but that's it then.

Passenger

Being able to run Ruby is nice, but Apache2 didn't know anything of it's luck yet so next step was to install the Passenger in order to run Rack apps.

Now here it's a bit tricky because Passenger is available in the apt sources. So if you run apt-get install libapache2-mod-passenger you are screwed as apt will go ahead and pull down Ruby 1.8 and overwrite all the stuff you did with RVM before. (No big deal but not ideal either).

So the better way to install Passenger is to actually install it through the new RVM rubie as a Gem:

gem install passenger
passenger-install-apache2-module

Again, it can't really get any easier. The installer will even tell you what libraries you are missing and tell you exactly what to type into apt-get to install them.

After the install is done you simply need to hack open your apache2.conf and add the module settings (they are listed in the installer), but it's better to go into your /etc/apache2/mods-available and put the code into a new file (conveniently called passenger-local.load). Now your local passenger install is an apache module and apache won't blow up on the next apt-get upgrade.

You then activate your module with a2enmod passenger-local and restart apache (/etc/init.d/apache2 restart).

Wordpress

Migrating a Wordpress blog was fairly easy, I just copied all the files from my old host into /var/www and restored the MySQL database from the mysql-dump. The thing that amazed me at this point however was Sequel Pro and SSH. The MySQL server does not allow connections from the outside for obvious security reasons so I was already thinking about either installing phpMyAdmin on the machine or figuring out how to run the 5 mb SQL insert script through the MySQL commandline client. Turns out, my Mac MySQL app Sequel Pro can connect to MySQL servers over SSH. So I connected to 127.0.0.1 over the encrypted SSH tunnel - getting a really nice management interface with no open ports whatsoever. Wow..

Anyways, the Wordpress install was pretty easy. I set the correct file permissions on my /var/www folder with chown -R www-data:www-data /var/www and changed the database connection strings in wp-config.php. I then had to fiddle a bit because mod-rewrite was not enabled and all permalinks where broken. I fixed that with a2enmod rewrite and setting the AllowOverride setting in /etc/apache2/sites-available/default to FileInfo

In closing I have to say I am genuinely impressed by the amount of flexibility you get with SSH. Windows could really use a good command line interface and desperatly needs a way to remote into servers without having to run RDP all the time. Especially sending files around with SCP or tunneling traffic over SSH is so incredibly useful that I can't understand why there is no such thing in Windows at all. Your best bet there is PowerShell remoting but that's far away from useful.

Filed under site-news

Goodbye Wordpress, Hello Jekyll!

The title says it all, I’ve finally moved my Blog off Wordpress and replaced it by static HTML files generated by Jekyll

This means: No more security updates to Wordpress, no database roundtrip to display what amounts to static HTML content and best of all: I can version my posts using Git! Naturally, the code is now up on GitHub in it’s own repository Another added benefit is that I can now write my posts using textile instead of HTML, what amounts to a much better editing experience.

What changed for my readers? Nothing, and that’s not really a good thing. I feel like this blog would benefit from a cosmetic overhaul, but until I can convince a designer to help me out with that it will look and feel the same it has always done (boring). I did however clean out the sidebar a bit :)

The migration process

Oh this is where things get interesting. Migrating to Jekyll was not as easy as I thought it should be. Since my hoster does not allow for direct connections to the MySQL database using the migrator scripts within Jekyll was not an option. These require direct database access and I was not very keen on installing MySQL on my machine just for that purpose.

It was a journey from there, I first tried to export MSSQL compatible SQL but suffice it to say phpMyAdmin sucks. (It was also unable to generate sane YAML). I finally found the export function inside Wordpress itself that will generate a RSS style XML document that contains all posts and decided to simply write a Ruby script that exports the posts from the XML into html files for use in Jekyll.

Writing that script was also a bit funny, since Ruby/Jekyll fails totally at reading YAML Front Matter in any format besides ANSI. So I had to find out how to first write a file in ANSI using ruby (it defaulted to UTF-8) and then how to htmlencode text using htmlentities. Anyway, overall I have to say writing that Ruby script was really fun and I may end up doing a bit more Ruby in the future. And btw: I finally managed to learn how to get around Vim. Did I mention that this editor totally rocks?

In the end, the script is still rather simplistic. It will just take a wordpress.xml file and extract all posts into the _posts directory, adding categories, title etc to the YAML Front Matter of each post. You can find it in my GitHub repository: Importer.rb

I’ll put up a series of blogposts about the Wordpress → Jekyll migration in the near future.

Update: Sorry to all my feed subscribers for the spam there. I changed the format of the feed to atom and now your reader may show 20 unread posts when there is really only one.

Filed under programmierung, site-news

Thanks Lijit!

You may have seen that I use Lijit to power the on-site search for my blog. Since Lijit by default uses a Google custom search to power this (nothing really wrong with that) I became quite unhappy with the results (Google for some reason doesn’t like to index articles but rather indexes categories :(). Since I didn’t find my own stuff through Google, getting the same bad results through Lijit was quite annoying.

So I tweeted this one day:

image

Well, took about 45 minutes to receive this:

image

And this very nice Email alongside:

image

Well, that was 2 days ago. Search results that I get when using the on-site search are back to what I expect them to be and I’m once again able to find my own stuff.

Thanks Lijit. Great service!

Filed under personal, site-news

I&rsquo;m in on the Castle blog aggregator

Well, I already told you about the Castle blog aggregator as a source for keeping up to date with the Castle project. Turns out the idea was taken even further and the feed has now been integrated into the www.castleproject.org under Community/Blogs.

What I never anticipated was that I’d one day get this email by Mauricio Scheffer:

Hi Daniel, would you be interested in being included in the Castle blog aggregator?
Your posts tagged as "Castle" would be automatically included.

Cheers,
Mauricio

My immediate answer was Yes! I’m very happy to be able to contribute to castle in any way possible, and seeing people consider my posts interesting is very rewarding to me. Thanks Mauricio!

Filed under personal, site-news

RSS Feed moved

logo_footer

So, apparently Google has decided to finally get rid of Feedburner and moved their services over to new servers. 
That means new feed URLs for everyone, also for me.

The new Feed URL is: http://feeds2.feedburner.com/Tigraine

I changed the little subscribe button to the right, and Google has also put redirects on the old URL pointing to the new one. So, existing subscribers shouldn’t see any change.

Since I already moved (not the smartest thing), if you can read this in your reader, everything is fine.

Filed under site-news

Del.icio.us dissappears from the feed

After some thought I finally dragged myself to make a decision on the del.icio.us links in my RSS feed:

I finally decided to remove the links from the feed, most of my del.icio.us links aren't just that relevant to my blog posts that I really need to share them with you.
If you still want to recieve my del.icio.us links you can simply subscribe to my del.icio.us feed or add me to your network in del.icio.us.
Another way to stay informed on my del.icio.us (and all my other activities, wether you like it or not *gg*) would be to simply follow me on friendfeed (although I still haven't really grasped the concept of the site).

Hope the feed just got more enjoyable for you :)

Cheers!

Filed under site-news

Major site rehaul

wordpress

After doing yesterday's post on CruiseControl.NET it bit me that I really really needed a new theme for my blog. Posting sourcecode on a constrained surface doesn't really work, and after seeing the XML posted yesterday I decided I need to do something about it.

So I went to themes.wordpress.net and found the theme you are currently looking at. It's nothing really special, but I like the clean look and it has no fixed width. The theme came with no widget support so I followed this handy guide and hacked them into the theme myself. It really isn't that hard after all, although I found this php-html mix quite disturbing.

After being done with the new design, I decided that source is horribly unreadable, and I'm not really happy with my previous solution of doing screenshots (not indexable, not copyable). So I found this really cool JavaScript library by Alex Gorbatchev called SyntaxHighlighter that highlights <pre> tags and adds some very nice formatting to your code.
Here's an example:

static class Program
  
    {
        /// <summary>
        /// The main entry point for the application.
        /// </summary>
        [STAThread]
        static void Main()
        {
            Application.EnableVisualStyles();
            Application.SetCompatibleTextRenderingDefault(false);
            Application.Run(new Form1());
        }
    }


And while being at it I also updated to the most current version of WordPress. So if you encounter any oddities (especially with the feed), please tell me about it so I can fix it.

Oh and by the way, while being at it I installed iWPhone so that any user who visits http://tigraine.at with an iPhone or iPod touch will get a stripped down site without too much clutter that's been optimized for the iPhone resolution. Images get removed from the front-page but everything still looks cool. :)

Filed under site-news

Changes incoming!

As some of you may have noticed, I recently started to use this blog to share some of my views on C# programming topics and wrote those posts in English.

I chose English instead of German because obviously everything I am reading on those topics is kept in English (just browse my Blogroll and you'll see what I mean). Now that I recently realized that buying my technical books from Amazon.com saves me quite a penny over doing so at Amazon.de, I am literally breathing articles in English. I also had to realize that while being (somehow) perfectly fluent in English while talking and reading, my written skills seem to have deteriorated. This is something I really hope to be able to improve through this blog and work.

So, apparently this will be the first change: All future posts will be written in (more or less good) English.

I am currently trying to clean up the site, meaning that I will re-think Categories and Tags to fit.

I am also planning to focus a bit more on software development and .NET programming. So expect more on-topic and less off-topic posts in the future.

This is just one of many changes I currently plan to execute over the next weeks.

Filed under site, site-news, site-news

New RSS Feed!

feedburner

One thing that was on my checklist for some months now was getting my RSS Syndication right.

I was thinking about using Feedburner before, but stuck to the Wordpress default Syndication, believing that the Wordpress built-in Feed could do just as good.

I was obviously wrong and finally corrected this mistake today and did set up my new FeedBurner feed!

By clicking on the new Link in the sidebar you will find the new Feed that will not only syndicate this Blog and it's posts, but also my del.icio.us Links.

For all people who where using my old RSS Feed please update your subscription to the new URL.

My Photography business

Projects

dynamic css for .NET

Archives

more