Jaslabs: High performance Software

High Performance Software

Archive for April, 2007

The evolution of Delphi for PHP

By Justin Silverton

Recently, CodeGear announced the latest addition to their product line called Delphi for PHP. It is a great new tool that allows developers to easily create php applications with a drag-and-drop GUI interface. What many people do not know is that a few of the components are actually based on open source projects. I feel that this is a a good thing, because many of these projects have been in use for awhile, thoroughly bug tested, and full of many great features.

Here is a list of the open source projects:

1) Qooxdoo framework

Qooxdoo is the basis for many of the VCL controls. And not all of the properties of the qooxdoo controls that are used are available to the IDE Object Inspector. Learning the API can help you discover the other properties that you can set using JavaScript.

information about the API can be found here

2) VCL4PHP

This project is a class library of PHP components which replicate VCL for Win32. VCL for PHP is PHP framework to develop web applications, it’s OpenSource and it’s licensed using LGPL. It is the basis for the majority of the libraries within Delphi for PHP.

Features

  • Fully OO applications
  • Complete MVC model
  • Properties, Methods and Events>
  • I18N functionality
  • Template Engines
  • Ajax abstraction
  • Database abstraction and data-aware components
  • Input filtering using objects
  • Webservices integration

Project available here

3) walterzorn vector graphics library

This JavaScript VectorGraphics library provides graphics capabilities for JavaScript: functions to draw circles, ellipses (ovals), oblique lines, polylines and polygons (for instance triangles, rectangles) dynamically into a webpage. Usage of this Vector Graphics library should be easy even if you don’t have JavaScript experience. Another goal during development of this JavaScript Draw Shapes Vector Graphics Library was to achieve optimized performance and cleanly arranged pixel stair-step patterns (pixel-optimization).

This library is available for download here

a nice animation example here

4) xajax - ajax library

The xajax PHP object generates JavaScript wrapper functions for the PHP functions you want to be able to call asynchronously from your application. When called, these wrapper functions use JavaScript’s XMLHttpRequest object to asynchronously communicate with the xajax object on the server which calls the corresponding PHP functions. Upon completion, an xajax XML response is returned from the PHP functions, which xajax passes back to the application. The XML response contains instructions and data that are parsed by xajax’s JavaScript message pump and used to update the content of your application.

Features

  • xajax’s unique XML response / javascript message-pump system does the work for you, automatically handling the data returned from your functions and updating your content or state according to the instructions you return from your PHP functions. Because xajax does the work, you don’t have to write javascript callback handler functions.
  • xajax is object oriented to maintain tighter relationships between the code and data, and to keep the xajax code separate from other code. Because it is object oriented, you can add your own custom functionality to xajax by extending the xajaxResponse class and using the addScript() method.
  • xajax works in Firefox, Mozilla, probably other Mozilla based browsers, Internet Explorer, and Safari.
  • In addition to updating element values and innerHTML, xajax can be used to update styles, css classes, checkbox and radio button selection, or nearly any other element attribute.
  • xajax supports passing single and multidimensional arrays and associative arrays from javascript to PHP as parameters to your xajax functions. Additionally, if you pass a javascript object into an xajax function, the PHP function will receive an associative array representing the properties of the object.
  • xajax provides easy asynchronous Form processing. By using the xajax.getFormValues() javascript method, you can easily submit an array representing the values in a form as a parameter to a xajax asynchronous function:

    xajax_processForm(xajax.getFormValues(’formId’);

    . It even works with complex input names like “checkbox[][]” and “name[first]” to produce multidimensional and associative arrays, just as if you had submitted the form and used the PHP $_GET array

Non-open source software worth mentioning

Qstudio

CodeGear partnered with qadram software to jointly develop Delphi for PHP. qadram software, the development team behind VCL for PHP, had been working on a pre-beta project called Qstudio that became the foundation of Delphi for PHP.Development of Delphi for PHP is being done by CodeGear and qadram software at CodeGear headquarters in Scotts Valley, CA.

Interested in Delphi for PHP? a free, 14-day trial (as opposed to the 1-day trial when it was first released) can be found here

Share and Enjoy: These icons link to social bookmarking sites where readers can share and discover new web pages.
  • Digg
  • del.icio.us
  • DZone
  • Slashdot
  • StumbleUpon
  • Technorati
No comments

Top 5 javascript frameworks

By Justin Silverton

5) Yahoo! User Interface Library

