Glass Onion Blog

Cheat sheets, post-its and random notes from the desk of a programmer

MySQL: How to find out table stats like rows, space used and last update time

Posted by walrus on January 22, 2010

The following MySQL command provides a lot of good information about tables.

show table status 

This statement also displays information about views.

SHOW TABLE STATUS returns the following important fields along with a lot of other intersting data:

Engine
The storage engine for the table. See Chapter 13, Storage Engines.

Rows
The number of rows. Some storage engines, such as MyISAM, store the exact count. For other storage engines, such as InnoDB, this value is an approximation, and may vary from the actual value by as much as 40 to 50%. In such cases, use SELECT COUNT(*) to obtain an accurate count.

Avg_row_length
The average row length.

Data_length
The length of the data file.

More info here

Posted in MySQL, Software, Technology | Tagged: , | Leave a Comment »

JavaScript Lectures by Douglas Crockford

Posted by walrus on December 28, 2009

The JavaScript Programming Language

Yahoo! JavaScript Architect Douglas Crockford provides a comprehensive introduction to the JavaScript Programming Language in this four-part video.

Slides from this lecture are available here:  http://yuiblog.com/assets/crockford/javascript.zip

Advanced JavaScript

Douglas Crockford teaches “Advanced JavaScript.” This course is broken into three clips; this is the first of those three clips.

Slides from this lecture are available here: http://yuiblog.com/assets/crockford/advancedjavascript.zip

JavaScript – The Good Parts

Douglas Crockford delivered the keynote talk at the 2007 Konfabulator Developer Day and discussed the evolution of JavaScript and of his relationship to the language. Through his description of his own journey with the language, Douglas evokes what he considers to be the “good stuff” therein.

Theory of the DOM

Douglas Crockford teaches “An Inconvenient API: The Theory of the Dom.” This course is broken into three clips.

 Slides from this lecture are available here: http://yuiblog.com/assets/crockford/theory.zip

Useful links

Posted in Ajax, web 2.0 | Tagged: , , | 1 Comment »

Linux: Renaming multiple files from command line

Posted by walrus on September 12, 2008

How to rename multiple files at a shell prompt under Linux? The rename command is quite useful.

Rename command usage:

rename oldname newname *.files

Some examples:

Rename all *.abc file as *.xyz:

$ rename .abc .xyz *.abc

Remove .txt file extension:

$ rename 's/\.txt$//' *.txt

Convert all uppercase filenames to lowercase:

$ rename 'y/A-Z/a-z/' *

Posted in Software, linux | Tagged: , , , , | Leave a Comment »

Wireless protocols IEEE 802.11 A B G N compared

Posted by walrus on August 4, 2008

When buying a wireless router or a wireless network card, have you ever wondered what do these letters next to the protocol 802.11 (a, b, g, and n) really mean? What is the difference between these protocols?

IEEE 802.11 is a set of standards for wireless local area network (WLAN) computer communication. The terms 802.11 and Wi-Fi are often used interchangeably but there is slight difference between the two.

(A) 802.11a
Frequency- 5 GHz  
Typical Data Rate - 23 Mbit/s  
Max Data rate – 54 Mbit/s  
Range – 115 feet

(B) 802.11b
Frequency - 2.4 GHz  
Typical Data Rate - 4.5 Mbit/s  
Max Data rate – 11 Mbit/s  
Range - 115 feet

(G) 802.11g
Frequency - 2.4 GHz  
Typical Data Rate – 19 Mbit/s  
Max Data rate - 54 Mbit/s  
Range – 125 feet

(N) 802.11n
Frequency - 5GHz and/or 2.4GHz  
Typical Data Rate - 74 Mbit/s  
Max Data rate - 300 Mbit/s (2 streams)
Range – 230 feet

Posted in Networking, Technology | Tagged: , , , , , , , , , | 7 Comments »

Back up and Restore MySQL database from the command line

Posted by walrus on July 30, 2008

Backing up via the command line:

Type the following at the prompt with the appropriate USERNAME and DATABASE name:

mysqldump -u USERNAME -p DATABASE > dump.sql

You will be prompted for your database password and then the DATABASE will be dumped to a plain-text file called dump.sql.

Restoring via the command line:

First drop and recreate the database as needed:

Drop the database

mysqladmin -u USERNAME -p drop DATABASE

Recreate the database

mysqladmin -u USERNAME -p create DATABASE

Import the backup data

mysql -u USERNAME -p DATABASE < dump.sql

Posted in MySQL, Software, linux | Tagged: , , , , | 1 Comment »