I had missed this for long:
If you are using screen and you want to scroll through the terminal use the following sequence:
ctrl+a [
After this you can use the arrow keys or ctrl + u,b etc
http://www.samsarin.com/blog/2007/03/11/gnu-screen-working-with-the-scrollback-buffer/
Wednesday, May 19, 2010
Monday, May 3, 2010
mysql Dumps!
mysql> SELECT * FROMINTO OUTFILE ' ' FIELDS TERMINATED BY ','; We can use below query for importing data from .txt file mysql> LOAD DATA INFILE INTO TABLE ' ' FIELDS TERMINATED BY ',';
Thursday, April 29, 2010
Installing CPAN for perl
Installing: install cpan/
Reloading: reload cpan
dh-make-perl --install --cpan Template::Extract : for the module Extract from Template
Reloading: reload cpan
dh-make-perl --install --cpan Template::Extract : for the module Extract from Template
Friday, March 5, 2010
Caching
Excellent article on caching on http://www.mnot.net/cache_docs/
What’s a Web Cache? Why do people use them?
What’s a Web Cache? Why do people use them?
- Kinds of Web Caches
- Aren’t Web Caches bad for me? Why should I help them?
- How Web Caches Work
- How (and how not) to Control Caches
- Tips for Building a Cache-Aware Site
- Writing Cache-Aware Scripts
- Frequently Asked Questions
- Implementation Notes — Web Servers
- Implementation Notes — Server-Side Scripting
- References and Further Information
- About This Document
Tuesday, March 2, 2010
PHP memcache
What is Memcached?(http://memcached.org/)
Free & open source, high-performance, distributed memory object caching system, generic in nature, but intended for use in speeding up dynamic web applications by alleviating database load.Memcached is an in-memory key-value store for small chunks of arbitrary data (strings, objects) from results of database calls, API calls, or page rendering.
Memcached is simple yet powerful. Its simple design promotes quick deployment, ease of development, and solves many problems facing large data caches. Its API is available for most popular languages.
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.
sudo apt-get install php5-memcache
Example:
$memcache = new Memcache;$memcache->connect('localhost', 11211) or die ("Could not connect");
$version = $memcache->getVersion();
echo "Server's version: ".$version."
\n";
$tmp_object = new stdClass;$tmp_object->str_attr = 'test';$tmp_object->int_attr = 123;
$memcache->set('key', $tmp_object, false, 10) or die ("Failed to save data at the server");
echo "Store data in the cache (data will expire in 10 seconds)
\n";
$get_result = $memcache->get('key');
echo "Data from the cache:
\n";
var_dump($get_result);
?> Memcache Functions
Table of Contents
- Memcache::add — Add an item to the server
- Memcache::addServer — Add a memcached server to connection pool
- Memcache::close — Close memcached server connection
- Memcache::connect — Open memcached server connection
- memcache_debug — Turn debug output on/off
- Memcache::decrement — Decrement item's value
- Memcache::delete — Delete item from the server
- Memcache::flush — Flush all existing items at the server
- Memcache::get — Retrieve item from the server
- Memcache::getExtendedStats — Get statistics from all servers in pool
- Memcache::getServerStatus — Returns server status
- Memcache::getStats — Get statistics of the server
- Memcache::getVersion — Return version of the server
- Memcache::increment — Increment item's value
- Memcache::pconnect — Open memcached server persistent connection
- Memcache::replace — Replace value of the existing item
- Memcache::set — Store data at the server
- Memcache::setCompressThreshold — Enable automatic compression of large values
- Memcache::setServerParams — Changes server parameters and status at runtime
PECL
What is PECL?
PECL is a repository for PHP Extensions, providing a directory of all known extensions and hosting facilities for downloading and development of PHP extensions.The packaging and distribution system used by PECL is shared with its sister, PEAR.
To see the list of packages go here:
http://pecl.php.net/packages.php
PHP APC
The Alternative PHP Cache (APC) is a free and open opcode cache for PHP. Its goal is to provide a free, open, and robust framework for caching and optimizing PHP intermediate code.
Check for the installation using:
There are two primary decisions to be made configuring APC. First, how much memory is going to be allocated to APC; and second, whether APC will check if a file has been modified on every request. The two ini directives that control these settings are apc.shm_size and apc.stat, respectively. Read the sections on these two directive carefully below.
2)
Check for the installation using:
php -r 'phpinfo();' |grep apc If its not installed already use(on ubuntu): sudo apt-get install php-apc
sudo /etc/init.d/apache2 restart or apt-get install apache2-prefork-dev
pecl install apc Use dpkg -L php-apc to know where the files are installedThere are two primary decisions to be made configuring APC. First, how much memory is going to be allocated to APC; and second, whether APC will check if a file has been modified on every request. The two ini directives that control these settings are apc.shm_size and apc.stat, respectively. Read the sections on these two directive carefully below.
APC Functions
Table of Contents
- apc_add — Cache a variable in the data store
- apc_cache_info — Retrieves cached information from APC's data store
- apc_clear_cache — Clears the APC cache
- apc_compile_file — Stores a file in the bytecode cache, bypassing all filters.
- apc_define_constants — Defines a set of constants for retrieval and mass-definition
- apc_delete — Removes a stored variable from the cache
- apc_fetch — Fetch a stored variable from the cache
- apc_load_constants — Loads a set of constants from the cache
- apc_sma_info — Retrieves APC's Shared Memory Allocation information
- apc_store — Cache a variable in the data store
1)$bar = 'BAR';apc_store('foo', $bar);var_dump(apc_fetch('foo'));?> outputs : BAR 2)
$constants = array(
'ONE' => 1,
'TWO' => 2,
'THREE' => 3,
);apc_define_constants('numbers', $constants);
echo ONE, TWO, THREE;?> From :php.net/apc
Subscribe to:
Posts (Atom)