BLOG

12
Jan

Lightview by Nick Stakenburg

Nick has just released Lightview (another neat project) to the public. Lightview allows you to augment your images. It provides an excellent way of creating a slideshow or simply showing a large version of a thumbnail without resorting to popups. Effects are used to create very appealing slideshows and image galleries.

From the Lightview project site:

  • Clean: Designed to compliment your images.
  • Fast: Images and their neighbours are preloaded.
  • Easy to customize: You don’t even have to know CSS.
  • Rounded: Adjustable rounded corners, without PNGs.
  • Smart resizing: Images will always fit on your screen.
  • Slideshow: One button slideshow.
  • Effects: Using Scriptaculous.
  • Works on all modern browsers

Lightview is similar to Lightbox 2 and both are built with Prototype and Scriptaculous. However, there are a few differences I noticed:

  • The morphing effect that Lightview uses is a refreshing change (probably because I have seen the Lightbox effects too many times!).
  • Lightview allows you to customise many of the visual aspects of the viewer programatically. For example, the background colour and corner radius.
  • Lightview supports a customisable slideshow option which Lightbox lacks.
  • Lightview uses the caption attribute of the <a> tag to give images a caption. This attribute is not valid XHTML and thus its usage will produce invalid markup. I would suggest using a convention similar to that used by MooTools Tips: title="image title :: caption"
  • Lightbox has been around for a while and is well tested and proven.

Personally I like the look of Lightview but I wouldn’t use it because I don’t like invalid markup!

If you are interested in something similar for the MooTools framework, try Slimbox.

06
Jan

Setup Subversion and Trac on CentOS 5

Recently I set up a virtual server to use as a development machine. It runs on CentOS 5 and hosts several Subversion repositories with associated Trac projects.

There are many guides and plenty of help on the net to help you setup such a system. However, when I tried to do it I came across a few problems and I hope this post may help at least a few people trying to do the same as me. I am not going to rewrite the great tutorials out there, I will just point you to them and note what things I did differently.

This ‘guide’ should get you from a fresh install of CentOS 5 linux to one or more working Subversion (SVN) repositories and associated Trac wiki’s. Apache/WebDAV is used as the network layer. I have only tested this on a fresh install of CentOS 5.

Continue Reading..

02
Dec

Trying out MooTools 1.2 Beta 1

Whilst I commonly use Prototype and Script.aculo.us as my preferred JavaScript libraries, I recently decided to try out MooTools as an alternative.

MooTools is a compact, modular, Object-Oriented JavaScript framework designed for the intermediate to advanced JavaScript developer. It allows you to write powerful, flexible, and cross-browser code with its elegant, well documented, and coherent API (mootools.net).

I downloaded MooTools version 1.2 beta 1, which is feature complete but not fully tested. If you are interested in what’s new in 1.2, see the MooTools blog: 1.2 beta 1.

My first impressions of MooTools were good and whilst I haven’t mastered the ‘Moo way of doing things,’ I got to grips with it quickly.

Comparison with Prototype

This is not an exhaustive comparison, it’s just my first impressions.

  • In MooTools effects are a Core component. With Prototype you need an additional effects library (e.g Script.aculo.us).
  • When downloading MooTools you are able to select only the components you need and you are given the option of compressing the library.
  • I prefer Prototype’s documentation style. Initially I found MooTools hard to learn because the API documentation does not give sufficient examples of good practice etc…
  • I’m a fan of Dean Edward’s Base and MooTools has a really nice implementation of it.
  • MooTools acknowledges Prototype as an awesome library and a lot of code is based on Prototype.
  • Currently there is no central repository for MooTools extensions that I know of.

Prototype 1.6.0 weighs in at 121KB. Similarly, MooTools 1.2b1 (all components, uncompressed, no documentation) is 120KB. However, there is no need for an additional effects library and you can cut down the size of the MooTools library by removing unwanted components.

As I learn more of MooTools I will post more advice and tips on using MooTools from a Prototype background.

Resources

30
Nov

Zend Framework 1.0.3 Released

Zend Framework (ZF) 1.0.3 has been released. This is the third maintenance release since the launch of Zend Framework 1.0 at the beginning of July 2007, which goes to show how quickly the ZF community is growing.

Zend Framework is quickly becoming the most popular PHP5 framework, mostly due to the fact that it does not tie you to coding in a specific way. You can use individual components or choose to use the entire Model-View-Controller (MVC) architecture. In a post written on the Zend Blog, the ZF team are expecting over 3 million downloads of the framework by the end of the year.

The near future roadmap for ZF includes adding support for even more web services and providing a standard solution for handling web forms. There will also be improvements in the online documentation (which is already an excellent reference) and tutorials as well as support for OpenID.

We can expect some of these features to be ready for the upcoming 1.1.0 release which is expected in the first quarter of 2008.

For more information, see Zend Framework Components and the Zend Framework roadmap.

Download Zend Framework.

18
Nov

Starbox – Rating stars for prototype

Nick Stakenburg (creator of Prototip) has just submitted a new project to Scripteka. “Starbox” is a Prototype based rating system, allowing you to easily create all kinds of rating boxes using just one image. Additionally, you can use Script.aculo.us to add effects.

