Speed up your PHP like Facebook does with HipHop for PHP

It’s a fact that script based languages and frameworks slow you down. PHP and its huge amount of frameworks is no exception to that rule. Until you realize that it is used on the busiest site out there – Facebook.
Scripted languages typically are embraced as they have advantages in being simple to learn, code, and debug while counterbalanced with a definite sacrificing of speed. On the other side of the spectrum, compiled languages usually have a steeper learning curve and are much more strict; counter balanced with the clear fact that they are considerably faster and better optimized for handling memory. Facebook seems to have found a balance between both worlds with HipHop for PHP.
Facebook developers write lots of their core services in other languages, and then PHP is used as the glue that queries those services and builds the actual pages itself. Still, they have found that that really isn’t fast enough for what they want, so they went and wrote their own compiler, or rather an optimizer, called HipHop, which compiles PHP down to C++ which can then be compiled by G++.
You can download HipHop from here: http://github.com/facebook/hiphop-php

If you’re interested in using/trying some PHP frameworks you can start by looking at:

After The Deadline is a project of Automattic (the creator of WordPress) which checks:

  • spelling
  • grammar
  • styles (finds complex phrases, cliches, bias-language & suggests simple ones)
  • and detects misused words (has a database of 1500 most misused words & suggestions)

The software used to come as a plugin for several projects (like WordPress, RoundCube, PHP List) but it is now open source and anybody can embed it to their own code.

Besides the artificial intelligence it already has, it is possible to add new rules & improve the application.

The project also has libraries for jQuery, Ruby & Python to make developing new plugins easier.

Demo: http://www.polishmywriting.com/

Mockup tool: Balsamiq Mockups

A very, very useful tool and worth the cost, $79 USD is Balsamiq Mockups. It works because Balsamiq Mockups intentionally uses hand-drawn UI elements, so that people don’t get attached to “that pretty color gradient” or think that your mockup has actual code behind it and is “practically done”…

AeroWindow 2.0 – Cool Windows 7 style modal popups

AeroWindow is a jQuery plugin for creating Windows 7-like aero style modal pop-ups complete with the minimize, zoom, maximize and close functions. There can be multiple pop-ups in one page where the active one is highlighted visually. All on the screen can be resized, drag’n dropped and maximized with double-clicks.

Smokescreen: real time SWF to JS aka “hello iPad/iPhone”

Now this is “interesting”. Smokescreen, written by Chris Smoak, is a “Flash player written in JavaScript” in that it takes Flash objects and then actually converts them to JavaScript in real time… Whoah you say. Hello iPad/iPhone/whatever…

The goodness: it runs entirely in the browser, reads in SWF binaries, unzips them (in native JS), extracts all images and any embedded audio and then turns them into base64 encoded data:uris. Post all that prework it then stitches the vector graphics back together as an animated SVG. And rather nicely at that.

The badness: 8k lines of JS translates to ~175kb and some serious slowness on mobile devices…

The potential nss nss: supposedly it will be fully opensourced in the not too distant future. Allowing for sorts of optimization potential.

It’s a different type of Flash…

Sencha (previously known as Ext JS) has released Sencha Touch, a HTML5 Mobile Application Framework. which allows you to develop web applications that look and feel native on Apple iOS and Google Android touchscreen devices.
It makes use of HTML5 for delivering audio/video or localStorage and CSS3 for maximum styling like rounded corners, background gradients, and shadows.
The code created is resolution independent. It uses a method which allows developers to change the overall scale of their interfaces on the fly with no pixellation.

Sencha Touch has a powerful animation system that makes flexible animations between screens and views possible.

Slide, pop, and fade animations are included with the library, each with a robust set of options to change attributes like direction and masking style.
And, as they are created with CSS, building custom animations is a joy.

Also, it includes a set of common icons for using them in toolbars and tab bars.

Compatibility: Apple iOS and Google Android
Website: http://www.sencha.com/products/touch/
Demo: http://www.sencha.com/products/touch/demos.php

HumbleFinance: Dynamic Charts with HTML5, Canvas, and Flotr for Prototype

HumbleFinance is an HTML5 data visualization tool written as a demonstration of interactive graphing in HTML5. It is similar to the Flash tool on http://finance.google.com/. The tool itself is written entirely in JavaScript, using the Prototype and Flotr libraries. It can be used to display any two 2-D data sets of real numerical data which share an axis.


Custom Images for SharePoint profile page view

Sometimes you need to tightly control profile pictures in MOSS / SharePoint 2007. An easy way to do this if your pictures have the right naming convention is as follow.

Looking at the URL of the profile we can see that the data is clearly sent “/Person.aspx?accountname=DOMAIN%5JohnDoe” In this case we are looking at the domain user JDoe aka John Doe on the domain DOMAIN.
Edit person.aspx and at about line 39 comment out “
And replace it with the following JavaScript…

< type="text/javascript">
var str1=”< propertyname="FirstName" runat="server" preview="FirstName" values="<P N='PropertyName' T='FirstName' /><P N='ControlStyle'><P N='Font' ID='1' /></P><P N='Font' R='1' /><P N='ID' ID='2' T='ctl02' /><P N='Page' ID='3' /><P N='TemplateControl' R='3' /><P N='AppRelativeTemplateSourceDirectory' R='-1' />">“;
var str2=”< propertyname="LastName" runat="server" preview="LastName" values="<P N='PropertyName' T='LastName' /><P N='ControlStyle'><P N='Font' ID='1' /></P><P N='Font' R='1' /><P N='ID' ID='2' T='ctl03' /><P N='Page' ID='3' /><P N='TemplateControl' R='3' /><P N='AppRelativeTemplateSourceDirectory' R='-1' />">“;
str1 = str1.replace(“<>“, “”);
str1 = str1.replace(“< /span>“, “”);
str2 = str2.replace(“<>“, “”);
str2 = str2.replace(“< /span>“, “”);
document.write(“< src="'http://people/FirmDirectory/FacebookPictures/" alt="'" width="'72'"> <>“);
< /script>

(In this case our images have the following naming convention FirstLast.gif.)

As usual HTML tags have been changed in the following way:
“<" is now "< ".

Javascript Image Rotator/Presenter

Cycle is a script that supports image presentations to easily display multiple images. This script supports a lot of effects and the cycling of html elements.

Presentation Cycle is a variation on the functionality of Cycle. Instead of generating a list of numbers that are clickable. Presentation Cycle generates a progress bar that shows when the new slide will appear.