Friday, December 12, 2008

Earn As You Learn VIA Blog

Learning is a long term process and as you learn you will get the power of knowledge. Getting paid as you learn are not always possible and especially through blogging. There are case where people may be stopped from learning all due to short of money, which is great blunder. So its always well and good to earn a little as we learn so that it can aid us a lot for uninterrupted march upward in life.

In the search of earning while learning i found some interesting site. I wish to talk a lot about it and here in this post i will take a short trip into earning as you learn. Before i start let me make a note that its not all about making money but its all about earning for learning.

In the search for a better place to earn i found payingpost site, where we get paid to post.
However you are not going to move away from the theme of your blog because as you register (which is free) you are given option to choose opportunities as per your interest of your blog.



Payingpost not just preserves your interest but also provide lot of features like best user friendly layout site. They keep their site live with lots of great stuff and its stylish too. Everyone is given option to get registered as a advertiser or as a blogger. Paying post also provide you affiliation program which brings dollar to your finance.

Payingpost has also said that i would come up with much interesting stuff like sms alert when any new opportunities are available as per our interest.Payingpost also takes care that it will correct if any problem occurs by mailing to support[at]payingpost.com.If you wish to know more about payingpost before joining then just visit the payingpost blog where you get the most about earning through blogging.

All you will have to do is to post a review about any of the opportunities available to you which is simple as advertising on blog. This way of advertising brings a great market to blogging. I hope payingpost would be very helpful to add to your pocket some finance.

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......


Friday, November 21, 2008

VirtualHost by Apache Web server - HTTPD

Apache support for Virtual host. Virtual host is the feature where one can define one or more domain within a localhost system. Fore more information on virtualhost by apache visit http://httpd.apache.org/docs/2.2/vhosts/. In the up coming post we will talk about how to setup the virtualhost in apache 2.2.10.

I look for your valuable comments to improve my-tech-park. So don't forget to comment.

Configure PHP extension to support Session and MYSQL

Before you start reading this post make sure that you have installed Apache web server , PHP and Mysql.If you have also configured web server for PHP then we can start to configure PHP for mysql if not then view the post to configure web server for PHP. Basically PHP comes with support for lots and lots of extension. To make use of the extensions in php edit the php.ini file as follows to point to /ext/ folder inside installed php5.2.6 folder

------------------------------------------------------
;ORIGINAL
;extension_dir = "./"

;EDITED
extension_dir = "C:\Program Files\Apache Software Foundation\Apache2.2\php-5.2.6-Win32\ext\"

------------------------------------------------------

Now having set the php.ini file to point to the php extension directory we are going to make the
extension for mysql available. Edit the php.ini file as follows

------------------------------------------------------
;ORIGINAL
;extension=php_mysql.dll

;EDITED
extension=php_mysql.dll

------------------------------------------------------

NOTE : if this is not done then you will get the error 'Fatal error: Call to undefined function mysql_connect()---'

To make use of the session make the following changes in the php.ini file

------------------------------------------------------
session.save_path = "C:\WINDOWS\Temp"
------------------------------------------------------

Set the save_path for session to any directory that exist.

NOTE : php.ini is the file copied to %SYSTEMROOT% folder during installation of PHP.

For information on how to install PHP visit previous post

Mysql as Database for Script

Its often necessary to maintain data in a table over the server.Scripting language enable the developer to connect to the database and get the data. Here we are going to setup a free community database software mysql version 5.1.2600. Mysql is been supported by php right from beginning of its journey. Lets see how to install and then configure php for mysql.

Download the mysql installation file 'mysql-5.0.67-win32.zip'and install it just by clicking next and next, after extrating to temp directory.During installation check the option to install mysql as a service. So that mysql can be started from from command prompt as follows,

RUN COMMAND :cmd
------------------------------------------------------
>mysql -u root -p
Enter Password:*******

>mysql>
------------------------------------------------------

Prompt appears asking password , give a valid password(created during installation) to work with mysql.
Right now mysql is been installed but it still need to be configured with PHP for php code access Mysql database.Configuring PHP for mysql will be discussed in next post.

