Friday, October 17, 2008

What is PHP???? [Review]

PHP is a computer scripting language. Originally designed for producing dynamic web pages, it has evolved to include a command line interface capability and can be used in standalone graphical applications.

While PHP was originally created by Rasmus Lerdorf in 1995, the main implementation of PHP is now produced by The PHP Group and serves as the de facto standard for PHP as there is no formal specification. Released under the PHP License, the Free Software Foundation considers it to be free software.

PHP is a widely-used general-purpose scripting language that is especially suited for web development and can be embedded into HTML. It generally runs on a web server, taking PHP code as its input and creating web pages as output. It can be deployed on most web servers and on almost every operating system and platform free of charge. PHP is installed on more than 20 million websites and 1 million web servers. The most recent major release of PHP was version 5.2.6 on May 1, 2008

PHP originally stood for Personal Home Page. It began in 1994 as a set of Common Gateway Interface binaries written in the C programming language by the Danish/Greenlandic programmer Rasmus Lerdorf. Lerdorf initially created these Personal Home Page Tools to replace a small set of Perl scripts he had been using to maintain his personal homepage. The tools were used to perform tasks such as displaying his résumé and recording how much traffic his page was receiving. He combined these binaries with his Form Interpreter to create PHP/FI, which had more functionality. PHP/FI included a larger implementation for the C programming language and could communicate with databases, enabling the building of simple, dynamic web applications. Lerdorf released PHP publicly on June 8, 1995 to accelerate bug location and improve the code. This release was named PHP version 2 and already had the basic functionality that PHP has today. This included Perl-like variables, form handling, and the ability to embed HTML. The syntax was similar to Perl but was more limited, simpler, and less consistent.

Zeev Suraski and Andi Gutmans, two Israeli developers at the Technion IIT, rewrote the parser in 1997 and formed the base of PHP 3, changing the language's name to the recursive initialism PHP: Hypertext Preprocessor. The development team officially released PHP/FI 2 in November 1997 after months of beta testing. Afterwards, public testing of PHP 3 began, and the official launch came in June 1998. Suraski and Gutmans then started a new rewrite of PHP's core, producing the Zend Engine in 1999. They also founded Zend Technologies in Ramat Gan, Israel.

On May 22, 2000, PHP 4, powered by the Zend Engine 1.0, was released. On July 13, 2004, PHP 5 was released, powered by the new Zend Engine II.PHP 5 included new features such as improved support for object-oriented programming, the PHP Data Objects extension (which defines a lightweight and consistent interface for accessing databases), and numerous performance enhancements. The most recent update released by The PHP Group is for the older PHP version 4 code branch. As of August, 2008 this branch is up to version 4.4.9. PHP 4 is no longer under development nor will any security updates be released.

In 2008, PHP 5 became the only stable version under development. Late static binding has been missing from PHP and will be added in version 5.3. PHP 6 is under development alongside PHP 5. Major changes include the removal of register_globals, magic quotes, and safe mode.

PHP does not have complete native support for Unicode or multibyte strings; unicode support will be included in PHP 6. Many high profile open source projects ceased to support PHP 4 in new code as of February 5, 2008, due to the GoPHP5 initiative, provided by a consortium of PHP developers promoting the transition from PHP 4 to PHP 5.

It runs in both 32-bit and 64-bit environments, but on Windows the only official distribution is 32-bit, requiring Windows 32-bit compatibility mode to be enabled while using IIS in a 64-bit Windows environment. There is a third-party distribution available for 64-bit Windows.

Usage

PHP is a general-purpose scripting language that is especially suited for web development. PHP generally runs on a web server, taking PHP code as its input and creating web pages as output. It can also be used for command-line scripting and client-side GUI applications. PHP can be deployed on most web servers, many operating systems and platforms, and can be used with many relational database management systems. It is available free of charge, and the PHP Group provides the complete source code for users to build, customize and extend for their own use.

