Archive for the "Tweet" Category

LifeHacker: Adjust Your Car Mirrors Properly To Avoid Accidents

Adjust Your Car Mirrors Properly To Avoid Accidents via LifeHacker

Many accidents could be avoided if everyone had their car side and rearview mirrors positioned correctly, eliminating blind spots and making it easier to change lanes quickly.

Are You Reading Too Much?

Productivity501 via Are You Reading Too Much?.

Reading, after a certain age, diverts the mind too much from its creative pursuits. Any man who reads too much and uses his own brain too little falls into lazy habits of thinking.

~ Albert Einstein

The theming firehose (NB for designers & front-end developers new to Drupal) | rare pattern

You theme with the mark-up you have, not the mark-up you'd like to have.

That's the essential truth that designers and front-end developers new to Drupal need to understand. You don't get to construct your pages from scratch, building out essentials, never a wasted div, never an extraneous class. No, you have to flip the entire process around. With Drupal you're getting markup shot at you from a firehose, and as a themer you need to sop it all up and make it pretty. Don't spill a drop.

via The theming firehose (NB for designers & front-end developers new to Drupal) | rare pattern.

MySQL Query to get Data, Index and Table Size by Storage Engines

SELECT IFNULL(B.engine,’Total’) “Storage Engine”, CONCAT(LPAD(REPLACE(FORMAT(B.DSize/POWER(1024,pw),3),’,’,”),17,’ ‘),’ ‘,SUBSTR(‘ KMGTP’,pw+1,1),’B’) “Data Size”, CONCAT(LPAD(REPLACE(FORMAT(B.ISize/POWER(1024,pw),3),’,’,”),17,’ ‘),’ ‘,SUBSTR(‘ KMGTP’,pw+1,1),’B’) “Index Size”, CONCAT(LPAD(REPLACE(FORMAT(B.TSize/POWER(1024,pw),3),’,’,”),17,’ ‘),’ ‘,SUBSTR(‘ KMGTP’,pw+1,1),’B’) “Table Size” FROM (SELECT engine,SUM(data_length) DSize,SUM(index_length) ISize,SUM(data_length+index_length) TSize FROM information_schema.tables WHERE table_schema NOT IN (‘mysql’,’information_schema’) AND engine IS NOT NULL GROUP BY engine WITH ROLLUP) B,(SELECT 3 pw) A ORDER BY TSize;

Sample Report:

MyISAM 0.031 GB 0.013 GB 0.044 GB
InnoDB 0.599 GB 0.471 GB 1.069 GB
Total 0.630 GB 0.484 GB 1.113 GB

Compile PHP Extensions on Mac Snow Leopard OS X

If you have to custom compile PHP Extensions on Mac with Snow Leopard OS X while using MAMP , you will need to execute following commands. These are necessary to compile modules with both 32bit and 64bit support.

/Applications/MAMP/bin/php5.3/bin/phpize
MACOSX_DEPLOYMENT_TARGET=10.6
CFLAGS="-arch i386 -arch x86_64 -g -Os -pipe -no-cpp-precomp"
CCFLAGS="-arch i386 -arch x86_64 -g -Os -pipe"
CXXFLAGS="-arch i386 -arch x86_64 -g -Os -pipe"
LDFLAGS="-arch i386 -arch x86_64 -bind_at_load"
export CFLAGS CXXFLAGS LDFLAGS CCFLAGS MACOSX_DEPLOYMENT_TARGET

Install Emacs on Ubuntu Lucid 10.04

Here is the single command to get you started with using emacs on Ubuntu. This will get you all the pretty syntax highlight for PHP, Python or even Ruby

sudo apt-get install emacs-snapshot emacs-goodies-el php-elisp ruby-elisp python-elisp

How to downgrade PHP to 5.2 on Ubuntu?

Here is a quick script to do this task:

Courtsey of Stijn Beauprez from here: http://thejibe.com/blog/10/5/php-5210-debs-ubuntu-104-lucid#comment-9

#! /bin/sh
php_packages=`dpkg -l | grep php | awk ‘{print $2}’`

sudo apt-get remove $php_packages

sed s/lucid/karmic/g /etc/apt/sources.list | sudo tee /etc/apt/sources.list.d/karmic.list

sudo mkdir -p /etc/apt/preferences.d/

for package in $php_packages;
do echo “Package: $package
Pin: release a=karmic
Pin-Priority: 991
” | sudo tee -a /etc/apt/preferences.d/php
done

sudo apt-get update

sudo apt-get install $php_packages

To undo the script and upgrade to php 5.3 you will need to delete the file (sudo rm /etc/apt/preferences.d/php), run sudo apt-get update, and then sudo apt-get dist-upgrade which will get the latest packages for your distribution, including the PHP packages. (Ben Holt)

Set GMail as default client on Windows

Affixa software by Notably Good Ltd. (http://www.affixa.com/) lets you easily setup GMail or Yahoo as your mail client. Using this, you can easily send attachments from any of the windows application include Office and Windows Explorer.

How to restore / resurrect deleted files in subversion?

If you delete a file or folder from subversion. You can easily restore it using the svn copy command below:

#Example Command (all one line)

svn copy http://subversion.server.com/path/to/deleted/file.psd -r 115 http://subversion.server.com/path/to/deleted/file.psd -m “Commit Message”

Note: 115 is the revision number in subversion where the latest version of file exists.

How to auto start services on boot in Centos / Redhat?

To auto start services in Centos or Redhat OS, you can use builtin chkconfig utility. It is located in /sbin directory. If you are a regular user (non-root), then /sbin may not be in your path. Therefore, you may have to use the full path to access the chkconfig utility.

To auto start a new service:

  • Find out the name of service’s script from /etc/init.d/ directory e.g. mysqld or httpd
  • Add it to chkconfig
    sudo /sbin/chkconfig --add mysqld
  • Make sure it is in the chkconfig.
    sudo /sbin/chkconfig --list mysqld
  • Set it to autostart
    sudo /sbin/chkconfig mysqld on

To stop a service from auto starting on boot

  • sudo /sbin/chkconfig mysqld off