• webnology
  • Experts
  • Marketing
  • Testers
  • My Finance
  • psychometric

Webnology

We teach best what you most need to learn.
  • Home
  • Contact
  • Log in
  • EForum
Oct 27

Drupal content management system software Review

Uncategorized, PHP, HTML, CSS, Introduction, Applications, Blog Application, CMS 3529 feedbacks »

Drupal is content management system software that is much-beloved by a large and thriving developer community. The ever-evolving magnum opus of developer Dries Buytaert, the system, its modules, users and developers value flexibility, simplicity, utility, modularity, extensibility and maintainability in the code. The theory here seems to be that the core files are made light and feature-less – a blank canvas on which to create.

This philosophy obviously isn’t for everyone. The code is clean and light (only a few MB) but that’s because you will need to install/tweak many (20-30) plugins before you have the site of your dreams.

Standout Features

* Modules – thousands of them for utility, content, third-party integration, admin, content, media, e-commerce, and on and on.
* Intense levels of personalization – considered to be the “core of Drupal.”
* Fully indexed and searchable content.
* Role-based permissions – not so different from our other highly ranked systems, but vital nonetheless.

Built-in Applications:

Main criticisms of Drupal include that the countless modules are also its biggest drawback: a site in this system is nothing without many installed modules and conversely maintenance on 20+ modules is a nightmare. Also, this system is not object-oriented, which a lot of potential users find off-putting.

Some say Drupal is the best they’ve ever used – some say it is the worst. This just seems to be more proof that a content management system software is only as good as its user – meaning know what you need before choosing any CMS.

Back to Drupal, as stated before, this system is lacking in built-in features yet can’t really be compared to any other system nor directly penalized in our ratings for same. The Drupal stalwarts all contend that handling large amounts of modules and working around the bugs is completely do-able and worth the time.

User forums also reveal this system is weak when dealing with image modules – there are three that overlap but no one does it all on its own. So beware to photo-heavy sites.

Management:

This CMS does offer a lot in the way of built-in management – almost everything on our list. Analysis, tracking and statistics are built-in and you will definitely need these if you are running an online business of any kind. Having a site is almost pointless if you don’t pay attention to how it’s performing traffic-wise and make adjustments based on that research.

The web-based administration is a great plus here – you can administer your Drupal site from a web browser anywhere in the world and doesn’t require any additional software or installation for such.

Performance:

Caching is a must with this system since you will be running plenty of modules in addition to your core files, especially if your site has a lot of visitors as well. You can configure this option from the Administrator>Site Configuration>Performance path. This reduces queries to the server and will help a busy site stay up and running fast for its users.

The system also performs load balancing between multiple servers as another way to keep the site running smoothly and quickly. This is a built-in feature.

Commerce:

All commerce options in Drupal are available as plugins. This system doesn’t have a point-of-sale function.

Ease of Use:

Server page language and friendly URLs are the only built-ins here. Everything else on our list (with the exception of UI levels) can be added on for free.

Support:

Drupal content management system software offers the full complement of support, with smoke tests available – you guessed it – as a plugin. The forums and documentation aren’t perfect, but they are active and if you do have a nailbiter of a problem, you should be able to find someone or something to help you out.

Summary:

Drupal is an amazing assemblage of Open Source development, working from scratch and creating something totally unique. It’s most certainly made for developers, though. It's not content management system software for the faint-of-heart.

If you are planning a community site or a high traffic site, Drupal might not be the best choice. For less developer-heavy features, try another of our highly ranked products such as Wordpress.org or Joomla!

Reference Site : http://cms-software-review.toptenreviews.com/drupal-review-pg2.html

Oct 27

eZ Publish Open Source Enterprise CMS

PHP, HTML, Applications, CMS 4331 feedbacks »

eZ Publish is one of the world’s leading Open Source Enterprise CMS and development architecture. Some users might consider this complex framework to be complicated, but generally agree that eZ Publish has one feature that stands above the rest: the ability to create different content classes in the administration interface. If you want to create your own custom site on a solid framework, this CMS could be for you.

Standout Features

* Web publishing
* Intranets
* E-commerce capability
* Commercial support and documentation
* Wiki capability

Built-in Applications:

With eZ Publish content management system, if it’s not included, it’s a free add-on when it comes to built-in applications. Extensions, as they are called in this system, are many and easily downloadable from the developer’s site.

This system lets you easily publish content such as files, photos and articles using the Website Toolbar – directly from your web browser. When you log in you will see the toolbar which will give you the option to publish, move, replace or even translate your content.

There is no HTML coding required when adding content – the rich text editor is WYSIWYG and offers the formatting functions you would see in a word processing app. You can also publish your content right from your word processing program using OpenOffice. This makes it possible for you to create content independent of internet access then upload the document using a client or the front-end of your site.