PHP primarily acts as a filter, taking input from a file or stream containing text and/or PHP instructions and outputs another stream of data; most commonly the output will be HTML. It can automatically detect the language of the user. From PHP 4, the PHP parser compiles input to produce bytecode for processing by the Zend Engine, giving improved performance over its interpreter predecessor.

Originally designed to create dynamic web pages, PHP's principal focus is server-side scripting, and it is similar to other server-side scripting languages that provide dynamic content from a web server to a client, such as Microsoft's ASP.NET system, Sun Microsystems' JavaServer Pages, and mod_perl. PHP has also attracted the development of many frameworks that provide building blocks and a design structure to promote rapid application development (RAD). Some of these include CakePHP, PRADO, Symfony and Zend Framework, offering features similar to other web application frameworks.

The LAMP architecture has become popular in the web industry as a way of deploying web applications. PHP is commonly used as the P in this bundle alongside Linux, Apache and MySQL, although the P may also refer to Python or Perl.

Security

The proportion of insecure software written in PHP, out of the total of all common software vulnerabilities, amounted to: 12% in 2003, 20% in 2004, 28% in 2005, 43% in 2006, 36% in 2007, and 33.8% for the first quarter of 2008. More than a third of these PHP software vulnerabilities are listed recently.Most of these software vulnerabilities can be exploited remotely, that is without being logged on the computer hosting the vulnerable application. The most common vulnerabilities are caused by not following best practice programming rules and vulnerabilities related to software written in old PHP versions. One very common security concern is register_globals which was disabled by default since 2002 in PHP 4.2.

There are advanced protection patches such as Suhosin and Hardening-Patch, especially designed for web hosting environments.Installing PHP as a CGI binary rather than as an Apache module is the preferred method for added security.

Data types

PHP stores whole numbers in a platform-dependent range. This range is typically that of 32-bit signed integers. Unsigned integers are converted to signed values in certain situations; this behavior is different from other programming languages. Integer variables can be assigned using decimal (positive and negative), octal, and hexadecimal notations. Real numbers are also stored in a platform-specific range. They can be specified using floating point notation, or two forms of scientific notation. PHP has a native Boolean type that is similar to the native Boolean types in Java and C++. Using the Boolean type conversion rules, non-zero values are interpreted as true and zero as false, as in Perl and C++. The null data type represents a variable that has no value. The only value in the null data type is NULL. Variables of the "resource" type represent references to resources from external sources. These are typically created by functions from a particular extension, and can only be processed by functions from the same extension; examples include file, image, and database resources.Arrays can contain elements of any type that PHP can handle, including resources, objects, and even other arrays. Order is preserved in lists of values and in hashes with both keys and values, and the two can be intermingled. PHP also supports strings, which can be used with single quotes, double quotes, or heredoc syntax.

The Standard PHP Library (SPL) attempts to solve standard problems and implements efficient data access interfaces and classes.


Functions

PHP has hundreds of base functions and thousands more from extensions. These functions are well documented on the PHP site, but unfortunately, the built-in library has a wide variety of naming conventions and inconsistencies. PHP currently has no functions for thread programming.

JAVA Coding for Create a Non-Blocking Socket

public class test
{
public static void main(String args[])
{
// Create a non-blocking socket and check for connections
try {
// Create a non-blocking socket channel on port 8080
SocketChannel sChannel = createSocketChannel("www.xxx", 8080);
// Before the socket is usable, the connection must be completed
// by calling finishConnect(), which is non-blocking
while (!sChannel.finishConnect()) {
// Do something else
System.out.println("wonderful");
}
// Socket channel is now ready to use
}
catch (IOException e) {
}
}
// Creates a non-blocking socket channel for the specified host name and port.
// connect() is called on the new channel before it is returned.
public static SocketChannel createSocketChannel(String hostName, int port) throws IOException
{
// Create a non-blocking socket channel
SocketChannel sChannel = SocketChannel.open();
sChannel.configureBlocking(false);
// Send a connection request to the server; this method is non-blocking
sChannel.connect(new InetSocketAddress(hostName, port));
return sChannel;
}
}

What are the different scopes for Java variables?

