Monday, November 14, 2011

firefox how to disable/block alert,confirm,prompt?

find your prefs.js add 3 lines user_pref("capability.policy.default.Window.alert", "noAccess"); user_pref("capability.policy.default.Window.confirm", "noAccess"); user_pref("capability.policy.default.Window.prompt", "noAccess");

Thursday, October 20, 2011

scim stopped working

scim stopped working? try kill -9 all process of scim, then run this /usr/lib/scim-1.0/scim-launcher -d -c simple -e all -f socket --no-stay

Friday, September 16, 2011

ADB: error: insufficient permissions for device

problem:

List of devices attached
???????????? no permissions

solution:

adb kill-server
sudo adb start-server
adb devices

Tuesday, August 16, 2011

Wednesday, April 13, 2011

Monday, April 4, 2011

linux reference a file start with a dash

problem:

say you have a file, its name start with a dash, when you try to use command on that file, it will result in error,


solution:

use command ./-xxxxxxxxxxxxxxx instead of command -xxxxxxxxxxxxxxx

Wednesday, March 30, 2011

magento how to debug sql query

edit this file: lib/varien/Db/Adapter/Pdo/Mysql.php

protected $_debug = true;
protected $_logAllQueries = true;
protected $_debugFile = 'var/debug/sql.txt';

Tuesday, March 22, 2011

magento import export cms pages

mysqldump cms_page and cms_page_store tables

and restore to your destination database

Monday, March 14, 2011

Tuesday, March 8, 2011

mysql find all columns in a database

SELECT table_name, column_name from information_schema.columns WHERE column_name LIKE ’%searchTerm%’ AND table_schema = ‘yourDB’

Friday, March 4, 2011

sudo rm Operation not permitted, undeletable file

problem:
ever encounter such a file?
you can't even rm with root.

reason:
this file might be marked as immutable, to confirm, you can use lsattr to confirm, if you see an "i" then it's immutable, you can't even remove with root

solution:

use chattr -i
the one i had to use is: sudo chattr -s, sudo chattr -u, sudo chattr -a too then able to remove this file
then you can remove

Wednesday, March 2, 2011

Boot debian directly to terminal mode

remove gui on startup

update-rc.d -f gdm remove

then you can start gui, gnome desktop with command


startx

reset, make gui on startup


update-rc.d -f gdm defaults


note, you need to use "gdm3" for debian squeeze

Tuesday, March 1, 2011

windows 7 partition is gone, after installing debian

try this first

sudo update-grub

how to install dual-boot with debian and windows 7

first thing you need to do is to free up some disk space, in windows 7, you can use the new "shrink volume" feature from windows 7 in disk management.

after that, use debian installation cd to boot, and you can use that free space you created from windows 7 to install debian

Monday, February 28, 2011

linux tar same folder permissions

problem
linux tar same folder permissions

solution
use -p option

Monday, February 21, 2011

linux bash for loop

the syntax that i can understand and easily remember is as follows:


for i in {1..1000}; do echo $i; done;

best debian dedicated server provider

what is the best debian dedicated server provider?

i am currently using serverbeach, but ever since peer1 bought this company, i find that they have stopped upgrading their hardware lineup for quite sometime. ie, they intel core i series never enter to their processor list.

can any one suggest any company that provides better service than serverbeach?

thanks everyone.


a debian fan (for whatever reason)

ssh without password

ssh without password

step 1

ssh-keygen -t rsa

step 2

scp ~/.ssh/id_rsa.pub user@remote:~/.ssh/authorized_keys2

note: this is to encrypt the connection with this public key and that this key is authorized for version 2 of the ssh protocol


now you can

ssh user@remote without password

step 3

cat several id_rsa.pub from many hosts, and store it as .ssh/authorized_keys2 at remote machine, you can allow many host to access the same remote host

Agent admitted failure to sign using the key

if you created a new rsa private key, you will need to update that to your system by

ssh-add

otherwise you will see this error

Agent admitted failure to sign using the key

Sunday, February 20, 2011

Saturday, February 19, 2011

vim regular expression

* matches 0 or more of the preceding characters, ranges or metacharacters
.* matches everything including empty line
\+ matches 1 or more of the preceding characters...

debian nvidia driver install

run as root
apt-get install module-assistant nvidia-kernel-common
m-a auto-install nvidia-kernel${VERSION}-source

then run the NVIDIA....run

debian disable services at startup

