Saturday, September 10, 2011

Yankees Stadium

I went to Yankees game last Sunday. It was my first time in Yankees Stadium (new stadium). Roma invited me to the game with two of his coworkers (Eva from Germany) and Japanesse girl. Yankees won the game against Toronto (9-3).
The games was kind of boring... but stadium is great. Overall it was good experience and I like it. Here are some pictures from the game.






Friday, September 2, 2011

Database Optimization

Indexing can dramarically improve performance of MySQL database. Indexing is the most important tool for speeding up your queries.

Facts, Tips & Terms:
- Database is a set of tables. Table is a set of rows and columns
- Full Table scan (slow) - examine each row in the table
- Data rows kept in a data file and index values are kept in a index file
- MySQL indexes speed up searches for rows matching terms of a WHERE clause. It also improve performance of MIN(), MAX()
and ORDER By operations.
- Index columns that you search for, not columns you select
- Declare columns to be NOT NULL - fater processing and less storage.
- Disadvantages of Indexing
a). Slow inserts, deletes and updates (need to update data and index files)
b). Index file takes up the disk space

- How to choose indexes:
b). Use short indexes (int is better than varchar). A smaller index involves less disk I/O, so it can be compared more quickly.
a). Index should be uniue (spread of values in a column). So index work best for columns with unique values.
c). Indexes are used for
<, >, <=, =>, =

Wednesday, August 31, 2011

Irene (hurricane)

New York was hut by hurricane Irene last weekend. My apartment located in Zone A (mandatory evacuation).. I did not evacuate.
Public transportation was shutdown for the weekend first time.







New York was hit by hurricane last week. My apartment was located in Zone A (mandatory evacuation). I did not evacuate ... The building was not flooded. Here some picture of flooding Sheepsheadbay/Manhattan Beach area. Mayor Mike Bloomberg shut down public transportation.














drush

Helpful Drush Commands:

  1. drush fra - feature # Revert all

  2. drush fu $module # update the code

  3. drush dis $module # disable module

  4. drush en $module # enable module

  5. drush cc menu # clear cache for menu

  6. drush cc all # clear all cache

  7. drush sm # show modules The official full name of the command is pm-list which is confusing so just ignore it

  8. drush scr test.php # running a Drupal script

  9. drush php-script test.php # run a Drupal Script

  10. drush php-eval 'global $user; print_r($user)' # executing code

Tuesday, August 23, 2011

SSH Login Without Password

Server A (Local Server)
Server B (Remote Server)

Server A:
1. ssh-keygen -t rsa // generate a key using ssh-keygen
// More Secure: ssh-keygen -t rsa -b 4096
2. scp id_rsa.pub myname@SERVERB:/home/myname/

SERVER B:
1. ssh-keygen -t rsa
2. cp id_rsa.pub .ssh/authorized_keys2
3. chmod 700 ../.ssh
4. chmod 640 .ssh/authorized_keys2

Troubleshooting MySQL Slow Queries with Tcpdumps

Great article by Sean Hull - Troubleshooting MySQL Slow Queries with Tcpdumps

Monday, August 22, 2011

VIM (tutorial 1)

I - insert at the begin of line
A - append to end of line
o/O - open a new line after/before the current
v/V - Visual mode to select text
Shift+R - replace text
C - change remaining part of line
r - replace one character
~ - changes case
J - joins lines
Ctrl+A - increment a number
Ctrl+B - decrement a number
. - repeat last command (a simple macro)
= indent line

Thursday, August 18, 2011

Thursday, August 11, 2011

Git on RHEL/CENTOS

Git is not available in RHEL repository. Use the following commands to install it.

rpm -ivh http://download.fedora.redhat.com/pub/epel/5/i386/epel-release-5-4.noarch.rpm

yum install git

Wednesday, August 10, 2011

wget utlity on MAC

By default wget utility is not included in MAC. So I decided to install it through 'port'

sudo port install wget
---> Computing dependencies for wget
---> Fetching archive for wget
---> Fetching wget
---> Attempting to fetch wget-1.12.tar.gz from ftp://ftp.gnu.org/gnu/wget
---> Verifying checksum(s) for wget
---> Extracting wget
---> Applying patches to wget
---> Configuring wget
---> Building wget
---> Staging wget into destroot
---> Installing wget @1.12_3+ssl
---> Activating wget @1.12_3+ssl
To customize wget, you can copy wgetrc.sample to wgetrc
in /opt/local/etc and then make changes.
---> Cleaning wget