The scope of a Java variable is determined by the context in which the variable is declared. Thus a java variable can have one of the three scopes at any given point in time.
1. Instance : - These are typical object level variables, they are initialized to default values at the time of creation of object, and remain accessible as long as the object accessible.
2. Local : - These are the variables that are defined within a method. They remain accessbile only during the course of method excecution. When the method finishes execution, these variables fall out of scope.
3. Static: - These are the class level variables. They are initialized when the class is loaded in JVM for the first time and remain there as long as the class remains loaded. They are not tied to any particular object instance.

The the significance of public, private, protected, default modifiers both singly and in combination and state the effect of package relationships on

public : Public class is visible in other packages, field is visible everywhere (class must be public too)
private : Private variables or methods may be used only by an instance of the same class that declares the variable or method, A private feature may only be accessed by the class that owns the feature.
protected : Is available to all classes in the same package and also available to all subclasses of the class that owns the protected feature.This access is provided even to subclasses that reside in a different package from the class that owns the protected feature.
default :What you get by default ie, without any access modifier (ie, public private or protected).It means that it is visible to all within a particular package.

What is static in java?

Static means one per class, not one for each object no matter how many instance of a class might exist. This means that you can use them without creating an instance of a class.Static methods are implicitly final, because overriding is done based on the type of the object, and static methods are attached to a class, not an object. A static method in a superclass can be shadowed by another static method in a subclass, as long as the original method was not declared final. However, you can't override a static method with a nonstatic method. In other words, you can't change a static method into an instance method in a subclass.

What is the difference between an Interface and an Abstract class?

An abstract class can have instance methods that implement a default behavior. An Interface can only declare constants and instance methods, but cannot implement default behavior and all methods are implicitly abstract. An interface has all public members and no implementation. An abstract class is a class which may have the usual flavors of class members (private, protected, etc.), but has some abstract methods.

Free softwears can be downloaded....

  • www.download.com


  • www.freewarefiles.com

  • www.download3000.com

  • www.freedownloadscenter.com

  • www.brothersoft.com

  • www.downloads.zdnet.com

  • www.filehippo.com

  • www.download3k.com

Saturday, October 11, 2008

The Code to get IP address of the Current Machine?

public void UseDNS()
{
  string hostName = Dns.GetHostName();
  Console.WriteLine("Host Name = " + hostName);
  IPHostEntry local = Dns.GetHostByName(hostName);  
  foreach(IPAddress ipaddress in local.AddressList)
  {
  Console.WriteLine("IPAddress = " + ipaddress.ToString()); 
  }
}

dot NET? What's dat?

Simply put .NET is a new and innovative architecture that has a wide variety of uses. It makes mobile devices, connectivity and information a lot more accessible and easy to handle. 

It's a programming infrastructure for the net and a whole new user experience.

.NET is aimed at making your data simultaneously available on your PC and on all your wireless devices like PDAs and cell phones. It promises to bring together the functionality of various software applications like Word and Excel through the magic of XML. It introduced new concepts and new terminologies.

Web Services, another part of the .NET architecture, allows software to be put on the web and immediately become accessible to other software that need similar services. Word and Excel for example, would become Web services, and everyone connected to Web Service can use them. It comes with the promise of allowing functionality of different applications from within each other (like using a spreadsheet within Word) without opening up a new application.


A few glimpses of what .NET can do is gleaned through products that are coming soon from Microsoft:
The Samsung Smart Phone promises to turn your phone into something like a PDA, letting you access your data (contact information, e-mail, etc.) even when the phone is switched off.


The Tablet PC is a computer that looks like a flat-screened magazine for reading e-books. It allows you to annotate pages in your own handwriting, and search through your handwritten notes.



Statements of intent aside, it's hard to explain what .NET is all about if you do not have a qualified background. Let me try to describe .NET to non-technical people. 

Inside all computers, there is a constant cycle of program modules asking other modules questions, and getting back answers. Mouse clicks, keyboard key-clicks, or any other ways of input to the computer launch thousands of these software conversations. Similar to any other conversation, the conversationalists must agree on a common language. If one knows German, and the other doesn't, there can be no conversation. In IT, these modules are called Procedures. When one Procedure asks another Procedure something, it is said to "call" it. 