The Yahoo! User Interface (YUI) Library is a set of utilities and controls, written in JavaScript, for building richly interactive web applications using techniques such as DOM scripting, DHTML and AJAX. The YUI Library also includes several core CSS resources. All components in the YUI Library have been released as open source under a BSD license and are free for all uses.

Features

Two different types of components are available: Utilities and controls. The YUI utilities simplify in-browser devolvement that relies on cross-browser DOM scripting, as do all web applications with DHTML and AJAX characteristics. The YUI Library Controls provide highly interactive visual design elements for your web pages. These elements are created and managed entirely on the client side and never require a page refresh.

utilities available:

  • Animation: Create “cinematic effects” on your pages by animating the position, size, opacity or other characteristics of page elements. These effects can be used to reinforce the user’s understanding of changes happening on the page.
  • Browser History Manager: Developers of rich internet applications want bookmarks to target not just pages but page states and they want the browser’s back button to operate meaningfully within their application’s screens. Browser History Manager provides bookmarking and back button control in rich internet applications.
  • Connection Manager: This utility library helps manage XMLHttpRequest (commonly referred to as AJAX) transactions in a cross-browser fashion, including integrated support for form posts, error handling and callbacks. Connection Manager also supports file uploading.
  • DataSource Utility: DataSource provides an interface for retrieving data from arrays, XHR services, and custom functions with integrated caching and Connection Manager support.
  • Dom Collection:The DOM Utility is an umbrella object comprising a variety of convenience methods for common DOM-scripting tasks, including element positioning and CSS style management.
  • Drag & Drop: Create draggable objects that can be picked up and dropped elsewhere on the page. You write code for the “interesting moments” that are triggered at each stage of the interaction (such as when a dragged object crosses over a target); the utility handles all the housekeeping and keeps things working smoothly in all supported browsers.

Controls available:

  • AutoComplete: The AutoComplete Control allows you to streamline user interactions involving text-entry; the control provides suggestion lists and type-ahead functionality based on a variety of data-source formats and supports server-side data-sources via XMLHttpRequest.
  • Button Control: The Button Control provides checkbox, radio button, submit and menu-button UI elements that are more impactful visually and more powerful programmatically than the browser’s built-in form widgets.
  • Calendar: The Calendar Control is a graphical, dynamic control used for date selection.
  • Container: The Container family of controls supports a variety of DHTML windowing patterns including Tooltip, Panel, Dialog and SimpleDialog. The Module and Overlay controls provide a platform for implementing additional, customized DHTML windowing patterns.
  • DataTable Control: DataTable leverages the semantic markup of the HTML table and enhances it with sorting, column-resizing, inline editing of data fields, and more.
  • Logger: The YUI Logger provides a quick and easy way to write log messages to an on-screen console, the FireBug extension for Firefox, or the Safari JavaScript console. Debug builds of YUI Library components are integrated with Logger to output messages for debugging implementations.
  • Menu: Application-style fly-out menus require just a few lines of code with the Menu Control. Menus can be generated entirely in JavaScript or can be layered on top of semantic unordered lists.

Download and more information: here

4) Prototype

Prototype is a JavaScript Framework that aims to ease development of dynamic web applications.

Featuring a unique, easy-to-use toolkit for class-driven development and the nicest Ajax library around, Prototype is quickly becoming the codebase of choice for web application developers everywhere.

Features

  • Easily deploy ajax applications: Besides simple requests, this module also deals in a smart way with JavaScript code returned from a server and provides helper classes for polling.
  • DOM extending: adds many convenience methods to elements returned by the $() function: for instance, you can write $(’comments’).addClassName(’active’).show() to get the element with the ID ‘comments’, add a class name to it and show it (if it was previously hidden).
  • Utilizes JSON (JavaScript Object Notation): JSON is a light-weight and fast alternative to XML in Ajax requests

Download and more information here

3) Rico

Designed for building rich Internet applications.

Features

  • Animation Effects: provides responsive animation for smooth effects and transitions that that can communicate change in richer ways than traditional web applications have explored before. Unlike most effects, Rico 2.0 animation can be interrupted, paused, resumed, or have other effects applied to it to enable responsive interaction that the user does not have to wait on
  • Styling: Rico provides several cinematic effects as well as some simple visual style effects in a very simple interface.
  • Drag And Drop: Desktop applications have long used drag and drop in their interfaces to simplify user interaction. Rico provides one of the simplest interfaces for enabling your web application to support drag and drop. Just register any HTML element or JavaScript object as a draggable and any other HTML element or JavaScript object as a drop zone and Rico handles the rest.
  • AJAX Support: Rico provides a very simple interface for registering Ajax request handlers as well as HTML elements or JavaScript objects as Ajax response objects. Multiple elements and/or objects may be updated as the result of one Ajax request.