We can see why this style of interface might seem foreign to users of Drupal, Joomla! or the like – it looks different and doesn’t behave like a typical “dashboard”. But if what you want in a CMS is flexibility and expandability, eZ Publish really does offer it all as far as the many elements we’ve reviewed here.

Management:

All the management elements in our side-by-side comparison are covered by eZ Publish – from advertising management to the workflow engine.

One of the things we loved most from this category was the upload capabilities – you can batch upload and also the system detects the type of content and creates web pages accordingly. You can upload many photos at once and store them in a gallery – the system automatically scales, formats and resizes photos according to their content type and destination. This is a huge time-saving feature.

The administration interface is comprehensive, offering content management and editing, site management, configuration, customization and development.

The workflow engine is a really amazing mechanism. It has a built-in collaboration system that allows an administrator to pre-define a sequence of actions to be performed in a specific order after an object is published.

The content model is also very unique – the content engine lets administrators create content definitions on graphical interfaces.
Content cross publishing and versioning and modification tracking are a couple of the other super-powerful and versatile elements that are sure to be useful to large companies with diverse offerings.

Commerce:

If you’re in search of a content management system with e-commerce capability, this one offers plenty of options to make that possible. Shopping cart and wish list functions are built-in. Also built-in is the option to plugin your preferred payment service, shipping calculator and tax calculator. These are all available as extensions to your eZ Publish installation.

Ease of Use:

This CMS takes a while to learn and become familiar with, but after spending a week or so, we felt it was indeed eZ to publish and use. The rich text editor is WYSIWYG, which means you don’t need to know any code to create text content.

The access system is multi-level and role-based. The admin can give a user or an entire group (writers, designers, video production, etc.) of users access to just the specific functions they need to do their jobs.

Support:

eZ Publish content management system software offers the full complement of support, online and off. If you can’t figure out the system on your own, try the online documentation and forums. The developers also offer commercial manuals, support and training if you’re from a large company looking to implement this system company-wide.

Smoke tests are fairly standard with this level of code and we agree that it’s essential to not breaking your site – it’s a secure area within the CMS where you can test new code, plugins, updates, etc, and check to make sure it’ not going to break anything on implementation.

The built-in prototyping allows for default settings to be made for various content types – then when you need to reuse the certain type of content, the settings have already been created.

Images are automatically resized when you upload them into the system and the system also creates friendly (short, comprehensible) URLs which helps with search engine optimization as well as being easy to find and read by humans.

Summary:

If you are looking for a quick fix to a content problem and you are not so knowledgeable about web development (PHP, server configurations, etc.) you should avoid eZ Publish content management system software and go for something lighter such as WordPress.org or Movable Type, both of which are considered a little more “plug-n-play”.

If you have a large company with a professional Web developer, eZ Publish CMS could be the best decision you ever make! It’s difficult to judge these amazing systems by just looking at a collection of check marks, but it can give you a great idea of the standard features available and a starting point from which to consider your own specific needs.

Oct 26

PHP Basics for Beginners

Uncategorized 3627 feedbacks »

This article aims to serve for beginner PHP developers but those who are comfortable with PHP will also find this article useful. Basically, I’ll tell you the difference between some of PHP commonly used functions/features. By the end of this article you will have a clear difference among:

* include VS require
* include_once VS include
* require_once VS require
* echo VS print
* Single quote VS Double quote

Apparently all functions in each above point work in similar fashion. However, they are slightly different from other. Continue reading to explore the differences.

include VS require

Both are frequently used to include other files into our PHP code. Following are the differences between ‘include’ and ‘require’:

* ‘include’ throws a warning, if your specified file is not found. Rest of the code will be rendered.
* ‘require’ throws a fatal error, if your specified file is not found. Rest of the code will not be rendered.

include_once VS include AND require_once VS require

‘include_once’ and ‘require_once’ are same in nature. Here we will see the difference of ‘include_once’ against ‘include’. Following are the differences between ‘include’ and ‘include_once’:

* All includes for same file will be rendered, if you are using ‘include’.
* While all includes for same file will be rendered only once, if you are using ‘include_once’. This helps you to prevent an error, if same file included again.

Single quote VS Double quote

This might be very confusing for many developers to choose between single and double quote for writing string. There is a couple of difference between using single and double quote:

* Any variable or special character like \n \r etc under the single quote will not be rendered. It will be displayed as an string.
* Any variable or special character like \n \r etc under the double quote will be rendered properly.

Oct 11

Turn Text into an Image using the PHP GD Library

PHP, Interview Help 3331 feedbacks »

While developing a site for a client, I needed to figure out a way to convert certain text elements into images. I had no clue how to do this but after doing a bit of research, I discovered a nifty library of functions already available through PHP. The GD library offers tons of cools way to dynamically create PNG, JPEG or GIF files and output them directly to your browser, but you need to make sure that your server has the library enabled.