When computers are put on a network, all that is happening is one Procedure asking a Procedure sitting on another machine. These are called Remote Procedure Calls, or RPCs. Until .NET came out, it mattered very much which language software was written in, or on what Operating System it was meant to run under. Windows, Macintosh, Unix, all talked different languages. So like the German in Australia, they could connect at some level (for example the web) but to have a more sophisticated conversation, there had to be a better agreement between them. 

Until .NET came along, conversation between technologists was more like a playground conversation. Sun said, "You have to use Java". Microsoft said "Use DCOM". Everyone else sat back waiting for something interesting to happen. SOAP was one common language agreed on by many technologists. Everybody at the playground started saying, "Lets work together. Lets agree that this is the way Procedure Calls are made over the Internet. Let's standardize."

Whatever Microsoft says to the contrary, not much progress has been made by .NET. In many respects, it is still a case of playground conversation. All that Microsoft is now saying is:

"We now have a common language. We want to talk this language. Would you all like to talk with us?". 

This is not much different from earlier assertions like "You have to use Java", et al. But let us not haggle. Let us see what they want to talk about. They say that information can be stored in a single place, and made accessible through, for example, Microsoft Passport. The question is, do we want to give out our personal information to Microsoft? Can we agree with Microsoft on how they do this? Can we operate a Microsoft Passport compatible server? 

There are many other things that they want to talk about. Please check out the Microsoft website for more information. To make a long story short, .NET is yet another attempt at a common language.

Back to top

 

Here is what Microsoft's press release had to say about Windows.NET:
 

"Windows.NET is the next generation of Windows. Windows.NET will be a product that supports productivity, creativity, management, entertainment, and much more. It's designed to put users in control of their digital lives. It incorporates new .NET user experience technologies, is tightly integrated with .NET building block services -- including identity and search -- and provides integrated support for digital media. 

Windows.NET will be self-supporting, featuring services that provide ongoing support and updates as users need them. Windows.NET will provide a rich foundation for developers who want to create new .NET applications and services. It will offer a programmable user experience that can be customized by corporations and individuals and programmed by .NET services, including MSN.NET, bCentral for .NET and Office.NET, as well as a host of third-party .NET services. 

The first release of Windows to incorporate .NET elements is scheduled to be available in 2001. Microsoft will also continue to offer support for versions of the Windows platform without .NET services." 

This sounds good. 

Another part of the .NET architecture is the .NET Framework which combines the power and strength of all the accumulated experience of Microsoft in programming languages. It therefore has the power of many programming languages rolled into one. 

It is not just a programming language, it is more than that. It does not have a fixed language that you need to code for it. You can code in C, C++, Java, COBOL, VB, or any language of your choice. .NET Framework is the base that allows all those languages to be compiled to what is known as IL-Code (Intermediate-Language code). 

IL is a new terminology that simply describes an application or service in a structured language, similar to assembly. This then goes through an interpreter which, in turn, compiles and executes it on the fly. The concept is very similar to Java's Class Files. IL code allows wide portability across platforms that support Common Language Runtime (CLR). CLR is basically the .NET Framework itself, which include base classes and other components needed to create applications of such sorts. 

Another feature implemented into the CLR is the garbage collector. It's a very useful feature that releases heaps of unused memory allocated to processes that have run out their lifecycles. It automatically collects and frees memory used by obsolete threads, processes and database connections. 

The real glitch, then, is with regard to Microsoft itself. The public perceives Microsoft as a sneaky company - with a few things they've done like including adding tracking code to Word DOC files. .NET definitely shares this negative image. The whole thing is not going to be seen as a 24 x 7 world of online bliss. Instead it's seen as a 24 x 7 version of "Big Brother Watching". People don't like being monitored. Not because they have anything to hide. But because it is plain and simple creepy. Humans don't like staring and being stared at.

All in all, sounds interesting! Happy .NET-ing