Brushes Aliases for SyntaxHighlighter Extension

by Lasse Soelberg 21. May 2009 21:36

I have added a new feature to the SyntaxHighlighter extension for BlogEngine.NET. And that is to see which aliases can be used for each brush. It will only show the aliases for the brushes that are selected in the Brushes section.

aliases

The aliases are retrieved from the actual brush JavaScript files . So if a new brush gets installed and selected, the aliases for it will show up in the list.

Download the Extension

I have added the extension to CodePlex, so the latest version can always be found there.

SyntaxHighlighter 2.0 For BlogEngine.NET

Tags: , ,

BlogEngine

SyntaxHighlighter for BlogEngine.NET Extension

by Lasse Soelberg 20. May 2009 00:16

Alex Gorbatchev has made a fantastic piece of software called SyntaxHighlighter, that uses JavaScript to present formatted code posted on a blog. As an example here is a little code snippet formatted as C#

// Returns the sum
public int Add(int a, int b)
{
    return a + b;
}

And here it is unformatted

// Returns the sum
public int Add(int a, int b)
{
return a + b;
}

To make the code use SyntaxHighlighter, it is put inside <pre> tags, where the brush to use is set. The example code including the tags looks like this:

<pre class="brush: csharp;">// Returns the sum
public int Add(int a, int b)
{
    return a + b;
}</pre>

Before this functionality can be used however, one has to add some JavaScript and Css stuff to the headers of post pages. And in my search for how to add this to my blog, i stumbled upon this blog post by Chris Blankenship. He had made an extension to BlogEngine that automatically adds the necessary stuff. Very cool I think!

However, the extension is created for SyntaxHighlighter 1.5 and the one I have installed is version 2.0. And there are some differences. So I set out to modify the extension a little so it would support the new version of SyntaxHighlighter. Those small modifications soon turned out to be big ones, since i wanted dynamic recognition of available brushes. Version 2.0 also comes with styles that can be applied, and I wanted and easy way to change the style. So in the end the extension has gone through a complete rewrite and have got a custom made admin page added as well.

Extension Features

This is the list of features for the extension:

  • Automatically imports SyntaxHighlighter JavaScript and Css files.
  • The path to SyntaxHighlighters styles and scripts folders can be changed from the admin page.
  • The brushes to load is configurable.
  • If brushes gets uploaded or deleted, the list of brushes can be updated through the admin page.
  • The style used can be set.
  • The list of styles can be updated if more styles are added.

More...

Tags: , ,

BlogEngine

Script for SVN Backup

by Lasse Soelberg 19. May 2009 22:12

This script is used to control the backup procedure for backing up my SVN repositories. A post detailing the software needed for this script to run can be seen here. This script is originally made by Damon Timm and can be found here. I will not detail how to use it, since Damon has done a good job at it, so take a look at his site.

I have made some small modifications to the script. Most important is the possibility to use European buckets with S3.

Edit 23. June 2009: The number of log files in the log file directory started to annoy me, since every file is put in the same directory and the script is run once a day. I have now changed the script to save the log files in subfolders based on year and month.

The Script

More...

Tags: , ,

Backup | NSLU2

SVN Repository Backup

by Lasse Soelberg 17. May 2009 11:44

This is how I solved my first backup task. An overview of my backup project is found here.

The task is to make incremental backup’s of my subversion repository and store the backup on Amazon S3. I found a blog post by Damon Timm describing how to do incremental backups to S3 using a piece of software called Duplicity. Damon’s is based on OS X or Ubuntu, so it is quite similar to my install, since my server runs Debian. There are a few differences however, such as no sudo command and i had to generate the gpg key on another machine.

Installation of the software

First thing first. Log in as root and issue an apt-get update:

su root
apt-get update

Time to install Duplicity. The latest version at time I installed the software was 0.5.16. Check Duplicity’s download page to see if there has been a new version made available:

apt-get build-dep duplicity
aptitude install python-boto ncftp
wget http://savannah.nongnu.org/download/duplicity/duplicity-0.5.16.tar.gz
tar xvzf duplicity-0.5.16.tar.gz
cd duplicity-0.5.16/
python setup.py install

We also need a piece of software called s3cmd, so that is installed next

apt-get install s3cmd

Encryption

As mentioned earlier i couldn’t get the server to generate a new key for me. It just kept hanging with a message that it needed more entropy. To overcome this problem i generated the key on a different machine, exported it, imported it to the server and changed the trust, so I could use it.

Generate and export the key

I booted Ubuntu 9.04 from a Live CD and once logged in I generated the key with the default choices:

gpg --gen-key

To export the key run the following command, substituting NAME with the name from the key and FILE with the file to save the key in.

gpg -a --export-secret-keys NAME > FILE

Import the key

After copying the key to the server, it is loaded with the following command,  substituting  FILE as described above.

gpg --allow-secret-key-import --import FILE

Next is to change the trust level on the key, otherwise Duplicity will complain and quit, rendering encrypted use of Duplicity useless. Substitute NAME with the name from the key.

gpg --edit-key NAME

This will put you in a console. Type “trust” and choose 5, I trust ultimately. After the trust have been set, you leave the console again by typing “quit”.