You can check to see if the GD library available on your server by placing the code:

into a test.php file and uploading it to your site’s main directory. Open the file online and look to see if GD Support is Enabled. If it is, you are good to go.

The following code will dynamically create a PNG file from a text string.

header("Content-type: image/png");

$string = "This is my test string.";

$font = 2;
$width = imagefontwidth($font) * strlen($string);
$height = imagefontheight($font);

$image = imagecreatetruecolor ($width,$height);
$white = imagecolorallocate ($image,255,255,255);
$black = imagecolorallocate ($image,0,0,0);
imagefill($image,0,0,$white);

imagestring ($image,$font,0,0,$string,$black);

imagepng ($image);
imagedestroy($image);
?>

The above code must be included in its own file, it cannot be added to an existing PHP file with other functions. To access this image from another file just include it as the source in an image tag.

Test out turning text into an image by typing in something below.

Reference Site Name : http://bavotasan.com

Thanks And Regards
Shardul Kulkarni

Oct 06

Five more PHP design patterns

Uncategorized 4477 feedbacks »

Requirements

To get the most out of this article and use the examples, install the following on your computer:

* PHP V5 or later (this article was written with PHP V5.2.4)
* An extraction program, such as WinZIP (to extract the downloadable code archive)

The adapter pattern

Use the adapter pattern when you need to convert an object of one type to an object of another type. Typically, developers handle this process through a bunch of assignment code, as shown in Listing 1. The adapter pattern is a nice way to clean this type of code up and reuse all your assignment code in other places. Also, it hides the assignment code, which can simplify things quite a bit if you're also doing some formatting along the way.

================================================================
class AddressDisplay
{
private $addressType;
private $addressText;

public function setAddressType($addressType)
{
$this->addressType = $addressType;
}

public function getAddressType()
{
return $this->addressType;
}

public function setAddressText($addressText)
{
$this->addressText = $addressText;
}

public function getAddressText()
{
return $this->addressText;
}
}

class EmailAddress
{
private $emailAddress;

public function getEmailAddress()
{
return $this->emailAddress;
}

public function setEmailAddress($address)
{
$this->emailAddress = $address;
}
}

$emailAddress = new EmailAddress();
/* Populate the EmailAddress object */
$address = new AddressDisplay();
/* Here's the assignment code, where I'm assigning values
from one object to another... */
$address->setAddressType("email");
$address->setAddressText($emailAddress->getEmailAddress());

================================================================

This example uses an AddressDisplay object to display an address to a user. The AddressDisplay object has two parts: the type of address and a formatted address string.

After implementing the pattern (see Listing 2), the PHP script no longer needs to worry about exactly how the EmailAddress object is turned into the AddressDisplay object. That's a good thing, especially if the AddressDisplay object changes or the rules that govern how an EmailAddress object is turned into an AddressDisplay object change. Remember, one of the main benefits of designing your code in a modular fashion is to take advantage of having to change as little code as possible if something in the business domain changes or you need to add a new feature to the software. Think about this even when you're doing mundane tasks, such as assigning values from properties of one object to another.

=================================================================
Listing 2. Using the adapter pattern


class EmailAddressDisplayAdapter extends AddressDisplay
{
public function __construct($emailAddr)
{
$this->setAddressType("email");
$this->setAddressText($emailAddr->getEmailAddress());
}
}

$email = new EmailAddress();
$email->setEmailAddress("user@example.com");

$address = new EmailAddressDisplayAdapter($email);

echo($address->getAddressType() . "\n") ;
echo($address->getAddressText());

=================================================================

Alternate method

An alternate method of writing an adapter — and one that some prefer — is to implement an interface to adapt behavior, rather than extending an object. This is a very clean way of creating an adapter and doesn't have the drawbacks of extending the object. One of the disadvantages of using the interface is that you need to add the implementation into the adapter class

The iterator pattern

The iterator pattern provides a way to encapsulate looping through a collection or array of objects. It is particularly handy if you want to loop through different types of objects in the collection.

Look back at the e-mail and physical address example in Listing 1. Before adding an iterator pattern, if you're looping through the person's addresses, you might loop through the physical addresses and display them, then loop through the person's e-mail addresses and display them, then loop through the person's IM addresses and display those. That's some messy looping!

Instead, by implementing an iterator, all you have to do is call while($itr->hasNext()) and deal with the next item $itr->next() returns. An example of one of the iterators is shown in Listing 3. An iterator is powerful because you can add new types of items through which to iterate, and you don't have to change the code that loops through the items. In the Person example, for instance, you could add an array of IM addresses; simply by updating the iterator, you don't have to change any code that loops through the addresses for display.

