Archive for the ‘ How-To ’ Category

I am having problems with my SSH sessions, as it drops my connections to the server when I am idle, specially if am transferring large files or if I am updating database using mysqldump. So I added this line to my /etc/ssh/ssh_config file on my computer.

ServerAliveInterval 5
TCPKeepAlive yes

After adding this i restarted my ssh

/etc/init.d/ssh restart

What it does, Is it sends a small keep-alive packet to the server every 5 seconds to make it look like the ssh connection is actively used. That’s all folks hope you like the tip, for suggestions and feedback feel free to comment.

Like this blog? Why not buy me a cup of coffee?

When you are trying to install software on Ubuntu Linux using the apt-get package system, often you’ll forget the exact name of the package you are trying to install. Here’s how you can figure out what exact name of the package is.

Syntax:

apt-cache search package

raxso@raxso:-$ sudo apt-cache search mysql
bacula-sd-mysql - network backup, recovery and verification - MySQL SD tools
dbconfig-common - common framework for packaging database applications
exim4-daemon-heavy - Exim MTA (v4) daemon with extended features, including exiscan-acl
freeradius-mysql - MySQL module for FreeRADIUS server
libapache2-mod-auth-mysql - Apache 2 module for MySQL authentication
libdbd-mysql-perl - A Perl5 database interface to the MySQL database
libdbd-sqlite3-perl - Perl DBI driver with a self-contained RDBMS
libmysql-java - Java database (JDBC) driver for MySQL
libmysqlclient15-dev - MySQL database development files
libmysqlclient15off - MySQL database client library
libsasl2-modules-sql - Cyrus SASL - pluggable authentication modules (SQL)
mysql-client - MySQL database client (metapackage depending on the latest version)
mysql-client-5.0 - MySQL database client binaries
mysql-common - MySQL database common files
mysql-server - MySQL database server (metapackage depending on the latest version)
mysql-server-5.0 - MySQL database server binaries
postfix-mysql - MySQL map support for Postfix
python-mysqldb - A Python interface to MySQL
python-mysqldb-dbg - A Python interface to MySQL (debug extension)
python-pysqlite2 - Python interface to SQLite 3

I find it very useful when I forgot the name of the package I’m trying to install, you can figure out what the names of extra plugins are, as in the above example. You may also pipe the output to get results that you need.

raxso@raxso:-$ apt-cache search firefox | grep plugin
firefox-launchpad-plugin - Launchpad firefox integration
flashblock - mozilla extension that replaces flash plugin by a button
gcu-plugin - GNOME chemistry utils (browser plugin)
gnome-do-plugins - Extra functionality for GNOME-Do launcher
konqueror-plugin-gnash - free SWF movie player - Plugin for Konqueror
mozilla-plugin-gnash - free SWF movie player - Plugin for Mozilla and derivatives
totem-mozilla - Totem Mozilla plugin
flashplugin-nonfree - Adobe Flash Player plugin installer
mozilla-plugin-vlc - multimedia plugin for web browsers based on VLC

Like this blog? Why not buy me a cup of coffee?

I found this very cool fonts from dafont.com. It is a true type font which can be installed in ubuntu.

1. Download the font from  http://www.dafont.com/openlogos.font

2. unzip the file (unzip  openlogos.zip)

3. move openlogos.ttf to /usr/sahre/fonts/truetype

sudo mv openlogos.ttf /usr/share/fonts/truetype/

4. Then rebuild your font cache

sudo fc-cache -f -v

That’s it enjoy using the font…

Like this blog? Why not buy me a cup of coffee?

Recently we are having problems with our site not loading properly and found that the culprit is that the new version of php-memcache (php-memcache-5.2.9) is not compatible with the memcached daemon installed on the server. This is a simple script to test if memcached is working or not. A brief background about memcached.

From php.net

Memcache module provides handy procedural and object oriented interface to memcached, highly effective caching daemon, which was especially designed to decrease database load in dynamic web applications.

From danga.com

memcached is a high-performance, distributed memory object caching system, generic in nature, but intended for use in speeding up dynamic web applications by alleviating database load.

The Script:

<?php

$memcached = new Memcache;
$memcached->connect(’localhost’, 11211) or die (”Could not connect”);

$memver = $memcached->getVersion();
echo “Server’s Version: “.$memver.”\n”;

$tmp_obj = new stdClass;
$tmp_obj->str_attr = ‘test memcached and php-memcache module’;
$tmp_obj->int_attr = 123456789;

$memcached->set(’key’, $tmp_obj, false, 10) or die (”Failed to save data at the server”);
echo “Store data in the cache (data will expire in 10 seconds)\n”;

$result = $memcached->get(’key’);
echo “Data from the memcached:\n”;

var_dump($result);

?>

The output:

raxso@raxso:-$ php get-memcache-info.php
Server’s Version: 1.2.2
Store data in the cache (data will expire in 10 seconds)
Data from the memcached:
object(stdClass)#3 (2) {
["str_attr"]=>
string(38) “test memcached and php-memcache module”
["int_attr"]=>
int(123456789)
}

Happy Scripting… :)

Like this blog? Why not buy me a cup of coffee?