Archive

Archive for the ‘technology’ Category

How to remove wuauclt in your processes list

July 12th, 2009 admin No comments

I had problem with my other PC (windows xp) that ran very slow. I checked the processes running and found this wuauclt program is running. Tried to kill it but it reappear again.

I did some research on the net and found that the file is windows file for auto update and can’t be removed by kill it in the process list.

The solution is logon your PC via safe mode, find file named wuauclt.exe in c:\windows\system32. Rename it to another file name like wuaucltxxxx.exe. Then restart your PC as normal.

Remove unnecessary space between lines in dreamweaver

June 22nd, 2009 admin No comments

Sometimes code in dreamweaver got space in between. This will make your code very lengthy and hard to read. To remove the space you can use this method in Dreamweaver

1. Open the file (source code)
2. Click CTRL + F
3. Select “Current document” in “Find in” (You can also select the folder if you have multiple files)
4. Search in “Source code”
5. Tick “Use regular expression”
6. Type “[\r\n]{2,}” (without quotes) in “Find”
7. Type “\n” (without quotes) in “Replace”
8. Press “Replace All”

You are done! All the spaces gone.

source

Categories: technology Tags:

Use Gmail with your own domain name

June 10th, 2009 admin 1 comment

Gmail so far is the best known e-mail service provider. I don’t have to list the features of Gmail here.

If you want to have google powered applications (especially Gmail) but using your own domain, you have come to the right place. You can do that with Google Apps (standard edition)

With standard edition (there is premier edition for big corp), you can create 50 email accounts with 7GB space for free and other standard google applications like docs, calendar, chat and google sites.

Below is the steps to start using Gmail with your very own domain name. Very easy.

1. Start here - list of what you get besides gmail. Click on the “Get Started” button

2. Enter your domain name and other details in the provided form.

3. Create admin account and agree with the term

4. Activate gmail and change MX records in cPanel (you can choose from a list of hosting management applications).

At first I thought it was so complicated because I need to change the MX record, then all the A’s records, then CNAME and then other xx records but actually you have to change only MX record and it is in you hosting cPanel (not even in the domain management).

After changing your MX record, you are done. Wait for few hours (sometimes just in few minutes). You can also use all other applications offered as in the intro page.

To log on to your email and other app, just point your browser to

http://www.google.com/a/your_domain_here/

It is a good idea to make a forwarding or subdomain from your domain to above URL. Easier to remember..

Hope this article helps. All the best.

Full mysql backup with cron job in cpanel

May 28th, 2009 admin No comments

This is how to do daily mysql backup with cron job in cpanel. This cron job will backup your mysql database as dump file (and gzip) daily. The files will be replaced on the same day next week.

Command to run to dump your mysql database, gzip it and replace it the following week as follow

1
mysqldump -uDBUSERNAME -pPASSWORD --opt DBNAME > /home/USER/dbbackup/FILENAME.sql; gzip -f /home/USER/dbbackup/FILENAME.sql

Replace DBUSERNAME, PASSWORD, DBNAME, USER, FILENAME respectively.

Insert into table with select statement

May 25th, 2009 admin No comments

Sometimes you may need to populate a table (usually a temporary or new table) from data of another table (usually huge table).

Here’s is the statement that you may use

INSERT INTO “table1″ (”column1″, “column2″, …)

SELECT “column3″, “column4″, …FROM “table2″

source

Categories: technology Tags: ,

How to fix Error with database: Table ‘…is marked as crashed and should be repaired

May 24th, 2009 admin No comments

I got this error message in my application

Error with database: Table ‘table_name’ is marked as crashed and should be repaired

Went to the net and look for the solution. The simplest one is to click on the “Repair Database” button provided in cpanel

scrshot_21

scrshot_11


Categories: technology Tags: ,

Creating a unique number

May 21st, 2009 admin No comments

Easiest way to generate a unique number is by combining all the date and time.

The code is as follow

$unique = date(”YmdHis”); //will generate yyyymmddhhmmss

Categories: technology Tags:

Updating multiple records in one sql statement (MySQL)

May 21st, 2009 admin No comments

If you want to update multiple records, usually you will have to do a loop and generate multiple SQL statement like this

UPDATE table_name SET fieldname = value1 WHERE fieldname = field_id1;
UPDATE table_name SET fieldname = value2 WHERE fieldname = field_id2;
UPDATE table_name SET fieldname = value3 WHERE fieldname = field_id3;

But to save some resource (perhaps), you can also update multiple records in just one single MySQL statement

UPDATE table_name
SET fieldname = CASE value_id
WHEN value_id1 THEN ‘value1′
WHEN value_id2 THEN ‘value2′
WHEN value_id3 THEN ‘value3′
END
WHERE value_id IN (value_id1,value_id2,value_id3)

Categories: technology Tags: ,

PHP code to check email validity

May 21st, 2009 admin No comments

This PHP code can be used to check whether email is valid or not by ILoveJackDaniel. It is a bit lengthy compared to other script, but this one is more comprehensive.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
function check_email_address($email) {
  // First, we check that there's one @ symbol, 
  // and that the lengths are right.
  if (!ereg("^[^@]{1,64}@[^@]{1,255}$", $email)) {
    // Email invalid because wrong number of characters 
    // in one section or wrong number of @ symbols.
    return false;
  }
  // Split it into sections to make life easier
  $email_array = explode("@", $email);
  $local_array = explode(".", $email_array[0]);
  for ($i = 0; $i < sizeof($local_array); $i++) {
    if
(!ereg("^(([A-Za-z0-9!#$%&'*+/=?^_`{|}~-][A-Za-z0-9!#$%&
↪'*+/=?^_`{|}~\.-]{0,63})|(\"[^(\\|\")]{0,62}\"))$",
$local_array[$i])) {
      return false;
    }
  }
  // Check if domain is IP. If not, 
  // it should be valid domain name
  if (!ereg("^\[?[0-9\.]+\]?$", $email_array[1])) {
    $domain_array = explode(".", $email_array[1]);
    if (sizeof($domain_array) < 2) {
        return false; // Not enough parts to domain
    }
    for ($i = 0; $i < sizeof($domain_array); $i++) {
      if
(!ereg("^(([A-Za-z0-9][A-Za-z0-9-]{0,61}[A-Za-z0-9])|
↪([A-Za-z0-9]+))$",
$domain_array[$i])) {
        return false;
      }
    }
  }
  return true;
}

MySQL search and replace

May 20th, 2009 admin No comments

I’ve been doing data cleansing of one of my project. Then there was a need to find some abbreviation to be replaced by the real words.

Here I did with mysql statement.

update property set town = replace(town,’tmn’,'taman’)

In general:

update TABLENAME set FIELDNAME = replace (FIELDNAME, searchstr, replacestr)

Categories: technology Tags: ,