================================================================
Listing 3. Using the iterator pattern to loop through objects


class PersonAddressIterator implements AddressIterator
{
private $emailAddresses;
private $physicalAddresses;
private $position;

public function __construct($emailAddresses)
{
$this->emailAddresses = $emailAddresses;
$this->position = 0;
}

public function hasNext()
{
if ($this->position >= count($this->emailAddresses) ||
$this->emailAddresses[$this->position] == null) {
return false;
} else {
return true;
}
}

public function next()
{
$item = $this->emailAddresses[$this->position];
$this->position = $this->position + 1;
return $item;
}

}

================================================================

If the Person object is modified to return an implementation of the AddressIterator interface, the application code that uses the iterator doesn't need to be modified if the implementation is extended to loop through additional objects. You can use a compound iterator that wraps the iterators that loop through each type of address like the one listed in Listing 3. An example of this is available (see Download).

The decorator pattern

Consider the code sample in Listing 4. The purpose of this code is to add a bunch of features onto a car for a Build Your Own Car site. Each car model has more features and an associated cost. With only two models, it would be fairly trivial to add these features with if then statements. However, if a new model came along, you'd have to go back through the code and make sure the statements worked for the new model.

=================================================================
Listing 4. Using the decorator pattern to add features


require('classes.php');

$auto = new Automobile();

$model = new BaseAutomobileModel();

$model = new SportAutomobileModel($model);

$model = new TouringAutomobileModel($model);

$auto->setModel($model);

$auto->printDescription();

=================================================================

Enter the decorator pattern, which allows you to add this functionality onto the AutomobileModel in a nice, clean class. Each class remains concerned only about its price and options and how they're added to the base model.

An advantage of the decorator pattern is that you can easily tack on more than one decorator to the base at a time.

If you've done much work with stream objects, you have used a decorator. Most stream constructs, such as an output stream, are decorators that take a base input stream, then decorate it by adding additional functionality — like one that inputs streams from files, one that inputs streams from buffers, etc.

The delegate pattern

The delegate pattern provides a way of delegating behavior based on different criteria. Consider the code in Listing 5. This code contains several conditions. Based on the condition, the code selects the appropriate type of object to handle the request.

=================================================================
Listing 5. Using conditional statements to route shipping requests


pkg = new Package("Heavy Package");
$pkg->setWeight(100);

if ($pkg->getWeight() > 99)
{
echo( "Shipping " . $pkg->getDescription() . " by rail.");
} else {
echo("Shipping " . $pkg->getDescription() . " by truck");
}

=================================================================

With a delegate pattern, an object internalizes this routing process by setting an internal reference to the appropriate object when a method is called, like useRail() in Listing 6. This is especially handy if the criteria change for handling various packages or if a new type of shipping becomes available.

=================================================================
Listing 6. Using the delegate pattern to route shipping requests


require_once('classes.php');

$pkg = new Package("Heavy Package");
$pkg->setWeight(100);

$shipper = new ShippingDelegate();

if ($pkg->getWeight() > 99)
{
$shipper->useRail();
}

$shipper->deliver($pkg);

=================================================================

The delegate provides the advantage that behavior can change dynamically by calling the useRail() or useTruck() method to switch which class handles the work.

The state pattern

The state pattern is a similar to the command pattern, but the intent is quite different. Consider the code below.

==================================================================
Listing 7. Using code to build a robot


class Robot
{

private $state;

public function powerUp()
{
if (strcmp($state, "poweredUp") == 0)
{
echo("Already powered up...\n");
/* Implementation... */
} else if ( strcmp($state, "powereddown") == 0) {
echo("Powering up now...\n");
/* Implementation... */
}
}

public function powerDown()
{
if (strcmp($state, "poweredUp") == 0)
{
echo("Powering down now...\n");
/* Implementation... */
} else if ( strcmp($state, "powereddown") == 0) {
echo("Already powered down...\n");
/* Implementation... */
}
}

/* etc... */

}
==================================================================

In this listing, the PHP code represents the operating system for a powerful robot that turns into a car. The robot can power up, power down, turn into a robot when it's a vehicle, and turn into a vehicle when it's a robot. The code is OK now, but you see that it can become complex if any of the rules change or if another state comes into the picture.

Now look at Listing 8, which has the same logic for handling the robot's states, but this time puts the logic into the state pattern. The code in Listing 8 does the same thing as the original code, but the logic for handling states has been put into one object for each state. To illustrate the advantages of using the design pattern, imagine that after a while, these robots have discovered that they shouldn't power down while being in robot mode. In fact, if they power down, they must change to vehicle mode first. If they're already in vehicle mode, the robot just powers down. With the state pattern, the changes are pretty trivial.

