valibuk.net

A place for opinions and notes of a valibuk.

Copy With Exclude

Tagged with: — ondrej at 11:32 am on Tuesday, August 29, 2006

The cp command does not provide any exclude functionality. There is a nice way how to achieve it:

  1. (cd "./${SRCIN_DIR}" && tar cpf - –exclude=.svn . ) | (cd "./${DEST_DIR}" && tar xpf - )

Various Number of Conditions

Tagged with: — ondrej at 1:49 am on Monday, August 21, 2006

Ruby on RailsFiltering is basically about writing conditions. In most cases the number of conditions is fixed, e.g. an internal filter in an application. Then it is quite easy to prepare a value for the conditions parameter.

But what to do if a number of conditions may vary? It is not a good idea to pass an empty value, because an empty value is still a valid value. We have to somehow implicitly say that a condition with an empty value should not be taken into a filtering process at all.
(There is more where this came from … )

Flash Without Font on (K)Ubuntu?

Tagged with: — ondrej at 1:49 am on Thursday, August 17, 2006

Did you install Flash plug-in into Firefox on Ubuntu or Kubuntu? Do you see any text in Flash applications such as Google Analytics graphs? No?

Try this :)
sudo apt-get install gsfonts-x11

Broken Notebook

Tagged with: — ondrej at 1:39 am on Thursday, August 17, 2006

My notebook… well, actually it is a company notebook, but I have used it for two and half years, so… my :) notebook is broken.
It starts for a few seconds, then it restarts and freezes… Arrrrrgh…

It is.. was an Acer notebook (TravelMate 800), the cover was falling a part ;), but inside it was fine and I was really satisfied with it (dvd burner, 1gb ram, etc.). Ah, yeah, labels of keys were disappearing, so it was quite difficult for anybody else to distinguish between Ctrl, Alt, Win and Fn keys :)
(There is more where this came from … )

How to observe more fields with AJAX helper

Tagged with: — ondrej at 12:31 am on Tuesday, August 15, 2006

Ruby on RailsThe observe_field AJAX helper allows to observe one field; if there is a change, it calls the specified method on the server side. It is possible to attach one value for the call.

This is enough if we have one text box search for searching over multiple columns or for a full-text search.

For a more complicated filtering functionality with more fields there are two main problems with the observe_field helper:

  • how to specify more parameter values in the observe_field helper.
  • it is necessary to write a observe_field call for each field.

Added: Thanks to Ryan Bate and Benjamin, I found out there is a helper for the whole form: the observe_form helper. Basically my post is useless, except a few situations: if a form contains a lot of items and you would not like to send them all, or, and I am not 100% sure about this, if a form contains a file field (the file_field helper).

Let’s create a special observe_fields helper that will handle all this problems :)
(There is more where this came from … )

Photos from Sweden and Denmark

Tagged with: — ondrej at 4:37 am on Monday, August 7, 2006

I added some pictures from my trip to Sweden and Denmark to my photo album. Enjoy :)

Pridal som zopár fotiek z výletu do Švédska a Dánska do fotoalbumu. Veľa zábavy :)

Form Helpers for Collection in One Form

Tagged with: — ondrej at 2:37 am on Sunday, August 6, 2006

Ruby on RailsA usage of form helpers for a single record is easy and straightforward. But how to use them for a collection of records in one form?

Do we need to edit a collection of records in one form? Well, there is always an option to let a user to edit records one by one, and we should use this option if the structure of a record is complex, e.g. a lot of items. If the structure is simple or we use a subset of a complex structure, we can allow a user to edit more records in one form. A good examples are labels of photos in a photo album, description and price for items in a web shop, etc.
(There is more where this came from … )