Saturday, January 16, 2010

Situation where to use abstract class?.

One example that I like to use is a complex sort algorithm,say a generic quicksort, where you know how to sort but you don't know enough about the final class to complete the class. In other words, you must defer the final implementation to a more knowledgeable class. So you write an abstract quicksort class with an abstract Compare(obj1, obj2) method. The user of the class simply extends the Sorting class and provides a Concrete implementation of the Compare method appropriate for the class. The key here is that methods in the abstract class can call the abstract Compare method that still needs to be implemented! Multiple concrete classes can then reuse your quicksort algorithm.
In an object-oriented drawing application, you can draw circles, rectangles, lines, Bezier curves, and many other graphic objects. These objects all have certain states (for example: position, orientation, line color, fill color) and behaviors (for example: moveTo, rotate, resize, draw) in common. Some of these states and behaviors are the same for all graphic objects—for example: position, fill color, and moveTo. Others require different implementations—for example, resize or draw. All GraphicObjects must know how to draw or resize themselves; they just differ in how they do it. This is a perfect situation for an abstract superclass. You can take advantage of the similarities and declare all the graphic objects to inherit from the same abstract parent object—for example, GraphicObject, as shown in the following figure.

Classes Rectangle, Line, Bezier, and Circle inherit from GraphicObject
First, you declare an abstract class, GraphicObject, to provide member variables and methods that are wholly shared by all subclasses, such as the current position and the moveTo method. GraphicObject also declares abstract methods for methods, such as draw or resize, that need to be implemented by all subclasses but must be implemented in different ways. The GraphicObject class can look something like this:
abstract class GraphicObject {
int x, y;
void moveTo(int newX, int newY) {
abstract void draw();
abstract void resize();
Each non-abstract subclass of GraphicObject, such as Circle and Rectangle, must provide implementations for the draw and resize methods:
class Circle extends GraphicObject {
void draw() {
void resize() {
class Rectangle extends GraphicObject {
void draw() {
void resize() {

Wednesday, January 13, 2010

difference between asynchronous and synchronous request

The difference between asynchronous and synchronous interaction is that when it is synchronous you have to do each step at the time. You cannot do two things - or what is called multitasking.

Take uploading a file. To do this, you have to:

1. Select the files you want to upload
2. Click the upload button
3. Wait for the files to be uploaded
4. Work with them

You cannot chose to upload another set of files while the first ones are being uploaded, nor can you start to work with them (like adding tags) before the upload process has completed. The interaction is synchronous.
With asynchronous interaction you can do other things while the system uploads the file.

Or take a kitchen, which is asynchronous by design. While you are e.g. baking bread, cooking spaghetti and frying some meat - you are also making the salad. The result of this multitasking behavior is that you can prepare a nice dinner in about 30 minutes. If you had to do the same in a synchronous fashion it would take hours, and most of the food would have gotten cold before everything was finished.

The Future of CakePHP

Wow - it's 2010. The future is here and appropriately we'll look to CakePHP lead cosmonaut Nate Abele to take us on an odyssey of both Cake and PHP. Join us this January as we mark NYPHP's ninth year and sit back while the monolith evolves your understanding of HAL CakePHP and the future of PHP frameworks - and we'll see you in 3001.

Now that the major PHP frameworks have reached sustained maturity, where do we go from here? With the long-awaited release of PHP 5.3, many are gearing up to take advantage of the available features with new major versions, which will change the way we create web applications. We'll take a sneak peak at the next major version of CakePHP to see what this evolution might look like, and how you can apply new techniques in your own projects.

Nate Abele is the lead developer of the CakePHP framework, an internationally ignored author and speaker, and has come to be known as the Johnny Cash of the PHP community. Having lived in the midwestern US and both coasts, Nate has currently taken up residence in the most desolate place on the planet: New Jersey. When not code-monkey'ing or yelling at people for "doin' it rong", Nate enjoys snowboarding, playing guitar, being a beach bum, and writing about himself in the third person.

Thank you to IBM for providing a great presentation space in Midtown Manhattan. As a service to our community, New York PHP Community meetings are always free and open to the public.

Monday, January 11, 2010

jQuery feature

Query provides many general function to build a rich pages. jQuery feature:
  • Ajax
    jQuery is one of the ajax framework that used mostly by many web master.
  • Shortcut access to DOM
    instead of using bulk of code in accessing DOM, jQuery have the shortcut.
  • Manipulating the element content
    With jQuery, we can freely insert, update and delete every HTML element.
  • Easy event handling
    Event handling is no fear again in web pages, jQuery make the process simple.
  • Animation
    by default, jQuery already have ability to perform general animation on the pages.
  • Action Chaining
    Instead of using many temporary variable and repetition lines, we can easily unite several lines of code that have same characteristic to a line code with chaining.
  • CSS Compliance
    The jQuery selector is CSS Compliance, that make any designer that already have knowledge about CSS is able to learn jQuery easily.
  • Cross browser
    using jQuery, no more hack for IE… the framework has done it automatically.

Small Businesses Benefit from Drupal

Small businesses today are quickly recognizing the power of content management systems and website platforms that allow you to interact with your customers. The days of an old static website that simply lists your phone number are long gone. Today, your website visitors demand that you engage them in dialogue, provide resources at their fingertips, and give them an easy way of understanding what you do and how to buy it from you.

This might seem difficult or expensive, but it doesn't have to be. Orchestra provides Drupal, a leading open source Content Management System, to our clients for a price and timeline built for small business. Drupal is free and open source, so we're able to offer an enterprise level website solution for a very affordable price.

As you'll see below, Orchestra has crafted a solution for small and midsize companies to take advantage of web 2.0 and the growth in internet marketing. And it's not just B2C that benefits, one of the fastest growing sectors of the web is B2B. For small businesses in the B2B space, having an engaging website that positions your company as a market leader and thought driver is imperative.

So, lets get right into the "meat and potatoes" as they say:

Big Features for Small Networks

Business computer networks come in two basic varieties. Larger companies, from giant corporations to medium-size operations, use nets that are typically built around Novell NetWare or Windows NT servers. These nets demand care and feeding from highly trained administrators. Small businesses, if they are wired at all, usually string together a few computers using the simple Windows or Macintosh built-in networking.

The increasing importance of computers in even very small businesses is exposing the weaknesses of these simple networks: They offer little security, no data backups, no easy way to share an Internet connection, and they become difficult to manage if they grow beyond a handful of computers. Help is on the way. A new breed of server can deliver big office features at low cost and require little technical skill. Eventually, they may even find their way into your home.