Database structure of user table for a web based application (generic)

Table name = users

first_ name // You don’t want to be called stupid
last _name // Definitely, you wouldn’t want to be called as
email // This is what we need
password // salted/hashed – you know, for security and all
IP address // Why? Why Mr. Anderson?
created // Help us identify the date you were wandering and got stuck
photo // How do you look (I know, I know – looks don’t matter, but still… smile please)
status // By default > Inactive | We want you to click on the link that we sent in the email when you register

email_verified // Default > 0 | When click on signup verification link or forgot password link | Account status is not as same as verified email
phone_verified // Default > 0 | When correct OTP is entered

id_facebook // Facebook profile ID
status_facebook // Default > 0 | In case you are registering with email
photo_facebook // In case you want to make yourself visible using your Facebook photo (really?)



forgot_password_hash // When you forgot your password, and we send you a link (which is unique, btw), we keep a copy of the hash in the system (of course, to uniquely identify the link that you will need to click to reset the password)
remember_me_hash // When you click the little checkbox that says “Remember Me” then we create a hash and store it in DB. The same hash is also saved in a cookie, so that when a session is not found (or expired) then before sending the user to login screen,

user_status // Default > 1
adviser_status // Default > 0

username // Adviser username



1. Register : Sign up > Send email with verification link > Click on email link to verify > Thank you page > Link to login + Automatic redirect to login page after some time (5 seconds)

2. Forgot Password : Sign up / Login > Forgot password > Enter email > Send link in email > Click on email link to enter new password and confirm password > After successful password change > Thank you page > Link to login + Automatic redirect to login page after some time (5 seconds)

3. Login : Email + Password > User Profile page

4. Remember me : If checked, then save hash in cookie > If logged out, but cookie hash is valid, then don’t redirect to login page, but login using the hash and send to User Profile page

5. Social Login : Get details from social network (FB / Twitter / Google+) > Type (Social type) + ID (Social ID) > Check if email is available from Social data already exists in system or not > If it exists, then update the Type and Social ID for that user, and login that user, if the social email does exists in our system, then create a new user record and login with that user.




CakePHP 2.x | Console | cake bake all | Windows + Linux

In CakePHP the “cake” (console) command can be used to bake scaffolding Model, View and Controller files (to quickly create content management system).

Following is the command
“cake bake all”

“cake” is the actual command.
“bake” and “all” are parameters (other options are available to selectively bake stuff – M/V/C).

“cake” is the Linux shell command.
It will not run on Windows, because it is a Linux shell command.

To run this on Windows you will need to use cake.php (available in the same folder – app/Console).

Since, by default, php path is not available in command line, so you will need to provide php path also.

So, the final command will be something like following:
(assuming, XAMPP is installed – and, you are already in c:\xampp\htdocs\cakeproject\app\Console)

c:\xampp\php\php.exe cake.php bake all


Basic Linux shell commands for new users

touch a.txt (to create a new blank file)
ll (to list all the files in this folder)
ll | grep john (to filter the files matching the pattern – john – in this case)
ll | grep tac

chmod 0777 test_file (to make the file fully writable for all users – not recommended for production environment)
chmod 0777 test_folder (if this is a folder, then the permissions are set for this particular folder only)
chmod -R 0777 test_folder (Applies the permissions to all the folders and sub-folders inside this folder)


Model based DB understanding

There is a need of paradigm shit in terms of database modelling.

The shift needs to happen at the relationship level – instead of using tables, the relationships should connect at the Model level.

This is a major shift, and requires a different mind-set altogether.

Models should be considered while designing the application (architecture).
Tables should(would) come into picture only after the conceptual Model have been created and the relationships have been clearly identified and specification for that has been set (and rightly so).

More on this later.

coding, jakaildesignspegh

Tapping the core coder within me | NOW

It’s been a long time since I have written a code of the level that I was kinda proud of.

I think I need to tab in to my oracle grid, and access the projects Pegasus, Exodus and Goliath, and bring in the core coder again (#IronMan reference).

My typing speed has slowed down ever since I have stopped coding, my creativity has started to die and my estimation skills are improving (that is a sad thing to happen if I want to continue to call myself a coder – usually my estimations fall back by approx 5-10 times).

I am trying to access a lot of my brain’s part to work, and I am hopeful to get this done since I have started to get on to a artificial add-on : mod(alert)

Coding on RedBull right now.


coding, jakaildesignspegh

Just another day in paradise

Woke up, coded for half an hour on IMS(Inventory Management System) that I and Bal are working on, opened up the gift from the company I’m working at(Trantor), and now on way to drop the wife to her office.

Planning to visit Peacock Garden(Chandigarh) with mom and daughter, and later check few creches for the kiddo to start her pre-schooling.

Also plan is on the table for an evening at Dharampur.