Oct 18, 2010

Activating windows copy withot a product key.

Just follow the steps:

Click on Start
Find and Click “Run”
Type regedit
Click the plus next to “HKEY_LOCAL_MACHINE”
Click the plus next to “SOFTWARE”
Click the plus next to “Microsoft”
Click the plus next to “Windows NT”
Click the plus next to “CurrentVersion”
Click “WPAEvents”
On the right panel, find “OOBETimer” then double click it.
Now, Delete all the Values by highlighting it, then delete it
Then type in this value without the quotation mark “FF D5 71 D6 8B 6A 8D 6F D5 33 93 FD”
Then after that click OK,
Then on the left panel right click WPAEvents, then click on permissions
Then click System or SYSTEM, then Deny Full Control, then Click OK.
Then Exit Registry Editor by Click the X or the red X on the Upper Right of the Title Bar or press ALT and F4 at the same time.
To Very that it works, go to start, then “activate windows”, or go to start, then all programs, then “activate windows”
If it says that Windows has been activated.


Originally from: how-to-activate-windows-xp-without-product-key

Oct 15, 2010

Calculating the numbers of days in a month.


@numberOfDaysInMonth = DAY(DATEADD (m, 1, DATEADD (d, 1 - DAY(getdate()), getdate())) - 1);

Sep 28, 2010

Bash Socket Programming


exec 3<>/dev/tcp/myhomesite.com/80
echo -e "GET / HTTP/1.1\nHost: myhomesite.com\n\n" >&3
cat <&3


Originally from:
http://thesmithfam.org/blog/2006/05/23/bash-socket-programming-with-devtcp-2/

Sep 8, 2010

Mysql Server error.

ERROR 1206 (HY000): The total number of locks exceeds the lock table size


THis is commonly occures when you are trying to execute query on a big data. For example when you are trying select/delete a million of record try chunk it by 5%-10% of the record.

Also you may try to higher the the buffer memory, as default it only 8MB which is too short for that kind of large data. To do it, modify the /etc/my.cnf

set-variable = innodb_buffer_pool_size=100M
set-variable = innodb_additional_mem_pool_size=10M
innodb_flush_log_at_trx_commit=1


Replication can often break


When a query cannot process properly on a slave (due to duplicate key or another MySQL error), replication will stop running until you manually resume it.

To avoid replication breaking due to duplicate keys, make sure your /etc/my.cnf configuration file includes these two lines:

slave_exec_mode = IDEMPOTENT
slave-skip-error = 1062

Aug 17, 2010

TERM environment variable not set

Using a cron execution of linux TOP command it generate the error "TERM environment variable not set".

To solve it:

#!/bin/sh
TERM=linux
export TERM
top -b -n 1 >> <Output file>

Aug 10, 2010

Rewrite symfony URL

Setting the virtual host:

<VirtualHost *:80>
ServerName admin.my-app.com
DirectoryIndex backend.php
DocumentRoot "/path/to/the/web/directory"
<Directory "/path/to/the/web/directory">
AllowOverride All
Order Allow,Deny
Allow from All
</Directory>
Alias /sf /path/to/the/symfony/data/web/sf
<Directory "/path/to/the/symfony/data/web/sf">
AllowOverride All
Allow from All
</Directory>
</VirtualHost>


Setting the .htaccess

Options +FollowSymLinks +ExecCGI



RewriteEngine On

## uncomment the following line, if you are having trouble
## getting no_script_name to work
RewriteBase /

## we skip all files with .something
##RewriteCond %{REQUEST_URI} \..+$
##RewriteCond %{REQUEST_URI} !\.html$
##RewriteRule .* - [L]

## we check if the .html version is here (caching)
RewriteRule ^$ index.html [QSA]
RewriteRule ^([^.]+)$ $1.html [QSA]
RewriteCond %{REQUEST_FILENAME} !-f

## no, so we redirect to our front web controller
RewriteRule ^(.*)$ index.php [QSA,L]

## Just search in the Net
## The admin subdomain returns to the backend
#RewriteCond %{REQUEST_FILENAME} !-f
#RewriteCond %{HTTP_HOST} ^admin\.my-app\..*
#RewriteRule ^(.*)$ backend.php [QSA,L]

#RewriteCond %{REQUEST_FILENAME} !-f
#RewriteCond %{HTTP_HOST} ^admin\.my-app\..*
#RewriteRule ^(.*)$ index.php [QSA,L]



Try to access like


http://host.com/module/action

The common to access is

http://host.com/index.php/module/action


Reference URL

Jun 9, 2010

Lighttpd PHP fastcgi configuration

Install lighttpd

# yum install lighttpd
# yum install lighttpd-fastcgi


Make sure php support fastcgi

$ php-cgi -v

PHP 5.0.4 (cgi-fcgi) (built: Nov 8 2005 08:25:54)
Copyright (c) 1997-2004 The PHP Group
Zend Engine v2.0.4-dev, Copyright (c) 1998-2004 Zend Technologies


Open lighttpd configuration file:

# vi /etc/lighttpd/lighttpd.conf

server.modules = (
"mod_access",
"mod_accesslog",
"mod_fastcgi",
"mod_rewrite",
"mod_auth"
)


Add the following lines:

fastcgi.server = ( ".php" => ((
"bin-path" => "/usr/bin/php-cgi",
"socket" => "/tmp/php.socket"
)))


Restart the lighttpd server

# /etc/init.d/lighttpd restart

Jun 1, 2010

Bash programming.

Manipulation of number

total=`expr ${total} + ${pathsize}

let sum=0
let sum=$sum+$num


Testing Using While loop.

#!/bin/bash
COUNT=6
# bash while loop
while [ $COUNT -gt 0 ]; do
echo Value of count is: $COUNT
let COUNT=COUNT-1
done


Calculating the Date Modified
Sample Code:

CUR_DATE=$(date +"%s");
for JOB_FILE in [0-9]*; do
MOD_FILE_DATE=$(stat -c "%Y" $JOB_FILE)
echo -e "$JOB_FILE\t$CUR_DATE\t$MOD_FILE_DATE"
done

Or

if [ "$(( $(date +"%s") - $(stat -c "%Y" $somefile) ))" -gt "7200" ]; then
echo "$somefile is older then 2 hours"
fi

VIM Command


http://www.yolinux.com/TUTORIALS/LinuxTutorialAdvanced_vi.html

Encoding String using BASH


OUTPUT=$(php -r "echo rawurlencode('$(sed "s/'/\\\\'/g" <<< "$OUTPUT")');")


Getting Absolute File Path


Originally FROM: how-to-get-the-absolute-path-within-the-running-bash-scrip

# Absolute path to this script. /home/user/bin/foo.sh
SCRIPT=$(readlink -f $0)
# Absolute path this script is in. /home/user/bin
SCRIPTPATH=`dirname $SCRIPT`


Multi di-mentional ARRAY



#!/bin/bash
A=("abcd" "dcba")
Z=("zxyw" "wxyu" "tuxz")
ARR=(A Z)

for ROW in ${ARR[*]}
do
echo "processing row: $ROW"
TEMP="\${$ROW[*]}"
ROW=`eval echo $TEMP`
for ELEMENT in $ROW
do
echo " processing element: $ELEMENT"
done
done

Original Post:bash-multidimensional-array

Bash : converting unix timestamp to date


converting unix timestamp to date

May 20, 2010

ShMessenger 3.1.10 Beta HandlerUI143 Free Instant Messenger[Yahoo, Msn, Gtalk + Facebook]

Create APN setting

APN: http.globe.com.ph
Proxy: concealme.com or 208.85.242.222
Port: 80


Open the shMessenger and do this 3rks.

Front Query: twitter.globe.com.ph/nph-proxy.pl/000100a/http/


After we set, just OK and set the ConnectionType. A choose "HTTP(wap)"

Download Application here: shm3110bHandlerUI143.jar

May 16, 2010

[Update July 2010] Ebuddy Trick 1.5 Handler.

First get thanks to the person who share this 3ks.
I get this form: http://www.symbianize.com/showpost.php?p=2388397&postcount=45

Tested ko na sa N73 ko. 100% working.
NOTE:
* Globe po ako. Kaya test nyo nlng sa ibang network.
* I notice in middle of june Installation 3rks not working already so, I sacrifice may 5peso load to install it. Atleast after you install you can use as want as you can for free as long as you dont have load when you use it.

1. Install it First Using CGI, Gawa muna ng connection or accesspoint.
Access Point Name: http.globe.com.ph
Proxy:concealme.com or 208.85.242.222
Port: 80


2. Install the EBuddy handler and Open to setup the trick.

From Operator select Custom1
Front Query: twitter.globe.com.ph/nph-proxy.pl/010110a/http/
Leave all the queries blank
Use Proxy: select no proxy



Then iOK na. Piliin yung Access Point for installation ng Ebuddy.

After Successful Installation exit Ebuddy. DONE!

Create another new access point Access Point. For the EBuddy messaging. The first APN you create is only use to install the application.

Access Point Name: http.globe.com.ph
Proxy: h-connector.ebuddy.com or 38.99.73.52
Port: 80


Open Ebuddy. Heto na Trick naten.

From Operator select: Custom1
Leave all the queries blank
Use Proxy select: HTTP
Proxy Server: twitter.globe.com.ph


Update: July 2010
Dowload Here

May 4, 2010

Setting up NFS on Yum base Linux

1. Install nfs-util and portmap.
# yum install nfs-utils portmap

2. Edit the
/etc/exports to setup the shared director.
Syntax:

syn - Set to synchronous
rw - set shared directory to be writable by the client server
# vim /etc/exports
/opt/nfstest 192.168.10.143(rw,sync)



Some Issues:
Error when mounting the shared directory to the client.
mount: mount to NFS server '192.168.10.190' failed: timed out (retrying).
Solution:
This issues when the server having firewall.
Execute the command:
# rpcinfo -p localhost
The comnand will display the the port that is using.
The port that use by portmaper, nfs, nlockmngr, mountd and status. Also you need sure that you open the port both tcp and udp.