The Starbox rating system is a new interactive feature which allows users to submit their own rating towards a particular subject. This system is ideal for a majority of websites who wish to include a rating system, which promotes the interactivity and feedback of users. The Starbox rating system is particularly useful for websites such as Amazon, where people can write their own review based on an item.

Starbox is not the first rating system to be created for Prototype and there are other more mature choices available on Scripteka including Rater 2.0, which allows for more customisation of the rating control but has larger overheads. You might also want to check out Control.Rating, especially if you are using other components of Control Suite from LivePipe. Personally, I like the look of Starbox and if it is as simple to use, cleanly coded and well defined as Prototip it will be my rating system of choice if I ever find the need to use one.

I recommend subscribing to the Scripteka feed, as I am sure it will become a valuable resource when looking for new extensions based on Prototype.

For downloads, interactive demos and more, see Starbox by Nick Stakenburg.

11
Nov

Prototip 1.1.0 Final Released

Prototip 1.1.0 Final has now been released. Prototip 1.1.0 is now guaranteed to work with the final version of Prototype 1.6.0 and extra values for the hooking property have been added since the preview release.

The hooking property takes a few extra values now, allowing you to hook tips to the: topMiddle; bottomMiddle; leftMiddle; and rightMiddle of elements.

All those using the preview release should upgrade to ensure full compatibility with Prototype.

More details can be found at Prototip 1.1.0 Final by Nick Stakenburg.

Don’t forget to rate Prototip as your favourite Prototype based tooltip library on Scripteka!

08
Nov

Scripteka, Prototype 1.6 and Scriptaculous 1.8 Released!

Prototype 1.6.0 Final has now been released on the same day as Scriptaculous 1.8.0.

In a previous post about Prototype 1.6.0 RC1, I discussed many of the improvements this release will bring. Prototype 1.6.0 is the most significant release in over two years bringing a completely rewritten Class API, new enchancements to the DOM API and more.

Scriptaculous 1.8.0 was also released on the same day and is fully compatible with Prototype 1.6.0 final. The latest version brings many performance improvements and bug fixes and a few new features, including support for playing .mp3 sounds! Future releases of Scriptaculous 1.x will be bug releases only. A preview version of Scriptaculous 2.0 is expected soon!

Prototip 1.1.0 is expected to be released shortly after the final release of Prototype 1.6.0.

There is also a fantastic new website which recently went live called Scripteka. Scripteka is a site that many users of prototype have been waiting for, a central resource for all libraires, extensions and add-ons created using the prototype framework. It features a full rating system and tagging. Scripteka is itself an application built with prototype.

See the full post on the release of Prototype 1.6.0 for more info.

See the full post on the release of Scriptaculous 1.8.0 for more info.

Prototip can be found at Nick Stakenburg’s Prototip site.

29
Oct

Prototip 1.1.0 preview

In a short follow up to my last post on Prototype 1.6.0 RC1, Nick Stakenburg has just released a preview version of the latest Prototip.

For those who don’t know, Prototip is a tooltip library which allows you to create custom styled tooltips. Prototip is based on the Prototype Javascript Library.

Prototip 1.1.0 is completely rewritten and refactored using the new features and improvements of Prototype 1.6.

New features in this release include:

  • Persistant tooltips: Allowing you to keep tooltips open and customise how you close them with mouse events and close buttons.
  • Opening delay: Specify an amount of time before the tooltip is opened. By default tooltips have a small delay to prevent accidental opening of tooltips when navigating a page.
  • New CSS model: Giving you even more control over tooltip style.

Since the final version of Prototype 1.6 is not yet released, Prototip 1.1.0 was released as a preview. Both the final versions of Prototype 1.6 and Prototip 1.1.0 are expected in November.

More on Prototip can be found at the Prototip site.

21
Oct

Using Prototype

With the new release of Prototype 1.6.0 just around the corner I thought it would be a good idea to highlight some of the new features of the upcoming release and go on to overviewing a couple of libraries built on Prototype that I have recently found very useful.

Prototype 1.6.0 final is due to be released in early November 2007 and brings with it some fairly major changes to existing API’s as well as a few new features. Prototype 1.6.0 is not expceted to be compatible with earlier versions.

Prototype 1.6.0

There have been many changes to the Event API, in particular:

  • The event object has been brought more into line with the W3C-standard and so there won’t be as much need to make calls of the form Event.method(eventInstance).
  • Support for custom events. This is good news for building event driven AJAX applications. Custom events such as AJAX requests and responses can be handled in exactly the same way as real DOM Events.
  • Cross-Browser support for the DOMContentLoaded event means that scripts can easily be initiated whilst images are still loading.

The Class API has better support for inheritance and calling superclass methods. Go to the full tutorial on Prototype class inheritance at the Prototype site for detailed information.

There are some great looking enhancements to the DOM API, in particular:

  • Creating new elements using new Element(); – Will this see the end of the Builder.build() function in Scriptaculous? There is more about this in a post on the Prototype blog: Prototype: DOM builder.
  • Support for objects with toHTML() and toElement() methods to make it easy for an object to represent a DOM node without having to directly extend a DOM element.
  • document.viewport allows easy retrival of the viewport size and scroll offsets.

