Tag Archives: data

Some words about IIS


I had to format my C Drive to freshly install IIS. After that Visual Studio is installed and now its working beautifully.
I did not install SQL Server again as I am using SQL Express that has been shipped with VS.
For other users my suggestion is: locally its better not using SQL Server 2005/2008.
Its wise to use SQL Express Database in APP_Data folder.


Difference between function and method


In PHP I took reference from Beginning PHP 5 and MySql 5 By W Jason Gilmore, Appress book.
A method is quite similar to a function, except that it is intended to define the behavior of a particular class. Like a function, a method can accept arguments as input and can return a value to the caller. Methods are also invoked like functions, except that the method is prefaced with the name of the object invoking the method, like this:

Methods are created in exactly the same fashion as functions, using identical syntax. The only
difference between methods and normal functions is that the method declaration is typically
prefaced with a scope descriptor. The generalized syntax follows:
scope function functionName()
/* Function body goes here */
For example, a public method titled calculateSalary() might look like this:
public function calculateSalary()
return $this->wage * $this->hours;
In this example, the method is directly invoking two class fields, wage and hours, using the $this keyword. It calculates a salary by multiplying the two field values together, and returns the result just like a function might. Note, however, that a method isn’t confined to working solely with class fields; it’s perfectly valid to pass in arguments in the same way you can with a function.
Methods are invoked in almost exactly the same fashion as functions. Continuing with the previous example, the calculateSalary() method might be invoked like so:
$employee = new staff(“Janie”);
PHP supports six method scopes: public, private, protected, abstract, final, and static. The first five scopes are introduced in this section. The sixth, is static.
$salary = $employee->calculateSalary();
Public methods can be accessed from anywhere, at any time. You declare a public method by
prefacing it with the keyword public, or by foregoing any prefacing whatsoever. The following
example demonstrates both declaration practices, in addition to demonstrating how public
methods can be called from outside the class:

class Visitors
public function greetVisitor()
echo "Hello
function sayGoodbye()
echo "Goodbye
$visitor = new Visitors();

Now let’s see what happens in ASP.NET, or to be precise in C# :
I got a good answer from EggHeadCaffe
The major difference between methods and functions is that methods called by the reference variables called objects where as the functions do not having any reference variables.methods are invoked using objects.wheres as in case of functions here is no quesion of objects.we call it directly.
And yet another good answer from StackOverflow
A function is a piece of code that is called by name. It can be passed data to operate on (ie. the parameters) and can optionally return data (the return value).

All data that is passed to a function is explicitly passed.

A method is a piece of code that is called by name that is associated with an object. In most respects it is identical to a function except for two key differences.

It is implicitly passed the object for which it was called
It is able to operate on data that is contained within the class (remembering that an object is an instance of a class – the class is the definition, the object is an instance of that data)
(this is a simplified explanation, ignoring issues of scope etc.)



To start with the data types, in PHP you don’t need to declare the type of data.
You can just write like this : $number = 1; $name = "Your Name"; etc.
But in C# as it is strongly typed data, you have to declare the type of data. Like : for integer you need to write :
int number = 1;
string name = "Your Name";

Now everything has its pros and cons. People from strong PHP background will argue that this is absolutely simple to remember. Moreover You don’t need to convert your data from string to integer when you accept data from an user.