Archive for the ‘Projects’ Category

Simple backup script written in Ruby

Posted by rich on August 18th, 2008 categorised as Projects | No Comments »

I’ve written a simple backup script in Ruby that utilises Rsync I’ve made it public so feel free to fork, change and contribute!

The backups are structured as such:

/remote/location/current - The current folder contains the the latest clone of the intended backup folder.
/remote/location/backup_dir - The backup directory, which by default is the current day (monday, tuesday, etc) contains
the difference to current since it was last run. So it will contain any new files and any files that were deleted.

I need to add a few examples of the settings and how to use it via cron on Linux and Launchd on OS X but the basic script should be working fine.

The script can be found on my github account, http://github.com/RichGuk/rrsync/tree/master

You can simply clone it with the following command:

git clone git://github.com/RichGuk/rrsync.git

Moving the goals of Readinfra

Posted by rich on June 4th, 2008 categorised as Projects | No Comments »

Just a quick post, thought I’d let the world know that I’m changing the main goals I had for readinfra. I sat down yesterday and started to plan out bits of how I was going to do readinfra, what the design was going to look like among things when I thought to myself, I’ve not actually checked out if someone else has even done this. Turns out quite a few have (typical), one that stuck out was readbag, it’s written with google app engine too, nice eh? So with simlar services out there I’ve decided to make readinfra about hitting some nice goals I’d like to achive.

For one I’m going to develop the site using the merb framework so theres a goal already get good at merb and maybe become one of those big sites using merb? Other gloals….well shall I just list them?

1. Simple, clean and fast design!

I’ve decided to keep the design very simple and clean, as too focus more on your links and content instead of fancy graphics. Also by being clean I’m hoping that the design will be fast! Not having lots of images and making sure I cut right down on bloated javascript prettyness I’m hoping it’ll make the site snappy.

2. Rapid development

I want to get this done quick, I’ve read about quite a few of these modern type services being done in 24 hours! That’s not my goal as I don’t think I’d manage that (far to busy… yes…) but I want to only spend about a week of development time getting it up to a nice useable level. The time will be spread over a few weeks or so though.

3. Learn, develop and master Merb

I’m looking at merb as another ruby based alternative to rails -which although very nice might be an overkill for certain things as it comes with a lot of stuff. Merb is different to rails though it takes more of the approach of adding what you need instead of having it all thrown in there. I ran some simple benchmarks the other day by writing the same app in rails and merb.

This app simply pulled some records out the same database, they both had the same layout and pretty much the same code and here are the results I got from running apache benchmark (ab) making 10000 requests with a concurency of 100.

Rails development mode: 22.98 req/sec
Merb development mode: 144.62
req/sec
Rails production mode: 151.18 req/sec

Merb production mode:
222.90 req/sec

req/sec = requests per second.

As you can see merb seemed quite a bit faster so looking forward to some development with merb.

3 goals will do for now, I’m sure I’ll have much more as I go though the development stage… so stay tuned join the beta and hopefully you’ll enjoy the service.

New projects, when the time comes

Posted by rich on April 10th, 2008 categorised as Projects | No Comments »

So….I’ve got a project coming soon hopefully… when the free time is given to me. I won’t release information about it leave it as a nice surprise. I’m hoping it will be of some use to people but who knows eh? :). A few lucky people could have some beta access, if you want to try the beta then email me.

Readinfra - Save it for later!

Tinymce Syntaxhighlighter Plugin

Posted by rich on April 7th, 2008 categorised as General, Projects | 5 Comments »

I went to intergrate Syntaxhighlighter into the site tonight, something I’d forgotten to do in the redesign and I thought it would be nice if I could just click a button in tinymce and paste in the code, select a few options and click insert. Which of course is entirely possible so I’ve written a tinymce plugin to do just that.

I did encounter one little bug writing the plugin. When inserting the pasted code it keept repeating itself if there was currently no content in the body of the textarea (tinymce). I finally managed to fix it by putting a space at the end of the variable I was trying to insert (and with the power of highlighting here’s what that looked like).

textarea_output += '</textarea> '; /* Note space */
tinyMCEPopup.editor.execCommand('mceInsertContent', false, textarea_output);

You can download the plugin here:

  syntaxhl.rar (5.1 KiB, 63 hits)
  syntaxhl.tar.gz (4.6 KiB, 80 hits)
  syntaxhl.zip (5.7 KiB, 74 hits)

UPDATE: The project has been moved to github, this is the preferred way of obtaining the files. I will leave the old download links up for now. Also feel free to fork, modify and send pull request with changes to the project… improvements are always welcome.

http://github.com/RichGuk/syntaxhl/tree/master

Getting it to work

First you need to download Syntaxhighlighter and get that working by including the CSS file and Javascript files. I combind all of the syntaxhighlighter javascript files into one on 27smiles, you can get it here.

Extract the plugin

Next you need to extract the plugin to your tinymce plugin directory. When extracted it should be something like this:
/path/to/tinymce/plugins/syntaxhl

Configure tinymce

Finally we need to configure tinymce to use our plugin we also need to stop tinymce from stripping out <textarea></textarea> html tags as this is needed for Syntaxhighlighter.

tinyMCE.init({
theme : "advanced",
plugins : "syntaxhl",
theme_advanced_buttons1 : "bold,italic,underline,undo,redo,link,unlink,image,forecolor,styleselect,removeformat,cleanup,code, syntaxhl",
theme_advanced_buttons2 : "",
theme_advanced_buttons3 : "",
remove_linebreaks : false,
extended_valid_elements : "textarea[cols|rows|disabled|name|readonly|class]"
});

We tell tinymce to use our plugin by adding syntaxhl to the plugins list and also adding the sytnaxhl button to the buttons list also note that extended_valid_elements contains the textarea tag this tells tinymce to not remove it.

If all went well you should see a new highlighter icon button in tinymce and when you click it you should get a dialog popup allowing you to insert code into your content.

If you encounter any bugs or have any problems getting it to work please contact me I’d be happy to help/fix bugs. Please note that I’ve only briefly tested this on Safari/IE7/Firefox 2/Firefox 3b5 and a quick blast on IE6 and from first tests it seemed to work. Also I was unsure if you have to stick to any standards when writing plugin’s for tinymce so it might not be the correctly way of doing it.