Passphrase

The last thing to consider is the passphrase used for the key. I have my key stored in a file that has been chmod’ed to 0600.

nano ~/.gnupg/.gpg-passphrase

Enter the passphrase and press Ctrl^O to save and then Ctrl^X to exit. Finally the rights on the file has to be modified.

chmod 0600 ~/.gnupg/.gpg-passphrase

The Script

Now that all the software bits have been set up, it is time to make a script that can take care of the backup procedure. And that script is described here .

Tags: , , , ,

Backup | NSLU2

My Backup Project

by Lasse Soelberg 16. May 2009 15:00

With the increasing amount of data that i have stored in various places, it has become quite clear that i need to have backup of important things. And it should not just be backup on other disks at my home, it should be an online backup somewhere in the cloud.

After doing some research into what options are available i have settled on using Amazon’s S3 for storing the backups. There are no limits on the amount of data to store and you only pay for what you use. And it is not too expensive either.

Backup Requirements

Before I define what i would like to have backup of, i will start by making some requirements that the backup procedure should adhere to.

  • Automatic. The backup procedure must be completely automated. If it aren't automatic, i will probably forget a step or two along the way and finally end up not doing any backup at all.
  • Controlled by my server. The backup procedures must be controlled by my server, since it is the only machine i have that is always turned on.
  • Online backup. The backup’s must be stored online, since a backup on other disks in house is void if the house burns down.
  • Free! The backup procedures has to be based on free and/or open source software. It is enough to be paying for the use of S3.

Backup Tasks

So far i have identified 6 different backup tasks that i would like to address. The tasks are as follows:

  1. SVN repository backup. This should be straightforward. Do incremental backup of the folder containing all my repositories. Should be run once a day.
  2. Picture backup. This is the big one. Currently i have more than 20 GB worth of pictures. I won’t be doing incremental backup with the pictures, since i don’t think the content of a picture will change. Even though there is a lot of data, i will prefer to have this one be a mirror of my pictures folder. The backup procedure should be run once a week.
  3. Linux web domain file backup. Incremental backup of various files on my Linux domain. Primarily my phpbb installations. Should be per app backup, for example separate backup of each of my phpbb installations. This procedure should be run once a week.
  4. Linux web domain DB backup. Incremental backup of the MySQL database belonging to my Linux domain. Per app backup just as for the files. Should be run once a week.
  5. Windows web domain file backup. Incremental backup of various files on my Windows domain. Backups should be per sub domain and/or app. This procedure should be run once a week.
  6. Windows web domain DB backup. Incremental backup of the SQL Server databases belonging to the windows domain. Backups should be per database and/or application. Should be run once a week.

Tags: , ,

Backup | NSLU2

My Home Server

by Lasse Soelberg 14. May 2009 21:40

As like many other Computer Science persons, i have my own server running at home. I use it primarily as an svn server and to do backup of various things. Being a student, one of the demands I had for server was that it was cheap to run, such that my electrical bill wouldn’t be too insane. After some researching into the matter i discovered the perfect little device: the Linksys NSLU2

The Slug

The NSLU2 is nicknamed Slug. It contains a 266 MHz ARM processor, 32 MB RAM and 8 MB Flash ROM. Being small the only connectors on it are 2 USB ports, an ethernet port and the power. A nice feature of the device is that it is passively cooled, so it is dead quiet Laughing. The OS on the slug is a custom made version of Linux.

           nslu2                           250px-NSLU2_board_front

 

Modding

Being a Linuc device, there are some nifty people that have managed to replace the firmware on the slug with their own version, making it capable to do a lot more than it was designed to. A good source for information regarding what you can do with a slug is http://www.nslu2-linux.org/.

By changing the firmware it is possible to install the OS on an external disk, making it possible to install a lot more programs on it than can be kept in the 8 MB onboard flash. My first attempt was with Unslung, which is a good starting point, since it only extends the original firmware and still keeps the interface from the original. After a while though, i decided to change it to Debian to get the power of a full linux distro.

My Setup

My Slug runs Debian 5.0, which there is a nice installation guide for here, from a 30 GB external 2.5” harddrive. I have set up ssh with key authentication on it, which is my primary means of interacting with it. I also have Sambato make a little network drive. I have subversion installed for having my own versioning control system. I also have some backup solutions running that stores the backup on Amazon S3, i will describe those setups in other blog posts.

Tags: , ,

NSLU2

JAOO 2008 Day Three

by Lasse Soelberg 2. October 2008 21:30

My third day at JAOO started out with working in the eating area from 9:00 to 14:00, so i only got to attend two sessions. But atleast there was enough food at lunch. After the sessions there was a crew and speakers dinner. We got some very good food including a chili chocolate mousse, which was insanely good. It was a good way to end the conference.

Six Designs Principles Illustrated

This talk was about using some common design principles when making software. The presenter used three case studies to discuss a bunch of design principles. I liked the talk, it was interesting and presented well.

Concurrent Programming with Parallel Extensions to .NET

