Quotations
Here are some of my favorite quotation again:
1. If my mind can concieve it, my heart can believe it, I know I can achieve it. - Jesse Jackson
2. Life is not about having and getting but being and becoming.
The idea was to allow people share quotations they like, I also started making some, and perhaps I think so. I think there are more people on planet like me who like making quotations. So why not create a social networking website based aroung quotations only. Though there are many other sites that keep quotations and allow their users to add quotations, but they are more like repositories of quotations and not social networking. The emphasis of www.linowis.com is on social networking.
Monday, July 14, 2008
Saturday, July 12, 2008
MVC Framework
I am new to webmaster world, but I am really impressed by MVC framework. I decided to use cakePHP for my PHP development. But I found the learning curve of cakePHP quite steep. And then the hassle of getting a shared host with cakePHP support. I decided to not use cakePHP or any other framework. But I really liked the MVC approach. Soon i found out that one can use MVC approach even without using any of these available frameowrks. This gives me ease of development of MVC and flexibility and there is almost no learning curve. It seems to be an ideal situation. The Idea is this, its simple but I found it effective.
The Model Part
1. Create a forder and name is "db", "mydb" or anything else..
2. This folder will contain all the classes that interact with database.
3. Create a separate file for each of the database tables.
4. Each of these file will contain a class that will encapsulate code that gets mainly data for that table in database, this is a bit tricky as u may not always extract data from a single table only. But mostly data is from a single table , and data from other tables is use to either supplement it. For example, if you are displaying profile of a user and you have a separate table for profiles. Then you may want data from users table also, but actually because you are diplaying the profile, the file created for profiles table should contain this code. These files will represent the Model part of your app.
The Controller part
5. Create a separate folder for each of the tables in your data base
6. In each of these folder create again a seaparate folder for each of the action u will perform, for example, if you are to edit a post , and you have a posts table in your database , you should create a posts folder in that folder you create a 'edit' folder. The index file of this folder will contain the code for the editing of post.
The View Part
7. In the folder you creates for each of the actions to perform, create a PHP file that contains the Veiw , i.e. that contains HTML, JS, or forms, everything else that describes the view of your page. This file will be included by the index file in the same folder when required.
Example:-
1. Three tables/entities in the application "Post" "User" "Profile"
Actions on user
1. Login
2. Logout
3. Register
Actions on Post
1. Add
2. Edit
3. View
4. Delete
Actions on Profile
1. Create
2. Edit
3. View
the file structure would be like this
I am new to webmaster world, but I am really impressed by MVC framework. I decided to use cakePHP for my PHP development. But I found the learning curve of cakePHP quite steep. And then the hassle of getting a shared host with cakePHP support. I decided to not use cakePHP or any other framework. But I really liked the MVC approach. Soon i found out that one can use MVC approach even without using any of these available frameowrks. This gives me ease of development of MVC and flexibility and there is almost no learning curve. It seems to be an ideal situation. The Idea is this, its simple but I found it effective.
The Model Part
1. Create a forder and name is "db", "mydb" or anything else..
2. This folder will contain all the classes that interact with database.
3. Create a separate file for each of the database tables.
4. Each of these file will contain a class that will encapsulate code that gets mainly data for that table in database, this is a bit tricky as u may not always extract data from a single table only. But mostly data is from a single table , and data from other tables is use to either supplement it. For example, if you are displaying profile of a user and you have a separate table for profiles. Then you may want data from users table also, but actually because you are diplaying the profile, the file created for profiles table should contain this code. These files will represent the Model part of your app.
The Controller part
5. Create a separate folder for each of the tables in your data base
6. In each of these folder create again a seaparate folder for each of the action u will perform, for example, if you are to edit a post , and you have a posts table in your database , you should create a posts folder in that folder you create a 'edit' folder. The index file of this folder will contain the code for the editing of post.
The View Part
7. In the folder you creates for each of the actions to perform, create a PHP file that contains the Veiw , i.e. that contains HTML, JS, or forms, everything else that describes the view of your page. This file will be included by the index file in the same folder when required.
Example:-
1. Three tables/entities in the application "Post" "User" "Profile"
Actions on user
1. Login
2. Logout
3. Register
Actions on Post
1. Add
2. Edit
3. View
4. Delete
Actions on Profile
1. Create
2. Edit
3. View
the file structure would be like this
/|+-----DB
| | // --- Models ----//
| |--posts.php
| |--users.php
| |--profiles.php
|
|
|+-----POSTS
| |
| |+-----ADD
| | |
| | |--index.php
| | | --posts_add_view.php
| |
| |+-----EDIT
| | |
| | |--index.php
| | | --posts_edit_view.php
| |
| |+-----VIEW
| | |
| | |--index.php
| | | --posts_view_view.php
| |
| |+-----DELETE
| |
| |--index.php
| | --posts_delete_view.php
|
|
|
+-----USERS
| |
| |+-----LOGIN
| | |
| | |--index.php
| | | --users_login_view.php
| |
| |+-----LOGOUT
| | |
| | |--index.php
| | | --users_logout_view.php
| |
| |+-----REGISTER
| |
| |--index.php
| | --users_register_view.php
|
|
+-----PROFILES
|
|+-----CREATE
| |
| |--index.php
| | --profiles_create_view.php
|
|+-----EDIT
| |
| |--index.php
| | --profiles_edit_view.php
|
|+-----VIEW
|
|--index.php
| --profiles_view_view.php
Friday, July 11, 2008
Setting up your own server
Setting up your own server on a machine which has its static global ip is straight forward, just install the server application and done.
But on a machine that is hidden from outside network behind a NAT router requires a some tweaking.
Common Configuration for such a machine is
ISP----------NAT Router-------Host Machine(Your Machine)
The configuration shown in picture. As the nearest public ip to your machine is the ip assigned by the ISP ( which is dynamic) beyond this (toward your machine these are two more ips( gateway and your machine ips that are private). NAT rounter ( ADSL, DSL router prevent access to you machine by any other machine from outside. The broken line shows the separation between inside and outside world. The NAT router is responsible for this separation. Key to the solution is to create a hole in this separation boundary. And this is done through the technique of port forwarding. Port forwarding is done for a given port.
If you have to install a webserver then port number 80 and 443 should be forwarded. If you have to set up a mail server the port number 25 should be forwarded.
There are three pieces of information given to router
1. Outside port (port on which request will arrive from outside at the out side of NAT router.
2. Inside port (port on which your machine will receive the request)
3. Machine IP for which this port should be forward( this is the ip of your machine).
To implement the last step , the automatic assigning of IP on your machine by DHCP should be turned off. You must assign IP to your machine manually.
To assign IP manually and turn of DHCP follow these steps.
1. Go to properties of My Network places
2. Go to the properties of your network connection
3. Select Internet TCP/IP from list, and click properties button.
4. Select the option "Use following ip addresses" and then enter the information asked.
To verify above setting check that your internet connect, try openning website.
Now the final step. to Forward port.
Router provide functionality through virual server concept. Actual method to do this depends on router you are using(www.portforward.com). For router given by MTNL (UT-300R2U) Startcom Router steps are:
Assume Gateway ip is 192.168.1.1
Manually assigned IP of your machine is 192.168.1.2
1. open cmd
2. Type telnet 192.168.1.1
3. enter login, password default is (admin, admin) respectively
4. choose NAT from options
5. choose Virtual Server from options
6. choose Add
7. enter service name : anyname
enter start outside port: 80
enter end outside port: 80
enter start inside port :80
enter end inside port:80
enter local machine address: 192.168.1.2
8 go back to main menu and save and exit. do not forget the save before u exit.
Port can be forwarde for all other ports also depeding on the server you are going to install.
Now all the requests arriving for the global ip at port 80 will be sent to your machine at port 80.
To provide a domain name to you dynamic public ip visit dyndns, or no-ip websites.Setting up your own Server
Setting up your own server on a machine which has its static global ip is straight forward, just install the server application and done.
But on a machine that is hidden from outside network behind a NAT router requires a some tweaking.
Common Configuration for such a machine is
ISP----------NAT Router-------Host Machine(Your Machine)
If you have to install a webserver then port number 80 and 443 should be forwarded. If you have to set up a mail server the port number 25 should be forwarded.
There are three pieces of information given to router
1. Outside port (port on which request will arrive from outside at the out side of NAT router.
2. Inside port (port on which your machine will receive the request)
3. Machine IP for which this port should be forward( this is the ip of your machine).
To implement the last step , the automatic assigning of IP on your machine by DHCP should be turned off. You must assign IP to your machine manually.
To assign IP manually and turn of DHCP follow these steps.
1. Go to properties of My Network places
2. Go to the properties of your network connection
3. Select Internet TCP/IP from list, and click properties button.
4. Select the option "Use following ip addresses" and then enter the information asked.
To verify above setting check that your internet connect, try openning website.
Now the final step. to Forward port.
Router provide functionality through virual server concept. Actual method to do this depends on router you are using(www.portforward.com). For router given by MTNL (UT-300R2U) Startcom Router steps are:
Assume Gateway ip is 192.168.1.1
Manually assigned IP of your machine is 192.168.1.2
1. open cmd
2. Type telnet 192.168.1.1
3. enter login, password default is (admin, admin) respectively
4. choose NAT from options
5. choose Virtual Server from options
6. choose Add
7. enter service name : anyname
enter start outside port: 80
enter end outside port: 80
enter start inside port :80
enter end inside port:80
enter local machine address: 192.168.1.2
8 go back to main menu and save and exit. do not forget the save before u exit.
Port can be forwarde for all other ports also depeding on the server you are going to install.
Now all the requests arriving for the global ip at port 80 will be sent to your machine at port 80.
To provide a domain name to you dynamic public ip visit dyndns, or no-ip websites.Setting up your own Server
Subscribe to:
Posts (Atom)