Download and more information here

2) Qooxdoo

qooxdoo is one of the most comprehensive and innovative Open Source multipurpose AJAX frameworks, dual-licensed under LGPL/EPL. It includes support for professional JavaScript development, a state-of-the-art GUI toolkit and high-level client-server communication.

Features

  • Client detection: qooxdoo knows what browser is being used and makes this information available to you.
  • Browser abstraction: qooxdoo includes a browser abstraction layer which tries to abstract all browser specifics to one common “standard”. This simplifies the real coding of countless objects by allowing you to focus on what you want and not “how to want it”. The browser abstraction layer comes with some basic functions often needed when creating real GUIs. For example, runtime styles or positions (in multiple relations: page, client and screen) of each element in your document.
  • Advanced property implementation: qooxdoo supports “real” properties for objects. This means any class can define properties which the created instances should have. The addProperty handler also adds getter and setter functions. The only thing one needs to add - should you need it - is a modifier function.
  • Event Management: qooxdoo comes with its own event interface. This includes event registration and deregistration functions.

    Furthermore there is the possibility to call the target function in any object context. (The default is the object which defines the event listener.) The event system normalizes differences between the browsers, includes support for mousewheel, doubleclick and other fancy stuff. qooxdoo also comes with an advanced capture feature which allows you to capture all events when a user drags something around for example.

Download and more information here

1) Dojo

Dojo allows you to easily build dynamic capabilities into web pages and any other environment that supports JavaScript sanely. You can use the components that Dojo provides to make your web sites more usable, responsive, and functional. With Dojo you can build degradable user interfaces more easily, prototype interactive widgets quickly, and animate transitions. You can use the lower-level APIs and compatibility layers from Dojo to write portable JavaScript and simplify complex scripts. Dojo’s event system, I/O APIs, and generic language enhancement form the basis of a powerful programming environment. You can use the Dojo build tools to write command-line unit-tests for your JavaScript code. The Dojo build process helps you optimize your JavaScript for deployment by grouping sets of files together and reuse those groups through “profiles”.

Features

  • Multiple Points Of Entry: A fundamental concept in the design of Dojo is “multiple points of entry”. This term means that Dojo should work very hard to make sure that users should be able to start using Dojo at the level they are most comfortable with.
  • Interpreter Independence: Dojo tries very hard to ensure that it’s possible to support at least the very core of the system on as many JavaScript enabled platforms as possible. This will allow Dojo to serve as a “standard library” for JavaScript programmers as they move between client-side, server-side, and desktop programming environments.
  • Unifies several codebases: builds on several contributed code bases (nWidgets, Burstlib, and f(m)).

Download and more information here

Share and Enjoy: These icons link to social bookmarking sites where readers can share and discover new web pages.
  • Digg
  • del.icio.us
  • DZone
  • Slashdot
  • StumbleUpon
  • Technorati
127 comments

Converting PHP scripts to dlls

By Justin Silverton

I came across this great open source project that allows you to convert your php scripts to a fast/cgi executable that can be executed by any web server that supports it (including apache and IIS).

From the site:

“Roadsend Compiler is an open source, native compiler for the PHP language. It compiles PHP source code to stand alone, native binaries which do not require an interpreter. Roadsend Compiler can build online web applications with Fast/CGI, offline web applications with an embedded web server (MicroServer), desktop GUI applications with PHP-GTK, and console applications. It is known to build on Linux, Windows (using mingw), and FreeBSD.”

Benefits of using the roadsend compiler

  • Faster execution time, because your php script is now a native binary and does not have to be interpreted each time it is accessed.
  • Better than a solution such as zend encoder or ion cube because it does not require the server to have any extra extensions (besides fast/cgi support installed). It also provides a good obfuscation solution.
  • The ability to create stand-alone web applications. These applications include a built-in webserver that allows the execution of php scripts as if they were a local application.

Issues to consider

  • Because this is an executable, it needs to be re-compiled for any operating system that you would like to support (freebsd, linux, windows, etc.)

more information can be found at the main roadsend website here

Share and Enjoy: These icons link to social bookmarking sites where readers can share and discover new web pages.
  • Digg
  • del.icio.us
  • DZone
  • Slashdot
  • StumbleUpon
  • Technorati
5 comments

10 tips for optimizing mysql queries