==================================================================
Listing 8. Using the state pattern to handle the robot's state


$robot = new Robot();
echo("\n");
$robot->powerUp();
echo("\n");
$robot->turnIntoRobot();
echo("\n");
$robot->turnIntoRobot(); /* This one will just give me a message */
echo("\n");
$robot->turnIntoVehicle();
echo("\n");

==================================================================

==================================================================
Listing 9. Small changes to one of the state objects


class NormalRobotState implements RobotState
{
private $robot;

public function __construct($robot)
{
$this->robot = $robot;
}

public function powerUp()
{
/* implementation... */
}
public function powerDown()
{
/* First, turn into a vehicle */
$this->robot->setState(new VehicleRobotState($this->robot));
$this->robot->powerDown();
}

public function turnIntoVehicle()
{
/* implementation... */
}

public function turnIntoRobot()
{
/* implementation... */
}
}

==================================================================

Something that doesn't appear obvious when looking at Figure 6 is that each object in the state pattern has a reference to the context object (the robot), so each object can advance the state onto the appropriate one.

Summary

Using design patterns in your PHP code is one way to make your code more readable and maintainable. By using established patterns, you benefit from common design constructs that allow other developers on a team to understand your code's purpose. It also allows you to benefit from the work done by other designers, so you don't have to learn the hard lessons of design ideas that don't work out.

I have got this nice article from here :
http://www.stumbleupon.com/su/1n5Erx/www.ibm.com/developerworks/library/os-php-designpatterns/index.html%253Fca%253Ddrs-
Thanks And Regards
Shardul Kulkarni

Oct 04

Web traffic

Uncategorized 2215 feedbacks »

Web traffic is the amount of data sent and received by visitors to a web site. It is a large portion of Internet traffic. This is determined by the number of visitors and the number of pages they visit. Sites monitor the incoming and outgoing traffic to see which parts or pages of their site are popular and if there are any apparent trends, such as one specific page being viewed mostly by people in a particular country. There are many ways to monitor this traffic and the gathered data is used to help structure sites, highlight security problems or indicate a potential lack of bandwidth — not all web traffic is welcome.

Some companies offer advertising schemes that, in return for increased web traffic (visitors), pay for screen space on the site. Sites also often aim to increase their web traffic through inclusion on search engines and through Search engine optimization.


Analyzing Web Traffics

Web analytics is the measurement of the behavior of visitors to a website. In a commercial context, it especially refers to the measurement of which aspects of the website work towards the business objectives of Internet marketing initiatives; for example, which landing pages encourage people to make a purchase. Notable vendors of web analytics software and services include: Webtrends, Coremetrics, Omniture, and Google Analytics.

Web traffic is measured to see the popularity of web sites and individual pages or sections within a site.
Web traffic can be analyzed by viewing the traffic statistics found in the web server log file, an automatically-generated list of all the pages served. A hit is generated when any file is served. The page itself is considered a file, but images are also files, thus a page with 5 images could generate 6 hits (the 5 images and the page itself). A page view is generated when a visitor requests any page within the web site – a visitor will always generate at least one page view (the main page) but could generate many more.

Tracking applications external to the web site can record traffic by inserting a small piece of HTML code in every page of the web site.

Web traffic is also sometimes measured by packet sniffing and thus gaining random samples of traffic data from which to extrapolate information about web traffic as a whole across total Internet usage.

The following types of information are often collated when monitoring web traffic:

* The number of visitors.
* The average number of page views per visitor – a high number would indicate that the average visitors go deep inside the site, possibly because they like it or find it useful.
* Average visit duration – the total length of a user's visit. As a rule the more time they spend the more they're interested in your company and are more prone to contact.
* Average page duration – how lo

1. REDIRECT Target page name
2. Numbered list item

* Domain classes – all levels of the IP Addressing information required to deliver Webpages and content.
* Busy times – the most popular viewing time of the site would show when would be the best time to do promotional campaigns and when would be the most ideal to perform maintenance
* Most requested pages – the most popular pages
* Most requested entry pages – the entry page is the first page viewed by a visitor and shows which are the pages most attracting visitors
* Most requested exit pages – the most requested exit pages could help find bad pages, broken links or the exit pages may have a popular external link
* Top paths – a path is the sequence of pages viewed by visitors from entry to exit, with the top paths identifying the way most customers go through the site
* Referrers; The host can track the (apparent) source of the links and determine which sites are generating the most traffic for a particular page.

Web sites like Alexa Internet produce traffic rankings and statistics based on those people who access the sites while using the Alexa toolbar. The difficulty with this is that it's not looking at the complete traffic picture for a site. Large sites usually hire the services of companies like Nielsen NetRatings, but their reports are available only by subscription.

