Saturday, September 17, 2011

Monday, September 12, 2011

Clean up CodeIgniter's database (ActiveRecord) memory usage

As what I have found when I was researching there are 2 ways:
  • Prevent ActiveRecord from saving query
by
$this->db->save_queries = false;
credit: how can I free the memory used by $this->db->insert()

  • Free result memory - CodeIgniter will only reclaim memory when http query processing was returned. If you request is long, you have to free by yourself
by
$query = $this->db->query('SELECT title FROM my_table');
$query->free_result();
credit: last section of Generating Query Results

Friday, September 9, 2011

Useful VIM command that I still can't remember



  • “0p - pastes the last explicitly copied text
  • :reg - Show a list of registers
  • J - Merge current line With Next Line
  • =, == - Fix indention
  • u,U(in visual mode) - lower, uppercase
  • q: - list command history
  • q/ - list search history
  • Ctrl ^ - go to previous buffer
  • :w !sudo tee % - save readonly file
  • diw - delete a word
  • di(, da( - delete text inside/include ()
  • di", da" - delete text inside/include ""
For rails.vim
  • gf - open file from cursor
  • :R{view,model,controller,spec} {file}

Collectd PostgreSQL Plugin

I couldn't find this link when searching with google https://www.collectd.org/documentation/manpages/collectd.conf.html#plugin-postgresql