There are many more additions/improvements. Detailed information can be found at Prototype 1.6.0 RC0. Also, make sure to look at Prototype 1.6.0 RC1: Changes.

I am constantly finding new features of Prototype that I never realised existed before and it just goes to show how feature rich the framework has become. Such a rich feature set means that the framework is becoming fairly large and you should take steps to optimise the performance of sites with large javascript payloads. see the post on Combine for performance optimisation tips.

I have come across a couple of fantastic javascript libraries based on Prototype recently. Prototip and LiveValidation are two in particular which I will be using regularly in projects.

Prototip

This library allows you to create custom tooltips easily and effectively for websites and applications. You have complete control over the tooltip style and a mass of options allow you to customise them to your needs.

Demos, usage and more details can be found at Prototip by Nick Stakenburg.

LiveValidation

This is a neat client-side form validation library which is: not intrusive; coded in an object-orientated fashion; and integrates easily with existing frameworks.

The main differences between LiveValidation and most similar libraries are:

  • ‘Validation as you type’ – This gives a unique interactive feel to your forms and can be easily customised.
  • Non-intrusive. This means that you don’t need to assign markers such as class names (e.g. class=”required email”) to the input elements. Setting up the validation of form elements is completely separated from the form markup itself.

There is no built-in support for AJAX-style validation but it is straightforward to implement a new Validate method to deal with this.

Demos, usage and more details can be found at LiveValidation.

11
Sep

Improving Site Performance

In the previous article regarding web development tools I briefly mentioned the YSlow tool for FireBug. YSlow analyses the performance of web pages in terms of their size and overall load time. When you run YSlow on your page you get an overall grade from A to F which is dependent upon how the page performs. The performance is measured by 13 factors, which are individually graded.

Performance Optimisation

Whilst the 13 factors are well explained, there is no real information on how to improve the page. All you know is how well your site performs in that area aswell as getting a good description of why it is important. The lack of solutions and methods of improvement turns out to be a good thing since it drives further research into how to improve page performance.

This article focuses on a very handy, cool, simple PHP script that can drastically improve the performance of your site without much effort at all!

Combine

The script is called Combine and is written by Niels Leenheer

Basically, the script has two main aims: reducing the number of HTTP requests made per page, and reducing the size of JavaCcript and CSS files to improve page load times. The script is highly effective and is easily integrated into any existing site. The performance improvement is pretty impressive, it improved my YSlow grade drastically.

Combine does a number of things and is very well focused in its purpose. Here is a quick overview:

  • Allows you to make requests for several CSS and JavaScript files with far fewer HTTP requests.
  • Combines and compresses individual CSS/JavaScript files into one compact file.
  • Utilises advanced caching and header techniques to cover every aspect when it comes to improving page loading times.
  • Works in a way that is non-invasive – you won’t need to do anything drastic to incorporate it into your existing system.

The integration of Combine into a new or existing site is easy and you will be reaping the rewards in terms of performance improvements in no time.

Example:

without Combine the includes for my gallery page would look something like:

<!-- include external CSS files --> 
<link rel="stylesheet" type="text/css" href="/styles/layout.css" /> 
<link rel="stylesheet" type="text/css" href="/styles/styles.css" /> 
<link rel="stylesheet" type="text/css" href="/styles/navigation.css" /> 
<link rel="stylesheet" type="text/css" href="/styles/banners.css" /> 
<link rel="stylesheet" type="text/css" href="/styles/features.css" />   

<link rel="stylesheet" type="text/css" href="/styles/print.css"  /> 
<link rel="stylesheet" type="text/css" href="/styles/geshi.css" /> 
<!-- include JavaScript required for gallery --> 
<script type="text/javascript" src="/script/lib/effects.js"></script> 
<script type="text/javascript" src="/script/lib/builder.js"></script> 
<script type="text/javascript" src="/script/imgRoll/roller.js"></script> 
<script type="text/javascript" src="/script/imgView/viewer.js"></script>

With Combine this becomes:

<!-- include external CSS files--> 
<link rel="stylesheet" type="text/css" href="/styles/layout.css,styles.css,navigation.css,banners.css, 
                       features.css,print.css,geshi.css" /> 
<!-- include JavaScript required for gallery --> 
<script type="text/javascript" 
src="/script/lib/effects.js,lib/builder.js,imgRoll/roller.js,imgView/viewer.js"></script>

As you can see in the Combine version, the files you wish to include are just separated by commas. This reduces the amount of markup, the number of HTTP requests made and the size of the HTTP requests (since Combine compresses files using GZip). Combine will cache the combined files so that server side processing time is also reduced on subsequent requests. Combine allows you to keep your files well structured without having to worry about making too many HTTP requests!

Conclusion

Overall, Combine provides a huge performance improvement for most pages whilst being easy to integrate into existing systems. The purpose of Combine is well defined and it doesn’t try to do more than is needed.

For detailed information see the Combine page on Rakaz.