Configure Apache for PHP

Lets see how to configure Apache for PHP. Before proceeding with this post make sure you have installed PHP. Installing PHP was discussed in last post.

Following are the steps to configure apache2.2.10 for PHP5.2.6:

Step 1 :

Open the file 'httpd.conf' inside \Apache Software Foundation\Apache2.2\conf and add the following lines.

# ADDED FOR PHP HANDLING
------------------------------------------------------
LoadModule php5_module "C:\Program Files\Apache Software
Foundation\Apache2.2\php-5.2.6-Win32\php5apache2_2.dll"

AddType application/x-httpd-php .php
AddType application/x-httpd-php-source .phps
------------------------------------------------------

The folder 'php-5.2.6-Win32' in the LoadModule line is the unzipped php installation file.

STEP 2 :

Restart
the apache server.


STEP 3 :

Create a php file 'index.php' with the following code.
------------------------------------------------------

phpinfo();
?>
------------------------------------------------------

And save it inside the folder 'htdocs' in /Apache2.2/ folder

STEP 4 :
Load the following URL in your browser -
http://localhost/index.php , you should get the php setting displayed to indicate that the php in properly parsed.

Installing PHP

PHP is being prefered by many web developers to perform their server side scripting nowsdays. PHP is getting more and more efficient in recent time supporting for its wide approval. Lets see how to install a php parser so that your local system web server can make use of it to parse any php web page.

While i am writing this post the most recent version was 5.2.6. Download the zipped file
PHP 5.2.6 zip package and extract it to the directory where Apache is installed.

Now copy the file'php.ini-dist' inside moved 'php 5.2.6' folder to %SYSTEMROOT% in Windows XP and rename it to 'php.ini'. Then Copy the file 'php5ts.dll' to %SYSTEMROOT%\System32 in WindowXP.



Right now setting up php is done and it need to be added to apache web server by configuring the httpd.conf file. This will discussed in next post.

Setting up Apache Web Server

Now we are going to see one of the project by apache software foundation which is http server project. Most Current version of httpd software can be downloaded from http://httpd.apache.org/ . When i am writing this post the most recent version is 2.2.10 which is considered to be most stable at this point.

I just downloaded apache_2.2.10-win32-x86-no_ssl.msi, which is a installer file. Setup is quite easy just clicking next and next. The http server can be configured latter at any point by editing the file httpd.conf file.

While installing you will be prompted for entering the domain, server name and email address.

Enter
Domain: localhost
Server Name: localhost
Email Address: admin@localhost

Once the installation is over you can verify the integration of the installation by checking the path 'http://localhost/' in any browser. You will get 'It works' showing that the localhost is handled by the web server.

The web server can be configured with other software like php etc by editing the httpd.conf file found inside the conf folder in the apache installed location.

When we talk about other software (another post) will discuss about how to configure web server to manager those application.


Lets Start Programming Server Side Script

As we start to learn any server side scripting we should also test some of the script in real time to see how it actually behaves and how the flow occurs. But to perform these we need to make some initial arrangement such as getting a real server access or the local system should be made to behave as a server. Often young developers prefer going on for setting up local system server. Thus making use of the localhost 127.0.0.1 to perform the task of a server.

Before we start let turn to the procedure to setup the local server.There are many developer tools to setup server configuration. Microsoft offers IIS which is often bundled with the XP Installation CD. The most widely used one is the Apache Project tool i.e http server by apache. Its is best and we are going to discuss in another post about how to setup it.

Welcome to Mytechpark

Hello visitors
First off all i need to thank you people for visiting my blog. Thanks a lot. Hope you people will find some interesting tips around this blog. I just created this blog to share my technical learning in the area of web programming. Here in this blog i will post articles on how to program some internet programming language like html,javascript,php,xml,jsp etc and also the recent technological development in WWW. I will be grateful if you people make a friendly comments and suggestion. Thanks for visiting ...and keep visiting ... Have a great day