Google Analytics is the enterprise-class web analytics solution that gives you rich insights into your website traffic and marketing effectiveness. Powerful, flexible and easy-to-use features now let you see and analyze your traffic data in an entirely new way. With Google Analytics, you're more prepared to write better-targeted ads, strengthen your marketing initiatives and create higher converting websites.

Join Following Amizing Programs for getting good hosting plans:

HOSTSTEPS's product:
Click Here!

RADSYSLTD's product
Click Here!

AAMIRSHAHJ's product
Click Here!

TAKIS76's product.
Click Here!

MEGACLERK's product
Membership provides Unlimited space and bandwidth. Fresh Content Generator retrieves all the latest from articles, blogs, forums, podcasts, videos, and hot press releases. Create websites, web pages and ad campaigns with just a click... Recurring Income!

Click Here!

Apr 07

HipHop for PHP: Move Fast

PHP, MySQL, HTML, CSS, Applications 2134 feedbacks »

One of the key values at Facebook is to move fast. For the past six years, we have been able to accomplish a lot thanks to rapid pace of development that PHP offers. As a programming language, PHP is simple. Simple to learn, simple to write, simple to read, and simple to debug. We are able to get new engineers ramped up at Facebook a lot faster with PHP than with other languages, which allows us to innovate faster.

Today I'm excited to share the project a small team of amazing people and I have been working on for the past two years; HipHop for PHP. With HipHop we've reduced the CPU usage on our Web servers on average by about fifty percent, depending on the page. Less CPU means fewer servers, which means less overhead. This project has had a tremendous impact on Facebook. We feel the Web at large can benefit from HipHop, so we are releasing it as open source this evening in hope that it brings a new focus toward scaling large complex websites with PHP. While HipHop has shown us incredible results, it's certainly not complete and you should be comfortable with beta software before trying it out.

HipHop for PHP isn't technically a compiler itself. Rather it is a source code transformer. HipHop programmatically transforms your PHP source code into highly optimized C++ and then uses g++ to compile it. HipHop executes the source code in a semantically equivalent manner and sacrifices some rarely used features — such as eval() — in exchange for improved performance. HipHop includes a code transformer, a reimplementation of PHP's runtime system, and a rewrite of many common PHP Extensions to take advantage of these performance optimizations.

Scaling PHP as a Scripting Language
PHP's roots are those of a scripting language, like Perl, Python, and Ruby, all of which have major benefits in terms of programmer productivity and the ability to iterate quickly on products. This is compared to more traditional compiled languages like C++ and interpreted languages like Java. On the other hand, scripting languages are known to generally be less efficient when it comes to CPU and memory usage. Because of this, it's been challenging to scale Facebook to over 400 billion PHP-based page views every month.

One common way to address these inefficiencies is to rewrite the more complex parts of your PHP application directly in C++ as PHP Extensions. This largely transforms PHP into a glue language between your front end HTML and application logic in C++. From a technical perspective this works well, but drastically reduces the number of engineers who are able to work on your entire application. Learning C++ is only the first step to writing PHP Extensions, the second is understanding the Zend APIs. Given that our engineering team is relatively small — there are over one million users to every engineer — we can't afford to make parts of our codebase less accessible than others.