This talk was very interesting. It was about concurrency and how it will be handled in the .NET framework in the future. Parallel Extensions is an addition to the .NET that is currently in a beta stage. It will be a core part of .NET when the next big release will take place (C# 4.0). The talk gave rise to some thoughts about how I use for and foreach loops. For example in a typical for-loop, you specify an ordering, usually with the use of an index variable. In an foreach-loop however, you don't specify an ordering, and thus it is easier for the runtime system to run the loop concurrently.

Tags: ,

JAOO

JAOO 2008 Day Two

by Lasse Soelberg 30. September 2008 20:54

My second day at the JAOO conference has ended. I had no duties as a crew, so I could spend the entire day going to sessions. I attended 4 sessions today. I had planned to go to a 5th session, however I was almost about to fall asleep in the last two sessions I attended. Not because the sessions where boring, but due to lack of sleep the last few days. When 30 odd helpers sleep in the same room, the majority being in young and drinking beer, the noise level has been too high for me to sleep properly.

How Cool do Users Feel When Interacting with Your Software

When entering this session i thought it was about how users feel when interacting with various pieces of software, and tips for what to do in order to get users to like ones application. Boy was i wrong! The session was more about how you could enhance the physically world around you with IT. As an example was shown a beanbag that you could use to display images on a wall. The more you messed around in the bag, the more pictures was displayed. Try to do that with a business application! The presenter was a researcher at Århus University with HCI as her research area, and she falls into the same category as some of the work i have been presented to at Aalborg University during my own studies: Research for the sake of research. Or atleast that is my opinion,

Identifying your Client's Needs

This talk centered around the issues of customers not knowing what they want. I liked the talk. It gave some good examples of what to be aware of when trying to identify a client's needs.

Architecture of a RIA

This talk was a joint effort by Josh Holmes from Microsoft and James Ward from Adobe. They gave  a talk about the background of Rich Internet Applications (RIA) and what kinds of patterns are behind them (Model-View-Controller). They gave 10 best practice advices and 10 worst practice advices. All of them based on their own experiences. It was a very good talk, and it was cool to see that two RIA competitors (Microsoft with Silverlight and Adobe with Flex) joined forces inorder to spread the message about RIA.

RIAs using Adobe AIR & Flex

This talk was a continuation of the RIA introduction. This time with the focus on Adobe Flex and AIR, and with demonstrations of what you can do with those technologies. This was demonstrated by James Ward from Adobe. Again it was a good presentation, but unfortunately it was also the time when the lack of sleep really started to kick in.

Tags: ,

JAOO

JAOO 2008 Day One

by Lasse Soelberg 30. September 2008 08:14

I am attending this year's JAOO Conference in Århus, Denmark as student crew. It's pretty nice, I have to work for 2x6 hours during the 3 days, and the rest of the time I can attend the sessions as I like. A nice way to spend 3 days.

Where Are Programming Languages Going

The first session i attended was Anders Hejlberg's keynote speak about his views on the future for programming languages. He started out by giving a small demo of Turbo Pascal, which was the first language he helped create. He gave two reasons for showing the pascal demo. Firstly it is 25 years since it was made and secondly he wanted to show that not much has changed since then. At least not in the way we program today. 25 years ago you programmed using text files, and that method hasn't changed since. Anders's prediction as to how we program in 25 years, is that it will still be as text files.

A Developer's guide To the Microsoft Platform

After the keynote speak, i attended a session showing the possibilities with .NET and C#. During the session the presenter made an application using various new techniques for just about everything. Some of the topics covered was Ling to SQL,Silverlight, WPF and ASP.NET AJAX. Basically it was show how to use <insert Microsoft acronym for fancy stuff here>. But pretty cool though. I find it fascinating how much stuff you can make so easily using the .NET languages and Visual Studio.

Tags:

JAOO

Update 24. September 2008

by Lasse Soelberg 24. September 2008 11:57

It has been a while since my last update. but to sum up what has happened, the most important part is that I got my Bachelor degree in Computer Science.

I have not made any real progress on the online gallery application since i ran into troubles with my subversion repository server. At home i have a Linksys NSLU2, on which i have installed Debian Linux. A few months ago a security issue regarding SSL was discovered and as a result of the update i lost the ability to log into it. Kind of a problem when the device is only accessible through a network connection. I spend the entire summer trying to convince myself to correct the problem, so i would be able to access my repository again, but playing Guitar Hero on my Xbox always won Open-mouthed, so it wasn't until i started at the university again i got it up and running.

LSGallery

What has happened with the gallery, is that i have AJAX enabled it. I put the Treeview and the Gridview in separate updatepanels, such that an update in one doesn't affect the other. And this works very nicely, except for one small detail. Since the entire page no longer gets updated when something happens, the page history doesn't get updated and thus the ability to use the back button has disappeared.

To solve the history problem i am using .NET 3.5 SP1, which adds history management to AJAX. At the moment there is added a new entry to the history, every time there is navigation event on the page. I still need to make the functionality that actually uses the history, but before i can get that working i need to make some changes to how the albums are loaded in the first place.

Tags:

General | LSGallery

Powered by BlogEngine.NET 1.5.0.7
Theme by Mads Kristensen