Archive for the ‘How To's’ Category

xterm-clipboard support on Vim under Arch

Jul
15

I ran a system-upgrade on my Arch linux about 2 weeks ago and not until recently when I was using Vim heavily that I realized I lost my copy-paste support between vim instances on different terminal. I knew I solved this problem before but I just couldn’t remember how.

I finally found the solution and before I forget, I’m just going to share it here. This thread helped me.

Basically, vim that comes with Arch was compiled with minimal options. Some features (like xterm-clipboard support) are not included. The solution is to remove the default Vim and install GVim through pacman. GVim includes a richer-featured Vim. After that, don’t forget to insert below line on your ~/.vimrc:

set clipboard=unnamed

Completely Remove a File from a Git Repo

Apr
11

This guide helped me removing a file and its associated history from my git repo.

Change Default Storage Engine in MySQL

Jan
30

I like my default engine to be InnoDB because it’s fully transactional and supports foreign key references. However, the default engine in MySQL is MyISAM.

There are several ways to change the default storage engine:

  1. Add default-storage-engine = innodb to your /etc/mysql/my.cnf under mysqld server section
  2. The default storage engine can be specified at server startup with the –default-storage-engine option.
  3. For a running server, an administrator who has the SUPER privilege can change the default storage engine globally for all clients by setting the global storage_engine system variable:
    SET GLOBAL storage_engine = innodb;

    Setting the storage engine this way affects any client that connects after the statement executes. Clients that are connected at the time of statement execution are unaffected.

  4. Any client can change its own default storage engine by issuing either of these statements:
    SET SESSION storage_engine = innodb;
    SET storage_engine = innodb;
    

If you change your default storage engine using Method 1, you can optimize the performance by adding few more instructions, as explained in this Stack Overflow post.

I use Method 1, and I added 3 lines to my /etc/mysql/my.cnf:

Under [mysqld] :

default-character-set = utf8
default-storageengine = innodb

… then I also added this line in InnoDB section:

innodb_buffer_pool_size = 512M

Removing Your Site from Search Engine Crawler

Jan
30

Don’t want search engine like Google to include your site in the search results?

Create a file called “robots.txt” on your root HTML directory, the path where your main site’s URL belongs: http://www.yoursite.com/

This is normally located in www directory or public_html.

In this file, add these lines:

User-agent: *
Disallow: /

“Disallow” property indicates the path that you don’t want to be crawled/searched by search engines, including its child URL. In the example above, your site will be completely removed from search engine results as the main URL is disallowed.

If you want to exclude only certain child URLs, you can do write something like this:

User-agent: *
Disallow: /about
Disallow: /secret

Backing-up Your SVN Repository

Oct
21

To back up your SVN repository:

svnadmin dump path_to_svn_repo > backup_filename
tar cfz backup_filename.tgz backup_filename

Then to restore the SVN dump somewhere else:

tar xfvz backup_filename.tgz
svnadmin create new_svn_repo
svnadmin load new_svn_repo < backup_filename

Installing JDK in Ubuntu

Sep
9
  1. Look up the JDK version you want to install first
    apt-cache search jdk
    
  2. Then choose to install JDK.
  3. sudo apt-get install sun-java6-jdk
  4. Setup an environment variable for JAVA_HOME to point to the location of the JDK installation path (normally located at /usr/lib/jvm/java-6-sun/) by entering below line on your .bashrc file (located on your home directory, e.g. /home/username/.bashrc)
  5. export JAVA_HOME="/usr/lib/jvm/java-6-sun/;"