By Justin Silverton

  1. use the explain command
    Use multiple-row INSERT statements to store many rows with one SQL statement.

    The explain command can tell you which indexes are used with the specified query and many other pieces of useful information that can help you choose a better index or query.

    Example of usage: explain select * from table

    explanation of row output:

    • table—The name of the table.
    • type—The join type, of which there are several.
    • possible_keys—This column indicates which indexes MySQL could use to find the rows in this table. If the result is NULL, no indexes would help with this query. You should then take a look at your table structure and see whether there are any indexes that you could create that would increase the performance of this query.
    • key—The key actually used in this query, or NULL if no index was used.
    • key_len—The length of the key used, if any.
    • ref—Any columns used with the key to retrieve a result.
    • rows—The number of rows MySQL must examine to execute the query.
    • extra—Additional information regarding how MySQL will execute the query. There are several options, such as Using index (an index was used) and Where (a WHERE clause was used).
  2. use less complex permissions
  3. The more complex your permissions setup, the more overhead you have. Using simpler permissions when you issue GRANT statements enables MySQL to reduce permission-checking overhead when clients execute statements.

  4. specific mysql functions can be tested using the built-in “benchmark” command

    If your problem is with a specific MySQL expression or function, you can perform a timing test by invoking the BENCHMARK() function using the mysql client program. Its syntax is BENCHMARK(loop_count,expression). The return value is always zero, but mysql prints a line displaying approximately how long the statement took to execute

  5. optimize where clauses
    • Remove unnecessary parentheses
    • COUNT(*) on a single table without a WHERE is retrieved directly from the table information for MyISAM and MEMORY tables. This is also done for any NOT NULL expression when used with only one table.
    • If you use the SQL_SMALL_RESULT option, MySQL uses an in-memory temporary table
  6. Run optimize table
  7. This command defragments a table after you have deleted a lot of rows from it.

  8. avoid variable-length column types when necessary
  9. For MyISAM tables that change frequently, you should try to avoid all variable-length columns (VARCHAR, BLOB, and TEXT). The table uses dynamic row format if it includes even a single variable-length column.

  10. insert delayed
  11. Use insert delayed when you do not need to know when your data is written. This reduces the overall insertion impact because many rows can be written with a single disk write.

  12. use statement priorities
    • Use INSERT LOW_PRIORITY when you want to give SELECT statements higher priority than your inserts.
    • Use SELECT HIGH_PRIORITY to get retrievals that jump the queue. That is, the SELECT is executed even if there is another client waiting.
  13. use multiple-row inserts
  14. Use multiple-row INSERT statements to store many rows with one SQL statement.

  15. synchronize data-types
  16. Columns with identical information in different tables should be declared to have identical data types so that joins based on the corresponding columns will be faster.

Share and Enjoy: These icons link to social bookmarking sites where readers can share and discover new web pages.
  • Digg
  • del.icio.us
  • DZone
  • Slashdot
  • StumbleUpon
  • Technorati
47 comments

Microsoft’s PHP initiative

by Justin Silverton

Microsoft has recently released the second technical preview release of FastCGI for IIS, a new component for Microsoft’s Web server platform. This release is available immediately for download to Windows Vista, IIS including IIS 6.0 in Windows 2003 Server and IIS 5.1 in Windows XP.

The FastCGI component is part of the collaboration between Microsoft and Zend to improve performance and stability of PHP on the Windows platform. This effort aims to help PHP developers achieve improved performance on the Windows platform by leveraging the new IIS FastCGI feature together with Zend’s on-going work to improve the PHP engine on Windows.

Installing

This is just a technical release, so it is not recommended that you install this on a production server.

To install this on your server, go through the following steps:

  1. Download the beta here
  2. Extract the downloaded files
  3. within a command prompt, execute the following command in the same directory as the extracted files:

fgisetup.exe /install /add c:\php\php.exe php (This should point to your php installation)

New features of IIS 7

  • The IIS7 output cache is a new feature in IIS7 which will make it possible to cache script responses in memory (including dynamic content). It is much smarter than the current caching system IIS offers because it can be configured to cache different copies of responses for the same page based on a query string value
  • another interesting feature is kernel mode driver caching, allowing for very fast and improved performance. It will work with any content type, and can significantly speed up performance for applications where the underlying data doesn’t change.
Share and Enjoy: These icons link to social bookmarking sites where readers can share and discover new web pages.
  • Digg
  • del.icio.us
  • DZone
  • Slashdot
  • StumbleUpon
  • Technorati
8 comments

Next Page »