Blog

Toolkat v.0.3.1

2010-04-29 00:00:00

Toolkat version 0.3.1 is now available for download from:
http://code.google.com/p/toolkat/downloads/list

Toolkat is an open source, object-oriented web application toolkit implemented in the haXe language. It compiles to both PHP5 and NekoVM and is licensed under the New BSD License. Toolkat is designed for rapid deployment of lightweight, standards-driven and scalable web applications; to implement web development best practices and provide components for common functionality.

Installation instructions (also included in the zip file):
http://217.70.39.109/toolkat/install.html

A test installation (Linux) + the demo-application is running on:

NekoVM version: http://217.70.39.109/toolkat/
PHP version: http://217.70.39.109/toolkat/www/

(This is the same application as the one included in the zip-file.)

haXe/NekoVM can be installed using the automatic installers available from: http://haxe.org/download

Tutorials, API documentation and Wiki pages are coming soon!


Tell if a checkbox is checked with jQuery

2010-04-10 00:00:00

if ($('#checkbox').attr('checked')) {
    // do something
}

Was it really that simple?

View all 6 comments

Abstract classes/methods in haXe

2010-04-08 00:00:00

The only feature I currently miss in haXe is support for abstract classes and methods. Fortunately this is not really a limitation per se; there are several ways to achieve similar results using exceptions. Not exactly the same however, since an attempt to instantiate the abstract class will not generate a compile time error – which is pretty much the whole idea, some would argue. Nevertheless, using the following solution, making the constructor private + performing a type check on the instantiating object (only inhereted classes may be instantiated) is a common workaround:

/* abstract */ class AbstractUser
{
 
   private function new():Void
   {
	if (Type.class(this) == AbstractUser) {
	     throw "Abstract class, no instantiation";
	}
 
	//
   }
 
}
 
class User extends AbstractUser
{
 
   public function new():Void
   {
      super(); 
   }
 
}
 
var user:User = new User();	// works
 
// The following will not work, throws exception
var aUser:AbstractUser = new AbstractUser();

In a similar way, abstract methods can simply throw an exception when called. Again, if there was built-in support for the abstract keyword, the compiler would make sure that classes extending the abstract also fulfill any abstract methods declared by the superclass.

   /* abstract */ public function isAdmin():Bool
   {
	throw "Abstract method";
   }

Abstract methods are typically used when defining an abstract class that implements an interface, but leaves out actual implementation of some of its methods to the concrete class. In Java and PHP, only abstract classes are allowed to contain abstract methods.

I hope that in the future haXe will have native support for abstract classes and methods, as well.


HTML5 is coming

2010-04-07 00:00:00

HTML5 is just around the corner and although the specification is not expected to reach official W3C recommendation status until the year 2022(!), or even later; (source: http://en.wikipedia.org/wiki/HTML5) some several HTML5 specific tags are already natively supported by the latest builds of some popular browsers; including Chrome, Safari, Firefox and Opera.

Differences from HTML 4.01 and XHTML 1.x:

  • New parsing rules oriented towards flexible parsing and compatibility; not based on SGML
  • Ability to use inline SVG and MathML in text/html
  • New elements – article, aside, audio, canvas, command, details, datalist, dialog, embed, figure, figcaption, footer, header, hgroup, keygen, mark, meter, nav, progress, output, rp, rt, ruby, section, source, summary, time, video
  • New types of form controls – dates and times, email, url, search
  • New attributes – ping (on a and area), charset (on meta), async (on script)
  • Global attributes (that can be applied for every element) – id, tabindex, hidden, data-* (custom data attributes)
  • Forms will get support for PUT and DELETE methods too instead of just GET and POST (Representational State Transfer)
  • Deprecated elements dropped – center, font, frameset, strike

Some additional resources:

HTML5 defines over a dozen new input types that you can use in your forms:
http://www.diveintohtml5.org/forms.html

The <video> tag:
https://developer.mozilla.org/En/HTML/Element/Video

HTML5 presentations:
http://www.labnol.org/internet/html5-presentations/10587

List of new elements:
http://www.w3.org/TR/2008/WD-html5-diff-20080122/#new-elements

View all 9 comments

Columns, CSS3 style

2010-04-07 00:00:00

Here is how easy CSS3 makes it to create multi-column layouts:

p {
    -moz-column-count: 3;
    -moz-column-gap: 1.5em;
    -moz-column-rule: 1px solid #c4c8cc;
    -webkit-column-count: 3;
    -webkit-column-gap: 1.5em;
    -webkit-column-rule: 1px solid #c4c8cc;
}

The result:

Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.

Some other, interesting new CSS3 features:

Transformations:
http://www.zenelements.com/blog/css3-transform

RGBA colors (opacity):
http://www.zenelements.com/blog/css3-rgb-rgba-color-opacity


Web development with haXe

2010-03-25 00:00:00

haXe is a web oriented universal language (pronounced [hex], but apparently some say [hacks] according to Wikipedia), designed for creating interactive web applications. While most other languages are bound to their own platform (Java to the JVM, C# to .Net, ActionScript to the Flash Player), haXe is a multiplatform language. Currently there are five official compiler targets: Adobe Flash, JavaScript, PHP, C++ Source Files and the Neko VM.

The language is just like ActionScript and JavaScript, based on the ECMAScript standard. It is a general-purpose, object-oriented language with Java-like exception handling, type inference and class parameters. Generic classes, reflectivity, iterators, and functional programming features are also built-in functionality of the language and its libraries.

The syntax is "not much news under the sun" for anyone familiar with Java, ActionScript, JavaScript or even C/C++. And this is not a bad thing, since the whole idea behind haXe is to unite all web development technologies under one and the same syntax.

There is also an excellent book called "Professional haXe and Neko," written by Franco Ponticelli and Lee McColl-Sylvester. It covers more or less everything related to haXe, from detailed installation instructions, the compiler, language syntax and features in detail, to the different libraries available and advanced topics like building desktop applications and extending the language; and lots, lots more.

Check out the official haXe website for more.


The Tristar Carousel

2010-03-12 00:00:00

The Tristar Carousel is a customizable, lightweight (38 kb) Flash image gallery carousel, licensed under the New BSD License. Customizable options include camera angle/position, auto-rotation, motion blur and distance fading.

The carousel is available for download from:
http://www.tristarafrica.com/node/projects/the-tristar-carousel

Check out the demo at:
http://www.tristarafrica.com/public/carousel