Monday, May 17, 2010

Taking and Deploying the Dump (fast)

Taking a Dump from command line-
mysqldump -h localhost -u root -p emba > c:\dbname.sql

Deploying the Schema from command line-
mysql -u root -p emba < dbname.sql

advantage- far much faster in comparison to doing it other wise
just make sure that you have created a database before deploying your .sql file into database.

Basic Concept of an ORM

It will generate four files for an entity= Table

say for example - Employee

1) employee.php (over ride or define some new methods (getter setter or others) on your own= custom code)
2) baseEmployee.php (avoid touching it, as these are the files automatically generated by ORM)

These files are basically to deal with Object level things

3) employeePeer.php (here you can override the basic query for an object )
4) baseEmployeePeer.php () (The basic CRUD queries are written here- automatically generated by Propel)

Creating a new Module in Drupal

First of all we need to create a folder inside modules folder, basically we will see it in C:\wamp\www\drupal platform\sites\all\modules\Test
and inside this folder now we will create some module related files.
like -.info file, .install, .module,ModuleAction.php, ModuleView.php

it is important to define the id of the new module, for the reason it recognizes a module with its id.
do define name, description, package and core for that module.
core basically defines which drupal version are you using.

There is a choice - To make a Drupal website more of MVC architecture oriented in Place of PAC orieneted, we can introduce this concept of writing
an .xml file .

where you can define the title, action URL and function name etc.

also we will have to write a utility function to generate an array of these things out of XML file, to tell the controller that which function should be called when a particular URL is hit.

if you dont opt for this approach you will have to define this array of title, function name and URL etc same as its done in drupal modules.

Now we need to do a build and check it whether these URLs got registered in the menurouter table or not.

so Do a build and check your menu_router table, also check Actions.php there it should have defined the action name , url etc there also .

Now we need to go to URL like-
localhost/drupalwebsite/?q=admin/build/modules

Now our newly created module should be shown here, just check it to enable
and click on save configuartion.

once its done You can basically access other pages where those specific actions can be performed which you will be defining soon in .module file.


now go to .module file and well make sure that you have defined a hook_menu function.
and the other functions.

If you have done so, just say hurray! as you must be retreiving the function output while hitting the URL.

Learning Drupal

Its as easy as that, installing Drupal and creating a website with it.

Download and Install wamp on your machine, Put the Drupal (Downloaded folder inside the www directory of wamp, which is same as apache/webapps)
Now surf localhost on your browser. you will get to see Drupal directory there as project.
Click and it will take you to easy install.
Just make sure that you have created a database in your MySQL.

Now provide all the specific details that Drupal asks you for while installing itself.
and here you are ready to go.

** PS = Installation of Drupal Basically refers to creating the backend tables needed for the functionality of all the modules you have selected while installing it.

** also note that the first created User becomes the admin of the website by default.

Webapps 2010

I got a chance to attend this event sponsered by siliconindia.
Guys from Yahoo and Rediff took the sessions.
topics were: