Steffen Hi, the name's Steffen and I'm writing about the Web, programming and all those things coming to my mind. Enjoy your stay.

I'm currently working on fabidoo.com - 3D Printing for everyone!

Archive for the ‘Coding’ Category

Round Robin Database with MySQL

Friday, March 9th, 2007

If you have loads of continuous data which you have to store and at the same time it is o.k. if old data gets removed after a while, a round robin database is your choice. Those databases allow the user to define a maximum number of records (or maximum number of storage space) and new data that would not fit into the allocated space, will simply overwrite the oldest record in the database. Basically a ring buffer on disk. The database won’t grow indefinitely and you don’t have to do extensive maintenance tasks.

Without any doubts, RRDTool is the most popular round robin database out there. But fitting RRDTool into an existing database landscape is sometimes not what you want - especially if you need backups, etc. which you’d have to setup twice - for your existing database and for RRDTool.

I’m using MySQL quite a lot and it would be nice to have a round robin database engine for MySQL. Unfortunately this engine doesn’t exist, yet.

Fortunately however, Oli Sennhauser has written a three-pages-paper which describes how to “simulate” a round robin database with MySQL using MyISAM tables and a database trigger. Nice one - check it out.

Tags: , , , ,

Cropping Images with JavaScript

Friday, February 16th, 2007

Imagine you have an image on your web page. And you want to crop an area from that image and display it with a given size. And you want to do that, without the server having to do the heavy work. Well then, read on, here’s a solution. (more…)

RDT and RadRails Keyboard Shortcuts

Thursday, February 8th, 2007

RDT together with RadRails on Eclipse is a pretty convenient development environment when doing things in Ruby on Rails. A little unknown are the keyboard shortcuts, which make your day even more productive. Here’s a list of those:

Ctrl-Alt-T

Jump to the test case of a model or controller and vice versa.

Ctrl-Shift-V

Jump to the view of a controller method and vice versa.

Ctrl-Alt-X

Factor out a partial from a view. Simply select the code block you want to factor out into a separate partial an press the key combination. A window opens an you can enter the name for the new partial (dont’t forget the _ and the .rhtml).

Ctrl-Shift-F

Auto-format the selected code (Ruby only). Not that mature, yet, and seems to have problems with regular expression - currently not recommended to use.

Ctrl-Shift-C

Toggle comment (Ruby only), i.e. the selected code block will be commented out if it wasn’t (# are inserted in the first column of each row), and vice versa.

 

Especially jumping between models/controllers and their test-cases/views saves you a lot of hassle like “where’s that file again in my damn folder hierarchy”, especially when your project gets larger.

Oh and one more thing: The listed shortcuts are the ones coming with RDT/RadRails additionally to the ones already included in Eclipse. You can always check those out via Window->Preferences->General->Keys. Gems are awaiting you ;-)

Tags: , , , , , ,

You are currently browsing the archives for the Coding category.

18507