sudo update-rc.d -f exim4 remove

debian enable services in startup

sudo update-rc.d exim4 defaults

debian install bigmem kernel

The Bigmem Kernel

sudo apt-get install linux-image-2.6-686-bigmem


Configuring Grub


grep "Debian GNU" /boot/grub/menu.lst | nl -v0
0 title Debian GNU/Linux, kernel 2.6.18-5-k7
1 title Debian GNU/Linux, kernel 2.6.18-5-k7 (single-user mode)
2 title Debian GNU/Linux, kernel 2.6.18-5-686-bigmem
3 title Debian GNU/Linux, kernel 2.6.18-5-686-bigmem (single-user mode)
4 title Debian GNU/Linux, kernel 2.6.18-4-k7
5 title Debian GNU/Linux, kernel 2.6.18-4-k7 (single-user mode)


1. So what is the current default entry?

sudo grep ^default /boot/grub/menu.lst
default 0

2. sudo vim /boot/grub/menu.lst

debian show exim4 version number

aptitude show exim4

Friday, February 18, 2011

godaddy coupon for .com renewal $7.99 only

coupon code: gdbb776

as of today, 2011, feb 18, this worked like a charm

linux untar a tar ball with permissions intact

sudo tar xpzvvf file.tar.gz

linux create a tar ball with permissions intact

sudo tar cpzvvf file.tar.gz source source source

debian restore server configs

sudo rm /etc/apache2/sites-enabled/000-default
sudo cp apache2.conf /etc/apache2/apache2.conf
sudo cp hosts.conf /etc/apache2/sites-enabled
sudo cp my.cnf /etc/mysql/my.cnf
sudo cp php.ini /etc/php5/apache2/php.ini

debian backup server configs

cp /etc/apache2/apache2.conf ./apache2.conf
cp /etc/apache2/sites-enabled/hosts.conf
cp /etc/mysql/my.cnf ./my.cnf
cp /etc/php5/apache2/php.ini ./php.ini

Thursday, February 17, 2011

install magento on debian apt-get install way

sudo apt-get install apache2 mysql-server php5 php5-mysql php-soap php5-mcrypt php5-curl php5-gd

GPG error on update -- public key not available

error:

W: GPG error: http://deb.opera.com stable Release: The following signatures couldn't be verified because the public key is not available: NO_PUBKEY A2019EA84E7532C8


reason:

pubkey expired for opera


where to look for:

sudo apt-key list

solution:

sudo apt-key del 9D1A0061
wget -O - http://deb.opera.com/archive.key | sudo apt-key add -

W: GPG error apt-get update NO_PUBKEY AED4B06F473041FA

error message:

http://security.debian.org lenny/updates Release: The following signatures couldn't be verified because the public key is not available: NO_PUBKEY AED4B06F473041FA

reason:

as it turns out this is because GPG key expired

This key rollover is a normal maintenance task and was started in August 2010. For security reasons Debian’s archive signing keys regularly expire after three years.

solution:
update the keys by

sudo aptitude install debian-archive-keyring

Thursday, February 10, 2011

magento add custom fields in account and registration

http://www.magentocommerce.com/wiki/5_-_modules_and_development/customers_and_accounts/registration_fields

http://www.magentocommerce.com/boards/viewthread/9620/

Tuesday, February 8, 2011

Nikon D90 Practice


How to change DNS PTR record?

How do you change DNS PTR record? You might think that this is done by your domain registrar, such as Godaddy - after all, they point your domain to an IP address. Or you might think whoever handles your DNS would do this. But the PTR record isn't up to them, it's up to the ISP that "owns" the IP block it came from.

MySQL Access denied for user debian-sys-maint@localhost

step 1:
sudo cat /etc/mysql/debian.cnf

step 2:
[client]
host = localhost
user = debian-sys-maint
password = xxxxxxxxxxxxxxxx
socket = /var/run/mysqld/mysqld.sock
[mysql_upgrade]
user = debian-sys-maint
password = xxxxxxxxxxxxxxxx
socket = /var/run/mysqld/mysqld.sock
basedir = /usr

step 3:
GRANT ALL PRIVILEGES ON *.* TO 'debian-sys-maint'@'localhost' IDENTIFIED BY 'xxxxxxxxxxxxxxxx';

Sunday, February 6, 2011

javascript checking if image is fully loaded

img = new Image();
img.src = "path_to_your_image.jpg";
img.onload = function() { some_action();};