Vim vim vim

I cant live without vim. Today is the day I understand this and have install vim on my home windows:) I hope that no one will start it accidently.

Ok. Here i will keep track of the commands that I use in vim.

configuring vim and nice screenshots tutorial

Here is more on the topic

  • Open many files in tabs:  vim -p file*
  • Search & Replace:  %s/something/nothing/g
  • cntrl-space in vim is: cntr-n /  cntrl-p
    load words from all pl/pm files: ctags *.p?
  • windows: :split / :vsplit
    cntr-w – switch
  • tabs:
  • set tabstop=2
    set autoindent
    << >>  size is controller:


Keyboard Shortcuts:

do – Get changes from other window into the current window.

dp – Put the changes from current window into the other window.

]c – Jump to the next change.

[c – Jump to the previous change.

Ctrl W + Ctrl W – Switch to the other split window.

Copy checkboxes from one form to another with Prototype

I have a case where the user must select items from a basket and use them with different forms.

Some items in this form
  • Item:
  • Item:
  • Item:
  • Item:
Another form here
(I will create here hidden fields from the the checkboxes in the first box)

I will show you how to use the checked boxes from the first form with the submit action in the second form

It would be easy if the form could be one – less support.

I am starting with those two forms

  • Helper form – Form with checkboxes
  • Action form – the form that will do the real action based on the selected items in the helper form

Here is how it looks the helper form. All the checkboxes are tagged with the class=”selectable”. Here is rails example but you can implement it pure html.

<%= check_box_tag('selected[]', true, image.selected?, :class=>"selectable") %>

Then we can select all the checkboxes with this javascript.

var make_to_hidden = $$('input.selectable');

Put on your action form an id so we can access it easy in this case:

<form id="mail_form" onsubmit="import_selected_basket()"> ... </form>

Lets add those checkboxes from the first form to the real action form with this javascript function

      function import_selected_basket() {
          var make_to_hidden = $$('input.selectable');
          make_to_hidden.each(function(item) {
              if (item.checked) {
                var new_item = new Element('input', { 'type': 'hidden', name:, value: item.value })

Rails conf 2008/6/2

Its aways nice to know whats going on in rails field

Whats new for me was flog:


Some more video links

Upgrading Rails

Here is nice tutorial how to move your project from rails 1.2.x to 2.0

  • upgrade the gems:
    • gem update --system
    • nice task to find the deprecated elements: “rake -T deprecated”, 10x!

Web Spiders and expired content

All my spiders were taking all content from a website on a single visit starting from the begining.

It seems that the idea of remembering which urls “produce” links with content is not so very bad.

Here is what I found for – a local Bulgarian SE.

I see that hasn’t remove from their page


Even I have no links to this page. Check the result here

Ops. Google do it the same way: here

Then how to get rid of old pages without leaving “bad” links in internet?

I will try to put show_categories.php in robots.txt to see what will happen with this page.

Search engines

It seems that I know too little for the world of the search engines. I will try to summarize the search engines that can be used for real applications. Continue reading

Thinks that I want to read

Rails plugins, gems, search engines, applications

Plugins & gems lists


Versioning of AR


Ajax pagination with JQuery

Find_by_param is a nice and easy way to handle permalinks and dealing with searching for to_param values

Asset Plugin – better than rails 2.0 integrated

Asset Packager

Image Magic


Model graph visualize

Article on


Simple Captcha

Memcached stuff

Good rails 2.1 overview

memcached -vv -l -p 11211 -m 256 -P /tmp/ -u mongrel


monitor the connections with the hidden option in the memcached-tool

echo $(($(netstat -nt | grep 11211 | grep -v WAIT | wc -l)/2)); ./memcached-tool dump > memdump; cat memdump


alternative memcached client

PDF Output

Somone example report

Need to be checked:


ruport & acts_as_reportable
some java reporting into rails

Sending Email

Inline email attachments plugin:

Wiki integration



Rails2.0 Video

Performance and Loging

Announcing Clientperf: Simple Client-Side Rails Performance

web statistics – not free

production log analyzers

webstat like:




Open source rails projects

Server setup





  • check my post
  • gem install nginx_config_generator

Everyday SQL statements



SHOW status where Variable_name like ‘Th%’ or Variable_name like ‘%Connec%’ ;

Check/Repair tables

mysqlcheck -u root -p***** –auto-repair –check –optimize –all-databases


watch -n 0.5 ‘mysql -u root -ppass -e “SHOW FULL PROCESSLIST” | grep Query’

mysql> set profiling=1;
mysql> select count(*) from mysql.user;
mysql> show profile;


pg_dump -U test arachnid_archiv_test –inserts -h –encoding=utf8 -f pgsql.sql

mysqldump -c -h $MYSQL_HOST -u $MYSQL_USER -p$MYSQL_PASS -r $tfile --add-drop-table $DB
mysqldump -c -h localhost -u system3 system3_production -psomepassword -r system3_production.sql  --add-drop-table $DB

Dump for full backup with flushing of the log files

–single-transaction –all-databases –delete-master-logs –flush-logs –master-data=2
> backup_sunday_1_PM.sql

Encoding problems

SHOW VARIABLES LIKE ‘character_set_%’;
curl -i

Creating a database

create database re_production DEFAULT CHARACTER SET utf8 DEFAULT COLLATE utf8_general_ci;

Creating a user

GRANT ALL PRIVILEGES ON arachnid_production.* TO ‘payak’@’%’ IDENTIFIED BY ‘payakpassword’ WITH GRANT OPTION;
GRANT ALL PRIVILEGES ON system3_production.* TO ‘payak’@’%’ IDENTIFIED BY ‘payakpassword’ WITH GRANT OPTION;

mysqladmin -u [user] -h localhost -p password ‘[new_password]’

SQL for a table


mysql tunel to another machine

ssh -N -f -l root -L s1
open port 3307 on the local machine to and login into s1 with root

Replace text

UPDATE script_histories SET cod_script = replace(cod_script,”observer.ArchiveObserver(siteId)”,”observer.ArchiveObserver(siteId, script_id, owned_source_id)”);

Copy from one table to another

DELETE FROM system3_production.articles;
INSERT INTO system3_production.articles SELECT * FROM arachnid_from_screen.articles;

Sessions for Rails

select count(*) from sessions where updated_at < DATE_SUB(now(), INTERVAL 3 DAY);

Binnary loging

Check this attachment here: mysql-presentation on replication etc.

  • See the status of the log files
  • Clean the binary logs instantly
  • Clean binary logs to date/name
    PURGE BINARY LOGS TO ”mysqld-bin.00XXXX’;
  • Configurations in my.cnf
    server-id = 1
    expire_logs_days = 1
    max_binlog_size = 100M


max_allowed_packet = 50M

query_cache_limit=8M #~~~ removed, 1M def. max pozwl. razmer za cache-hirane na edna zajawka
query_cache_size=128M #~~~ 32M, 0 def.

Restoring the maintian Debian User

GRANT ALL PRIVILEGES ON *.* TO 'debian-sys-maint'@'localhost' IDENTIFIED BY '<password>' WITH GRANT OPTION;
Replace <password> with your debian-sys-maint password.


Once in the dark DOS ages I have one game with which you can make wonderfull animations. In the “Windows” era I miss this game a lot….until I found this nice replacement.

© 2020 Gudasoft

Theme by Anders NorénUp ↑