Success only for those who continuously busy to achieve.. A platform for your daily work problem and questions
Programmer in India
Thursday, August 25, 2011
Thursday, August 11, 2011
cake php
- Before read this i think you have some programming knowledge and client server architecture.
- What is Cake PHP:
- a quick list of features you’ll enjoy when using CakePHP:
- Active, friendly community
- Flexible licensing
- Compatible with versions 4 and 5 of PHP
- Integrated CRUD for database interaction
- Application scaffolding
- Code generation
- MVC architecture
- Request dispatcher with clean, custom URLs and routes
- Built-in validation
- Fast and flexible templating (PHP syntax, with helpers)
- View Helpers for AJAX, JavaScript, HTML Forms and more
- Email, Cookie, Security, Session, and Request Handling Components
- Flexible ACL
- Data Sanitization
- Flexible Caching
- Localization
- Works from any web site directory, with little to no Apache configuration involved
- Requriment for cake php:
Requirements
- HTTP Server. For example: Apache. mod_rewrite is preferred, but by no means required.
- PHP 4.3.2 or greater. Yes, CakePHP works great on PHP 4 and 5.
CakePHP supports a variety of database storage engines:
- MySQL (4 or greater)
- PostgreSQL
- Microsoft SQL Server
- Oracle
- SQLite
- It is a MVC based php framework for rapid application development.
- Used to build a rapidly develop robust web applications, without any loss to flexibility.
- See the picture above it helps you a lot:
- step 1 : User send a request for page.
- step 2 : Request goes to server's controller.
- step 3 : Controller find the specific page in model(also called a database table , rss feed or any other file) .
- step 4 : If found come back to controller and after that controller.
- step 5 : Then controller goes to the view, it is the view who represent the data in the form of html or pdf or other way.
- step 6 : At last it is the view that transfer to the client back.
- This is all over MVC hope you got it...
- here the file structure of cake php :
- the Root folder contain:
/app
/cake
/plugins
/vendors
.htaccess
index.php
README
- The app folder will be where you work your Programming Code files: it’s where your application’s files will be placed.
- The cake folder contained very useful predefined data files. make sure that you never edit files in this folder. This is the core of Cake .
- Finally, the vendors folder is where you’ll place third-party PHP libraries you need to use with your CakePHP applications.
The App Folder
CakePHP’s app folder is where you will do most of your application development. Let’s look a little closer at the folders inside of app.
config : | Holds the (few) configuration files CakePHP uses. Database connection details, bootstrapping, core configuration files and more should be stored here. | ||
---|---|---|---|
controllers | :Contains your application’s controllers and their components. | ||
libs: | Contains 1st party libraries that do not come from 3rd parties or external vendors. This allows you to separate your organization's internal libraries from vendor libraries. | ||
locale: | Stores string files for internationalization. | ||
models: | Contains your application’s models, behaviors, and datasources. | ||
plugins: | Contains plugin package. | ||
tmp: | This is where CakePHP stores temporary data. The actual data it stores depends on how you have CakePHP configured, but this folder is usually used to store model descriptions, logs, and sometimes session information. Make sure that this folder exists and that it is writable, otherwise the performance of your application will be severely impacted. In debug mode, CakePHP will warn you if it is not the case. | ||
vendors: | Any third-party classes or libraries should be placed here. Doing so makes them easy to access using the App::import('vendor', 'name') function. Keen observers will note that this seems redundant, as there is also a vendors folder at the top level of our directory structure. We'll get into the differences between the two when we discuss managing multiple applications and more complex system setups. | ||
views: | Presentational files are placed here: elements, error pages, helpers, layouts, and view files. | ||
webroot: | In a production setup, this folder should serve as the document root for your application. Folders here also serve as holding places for CSS stylesheets, images, and JavaScript files. |
Another important point is CakePhp Convension:
CakePHP Conventions:
- It will take a time to learn CakePHP’s conventions.
- But this will helps you save time in the long run.
- By the following convention you able to do:
- the maintenance nightmare of tracking config files.
- Convention also makes for a very uniform system development.
- Allowing other developers to jump in and help more easily.
File and Classname Conventions:
In general, filenames are underscored while classnames are CamelCased. So if you have a class MyNiftyClass, then in Cake, the file should be named my_nifty_class.php. Below are examples of how to name the file for each of the different types of classes you would typically use in a CakePHP application:
Each file would be located in or under (can be in a subfolder) the appropriate folder in your app folder.
--------------------------------------------------------------------------------- The Controller class KissesAndLovesController would be found in a file named kisses_and_loves_controller.php (notice _controller in the filename)
- The Component class MyFutureComponent would be found in a file named my_future.php
- The Model class OptionValue would be found in a file named option_value.php
- The Behavior class MyNewBehavior would be found in a file named my_new.php
- The View class SuperSimpleView would be found in a file named super_simple.php
- The Helper class BestEverHelper would be found in a file named best_ever.php
Each file would be located in or under (can be in a subfolder) the appropriate folder in your app folder.
Model and Database Conventions:
- Model classnames are singular and CamelCased. Person, BigPerson, and ReallyBigPerson are all examples of conventional model names.
- Table names corresponding to CakePHP models are plural and underscored.
- The underlying tables for the above mentioned models would be people, big_people, and really_big_people, respectively.
- Field names with two or more words are underscored like, first_name.
Controller Conventions:
Controller classnames are plural, CamelCased, and end in Controller
. PeopleController
and LatestArticlesController
are both examples of conventional controller names.
C.T.M:
The first method you write for a controller might be the
index()
method.When a request specifies a controller but not an action, the default CakePHP behavior is to execute the
index()
method of that controller.For example, a request for http://www.example.com/apples/ maps to a call on the
index()
method of theApplesController
, whereas http://www.example.com/apples/view/ maps to a call on theview()
method of theApplesController
.
URL Considerations for Controller Names:
As you've just seen, single word controllers map easily to a simple lower case URL path. For example,
i keep updating this : stay tuned.... thanks ..ApplesController
(which would be defined in the file name 'apples_controller.php') is accessed from http://example.com/apples.View Conventions:
- View template files are named after the controller functions they display, in an underscored form.
- The getReady() function of the PeopleController class will look for a view template in /app/views/people/get_ready.ctp.
- The basic pattern is /app/views/controller/underscored_function_name.ctp.
- Database table: "people"
- Model class: "Person", found at /app/models/person.php
- Controller class: "PeopleController", found at /app/controllers/people_controller.php
- View tem
- plate, found at /app/views/people/index.ctp
Let us start some delelopment:
The next big thing you have to done is:
Creating the Blog Database:
if you haven't already done this, create an empty database for use in this tutorial, with a name asn you wish.
create table name posts
/* First, create our posts table: */
CREATE TABLE posts (
id INT AUTO_INCREMENT PRIMARY KEY,
title VARCHAR(50),
body TEXT,
created DATETIME DEFAULT NULL,
modified DATETIME DEFAULT NULL
);
/* Then insert some posts data for testing: */
INSERT INTO posts (title,body,created)
VALUES ('The title', 'This is the post body.', NOW());
INSERT INTO posts (title,body,created)
VALUES ('A title once again', 'And the post body follows.', NOW());
INSERT INTO posts (title,body,created)
VALUES ('Title strikes back', 'This is really exciting! Not.', NOW());
Controller in brief:-
- if you were building a site for an online examsystem, you might have a OnlineexamController .
- In CakePHP, controllers are named after the model they handle, in plural form.
- So the The OnlineExam model is handled by the OnlineexamController and so on.
- Imp Point remember:
- Your application's controllers are classes that extend the CakePHP AppController class, which in turn extends a core Controller class, which are part of the CakePHP library.
- The AppController class can be defined in /app/app_controller.php and it should contain methods that are shared between all of your application’s controllers.
- Controllers can include any number of methods called as actions.
- Actions are controller methods used to display views. An action is a single method of a controller.
<? class OnlinexamController extends AppController {
function view($id) {
//action logic goes here..
}
function share($student_id, $stuname_id) {
//action logic goes here..
}
function search($query) {
//action logic goes here..
}
}
?>
-------------------------------------------------------------------
Source CakePhp.org
wanna View latest news and GK question answer:Click Here
Wednesday, August 10, 2011
Format a number in php
for this we have a function called : number_fomat();
Syntax is:
< ?php
$myno=123456;
$myno_after_format=number_format($myno);
echo $myno_after_format;
output is:123,456
also another way:
$myno=1234.56;
# this will show only one decimal digit.
$myno_after_format=number_format($myno,1);
echo $myno_after_format;
output is:
1234.5
? >
wanna View latest news and GK question answer:Click Here
Friday, August 5, 2011
what is Cloud Computing simple and easy defination
![]() |
Cloud Computing |
First of all know what is cloud computing: ,
A very clean and simple language/words Defination of Cloud Computing is::
- In old system, we purchase the computer software and other software. Each time we need a CD or DVD so that again install or reinstall that kind of software.
- This is the problem for every household as well as IT Companies.
- So to resolve this Big IT Gaint like Google, Yahoo, IBM start the Cloud way.
- Now you able to understand the definition:
- Cloud computing is the way to store your software or data in Internet (server) and you simply use this either free or sometime paid.
- Hope you understand!! :)
wanna View latest news and GK question answer:Click Here
what is exactly success in every Field?
Today i share some experience word with all of you, regarding the Word SUCCESS.if you really want to got success in your field then simple follow some tips that i share.
- Success is not for those who are lazy, it's true.
- So if you are lazy, then be become punctual and obey the rule.
- Count your seconds, it automatically fruitful for you..
- Above line means never waste time.
- Don't fear About Interview, it is the time when you learn most of the things you don't know.SO enjoy it with relief and comfort.
- Face the challenge and fix the target.
- Till you not set any target you never succeed.
- So Set the Target work upon it and see the result.
- if something Wrong then Improve that..
wanna View latest news and GK question answer:Click Here
How to change the width of dropdown list in HTML,PHP,JAVA,DOT NET
Let us assume the drop down list is this one:--
<select name="drop-list" style="width: 200px;">
<option> First value <option>
<option> second value <option>
<option> third value <option>
<option> fourth value <option>
<option> fifth value <option>
<select>
output is :
<select name="drop-list" style="width: 200px;">
<option> First value <option>
<option> second value <option>
<option> third value <option>
<option> fourth value <option>
<option> fifth value <option>
<select>
output is :
It is very simple just do this way:
------------------------------------------------------------------------------------
Now see the large width Drop down List
Type the following code:
<select name="drop-list" style="width: 400px;">
<option> First value <option>
<option> second value <option>
<option> third value <option>
<option> fourth value <option>
<option> fifth value <option>
<select>
see the output:
wanna View latest news and GK question answer:Click Here
Tuesday, August 2, 2011
Php Array types
Array is a datatype in php...
It is mostly used to store multiple item under a single variable name.
Types of array in PHP:
1.Numeric or Index array.
2.Associative array.
3.Multi-dimensional array.
1. Numeric array:
syntax to create this:
/*
#Write a program to Numeric array in PHP
#comment: make a array variable name $var
#Author : amit sharma
*/
$var = array (value1,value2,value3...);
#in detail
$var = array(10,20,30,40,50,60);
now in above line we create a array name $var in php that store 6 values 10,20,30,40,50 and 60 .
It is mostly used to store multiple item under a single variable name.
Types of array in PHP:
1.Numeric or Index array.
2.Associative array.
3.Multi-dimensional array.
1. Numeric array:
syntax to create this:
php code begin here
/*
#Write a program to Numeric array in PHP
#comment: make a array variable name $var
#Author : amit sharma
*/
$var = array (value1,value2,value3...);
#in detail
$var = array(10,20,30,40,50,60);
now in above line we create a array name $var in php that store 6 values 10,20,30,40,50 and 60 .
php code end here
wanna View latest news and GK question answer:Click Here
Saturday, July 30, 2011
Wednesday, July 27, 2011
JOB IN NIT HAMIRPUR
JOB in Faculty NIT Hamirpur center, Himachal Pradesh
LAST DATE is 26th and 27 july 2011
more info click here: NIT hamirpur
please hurry to enroll your interview time 2:30 sharp
wanna View latest news and GK question answer:Click Here
Monday, July 25, 2011
PHP difference between single and double quotes
1. Single quote treat all variable as string. while double quotes treat variable and string diferent.
2. 'Single quote ' are effective with . (concatenation operator), while less need of . operator by using "double quote"
example:
Double Quote
$my_var_name=120;
echo "the value is $_my_var_name";
output is:
the value is 120
----------------------------------------------------------
So i think ,the difference clear to you.
2. 'Single quote ' are effective with . (concatenation operator), while less need of . operator by using "double quote"
example:
Double Quote
$my_var_name=120;
echo "the value is $_my_var_name";
output is:
the value is 120
----------------------------------------------------------
Single Quote
$my_var_name=120;
echo "the value is $_my_var_name";
output is:
the value is $_my_var_name
So i think ,the difference clear to you.
wanna View latest news and GK question answer:Click Here
Thursday, July 14, 2011
Business communication
Mode of communication in Business:
Written communication:
Best Public busines communication notes are:
Best Business Communication notes
- Written Communication
- Oral Communication
- E-mail communication
Written communication:
- Neat and clean
- Clear idea
- No large sentance
- Proper grammar
- use of picture if possible
- It must be
- complete
- Means full and clear information about content
- concise
- Means straight-foreword
- To the point
- Relevant
- Simple Language
- clear
- concrete
- correct
- considerate
- courteous.
Best Public busines communication notes are:
Best Business Communication notes
wanna View latest news and GK question answer:Click Here
Thursday, June 23, 2011
How to Install RAR software for Ubantu
it is very simple and easy:
follw these steps:
open the command prompt; Go to applicaton->Accessories->Terminal
step 1: copy and paste this command " sudo apt-get install unrar-free "
then if ask for super user password then type your password.
step 2: copy and paste this command " sudo apt-get install unrar "
Enjoy...
follw these steps:
open the command prompt; Go to applicaton->Accessories->Terminal
step 1: copy and paste this command " sudo apt-get install unrar-free "
then if ask for super user password then type your password.
step 2: copy and paste this command " sudo apt-get install unrar "
Enjoy...
wanna View latest news and GK question answer:Click Here
Friday, June 10, 2011
cost gurd Job
INDIAN COAST GUARD
(MINISTRY OF DEFENCE)
EXCELLENT OPPORTUNITY FOR MEN AND WOMEN TO BECOME OFFICERS
IN INDIAN COAST GUARD - 01/2012 BATCH
(TRAINING COMMENCING – JAN 2012)
1.
The Indian Coast Guard, an Armed Force of the Union, offers a challenging
and inspiring career as a Group ‘A’ Gazetted Officer in the pay scale for
Assistant Commandant at Rs.15600-39100 with Grade Pay Rs 5400.
2.click here for more info:
http://www.indiancoastguard.nic.in/indiancoastguard/jobs/jobs.html
========================================
(MINISTRY OF DEFENCE)
EXCELLENT OPPORTUNITY FOR MEN AND WOMEN TO BECOME OFFICERS
IN INDIAN COAST GUARD - 01/2012 BATCH
(TRAINING COMMENCING – JAN 2012)
1.
The Indian Coast Guard, an Armed Force of the Union, offers a challenging
and inspiring career as a Group ‘A’ Gazetted Officer in the pay scale for
Assistant Commandant at Rs.15600-39100 with Grade Pay Rs 5400.
2.click here for more info:
http://www.indiancoastguard.nic.in/indiancoastguard/jobs/jobs.html
========================================
wanna View latest news and GK question answer:Click Here
Sunday, June 5, 2011
CGPA TO Percentage convert here
Grade Point Equivalent
Percentage
6.25 55%
6.75 60%
7.25 65%
7.75 70%
8.25 75%
Percentage
6.25 55%
6.75 60%
7.25 65%
7.75 70%
8.25 75%
wanna View latest news and GK question answer:Click Here
Saturday, May 21, 2011
PHP 5 with new exiting features
Here i am begin small tutorial for beginner as well as Professional..
Class:- It is an real world entity, like Person, Car, Employee etc
it contain properties also call variable and functions or Methods.
Object:- it is the instance of class. it like a variable , that is capable of using all class member variable as well as class member function.
Constructor: it is the important part of Class,behave like a function. It is a class function that execute automatically when we declare the object of that class.
their is no need to execute constructor by calling method. example
class className
{
//in php5
function __construct(){// this is the constructor , here we mention such type of statements that execute automatically when the object is created.}
}// end of class
ACCESS MODIFIERS :
the access modifiers are those who will specify the Scope of variable as well as functions...
here the name of some are as:
- Private
- Public
- Protected
- Final
- Abstruct
wanna View latest news and GK question answer:Click Here
Tuesday, May 10, 2011
Technology news
Google and Yahoo start collaboration with Indian Govt.
Google and Yahoo start collaboration with Indian Govt. to set up approximate 20 new IIIT in different parts of the country. This Venture is named as PPP public private partnership.
It's celebration time at Mahindra Satyam...
wanna View latest news and GK question answer:Click Here
Tuesday, March 1, 2011
SQL SERVER 2005 Notes
SQL- Structured Query Language is an DataBase Management language(DBML).and sql server is an DBMS.
Mysql,oracle etc are name of different kind of DBMS..
database is a collection of tables;
and table is a collection of fields or columns.
further record is a collection of related columns value.
Database:
How to create data base:
Sql is case in-sensitive. so be happy buddy and enjoy your typing. keep in mind spelling is correct.:)...
Syntax is:
Create Database databaseName
then execute this: by press F5 or {!excute} button on tool bar.
Create database Mydatabase
after creating you have to Use this database.
Syntax for this is:
Use Database databasename
use database mydatabase
then
(F5)
database is a collection of tables;
and table is a collection of fields or columns.
further record is a collection of related columns value.
Database:
How to create data base:
Sql is case in-sensitive. so be happy buddy and enjoy your typing. keep in mind spelling is correct.:)...
Syntax is:
Create Database databaseName
then execute this: by press F5 or {!excute} button on tool bar.
Create database Mydatabase
after creating you have to Use this database.
Syntax for this is:
Use Database databasename
use database mydatabase
then
wanna View latest news and GK question answer:Click Here
Monday, February 7, 2011
Commanly asked questions ans their answers.
1. Introduction
First important question in interviews is about your introduction.
You must have a short statement pre-pared in your mind.Also keep in Mind it does seems to be look like rehearsed. always use less words to explain.Never use large sentence for any answer.
Stay positive when such kind of questioning is being done .Also Never mention your problem with the organization and never use hatred words for seniors, co-employers or the organization. If you do like that ,you never be ale to get the right kind of job. make smiley face, with pleasant answers.
3. Experience
Another important question is experience in certain field you want to join.
if you have good experience than tell them, otherwise simply say i am less experience in this field.
4. Wording of colleagues about you:
another crucial question is your colleague expression about you. say some nice wording that you often listen about your self from the mouth of your friends.
Before going to interview you must have to investigate about the company of organization you want to visit for interview.
- Name of MD
- Any achievement of company or organization.
A lot more please stay visit here for more updation....
wanna View latest news and GK question answer:Click Here
Saturday, January 29, 2011
Bank Demands More people as Most of staff going to retire....
So there is a chance to all of you get involved in it and Enjoy it.
wanna View latest news and GK question answer:Click Here
Subscribe to:
Posts (Atom)