Owner: Geek Files URL:http://www.sunilb.com Join Date: Tue, 30 Oct 2007 23:23:07 -0500 Rating:0 Site Description: This blog gives you technical and programming tips, tricks and tutorials on PHP, MySQL, Programming, C, etc Site statistics:Click here
PayPal allows direct withdrawal to Indian Bank Accounts 2007-11-01 01:19:56 Good News for guys here in India who have always wondered how you could get your money stored in PayPal
to your Indian Bank Accounts
.
People who have been in micro trade or freelance developers will highly benefit. So start using this service to the fullest.
(more…)
Read more:withdrawal
Recharge your programming batteries - Tips 2007-10-31 11:48:10
Many of us in the field of programming and development go through a phase where we completely blank out. Our minds don’t work, our logic seems to have lost its track and we are not able to make any progress with projects. If this has happened to you and continues to happen to you… then you are not alone.
A lot of programmers and developers go through this phase on a continuous basis. I go through it at times. You could blame it on the module, your stress levels, family & personal issues, etc. But, no matter what; we still need to deliver projects on time. Clients are least interested to know what your personal problems are. They want their deliveries on time. Wouldn’t you?
(more…)
Read more:batteries
, Recharge
PHP5 Tutorial on Arrays 2007-10-30 20:29:47 This PHP5 tutorial discusses about PHP arrays.
What is an array?
Generally speaking an array is continuous allocation of memory of similar data types.
This means that you can define a single array variable which can hold multiple values at the same time. These multiple values are retrieved using an index number. Don’t worry if you did not get this… more explanation ahead.
The same definition mentioned above is also applicable for PHP as well, with an exception that it can store data of different data types in one array.
Memory representation of an array
In the above diagram, you can see that variable $a has been allocated 5 slots of memory in which data can be stored. Each of these slots / boxes are referred using an index number that starts from 0. A common mistake for people learning arrays is to consider the starting position of an array as 1.
(more…)
Read more:Tutorial
Tips to get article ideas for your blog 2007-10-27 12:42:28 If you wish to start a blog or already have a blog and have this issue that you keep running out of ideas
, I recommend that you consider the tips mentioned below to help you generate ideas for your blog posts.
1. Discuss issues with other people
When you discuss issues in your area of specialization, you get to know problems faced by other people. The moment a discussion starts; you should make mental notes. Once out of that discussion; jot the notes on text editor or a piece of paper. Using these notes you can create a new blog post based on the problems/issues discussed.
2. Research on a common pain point
Identify a pain point in your field of specialization. There could be many such pain points or problems for which people need help or solutions. To give you an example, I belong to the technical field and the pain points that I have identified are code optimization, query optimization, response times, server loads, etc.. So, identify such pain points in your field of specializat
PHP5 OOPS Tutorial __get() and __set() 2007-10-26 11:32:51 This article talks about the use of __get() (double underscore - get()) and __set() (double underscore - set()) PHP5 OOPS magic methods.
By default PHP is a Loosely typed language and therefore it is not necessary to declare variables before using them. This also holds true for using class members. Look at an example below.
(more…)
Read more:Tutorial
Is it 12 or 13? 2007-10-26 01:21:42 An interesting play with graphics. Check it out.
Your email: Subscribe Unsubscribe
PHP5 Tutorial - Magic Methods - __toString() method 2007-10-25 12:54:35 PHP5 provides a magic method
by the name of __toString() (double underscore followed by toString()) which is useful for debugging purposes.
The __toString() method is automatically called when an object in PHP5 is converted into a string for the purpose of display or concatenation.
(more…)
Read more:Magic
, Methods
, Tutorial
5 practical tips to secure your web applications 2007-10-25 12:20:33 Keep these practical tips in mind when developing code for your web applications. Examples shown are written in PHP and can be implemented in any language.
Prevent SQL Injection attacks
Provide additional security with backend validations
Validate Combo Box and List Box data
Convert HTML code into its entity form
Capture errors and show custom error page
(more…)
How to swap 2 variables without temp variable 2007-10-23 01:50:25 Swapping 2 variables requires a third temp variable, this is how it is implemented with 3 variables (I have implemented this in PHP, the same logic can be used in any language):
<?php
$a = 5;
$b = 7;
$temp = $a;
$a = $b;
$b = $temp;
echo “$a : $b”;
?>
(more…)
Common Tough Interview Questions 2007-11-03 07:08:42 There are some questions that tend to pop up during almost every job interview. The bad news is that these questions are difficult to answer since there is no standard way of answering and every interviewer expects an answer in his own style. The good news is that because these questions are so common, you can prepare for them well in advance and give a perfect answer without breaking a sweat.
Tell me something about yourself?
Why do you wish to leave your current job?
What are your career goals 3 - 5 years from now?
How do you plan to achieve those goals?
What is your biggest weakness?
Did you ever have an argument with your boss and how did you resolve it?
If I were to meet one of your school friend or teacher, what would the say about you?
What do you know about our organization?
What has been your most challenging project/assignment/job?
Do you have any questions for me?
(more…)
Read more:Common
, Tough
PHP5 OOPS Tutorial - Magic Methods - __sleep() and __wakeup() 2007-11-03 06:14:19 The magic method __sleep() and __wakeup() is called when an object is serialized. The magic method __sleep() and __wakeup() provides a method to clean up and restore objects before being serialized.
Working with the magic method __sleep()
__sleep() magic method is called when the object of a class is about to be serialized. This magic method __sleep() does not accept any parameter and returns an array. The array should contain a list of class members that should be serialized. This means that if you don’t wish to serialize a particular class member, you should not include it in the array. Look at the example below:
(more…)
Read more:Magic
, Methods
, Tutorial
PHP5 OOPS Tutorial - Magic Methods - __autoload() method 2007-11-03 04:34:31 This tutorial will teach you how and when to use the magic method
__autoload().
The magic method __autoload function is a convenience that allows you to use classes without having to explicitly write code to include them.
The magic method __autoload() is not included in your class definition as this is to be called once in a script. The best place to put the autoload() file is in your configuration file which is loaded in all your other scripts.
(more…)
Read more:Magic
, Methods
, Tutorial
PHP5 OOPS Tutorial - Magic Methods - __call() method 2007-11-03 03:37:14 This tutorial will teach you how and when to use the magic method
__call().
The magic method __call() is to undeclared methods what __get() and __set() are to undeclared data member.
These methods are automatically called internally when the program tires to execute a method that has not been defined within the class at the time of development.
(more…)
Read more:Magic
, Methods
, Tutorial
PHP5 OOPS Tutorial - Magic Methods - __isset() and __unset() 2007-11-03 02:30:22 In my previous PHP5 OOPS tutorial on PHP5 OOPS Tutorial
- MagicMethods
- __get() and __set(), we learnt how and when to use these magic methods.
This PHP5 OOPS tutorial will teach you how and when to use the magic methods __isset() and __unset().
(more…)
MySQL Tutorial - Seeking records in a predefined order 2007-11-09 07:35:19 You can use this tutorial in various projects where the requirement is to sequence the records based on the order that has already been predefined.
Imagine having to write code where you are supposed to display articles on the basis of an order predefined by the administrator of the site. I had a similar challenge with one of my sites www.careercurry.com where I had to show article listings on the home page based on the sequencing that I set through the admin control panel.
(more…)
Read more:MySQL
, Seeking
, Tutorial
PHP5 OOPS Tutorial - Defining Methods of a PHP5 Class 2007-11-08 08:41:43 In this PHP5 OOPS tutorial you will learn about methods and how to declare and use them in PHP5 class.
Definition of an class method
A class method/functions is the behavior/functionality of a class i.e. they provide the necessary code for the class in which it is defined. Examples could be a saveCustomer() method in the class Customer or a printDocument() in the Document class.
Methods
act (perform operations) on the data members of the class and can be declared as private or public. A class method is exactly similar to PHP functions, it’s just that class functions are declared inside classes and accessed using the -> (arrow operator / dereferencing operator).
(more…)
Read more:Tutorial
PHP5 OOPS Tutorial - Defining Attributes of a PHP5 Class 2007-11-08 07:39:48 In this tutorial you will learn about class attributes and how to declare & use them in PHP5 classes.
Definition of an class attribute
An attribute is also know as data members and is used to hold data of a class. The data that it holds are specific to the nature of the class in which it has been defined. For example, a Customer class would hold data related to a customer, an Order class would hold data related a an order.
(more…)
Read more:Attributes
, Tutorial
PHP5 OOPS Tutorial - Learn to create a PHP5 Class 2007-11-08 07:11:10 Before we begin learning how to create
PHP5 Class, lets first understand the meaning of a class in object oriented programming practices.
Definition of a Class
A class is user defined data type that contains attributes or data members; and methods which work on the data members. (You will learn more about data members and methods in following tutorials. This tutorial focuses only on learning how to create a Class in PHP5)
To create a class, you need to use the keyword class followed by the name of the class. The name of the class should be meaningful to exist within the system (See note on naming a class towards the end of the article). The body of the class is placed between two curly brackets within which you declare class data members/variables and class methods.
(more…)
Read more:Tutorial
PHP5 OOPS Tutorial - Introduction to PHP5 OOPS Features 2007-11-06 19:41:24 PHP5 has made a lot of improvements as regarding OOPS is concerned. Although it has not been up to the mark with the likes of Java, .NET and C++; but when compared to PHP4, PHP5 has made significant improvements.
In this post, I propose to cover the following topics:
About PHP5
Future of PHP
New keywords in PHP5
A note on Garbage Collection
Naming Conventions
Note on E_STRICT
Built in Classes (SPL)
(more…)
Read more:Introduction
, Tutorial
PHP5 OOPS Tutorial - Magic Methods - __clone() method 2007-11-05 10:32:50 Before I begin to explain the use of a __clone
() method
, lets try and understand what does object cloning mean.
To clone an object means to create a duplicate of an object. With regular variables $a = $b means that a new variable $a gets created that contains the value of $b. This means that 2 variables get created.
With objects $obj2 = $obj1 does not mean that a new object i.e. $obj2 gets created. When we execute $obj2 = $obj1, the reference of $obj1 is assigned to $obj2. This means that $obj1 and $obj2 point to the same memory space. Look at the diagram below.
(more…)
Read more:Magic
, Methods
, Tutorial
PHP5 Tutorial - Inheritance in PHP5 2007-11-14 23:21:50 In the tutorial we will understand what is Inheritance
in general and how to inherit classes in PHP5.
Definition of Inheritance:
Inheritance is the mechanism of deriving a new class from an existing class. It allows a sub-class / child class to share/inherit the attributes and behaviors of a base-class or parent class. These inherited attributes and behaviors are usually modified by means of extension.
(more…)
Read more:Tutorial
PHP5 Tutorial - Defining Class Constants 2007-11-14 22:46:36 In PHP4 the only constants that we would declare were global constants. In PHP5 it is possible to define a class level constant. These constants are specific to the class and hence don’t clutter the global level constant space.
(more…)
Read more:Tutorial
PHP5 Tutorial - instanceOf Operator Explained 2007-11-14 21:52:46 PHP5 introduces a new operator by the name of instanceOf. instanceOf is used to check if two objects passed as operands belong to the same class. This check can also happen when an object is compared with a class name.
In PHP4 a similar functionality existed with a method is_a(), which has been replaced by the instanceOf operator in PHP5.
(more…)
Read more:Operator
, Tutorial
PHP5 Tutorial - $this variable explained 2007-11-14 09:17:53 $this variable is a pointer to the object making the function call. $this variable is not avialable in static methods. We will learn more about static methods in the next series of tutorials.
(more…)
Read more:Tutorial
PHP Script to Extract Email Address from any text 2007-11-14 06:14:50 I have developed a function that you can embed in your PHP applications that will help you extract email addresses from a given piece of text.
I have tested this on a string of (actually 4 - 5 paragraphs) text and this has performed very well.
Please feel free to use this code in your applications and let me know if you face any issues.
(more…)
Read more:Address
, Email
PHP5 Tutorial - Function - Method Type Hinting in PHP5 2007-11-13 13:11:36 PHP5 Introduces Method Type Hinting. Type Hinting allows a function to force parameters to be objects of a particular class by specifying the name of the class in the function prototype.
Type Hinting is optional in all cases except catch block.
(more…)
Read more:Tutorial
PHP5 Tutorial OOPS - PHP5 Class Access Specifiers - public, private and protected 2007-11-13 13:02:44 In the earlier tutorials we have witnessed keywords like public, private and protected
. These are nothing but access specifiers. So, lets understand what access specifiers are.
Definition of Access
Specifiers
Access specifiers specify the level of access that the outside world (i.e. other class objects, external functions and global level code) have on the class methods and class data members. Access specifiers can either be public, private or protected.
(more…)
Read more:Tutorial