Scaling Facebook is particularly challenging because almost every page view is a logged-in user with a customized experience. When you view your home page we need to look up all of your friends, query their most relevant updates (from a custom service we've built called Multifeed), filter the results based on your privacy settings, then fill out the stories with comments, photos, likes, and all the rich data that people love about Facebook. All of this in just under a second. HipHop allows us to write the logic that does the final page assembly in PHP and iterate it quickly while relying on custom back-end services in C++, Erlang, Java, or Python to service the News Feed, search, Chat, and other core parts of the site.

Since 2007 we've thought about a few different ways to solve these problems and have even tried implementing a few of them. The common suggestion is to just rewrite Facebook in another language, but given the complexity and speed of development of the site this would take some time to accomplish. We've rewritten aspects of the Zend Engine — PHP's internals — and contributed those patches back into the PHP project, but ultimately haven't seen the sort of performance increases that are needed. HipHop's benefits are nearly transparent to our development speed.

Hacking Up HipHop
One night at a Hackathon a few years ago (see Prime Time Hack), I started my first piece of code transforming PHP into C++. The languages are fairly similar syntactically and C++ drastically outperforms PHP when it comes to both CPU and memory usage. Even PHP itself is written in C. We knew that it was impossible to successfully rewrite an entire codebase of this size by hand, but wondered what would happen if we built a system to do it programmatically.

Finding new ways to improve PHP performance isn't a new concept. At run time the Zend Engine turns your PHP source into opcodes which are then run through the Zend Virtual Machine. Open source projects such as APC and eAccelerator cache this output and are used by the majority of PHP powered websites. There's also Zend Server, a commercial product which makes PHP faster via opcode optimization and caching. Instead, we were thinking about transforming PHP source directly into C++ which can then be turned into native machine code. Even compiling PHP isn't a new idea, open source projects like Roadsend and phc compile PHP to C, Quercus compiles PHP to Java, and Phalanger compiles PHP to .Net.

Needless to say, it took longer than that single Hackathon. Eight months later, I had enough code to demonstrate it is indeed possible to run faster with compiled code. We quickly added Iain Proctor and Minghui Yang to the team to speed up the pace of the project. We spent the next ten months finishing up all the coding and the following six months testing on production servers. We are proud to say that at this point, we are serving over 90% of our Web traffic using HipHop, all only six months after deployment.

How HipHop Works
The main challenge of the project was bridging the gap between PHP and C++. PHP is a scripting language with dynamic, weak typing. C++ is a compiled language with static typing. While PHP allows you to write magical dynamic features, most PHP is relatively straightforward. It's more likely that you see if (...) {...} else {..} than it is to see function foo($x) { include $x; }. This is where we gain in performance. Whenever possible our generated code uses static binding for functions and variables. We also use type inference to pick the most specific type possible for our variables and thus save memory.

The transformation process includes three main steps:

Static analysis where we collect information on who declares what and dependencies,
Type inference where we choose the most specific type between C++ scalars, String, Array, classes, Object, and Variant, and
Code generation which for the most part is a direct correspondence from PHP statements and expressions to C++ statements and expressions.

We have also developed HPHPi, which is an experimental interpreter designed for development. When using HPHPi you don't need to compile your PHP source code before running it. It's helped us catch bugs in HipHop itself and provides engineers a way to use HipHop without changing how they write PHP.

Overall HipHop allows us to keep the best aspects of PHP while taking advantage of the performance benefits of C++. In total, we have written over 300,000 lines of code and more than 5,000 unit tests. All of this will be released this evening on GitHub under the open source PHP license.

Learn More this Evening
This evening we're hosting a small group of developers to dive deeper into HipHop for PHP and will be streaming this tech talk live. Check back here around 7:30pm Pacific time if you'd like to watch.

As I'm sure there will be plenty of questions, starting this evening take a look at the HipHop wiki or join the HipHop developer mailing list. You'll also find us at FOSDEM, SCALE, PHP UK, ConFoo, TEK X, and OSCON over the next few months talking about HipHop for PHP. We're very excited to evolve HipHop into a thriving open source project along with all of you.

Referance By : http://developers.facebook.com/news.php?story=358&blog=1

Nov 17

Enhance PHP session management

PHP 4852 feedbacks »

In PHP, sessions can keep track of authenticated in users. They are an essential building block in today's websites with big communities and a lot of user activity. Without sessions, everyone would be an anonymous visitor.
In system terms, PHP sessions are little files, stored on the server's disk. But on high traffic sites, the disk I/O involved, and not being able to share sessions between multiple webservers make this default system far from ideal. This is how to enhance PHP session management in terms of performance and shareability.

Session sharing in web clusters

If you have multiple webservers all serving the same site, sessions should be shared among those servers, and not reside on each server's individual disk. Because once a user gets load-balanced to a different server, the session cannot be found, effectively logging the user out.

A common way around this is to use custom session handlers. Writing a class that overrules default behavior and stores sessions in a MySQL database.

Sessions in Database

All webservers connect to the same database and so, as soon as www01 registers a session (insert in a sessions table), www02 can read it. All servers can now see all sessions: problem solved?

Yes, and no. This sure is functional and tackles the shareability issue. But databases seem to be the biggest bottlenecks of web clusters these days. They are the hardest to scale, and so in high traffic environments you don't want to (ab)use them for session management if you don't have to. We have to tackle the 'performance' issue.

Database memory

Memory is about 30 times faster than disk storage. So storing our sessions in memory somehow, could deliver great performance.

MySQL query caching

One form of using database memory is the standard MySQL query caching. But MySQL query caching isn't very effective because it invalidates all cache related a table, if only one record in that table is changed.

Of course the session table is changed all the time, so the session cache is purged all the time, rendering it quite useless for our purposes.

Heap tables / Memory tables.

We're really closing in to our goal now. Storing the sessions in a heap/memory table (a table that lives in your database server's RAM) speeds up things greatly. Many demanding sites have opted for this solution.

In my eyes however, it's still not optimal. Because it still requires a lot of additional queries that your database server(s) shouldn't necessarily have to process.

One other possible solution is using Memcache. And you will find it's easier to setup and has a smaller footprint than most alternatives. For one thing, because you will not have to code custom session handler classes in PHP. Memcache session support comes native.

Sessions in Memcache

PHP allows you to overrule the default session handler in two ways:

1. session_set_save_handler(). By programming your own session handlers, allowing you to virtually use any type of storage, as long as you can read/write to it from PHP. This example uses a MySQL database. We could also use this method to connect to Memcache.
2. session.save_handler. By specifying one of the default handlers in the php.ini file using the session.save_handler & session.save_path directives.

Option 1 allows greater flexibiliy. And it even allows you to create a combined database/memcache mechanism. Resulting in a fallback-on-database in case memcache goes offline and loses all of it's sessions (effictively logging out all users).

Option 2 is very easy to implement, doesn't require changing your existing code, and is the one I'm going to show you today.
session.save_handler

Assuming that you have one webserver, and installed the Memache server on that same machine, the hostname will be 127.0.0.1. If you have it on a different server, you will know what IP to substitute it with.

session.save_handler = memcache
session.save_path = "tcp://127.0.0.1:11211"

Done! Huh? what just happened?

Well, because we enabled Memcache session handler support, all work is done for us. PHP will now know not to use the default files handler so save session files in /var/lib/php5 but uses memcache running at 127.0.0.1 instead.

Don't forget to restart your webserver to activate your changes to the php.ini

/etc/init.d/apache2 restart

Referance Site http://kevin.vanzonneveld.net/

Thanks And Regards :)

Nov 17

Validate a Credit Card

PHP 2808 feedbacks »

This little function helps validating a given credit card number is legit:

function ValidateCreditCardNumber($cc_num)
{
$pattern = "/^3[47]\d{13}$/";//American Express
if (preg_match($pattern,$cc_num))
{
return true;
}

$pattern = "/^([30|36|38]{2})([0-9]{12})$/";//Diner's Club
if (preg_match($pattern,$cc_num))
{
return true;
}

$pattern = "/^6011\d{12}$/";//Discover Card
if (preg_match($pattern,$cc_num))
{
return true;
}

$pattern = "/^5[12345]\d{14}$/";//Mastercard
if (preg_match($pattern,$cc_num))
{
return true;
}

$pattern = "/^4\d{12}(\d\d\d){0,1}$/";//Visa
if (preg_match($pattern,$cc_num))
{
return true;
}

$pattern = "/^30[012345]\d{11}$/";//Diners
if (preg_match($pattern,$cc_num))
{
return true;
}

$pattern = "/^3[68]\d{12}$/";//Diners #2
if (preg_match($pattern,$cc_num))
{
return true;
}

// Not valid
return false;
}

Tags: credit card validation, php, validation

Sep 28

cakePHP Frameworks

PHP, MySQL, Applications, Opensource Framework 7376 feedbacks »

CakePHP is a rapid development framework for PHP that provides an extensible architecture for developing, maintaining, and deploying applications. Using commonly known design patterns like MVC and ORM within the convention over configuration paradigm, CakePHP reduces development costs and helps developers write less code.

Hot Features

-> No Configuration - Set-up the database and let the magic begin
-> Extremely Simple - Just look at the name...It's Cake
-> Active, Friendly Community - Join us #cakephp on IRC. We'd love to help you get started
-> Flexible License - Distributed under the MIT License
-> Clean IP - Every line of code was written by the CakePHP development team
-> Best Practices - covering security, authentication, and session handling, among the many other features
-> OO - Whether you are a seasoned object-oriented programmer or a beginner, you'll feel comfortable.

Screenshots
http://cakephp.org/screencasts

Download CakePHP
http://cakephp.org/downloads

1 2 3 4 >>
  • February 2012
    Mon Tue Wed Thu Fri Sat Sun
     << <   > >>
        1 2 3 4 5
    6 7 8 9 10 11 12
    13 14 15 16 17 18 19
    20 21 22 23 24 25 26
    27 28 29        
  • Webnology

  • If you have nice and informative articles than you can mail me that article with your contact information on shardulk10@gmail.com. Thanks

    Advertise With Us
    If anybody want to advertise with us than for further details contact us on shardulk10@gmail.com

    • Recently
    • Archives
    • Categories
    • Latest comments
  • Search

  • Categories

    • All
    • AJAX
    • Applications
      • Blog Application
      • CMS
      • CRM
      • PMS
    • CSS
    • HTML
    • Interview Help
    • MySQL
    • Online Marketing
    • Opensource Framework
    • PHP
      • Introduction
    • Uncategorized
    • UNIX
  • XML Feeds

    • RSS 2.0: Posts, Comments
    • Atom: Posts, Comments
    What is RSS?
  • User tools

    • Login
    • Register
    • Admin
  • Who's Online?

    • Guest Users: 11
b2
Contact. blog software / UK hosts / monetize.
Design & icons by N.Design Studio. Skin by Tender Feelings / Evo Factory.
Entries RSS Comments RSS Log in