How to Run Raw SQL Query on Zend Framework

This tutorial describes how to run raw SQL script inside a controller on Zend Framework.

For running non-queries, use the following:


Zend_Db_Table_Abstract::getDefaultAdapter()->query($sql);

In order to return a single row, use the following:


Zend_Db_Table_Abstract::getDefaultAdapter()->query($sql)->fetch(); 

To return all rows, use the following:


Zend_Db_Table_Abstract::getDefaultAdapter()->query($sql)->fetchAll(); 

How to get VIM-like functionality in Eclipse

This article describes how to get VIM-like functionality in Eclipse. It’s for the user who enjoys the speed of VIM but also needs to use Eclipse for software development.

There’s a great eclipse plugin called Vrapper. It is obtainable from the Vrapper website. It gives you VIM-like functionality while retaining the power of eclipse. It works pretty well.

How to copy from vim in ssh session to local clipboard on Mac

If you are using a Mac computer and editing vim inside an ssh session, then you can’t copy from the remote vim session to your clipboard using the familiar “+y. This is because the remove vim doesn’t know anything about your local pc’s clipboard. So, how do we copy text from a remote vim session to your local clipboard? There are 2 options :

1. Highlight the text with your mouse then press cmd+c

Note: if you have

set mouse=a

in your .vimrc file, this won’t work as any highlight with mouse switches vim to visual mode making cmd+c invalid. In this case you could press and hold alt before highlighting.

2. Put the text in a temporary file and transfer it to your local pc by scp, then put it in a the clipboard with pbcopy, i.e. go to local terminal and run these commands:

scp username@remotehost /tmp/stuff.txt
cat /tmp/stuff.txt | pbcopy