Friday, December 12, 2008

Online Resource for Web learning

Books are always the best partner who can let you know more and more about anything you wish to learn. Books from Deitel and Associates are my most favourite books for learning web programming language.

At Deitel site you can get to know most about web 2.0 and web service related article. If you are a registered user, which is just free of charge, you can get access to download of examples from their books. Here is the reference to deitel site ..external link

Some of his popular books include:
C How to Program, 5/e
C++ How to Program, 6/e
Visual C# 2008 How to Program, 3/e
Internet & World Wide Web How to Program, 4/e
Java How to Program, 7/e
Visual Basic 2008 How to Program

and many more..Never forget to check the link.

Thursday, December 11, 2008

Client does not support authentication protocol requested by server; consider upgrading MySQL client

I got this error at the very initial step of my hosting process. And as i searched through the documentation in mysql, i found that this error is caused basically due to compatibility problem between the client and server version. As an effective step to remove this problem mysql community suggest four possible action.

I am not going to explain each of the possibilities but i wish to refer to link where i found the solution, external link . Hope you found your solution.

Can't connect to MySQL server on 'localhost' (10061)

Such an error is caused basically when no mysql client is installed on the domain in which you are working, with the localhost as the option during installation( i hope so).

If you have arrived at this link only because you have got such an error with your mysql server and you need much more detail, then go for any other reference on this problem. I am sorry to say this because i am going to just tell about the problem which caused me such an error and the simple mistake which i committed and rolled back after a short tutor from my hosting documents to correct this problem.

As i worked through the document for my hosting site i found that i should use the host mentioned specifically for my hosting, which is like 'host.domain.extension:port_no'. As i changed the hostname from localhost to the said hostname, my problem got cleared.

So ensure that usage of localhost is appropriate for you or not.

Monday, December 1, 2008

Create user in mysql database

Often it is necessary to maintain individual profile and access privileges for each user. Mysql database provide many query statement to create user ,grant user privileges and revoke privileges.
Lets learn some of the queries to create a user, grant access permission for user and revoke access.

Creating a user without password:
mysql> create user dbuser1;
Query OK, 0 rows affected (0.06 sec)

Creating a user with password:
mysql> create user dbuser2 identified by 'password';
Query OK, 0 rows affected (0.06 sec)

Setting password for a user with password():
mysql> set password for dbuser1 = password('password');
Query OK, 0 rows affected (0.01 sec)

Queries to give privileges to user are...

Global level:
GRANT ALL ON *.* TO 'dbuser'@'localhost';
GRANT ALL ON *.* TO 'dbuser';

Database level:
GRANT ALL ON mydb.* TO 'dbuser'@'localhost';
GRANT ALL ON mydb.* TO 'dbuser';

Table level:
GRANT ALL ON mydb.mytbl TO 'dbuser'@'localhost';
GRANT ALL ON mydb.mytbl TO 'dbuser';

For more information and example visit mysql doc

Thursday, November 27, 2008

Setting up a virtual network with Apache HTTPD

            In this post you will get to know about how to setup a virtual network using apache features. By setting up a virtual network you can organise your various domain and customer domain in a clean and order manner so that you can publish your website in a few seconds to the internet.
            Before we start, make sure you have installed the apache web server and If you have not installed apache web server then read my previous post 'install apache web server'. Once you have a working apache web server installed, we can get straight to setting up virtual network in not more than 5 minutes.

            create a file 'myvirtualnetwork-hosts.conf' inside the directory 'conf'. You can find conf folder under the folder where you have installed apache 

e.g, C:\Program Files\Apache Software Foundation\Apache2.2\conf

            copy the following code into the file 'myvirtualnetwork-hosts.conf'....

------------------------------------------------------  
# Use name-based virtual hosting.
< directory >
  Order Deny,Allow
  Allow from all
< /directory >

NameVirtualHost 127.0.0.1
 
< virtualhost >
  DocumentRoot "C:/Program Files/Apache Software Foundation/Apache2.2/htdocs"
  ServerName localhost
  CustomLog "logs/access.log" common
  ErrorLog "logs/error.log"
< /virtualhost >
 
< virtualhost >
  DocumentRoot "C:\www\domain1.com\site\web"
  ServerName subdomain.domain1.com
  CustomLog logs/subdomain.domain1.com.access.log combined
  ErrorLog logs/subdomain.domain1.com.error.log
< /virtualhost >

< virtualhost >
  DocumentRoot "C:\www\domain2.com\site\web"
  ServerName subdomain.domain2.com
  CustomLog logs/subdomain.domain2.com.access.log combined
  ErrorLog logs/subdomain.domain2.com.error.log
< /virtualhost >
-----------------------------------------------------  

            You can rename the subdomain.domain1/subdomain.domain2 to your wish. Make sure you give name relavent to your actual domain but not the actual domain name itself. If you give the actual domain name then the browser will not load the domain on remote host but from your local host itself.

  The path 'C:\www\domain1.com\site\web' should exist. The path 'C:\www\domain1.com\site\web' can also be 'C:\www\domain1.com'. I have used it to give a logical structure, resembling my domain. 

            Once you are done with the previous step you can add the file name 'myvirtualnetwork-hosts.conf' to 'httpd.conf'. The file 'httpd.conf' will be found in the same directory, where you have created the file 'myvirtualnetwork-hosts.conf'.

            Add the following line.... 

 ------------------------------------------------------  
 Include conf/myvirtualnetwork-hosts.conf 
 ------------------------------------------------------  

            Final step is to add the following code to the file 'hosts'. The file can be found under the path 'C:\WINDOWS\System32\drivers\etc'. You should have access to write to that file.  

            copy the following code at the end of the file.

 ------------------------------------------------------  
 127.0.0.1 localhost 

 127.0.0.1 subdomain.domain1.com # site description 
 127.0.0.1 subdomain.domain2.com # site description 

 ------------------------------------------------------  
Restart apache. Feel the joy......