all repos — h3rald @ f36e3360c8c6f1efe18b99bb779920ecc18c6a67

The sources of https://h3rald.com

Updated content + generated tag pages.
h3rald h3rald@h3rald.com
Mon, 10 Aug 2009 11:20:15 +0200
commit

f36e3360c8c6f1efe18b99bb779920ecc18c6a67

parent

19e4a5e256c7bbd728825af8bd1f16b7abbb9137

69 files changed, 3061 insertions(+), 2755 deletions(-)

jump to
M content/articles/11.textilecontent/articles/11.textile

@@ -8,46 +8,45 @@

date: 2006-04-11 17:03:00 +02:00 tags: - cakephp -- blogging type: article toc: true ----- -I should write more. I noticed that I since I decided to take a break from "zZine Magazine":http:www.zzine.org I more or less stopped writing - and started _baking_ again with "CakePHP":http://www.cakephp.org/. As a result I finally recoded this website and _refreshed_ a little bit my almost-rusty baking skills. - -!<http://base--/img/pictures/cakephp.png! - -Why not taking advantage of this and write more about CakePHP then? After all, my last "article":http://base--/articles/view/cakephp/ turned out well enough and some people even bookmarked it online on del.icio.us and ma.gnolia... Now it's a bit out of date, I must admit: it was based on a pre-beta release of the framework, and we're (more or less) stable now. -A lot of things changed in the Bakers Community since then! At the time the "wiki":http://wiki.cakephp.org/ barely started and there was no "manual":http://manual.cakephp.org/ whatsoever, only my long and perhaps _slightly_ boring article describing Cake's functionalities. Now there things are much better for newcomers: they have a continuously growing community to rely upon, both on the Google user group and on IRC (#cakephp on FreeNode counted 63 members today, while back in the day 20 was a big number). There are also a few people who started blogging and starting websites about CakePHP: while I was the first to write an article about Cake I was _the last_ so far to start a blog :/ Oh well, nobody's perfect! - -The first site I came across - although not a blog really - is Graham Bird's "Cake for Beginners":http://grahambird.co.uk/cake/. When someone asks me some basic questions about CakePHP I send him there because first of all they'll find a short FAQ about the framework, i.e. something everybody should know before even start thinking about learning Cake. Similarly, the guy has a "Glossary":http://grahambird.co.uk/cake/glossary/ in progress to help those souls who feel lost in Cake's terminology. If you don't consider yourself a total beginner anymore, the "Tutorials":http://grahambird.co.uk/cake/tutorials/ section can be a very interesting read: I wanted to add some AJAX bits to my site, but the documentation about this seemed pretty scarce, so I headed to the "Ajax Task List":http://grahambird.co.uk/cake/tutorials/ajax.php tutorial and it really helped. - -On the blogs front, on the other hand, "Cake Baker":http://cakebaker.42dh.com/ seems to be the most active: I'm starting to check this one often (OK, I'd better subscribe to the RSS feeds, perhaps) because it seems to be THE best place to get the latest news about everything concerning CakePHP: The author seems to post quite frequently (there's always a new post every 1-3 days maximum) includes short code snippets when necessary and report news when there's anything to report. - -"Sentino":http://sentino.wordpress.com/ is also an interesting place to learn new things about CakePHP: the only problem is that the author seems to post less frequently... the blog seems to have some sort of "milestone" schedule, publishing something when there's something big enough to justify a post. If you want to subscribe to a less frequent blog with only the essentials about Cake, this is a good choice. - -"RosSoft":http://rossoft.wordpress.com/ unlike the others mentioned up to now has a much more technical approach: no news about Cake or anything, just some REALLY useful real-world example of Cake helpers, components etc. etc., with FULL source code to cut and paste. Really handy if you need something specific, truly excellent for beginners to have a look at how Cake classes should be written. -Among the most interesting fully working snippets: -"IP-to-country component":http://rossoft.wordpress.com/2006/03/29/ip-to-country-component-geo-location/ -"Poor man's cron component":http://rossoft.wordpress.com/2006/03/27/poor-mans-cron-component/ -"Image Auth - CAPTCHA component":http://rossoft.wordpress.com/2006/03/16/image-auth-component/ - -!>http://xcite-online.de/spliceit/themes/SpliceIt/logo.png! - -"ThinkingPHP":http://www.thinkingphp.org/ is another "technical" Cake blog, with interesting code snippets and thoughts about our favourite PHP framework. For those who don't know or don't remember him (yes, like me...), he's the author of "SpliceIt!":http://xcite-online.de/spliceit/... what? - -bq. SpliceIt!'s mission is to provide a clean and light-weight code base for people who want to create complex webapps faster then ever. The things we want to provide are: - - User/Right Managment - - Theming Support - - i18n - - Url Aliasing - - and most notabily: Modularization of often used Code Segments - -i.e. something I should have checked before recoding this website. I'll definitely keep this in mind for the next release of h3rald.com. - -!<http://rdos.rd11.com/img/rd11/rdlogo.gif! - -"Posts@ rd11":http://rd11.com/posts a.k.a. gwoo [and seth]'s blog. Moment of silence. Gwoo is CakePHP's project manager (respect+) and one of the lead developers of CakePHP and he also actually uses Cake for his website and blog instead of WordPress :) -What can I write about him. It's difficult. I'll avoid all possible pseudo-religious comparisons but when I say that _he created CakePHP_ I think I say it all. The code he used for his blog is part of a collection of open-source, Cake-powered tools all prefixed with rd- or Cake, available on "CakeForge":https://cakeforge.org/projects/rdos. I personally think that looking at his sample applications can be one of the best way to learn how to bake _properly_, and yes, I *did* check them out before coding this site for the second time. Demos are "online":http://rdos.rd11.com/. - -That's it. These are perhaps the most well-known bakers and/or Cake bloggers on the planet. There are certainly others, maybe even in other languages, but now I'd better stop writing now, because this is a rather long blog post. Sorry. I'm new to blogging and I just can't help myself: especially with Cake, I need to write lenghty texts! +I should write more. I noticed that I since I decided to take a break from "zZine Magazine":http:www.zzine.org I more or less stopped writing - and started _baking_ again with "CakePHP":http://www.cakephp.org/. As a result I finally recoded this website and _refreshed_ a little bit my almost-rusty baking skills. + +!<http://base--/img/pictures/cakephp.png! + +Why not taking advantage of this and write more about CakePHP then? After all, my last "article":http://base--/articles/view/cakephp/ turned out well enough and some people even bookmarked it online on del.icio.us and ma.gnolia... Now it's a bit out of date, I must admit: it was based on a pre-beta release of the framework, and we're (more or less) stable now. +A lot of things changed in the Bakers Community since then! At the time the "wiki":http://wiki.cakephp.org/ barely started and there was no "manual":http://manual.cakephp.org/ whatsoever, only my long and perhaps _slightly_ boring article describing Cake's functionalities. Now there things are much better for newcomers: they have a continuously growing community to rely upon, both on the Google user group and on IRC (#cakephp on FreeNode counted 63 members today, while back in the day 20 was a big number). There are also a few people who started blogging and starting websites about CakePHP: while I was the first to write an article about Cake I was _the last_ so far to start a blog :/ Oh well, nobody's perfect! + +The first site I came across - although not a blog really - is Graham Bird's "Cake for Beginners":http://grahambird.co.uk/cake/. When someone asks me some basic questions about CakePHP I send him there because first of all they'll find a short FAQ about the framework, i.e. something everybody should know before even start thinking about learning Cake. Similarly, the guy has a "Glossary":http://grahambird.co.uk/cake/glossary/ in progress to help those souls who feel lost in Cake's terminology. If you don't consider yourself a total beginner anymore, the "Tutorials":http://grahambird.co.uk/cake/tutorials/ section can be a very interesting read: I wanted to add some AJAX bits to my site, but the documentation about this seemed pretty scarce, so I headed to the "Ajax Task List":http://grahambird.co.uk/cake/tutorials/ajax.php tutorial and it really helped. + +On the blogs front, on the other hand, "Cake Baker":http://cakebaker.42dh.com/ seems to be the most active: I'm starting to check this one often (OK, I'd better subscribe to the RSS feeds, perhaps) because it seems to be THE best place to get the latest news about everything concerning CakePHP: The author seems to post quite frequently (there's always a new post every 1-3 days maximum) includes short code snippets when necessary and report news when there's anything to report. + +"Sentino":http://sentino.wordpress.com/ is also an interesting place to learn new things about CakePHP: the only problem is that the author seems to post less frequently... the blog seems to have some sort of "milestone" schedule, publishing something when there's something big enough to justify a post. If you want to subscribe to a less frequent blog with only the essentials about Cake, this is a good choice. + +"RosSoft":http://rossoft.wordpress.com/ unlike the others mentioned up to now has a much more technical approach: no news about Cake or anything, just some REALLY useful real-world example of Cake helpers, components etc. etc., with FULL source code to cut and paste. Really handy if you need something specific, truly excellent for beginners to have a look at how Cake classes should be written. +Among the most interesting fully working snippets: +"IP-to-country component":http://rossoft.wordpress.com/2006/03/29/ip-to-country-component-geo-location/ +"Poor man's cron component":http://rossoft.wordpress.com/2006/03/27/poor-mans-cron-component/ +"Image Auth - CAPTCHA component":http://rossoft.wordpress.com/2006/03/16/image-auth-component/ + +!>http://xcite-online.de/spliceit/themes/SpliceIt/logo.png! + +"ThinkingPHP":http://www.thinkingphp.org/ is another "technical" Cake blog, with interesting code snippets and thoughts about our favourite PHP framework. For those who don't know or don't remember him (yes, like me...), he's the author of "SpliceIt!":http://xcite-online.de/spliceit/... what? + +bq. SpliceIt!'s mission is to provide a clean and light-weight code base for people who want to create complex webapps faster then ever. The things we want to provide are: + - User/Right Managment + - Theming Support + - i18n + - Url Aliasing + - and most notabily: Modularization of often used Code Segments + +i.e. something I should have checked before recoding this website. I'll definitely keep this in mind for the next release of h3rald.com. + +!<http://rdos.rd11.com/img/rd11/rdlogo.gif! + +"Posts@ rd11":http://rd11.com/posts a.k.a. gwoo [and seth]'s blog. Moment of silence. Gwoo is CakePHP's project manager (respect+) and one of the lead developers of CakePHP and he also actually uses Cake for his website and blog instead of WordPress :) +What can I write about him. It's difficult. I'll avoid all possible pseudo-religious comparisons but when I say that _he created CakePHP_ I think I say it all. The code he used for his blog is part of a collection of open-source, Cake-powered tools all prefixed with rd- or Cake, available on "CakeForge":https://cakeforge.org/projects/rdos. I personally think that looking at his sample applications can be one of the best way to learn how to bake _properly_, and yes, I *did* check them out before coding this site for the second time. Demos are "online":http://rdos.rd11.com/. + +That's it. These are perhaps the most well-known bakers and/or Cake bloggers on the planet. There are certainly others, maybe even in other languages, but now I'd better stop writing now, because this is a rather long blog post. Sorry. I'm new to blogging and I just can't help myself: especially with Cake, I need to write lenghty texts! More to come...
M content/articles/14.textilecontent/articles/14.textile

@@ -8,49 +8,49 @@

date: 2006-04-14 09:55:00 +02:00 tags: - cakephp -- web-development +- webdevelopment - php type: article toc: true ----- -When I first talked to gwoo, CakePHP's project manager, I asked him if Cake had any potential _limitations_. I asked him - I was kidding actually - wether it would be possible to build an application like Gmail using the framework and he - very seriously - simply said _"yes, why not?"_. -I repeat myself when I say that CakePHP leaves plenty of freedom to developers within the bounds of its MVC structure: once you grasp the basic logic behind it, your possibilities are endless. I don't want to act as a Ruby on Rails fanatic and boast that _you can do anything with CakePHP_ and things like that, but I can certainly say that CakePHP can be _extended_ and _integrated_ with other collections of scripts, frameworks and projects. With limitations, of course: you probably don't want to force an integration between CakePHP and another MVC/Event Driven/Whatever framework, simply because it would be rather pointless and potential conflicts may occur. - -What I keep finding online is other open source projects adopting CakePHP as _backend_ and _structure_. I'm sure there are many examples which could be mentioned here, but I chose two in particular: one has been around for a few months and the other is just born. - -!<http://base--/img/pictures/amfphp.jpg! - -"AMFPHP":http://amfphp.org/ is quite an interesting project: - -bq. "[it] is an open-source Flash Remoting gateway. It's fast, reliable, 100% free and open-source. Flash Remoting is a technology built into the Flash player core that enables sending data between the server and the client seemlessly." - -In other words, it makes lifes much easier for developers who'd like to integrate their flash animations and script more tightly into their PHP application. If you are curious to see some results, head off to AMFPHP "showcase":http://amfphp.org/showcase.html. -Cool, but what has this project to do with CakePHP? Well, gwoo recently created "CakeAMFPHP":http://cakeforge.org/projects/cakeamfphp/, a CakeForge project which just yesterday reached its "0.4.0 release":http://rd11.com/posts/view/21, and it's fully compatible with AMFPHP 1.2.3 and CakePHP 0.10 final. -Here's an excerpt taken from CakeAMFPHP README.txt file: - -bq. "[...] -1) get CakePHP 0.10 final (http://cakephp.org) -2) get amfphp 1.2.3 (http://amfphp.org) -3) get the UFO js http://www.bobbyvandersluis.com/ufo/ -4) put amfphp into /app/vendors -5) put cakeamfphp into vendors -6) put the cake_gateway.php in /app/webroot -7) put the cakeamfphp.php in /app/views/helpers -8) put CakeMySqlAdpater.php in /app/vendors/amfphp-core/adapters -9) Voila: NetServices.setDefaultGatewayUrl( 'http://localhost/cake_install/cake_gateway.php'); -Access the service browser through -http://localhost/cake_install/vendors/cakeamfphp/cakebrowser/" - -The installation doesn't seem too painful at all. And - guess what - gwoo recently updated a very informative tutorial showing how to create a simple - but still impressive - bullettin board with CakeAMFPHP. - -_"Cool, but I never liked flash, what about AJAX?"_ - -!<http://base--/img/pictures/qooxdoo.gif! - -CakePHP has a nice AJAX helper to be used in conjunction with "prototype":http://prototype.conio.net/, but there are truly a lot of libraries, mini-frameworks, pre-built applications to create interactive desktop-like user interfaces. Some people may already know "qooxdoo":http://qooxdoo.oss.schlund.de/, - -bq. "[...] an advanced open-source JavaScript-based GUI toolkit. qooxdoo continues where simple HTML is not enough. This way qooxdoo can help you implement your AJAX-enhanced web 2.0 application - easier than ever before." - -In a recent "discussion":http://groups.google.com/group/cake-php/browse_thread/thread/ba219c64cd794764/1d77973293514618?lnk=raot on CakePHP user group someone suggested the possibility to integrate qooxdoo with CakePHP. Apparently qooxdoo people were "evaluating":http://www.nabble.com/Re%3A-qooxdoo-PHP-framework-project-p3799302.html various MVC frameworks, and Cake was obviously listed together with two other Rails clones for PHP. The good news is that "100rk":http://cakeforge.org/users/a100rk/ just started a new project called "CQX":http://cakeforge.org/projects/cqx, which - although still in pre-alpha a development demo is already available, and it _shows off_ most of qooxdoo's features... "Take a look":http://cqx.100rk.org/trunk/ - +When I first talked to gwoo, CakePHP's project manager, I asked him if Cake had any potential _limitations_. I asked him - I was kidding actually - wether it would be possible to build an application like Gmail using the framework and he - very seriously - simply said _"yes, why not?"_. +I repeat myself when I say that CakePHP leaves plenty of freedom to developers within the bounds of its MVC structure: once you grasp the basic logic behind it, your possibilities are endless. I don't want to act as a Ruby on Rails fanatic and boast that _you can do anything with CakePHP_ and things like that, but I can certainly say that CakePHP can be _extended_ and _integrated_ with other collections of scripts, frameworks and projects. With limitations, of course: you probably don't want to force an integration between CakePHP and another MVC/Event Driven/Whatever framework, simply because it would be rather pointless and potential conflicts may occur. + +What I keep finding online is other open source projects adopting CakePHP as _backend_ and _structure_. I'm sure there are many examples which could be mentioned here, but I chose two in particular: one has been around for a few months and the other is just born. + +!<http://base--/img/pictures/amfphp.jpg! + +"AMFPHP":http://amfphp.org/ is quite an interesting project: + +bq. "[it] is an open-source Flash Remoting gateway. It's fast, reliable, 100% free and open-source. Flash Remoting is a technology built into the Flash player core that enables sending data between the server and the client seemlessly." + +In other words, it makes lifes much easier for developers who'd like to integrate their flash animations and script more tightly into their PHP application. If you are curious to see some results, head off to AMFPHP "showcase":http://amfphp.org/showcase.html. +Cool, but what has this project to do with CakePHP? Well, gwoo recently created "CakeAMFPHP":http://cakeforge.org/projects/cakeamfphp/, a CakeForge project which just yesterday reached its "0.4.0 release":http://rd11.com/posts/view/21, and it's fully compatible with AMFPHP 1.2.3 and CakePHP 0.10 final. +Here's an excerpt taken from CakeAMFPHP README.txt file: + +bq. "[...] +1) get CakePHP 0.10 final (http://cakephp.org) +2) get amfphp 1.2.3 (http://amfphp.org) +3) get the UFO js http://www.bobbyvandersluis.com/ufo/ +4) put amfphp into /app/vendors +5) put cakeamfphp into vendors +6) put the cake_gateway.php in /app/webroot +7) put the cakeamfphp.php in /app/views/helpers +8) put CakeMySqlAdpater.php in /app/vendors/amfphp-core/adapters +9) Voila: NetServices.setDefaultGatewayUrl( 'http://localhost/cake_install/cake_gateway.php'); +Access the service browser through +http://localhost/cake_install/vendors/cakeamfphp/cakebrowser/" + +The installation doesn't seem too painful at all. And - guess what - gwoo recently updated a very informative tutorial showing how to create a simple - but still impressive - bullettin board with CakeAMFPHP. + +_"Cool, but I never liked flash, what about AJAX?"_ + +!<http://base--/img/pictures/qooxdoo.gif! + +CakePHP has a nice AJAX helper to be used in conjunction with "prototype":http://prototype.conio.net/, but there are truly a lot of libraries, mini-frameworks, pre-built applications to create interactive desktop-like user interfaces. Some people may already know "qooxdoo":http://qooxdoo.oss.schlund.de/, + +bq. "[...] an advanced open-source JavaScript-based GUI toolkit. qooxdoo continues where simple HTML is not enough. This way qooxdoo can help you implement your AJAX-enhanced web 2.0 application - easier than ever before." + +In a recent "discussion":http://groups.google.com/group/cake-php/browse_thread/thread/ba219c64cd794764/1d77973293514618?lnk=raot on CakePHP user group someone suggested the possibility to integrate qooxdoo with CakePHP. Apparently qooxdoo people were "evaluating":http://www.nabble.com/Re%3A-qooxdoo-PHP-framework-project-p3799302.html various MVC frameworks, and Cake was obviously listed together with two other Rails clones for PHP. The good news is that "100rk":http://cakeforge.org/users/a100rk/ just started a new project called "CQX":http://cakeforge.org/projects/cqx, which - although still in pre-alpha a development demo is already available, and it _shows off_ most of qooxdoo's features... "Take a look":http://cqx.100rk.org/trunk/ + Best of luck to 100rk and his brand new project, I really hope to see more of it soon!
M content/articles/15.textilecontent/articles/15.textile

@@ -8,74 +8,74 @@

date: 2006-04-15 15:15:00 +02:00 tags: - cakephp -- web-development +- webdevelopment type: article toc: true ----- -_"CakePHP will officially support Internationalization (i18n) from version 2.0"_. That is to say: not right now. That doesn't mean we have to wait, no chance! I'm Italian and there are plenty of bakers speaking a language other than English who might want to develop a multi-lingual website. - -I did, "once":http://v60.h3rald.com/, and the final result wasn't too bad in the end: every page of the site (except the articles) could be translated into Italian. Before examining my solution (which is far from optimal) I'd like to mention an excellent CakePHP package which allows basic (mostly statuc) i18n. -It looks like I missed an important baker in my recent "blog post":http://base--/blog/view/11: "Andy Dawson":http://www.noswad.me.uk/, creator - among other things - of the "Locale Package":http://cakeforge.org/snippet/detail.php?type=package&id=2, available at CakeForge. His solution actually came out after H3RALD.com v60 was already developed so I didn't use it for my own site. -At a first glance Andy's solution truly solves basic l18n problems in an elegant way: the most important code snippet is the "Locale Component":http://cakeforge.org/snippet/download.php?type=snippet&id=74 which provides the following functionalities: - -* automatic language detection based on browser's UserAgent string -* loading of locale files -* setting of customizeable (translated) messages - -The getString() method provided in the locale component is actually used through the double underscore function, which is already defined (but not yet implemented) in the standard CakePHP file @cake/basics.php@ (yes, this is a small core hack). Andy's double underscore function can take five parameters: - -bc. function __($msgId, $MessageArgs=NULL, $capitalize=1, $punctuate=0,$Code=NULL) -{ - require_once(COMPONENTS.'locale.php'); - $Locale = LocaleComponent::getInstance(); - return $Locale->getString( $msgId, $MessageArgs, $capitalize, $punctuate, $Code ); -} - - -These parameters are: - -* a "message id" or the message itself -* some parameters which can be passed to the message -* the message's capitalization: -** 0 = no change -** 1 = first letter of first word -** 2 = fist character of all words -* the message's punctuation: -** 0 = "" -** 1 = . -** 2 = ! -** 3 = ? -* the language code, if you need to override your page's language - -This is a convenient method which can be used everywhere, both in your controllers and in your views, to translate simple pre-stored messages. Where are those messages stored? In various locale files which must be placed in @app/controllers/components/messages/@ and look like this: - -bc. $messages = Array ( - 'LocaleSetTo'=>"Site locale set to UK English", - 'LocaleChangeTo'=>"Change site locale to UK English", - // Time related messages - 'ago' => "%s ago", - 'ages' => "a long time ago (%s)", -) - - -The locale package also comes with a _Language Controller_ you can use to handle language changes, and a useful rewrite of the _Time Helper_. Andy recently updated his "i18n tutorial":http://wiki.cakephp.org/tutorials:i18n available on CakePHP Wiki, a very interesting read on how to quickly add i18n support to yout first Cake blog (yes, the one described in the "Blog Tutorial":http://wiki.cakephp.org/tutorials:blog_tutorial_-_1). - -So far so good. The Locale Package provide some basic multi-lingual support in an efficient way, and I'd certainly use it if I decide to (re-)develop a multi-lingual site, but unfortunately this does not fully solve the problem. -If you want *full* i18n, for sure you'd like to have all the contents of your website translated, which is - normally - dynamic and maybe stored in a database. That was the case of my old website: all the pages are dynamic, not static, so I had to think about something else. -Since I only had plans to develop a _dual_ language site, I opted for a very lazy (but yet effective) solution: each table - more or less - had "duplicate" fields, something like this: - -* id -* title_en -* title_it -* text_en -* text_it -* created -* modified - -I basically defined a global $lang variable set to "en" by default and then I accessed the record's fields (for example in views) like this: - -@echo $data['Project']['text_'.$lang]@ - -Ugly, perhaps, but did the job. The good (or bad) thing about this technique was that I could modify the contents of a project, for example, regardless of the current language: in my add/edit view, I chose to generate _all_ the fields of a table and therefore modify all the fields of a project without switching to the other language. - +_"CakePHP will officially support Internationalization (i18n) from version 2.0"_. That is to say: not right now. That doesn't mean we have to wait, no chance! I'm Italian and there are plenty of bakers speaking a language other than English who might want to develop a multi-lingual website. + +I did, "once":http://v60.h3rald.com/, and the final result wasn't too bad in the end: every page of the site (except the articles) could be translated into Italian. Before examining my solution (which is far from optimal) I'd like to mention an excellent CakePHP package which allows basic (mostly statuc) i18n. +It looks like I missed an important baker in my recent "blog post":http://base--/blog/view/11: "Andy Dawson":http://www.noswad.me.uk/, creator - among other things - of the "Locale Package":http://cakeforge.org/snippet/detail.php?type=package&id=2, available at CakeForge. His solution actually came out after H3RALD.com v60 was already developed so I didn't use it for my own site. +At a first glance Andy's solution truly solves basic l18n problems in an elegant way: the most important code snippet is the "Locale Component":http://cakeforge.org/snippet/download.php?type=snippet&id=74 which provides the following functionalities: + +* automatic language detection based on browser's UserAgent string +* loading of locale files +* setting of customizeable (translated) messages + +The getString() method provided in the locale component is actually used through the double underscore function, which is already defined (but not yet implemented) in the standard CakePHP file @cake/basics.php@ (yes, this is a small core hack). Andy's double underscore function can take five parameters: + +bc. function __($msgId, $MessageArgs=NULL, $capitalize=1, $punctuate=0,$Code=NULL) +{ + require_once(COMPONENTS.'locale.php'); + $Locale = LocaleComponent::getInstance(); + return $Locale->getString( $msgId, $MessageArgs, $capitalize, $punctuate, $Code ); +} + + +These parameters are: + +* a "message id" or the message itself +* some parameters which can be passed to the message +* the message's capitalization: +** 0 = no change +** 1 = first letter of first word +** 2 = fist character of all words +* the message's punctuation: +** 0 = "" +** 1 = . +** 2 = ! +** 3 = ? +* the language code, if you need to override your page's language + +This is a convenient method which can be used everywhere, both in your controllers and in your views, to translate simple pre-stored messages. Where are those messages stored? In various locale files which must be placed in @app/controllers/components/messages/@ and look like this: + +bc. $messages = Array ( + 'LocaleSetTo'=>"Site locale set to UK English", + 'LocaleChangeTo'=>"Change site locale to UK English", + // Time related messages + 'ago' => "%s ago", + 'ages' => "a long time ago (%s)", +) + + +The locale package also comes with a _Language Controller_ you can use to handle language changes, and a useful rewrite of the _Time Helper_. Andy recently updated his "i18n tutorial":http://wiki.cakephp.org/tutorials:i18n available on CakePHP Wiki, a very interesting read on how to quickly add i18n support to yout first Cake blog (yes, the one described in the "Blog Tutorial":http://wiki.cakephp.org/tutorials:blog_tutorial_-_1). + +So far so good. The Locale Package provide some basic multi-lingual support in an efficient way, and I'd certainly use it if I decide to (re-)develop a multi-lingual site, but unfortunately this does not fully solve the problem. +If you want *full* i18n, for sure you'd like to have all the contents of your website translated, which is - normally - dynamic and maybe stored in a database. That was the case of my old website: all the pages are dynamic, not static, so I had to think about something else. +Since I only had plans to develop a _dual_ language site, I opted for a very lazy (but yet effective) solution: each table - more or less - had "duplicate" fields, something like this: + +* id +* title_en +* title_it +* text_en +* text_it +* created +* modified + +I basically defined a global $lang variable set to "en" by default and then I accessed the record's fields (for example in views) like this: + +@echo $data['Project']['text_'.$lang]@ + +Ugly, perhaps, but did the job. The good (or bad) thing about this technique was that I could modify the contents of a project, for example, regardless of the current language: in my add/edit view, I chose to generate _all_ the fields of a table and therefore modify all the fields of a project without switching to the other language. + How will Cake support locales? Will we have "localized" database tables (and models?) Only time will tell...
M content/articles/16.textilecontent/articles/16.textile

@@ -8,33 +8,33 @@

date: 2006-04-17 07:30:00 +02:00 tags: - cakephp -- web-development +- webdevelopment - databases type: article toc: true ----- -One of the most recurring questions on CakePHP User Group is probably _"Does Cake support X database?"_. Sure, most of us tend to use just MySQL for our websites and applications, but in certain situations some more _exotic_ database support makes the difference. A partial answer to the question above could be _"Yes, probably, at least partially"_: CakePHP offers support for some database "natively" (i.e. Cake folks made some _ad hoc_ database drivers), others through either "ADOdb":http://adodb.sourceforge.net/ or "PEAR::DB":http://pear.php.net/package/DB. - -CakePHP seems to use a _multiple level_ database abstraction: in other words, popular abstraction layers like ADOdb or PEAR::DB have been wrapped in a "driver" which basically extends the DboSource class (which is the most high level database abstraction). Some people don't like the idea, because this means that the could be some performance issues, for one, and also that inevitably not _all_ features offered by either ADOdb or PEAR::DB are used. In my very, very, very modest opinion (I'm not an expert on this matter), this solution focus on achieving good database compatibility leaving the doors open for further tinkering, if needed. - -!<http://base--/img/pictures/postgres.png! - -Having said this, yes, the possibilities are good that your favorite database is supported by CakePHP, more or less. Of course, as repeatedly pointed out by some CakePHP core developers, Cake dev team didn't and is not going to test _every_ database with Cake, using either of the two abstraction layers, but users are more than welcome to do so. - -Let's now have a look at what is _known to work_ with Cake: - -*MySQL* works fine, and is currently recommended as _preferred_ database solution. What about *MySQLi*? Well, thanks to mappleJoe there's a (PHP5 only!) "driver":http://cakephp.org/pastes/show/770e73e77e4d7a3d32c2f3de3f175512 ready to be used. - - *PostgreSQL*'s support is continuously improving. Something may work, something may not: the good news is that the folks who are using it are "sharing their thoughts":http://groups.google.com/group/cake-php/browse_thread/thread/85a29ab6ec6826a0/8eecea26ba53e1fd?q=postgres&rnum=1#8eecea26ba53e1fd with the rest of us. - -!>http://base--/img/pictures/sqlite.gif! - -*SQLite* is supported natively, or so it seems... what about the newest SQLite3? Yes, probably: there's a quick "howto":http://www.thompsonlife.net/index.php?section=9 on ThompsonLife.net to make it work through the dbo_pear driver. - -*Access* works through the ADOdb driver, as reported in CakePHP "wiki":http://wiki.cakephp.org/docs:databases (thanks ivanp). - -"FileMaker":http://www.filemaker.com/ is getting there: things aren't that easy, but bdb is doing "all his best":http://groups.google.com/group/cake-php/browse_thread/thread/572d8dd2ba4cbdf7/dca851c795247c0b?q=database&rnum=2#dca851c795247c0b to make it work, good luck! - -Neil Fincham was also trying to develop a custom driver to support "Pervasive":http://www.pervasive.com/ through a "unixODBC":http://www.unixodbc.org/ driver. Best of luck! - +One of the most recurring questions on CakePHP User Group is probably _"Does Cake support X database?"_. Sure, most of us tend to use just MySQL for our websites and applications, but in certain situations some more _exotic_ database support makes the difference. A partial answer to the question above could be _"Yes, probably, at least partially"_: CakePHP offers support for some database "natively" (i.e. Cake folks made some _ad hoc_ database drivers), others through either "ADOdb":http://adodb.sourceforge.net/ or "PEAR::DB":http://pear.php.net/package/DB. + +CakePHP seems to use a _multiple level_ database abstraction: in other words, popular abstraction layers like ADOdb or PEAR::DB have been wrapped in a "driver" which basically extends the DboSource class (which is the most high level database abstraction). Some people don't like the idea, because this means that the could be some performance issues, for one, and also that inevitably not _all_ features offered by either ADOdb or PEAR::DB are used. In my very, very, very modest opinion (I'm not an expert on this matter), this solution focus on achieving good database compatibility leaving the doors open for further tinkering, if needed. + +!<http://base--/img/pictures/postgres.png! + +Having said this, yes, the possibilities are good that your favorite database is supported by CakePHP, more or less. Of course, as repeatedly pointed out by some CakePHP core developers, Cake dev team didn't and is not going to test _every_ database with Cake, using either of the two abstraction layers, but users are more than welcome to do so. + +Let's now have a look at what is _known to work_ with Cake: + +*MySQL* works fine, and is currently recommended as _preferred_ database solution. What about *MySQLi*? Well, thanks to mappleJoe there's a (PHP5 only!) "driver":http://cakephp.org/pastes/show/770e73e77e4d7a3d32c2f3de3f175512 ready to be used. + + *PostgreSQL*'s support is continuously improving. Something may work, something may not: the good news is that the folks who are using it are "sharing their thoughts":http://groups.google.com/group/cake-php/browse_thread/thread/85a29ab6ec6826a0/8eecea26ba53e1fd?q=postgres&rnum=1#8eecea26ba53e1fd with the rest of us. + +!>http://base--/img/pictures/sqlite.gif! + +*SQLite* is supported natively, or so it seems... what about the newest SQLite3? Yes, probably: there's a quick "howto":http://www.thompsonlife.net/index.php?section=9 on ThompsonLife.net to make it work through the dbo_pear driver. + +*Access* works through the ADOdb driver, as reported in CakePHP "wiki":http://wiki.cakephp.org/docs:databases (thanks ivanp). + +"FileMaker":http://www.filemaker.com/ is getting there: things aren't that easy, but bdb is doing "all his best":http://groups.google.com/group/cake-php/browse_thread/thread/572d8dd2ba4cbdf7/dca851c795247c0b?q=database&rnum=2#dca851c795247c0b to make it work, good luck! + +Neil Fincham was also trying to develop a custom driver to support "Pervasive":http://www.pervasive.com/ through a "unixODBC":http://www.unixodbc.org/ driver. Best of luck! + For other databases, check ADOdb's "list of supported databases":http://phplens.com/adodb/supported.databases.html and use the @dbo-adodb@ driver, or use PEAR::DB (for fbsql, ibase, informix, msql, mssql, mysql, mysqli, oci8, odbc, pgsql,sqlite and sybase) using the @dbo-pear@ driver.
D content/articles/19.textile

@@ -1,42 +0,0 @@

------ -permalink: "19" -filters_pre: -- redcloth -title: (Almost) working at Siemens -comments: [] - -date: 2006-04-22 03:04:57 +02:00 -tags: [] - -type: article -toc: true ------ -In a recent "blog post":http://www.h3rald.com/blog/view/12/ I was evaluating two job proposals which I was offered, one involving a multi-national company and the other a regional/national but apparently successful IT business. -Actually only yesterday I got an official offer from the multi-national company, to be precise, and after evaluating my future possibilities (it took approx 0.03s) I decided to accept this one. To be precise I didn't _officially_ tell them I'd like to start working with them, and I took a few days to "think about it", only because of the damn weekend in between. -!<http://base--/img/pictures/siemens.gif! In reality, on Monday morning I'll call my new boss immediately and tell her to start preparing all the paperwork necessary to take me on board! - -So it turns out I'll be working at "Siemens":http://www.siemens.com/index.jsp as Technical Writer! - -So much for my friends _still_ taking another two years at Uni to get a crappy Italian MA in Computer Engineering -So much for some of my professors looking at me like I was an idiot for not being able to _fully understand and respect_ their hopeless and pointless theoretical mathematical models. -So much for those who treated me like a fool for _quitting_ after getting my BA, after studying pointless rubbish (with a few exceptions) for three years -So much for those complete _wa**ers_ who tried to offer me a "job" from the highness of their crappy little firms paying me less than a dish washer. - -!>http://base--/img/pictures/framework.jpg! Bu**ocks to all of you! - -Enough boasting for now: sorry about that, I just needed it after _years_ of people taking the piss out of me for my life choices. - -Anyhow, here's why I decided to accept Siemens' job offer: - -* They'll take me on _permantly_ after a three months trial period. Note: in my country _permanent_ contracts are a forgotten dream nowadays, as people normally tend to be forced to change job more than once a year, in some cases. -* They're offering a decent pay. They started off like: _"We're sorry, but you just graduated... and you have no prior job experience... so we *have* to take you on with a salary which may not be great: 20,000 Euro/year, before tax"_. They were sorry. Hell, that makes 1140 Euro/month after tax, straight to my pocket! In the US or other countries it may not be considered a lot of money, but here it's different! Especially considering that the new, soon-to-be standard apprentice contracts pay less than 800 Euro/month for three years, or so I was offered... -* _"We have an authomatic way to raise the salaries of all our employees depending on Siemens financial growth: on average this can vary between 7.5% and 15% more every year, than there are personal bonuses and incentives, but of course I can't guarantee for them, it's entirely up to you"_ -* _"We're sorry, but we don't have the necessary infrastructure to offer meals to our employees: we can only offer you meal tickets"_. They're so sorry! Hell, my dad was never offered free meals at work, and neither meal tickets! He's terribly jealous of that now. -* _"Normally technical writers only work here, on the second floor of this building, but for time to time you might have to go to Germany or the US for one or two days"_ - I'm sure I won't complain -* _"We want motivated people who want to come here and work hard. In your case, if you like writing in English so much it's definitely a plus"_- Damn right! -* _"Holidays? Normally about 30 days/year, you build up 2.5 days every month"_ - -!<http://base--/img/pictures/simatic.jpg! Sounds like my dream job. It may be hell boring for some people who only like coding, but for me writing technical documentation _in English_ will very gratifying: they _pay me_ for writing, after I spent all these months writing for free! -That's what I'll be doing: writing advanced technical docs for a big corporate project. The name of the project is not classified, and you can download bruchures and even part of the documentation itself from "here":http://base--/bookmarks/view/simatic/ or "here":http://base--/bookmarks/view/simatic-it/. - -I guess I'll write more about my job when I actually start working...
M content/articles/20.textilecontent/articles/20.textile

@@ -8,87 +8,86 @@

date: 2006-04-26 05:36:00 +02:00 tags: - personal -- family type: article toc: true ----- -Yesterday my grandpa passed away, due to an aggravation of his health condition, breathing problems and various other complications. He died in hospital, on Liberation Day, the Italian national holiday celebrating the liberation of our country from the nazi-fascist regime by the Allied troops and partisans on April 25th 1945. He died exactly 61 years after that day. - -I'd like to remember my grandpa today, because he most certainly deserves it, as he was a really extraordinary person. - -_"Yes, I'm sure he was, isn't everybody extraordinary in some way?"_ - -Definitely: everybody is special, and people tend to say that especially when someone passes away. In my grandpa's case, actually I can say that in a slightly more absolute sense: his life was truly uncommon and very active. - -*A very active life* - -!<http://base--/img/pictures/grandpa.jpg! - -Vittorio Cevasco, my grandfather, was certainly the most active member of my family. We're talking about a man who was still able to drive a car up to last September (he was nearly 90 years old), and used to drive 500 Km on the motorway and mountain roads every year to go on vacation: he went to the same place, Mals Vinschgau, near the Italian-Austrian-Swiss border for over fifty years. He never had particular troubles to walk, and just in the past months started using a walking stick... before that he used to walk around the city by himself everyday, in his endless meanderings. He always had something to do: visit friends, go to public offices, go to our house in the countryside - he still used to cultivate the land with potatoes, tomatoes and basil as a hobby until a few months ago - and so on: he was really a busy man. -I can certainly say that I never though he was really old until after his wife, my grandma, died, about a year ago. Since then he really aged, and quickly, as she probably was one of the main reasons of his existance. - -When he was "young" (i.e. less than 80) he used to _compete_ with the lift in his flat running down the stairs. Everyone else was taking the lift, but he always chose to go on foot down the stairs, to keep in exercise. His other exercise was cultivating our land in Sessarego, near Bogliasco (Genoa, Italy), as a hobby more than anything, providing us with fresh _biological_ products like that extraordinary basil essential to make our very tasty local "pesto sauce":http://www.pesto.net/eng/index.php. -He always tried to convince me to do some work there, and he actually taught me various tips and secrets which will hopefully be useful in near future. Sadly, when he was alive I wasn't too keen on the idea of cultivating and maintain our land from time to time... but I kind of changed my mind recently, and I know he realized that just a few days before he died. - -After WWII he did various things, he even was erhm... somehow active in _certain international import/export activities_ of watches from Switzerland to Italy - quite a common thing back in the day, especially considering that the border was at just a few hours drive. -Later on he became an estate agent, working for a local office and then helping out some friends running their activity. In 2001 he hit his own personal record selling a fancy villa worth one billion of the old Italian Lire - which convert to approx. 500,000 Euro, but at the time it was much bigger money than that. With the commission generated by that sale he bought a brand new Ford Fiesta: he was 85 years old. - -But no, these are not the most extraordinary episodes of his life of course. He could fly - literally. - -He was one of the first man in Italy and the the first in Genoa area to get a flying license, back in 1934. A news which made the local papers at the time, and we still have that article somewhere. He wanted to become a civil pilot, but he never did: the Country needed him to protect our sky, when Italy joined the War in 1941. - -*The Aviator* - -!<http://base--/img/pictures/sessarego.jpg! - -My grandpa lived the early years of his youth in the village of Sessarego, where my great-grandfather bought an old house, after taking part in "Giuseppe Garibaldi":http://www.italian-american.com/garib-it.htm's expedition at Marsala (1860) fighting for the Italian independence (he's listed among "the ones":http://www.italian-american.com/garibal.htm who actually landed there). -There his parents used to have a few cows and produce milk, and one of his tasks was milking delivery... no scooters or cars, at the time, of course, and certainly not for a teenager like him: he often had to carry the milk barrels up and down the hill _on foot_, and I'm talking about 1-2 Km with at least 30-40 kilos on your shoulders! - -But my grandpa's plans were much different: he wanted to fly away, and high - literally. You can imagine the face of my grand-grandfather when he expressed his wish to become a pilot! Nobody ever did that, in the area, and becoming a pilot was, at the time, like becoming an astronaut in the seventies. -The price of the license was really high at the time, 1,200 Lire. That would be like at least 30,000 Euro now, especially considering that his parents weren't exactly rich. In the very end, my father supported him and provided as much money as he could afford: 1000 Lire. -But he still needed 200 Lire, so after hassling the flying instructors he signed an agreement stating that if they anticipated him the money he'd have paid them back once he started working: it was clear in fact that he'd have became a military pilot, as the Regime needed people for their brand new aircrafts, and the was felt imminent. -He paid them back, eventually, after passing both the civil and military tests. He became a sergeant for the _Regia Aviazione_ (Royal Airforce), with a salary of 20 Lire/month, ten of which went to the flying school, for many months, but he was still earning some very decent money. - -One of the most peculiar things about my grandpa was his memory: he was always able to tell you the story of his life, all the events, with the same details and _all the exact dates_, on every occasion. Even when we took him to the hospital, a few weeks ago, when we asked the nurse if he was self-conscious she said: _"Yes... well, he was talking a few hours ago, but I don't know if he was raving or what... he said he was a pilot, and that he used to fly at 350Km/h..."_ - -!>http://base--/img/pictures/r2002-main.jpg! - -Damn right. His old "Re 2002":http://www.comandosupremo.com/Re2002.html was able to fly at 350 Km/h if pushed, at a standard altitude of 35,000 m, while carrying a 500Kg bomb. It was _his_ plane, and he never forgot that, even a few days before he passed away. He'd tell you all the stats, the mechanics, the technical details and all the tricks to perform acrobatic maneuvers if you asked him... Not that actually anybody ever did, because _every_ time something reminded him of that, even slightly, he'd start talking about the old days when he was commanding his squad patrolling the Italian borders. - -Last year, after my grandma died and he didn't feel like driving 500Km to go to the mountains (for the first time in his life), I had to drive his _Fiesta_ myself in my first long driving journey. At first I wasn't too sure I'd have enjoyed the drive, partly because of the long distance and partly because I was going to be alone with my grandpa for about six hours, and I was afraid of not be able to find enough topics of conversation... - -That fear went away almost instantly right a few minutes after we started the journey. -When we got on the motorway, I started complaining that my dad was going slightly over the limit with his brand new Peugeot 307: _"Look, he's already going at 140km/h and we just started the journey!"_ - -_"Cent&ucirc;c&auml;ranta chilumetri l'&ucirc;a... &ucirc; m&euml; aeruplannu p&ucirc;eiv&auml; f&acirc; &iuml; trex&euml;ntusinc&ucirc;anta c&ucirc;mme ninte!"_ -[140 kilometers per hour... my plane could easily do 350!] - -He normally used to speak in _zeneise_ ("Genovese"), Genoa's dialect, mixed with some Italian _if he really had to_. That was it: if you started talking about speed, technology, engines, history or any other topic which was _slightly_ related to his plane, the war, the regime etc. he always started off talking about his past and his plane, ignoring everything else. -My grandma used to get kinda annoyed about it... on every occasion, if he had a chance, he'd start talking about _that particular day in 193x/4x_ and so on: we all knew that, and actually I enjoyed listening to his stories, mostly because they were genuine and authentic relics of an old and glorious past. I think in his mind he wanted us all to remember him in that way, to always keep in mind that he was a pilot and how he enjoyed it, even when he went in jail for it, even when his plane was taken down... - -!<http://base--/img/pictures/Re2002.jpg! - -On that day right after he was assigned to a new base, they asked him to perform some exercises in the air, loops and all sort of acrobatics: _"&euml; s&ouml;lite c&ouml;se che s&euml; d&ucirc;vi&euml;iva f&auml; in t'&euml; l'avi&auml;si&ucirc;n"_ [the usual things you had to do in the airforce]. -He was just starting practicing the Re 2002 at the time, but he quickly found out that it was _extremely_ maneuvrable, at least to the standards of the time: the equivalent of a top range today's fighter. -He started off with some usual things, performing various twists in the air, loops, etc. etc. until he had to end his exhibition with a dive from an altitude of 10,000m down at maximum speed to a limit of 1500m... On that particular day a colonel from another base and some other high-ranking officer were down on the ground near the aircraft to enjoy the show, and check that everything was performed correctly. My grandpa was aware of that, so he decided to perform a great show especially for them that day: he went up to 10,000m, and then dove down accelerating, helped by gravity... he went down and down, faster and faster, people down on the ground were staring at him waiting for him to pull up the plane, but nothing, he still went down and down so that quickly the small crowd of captains and colonels got scared and run away in every direction: _"He'll crash, he'll crash!"_ -He did not crash, not that day... he went down up to slightly less than 100m and _then_ pulled up the plane: ar real wonderful _extreme_ performance. Now imagine this beast of a plane coming down at 300Km/h and accelerating, making a terrible noise typical of the engines of the time and then _pull up suddenly_ right above your head: one more second and he wouldn't have been able to tell that story. -He was called by the commander of the base who told him: _"Cevasco, you're hell of a skilled pilot, but now I have to put you in jail for a day for not obeying your orders of staying above 1500m"_ - That, I reckon, was one of the best days of my grandpa's life. - -He was never captured, but his plane was taken down by an English _Spitfire_ in the South of Italy. The war was nearly finished, and there were just those little air fights from time to time. He really risked a lot that day, and managed to attempt an emergency "landing" completely destroying his plane along as part of his jaw, which was alright after a few months. -Since then he never flew again, and managed to escape to be re-called in duty. But he did like flying back with his memories to those glorious days. - -A few years ago my dad showed him Microsoft's _"Flight Simulator 98"_, and some other flying games. He was amazed at the graphic, but not so satisfied with the whole _simulation_ thing: not even close to reality, too damn easy. - -_"C&auml;u m&euml;, te v&ucirc;eive vedde t&iuml;e a f&auml; v&ucirc;l&aacute; &ucirc; m&euml; aeruplannu"_ -[My dear, I'd have liked to see you trying to fly _my_ plane] - -...and that was it: the beginning of another journey back in time. - -He always had a very practical view of life and especially of technology. He wouldn't take you seriously and would not be interested in knowing about programming and the Internet, unless it could produce some concrete result: - -_"Ti che ti st&ucirc;ddi da insegn&euml; e che ti st&euml; sempre davanti a-&ucirc; cumputer, nun te puri&euml;sci truv&auml; &ucirc;n sistemm&auml; de an&auml; in t'&euml; a banca e piggi&euml; qualche mili&ucirc;n the Euro?"_ -[You that you're studying to become an engineer and that spend so long in front of the computer, couldn't you find a way to get into a bank and get out some million of Euro?] - -He'd have loved me to become a [rich] hacker, probably... But the last time I saw him, last Friday, he seemed happy enough to hear that I was just about to start working. - +Yesterday my grandpa passed away, due to an aggravation of his health condition, breathing problems and various other complications. He died in hospital, on Liberation Day, the Italian national holiday celebrating the liberation of our country from the nazi-fascist regime by the Allied troops and partisans on April 25th 1945. He died exactly 61 years after that day. + +I'd like to remember my grandpa today, because he most certainly deserves it, as he was a really extraordinary person. + +_"Yes, I'm sure he was, isn't everybody extraordinary in some way?"_ + +Definitely: everybody is special, and people tend to say that especially when someone passes away. In my grandpa's case, actually I can say that in a slightly more absolute sense: his life was truly uncommon and very active. + +*A very active life* + +!<http://base--/img/pictures/grandpa.jpg! + +Vittorio Cevasco, my grandfather, was certainly the most active member of my family. We're talking about a man who was still able to drive a car up to last September (he was nearly 90 years old), and used to drive 500 Km on the motorway and mountain roads every year to go on vacation: he went to the same place, Mals Vinschgau, near the Italian-Austrian-Swiss border for over fifty years. He never had particular troubles to walk, and just in the past months started using a walking stick... before that he used to walk around the city by himself everyday, in his endless meanderings. He always had something to do: visit friends, go to public offices, go to our house in the countryside - he still used to cultivate the land with potatoes, tomatoes and basil as a hobby until a few months ago - and so on: he was really a busy man. +I can certainly say that I never though he was really old until after his wife, my grandma, died, about a year ago. Since then he really aged, and quickly, as she probably was one of the main reasons of his existance. + +When he was "young" (i.e. less than 80) he used to _compete_ with the lift in his flat running down the stairs. Everyone else was taking the lift, but he always chose to go on foot down the stairs, to keep in exercise. His other exercise was cultivating our land in Sessarego, near Bogliasco (Genoa, Italy), as a hobby more than anything, providing us with fresh _biological_ products like that extraordinary basil essential to make our very tasty local "pesto sauce":http://www.pesto.net/eng/index.php. +He always tried to convince me to do some work there, and he actually taught me various tips and secrets which will hopefully be useful in near future. Sadly, when he was alive I wasn't too keen on the idea of cultivating and maintain our land from time to time... but I kind of changed my mind recently, and I know he realized that just a few days before he died. + +After WWII he did various things, he even was erhm... somehow active in _certain international import/export activities_ of watches from Switzerland to Italy - quite a common thing back in the day, especially considering that the border was at just a few hours drive. +Later on he became an estate agent, working for a local office and then helping out some friends running their activity. In 2001 he hit his own personal record selling a fancy villa worth one billion of the old Italian Lire - which convert to approx. 500,000 Euro, but at the time it was much bigger money than that. With the commission generated by that sale he bought a brand new Ford Fiesta: he was 85 years old. + +But no, these are not the most extraordinary episodes of his life of course. He could fly - literally. + +He was one of the first man in Italy and the the first in Genoa area to get a flying license, back in 1934. A news which made the local papers at the time, and we still have that article somewhere. He wanted to become a civil pilot, but he never did: the Country needed him to protect our sky, when Italy joined the War in 1941. + +*The Aviator* + +!<http://base--/img/pictures/sessarego.jpg! + +My grandpa lived the early years of his youth in the village of Sessarego, where my great-grandfather bought an old house, after taking part in "Giuseppe Garibaldi":http://www.italian-american.com/garib-it.htm's expedition at Marsala (1860) fighting for the Italian independence (he's listed among "the ones":http://www.italian-american.com/garibal.htm who actually landed there). +There his parents used to have a few cows and produce milk, and one of his tasks was milking delivery... no scooters or cars, at the time, of course, and certainly not for a teenager like him: he often had to carry the milk barrels up and down the hill _on foot_, and I'm talking about 1-2 Km with at least 30-40 kilos on your shoulders! + +But my grandpa's plans were much different: he wanted to fly away, and high - literally. You can imagine the face of my grand-grandfather when he expressed his wish to become a pilot! Nobody ever did that, in the area, and becoming a pilot was, at the time, like becoming an astronaut in the seventies. +The price of the license was really high at the time, 1,200 Lire. That would be like at least 30,000 Euro now, especially considering that his parents weren't exactly rich. In the very end, my father supported him and provided as much money as he could afford: 1000 Lire. +But he still needed 200 Lire, so after hassling the flying instructors he signed an agreement stating that if they anticipated him the money he'd have paid them back once he started working: it was clear in fact that he'd have became a military pilot, as the Regime needed people for their brand new aircrafts, and the was felt imminent. +He paid them back, eventually, after passing both the civil and military tests. He became a sergeant for the _Regia Aviazione_ (Royal Airforce), with a salary of 20 Lire/month, ten of which went to the flying school, for many months, but he was still earning some very decent money. + +One of the most peculiar things about my grandpa was his memory: he was always able to tell you the story of his life, all the events, with the same details and _all the exact dates_, on every occasion. Even when we took him to the hospital, a few weeks ago, when we asked the nurse if he was self-conscious she said: _"Yes... well, he was talking a few hours ago, but I don't know if he was raving or what... he said he was a pilot, and that he used to fly at 350Km/h..."_ + +!>http://base--/img/pictures/r2002-main.jpg! + +Damn right. His old "Re 2002":http://www.comandosupremo.com/Re2002.html was able to fly at 350 Km/h if pushed, at a standard altitude of 35,000 m, while carrying a 500Kg bomb. It was _his_ plane, and he never forgot that, even a few days before he passed away. He'd tell you all the stats, the mechanics, the technical details and all the tricks to perform acrobatic maneuvers if you asked him... Not that actually anybody ever did, because _every_ time something reminded him of that, even slightly, he'd start talking about the old days when he was commanding his squad patrolling the Italian borders. + +Last year, after my grandma died and he didn't feel like driving 500Km to go to the mountains (for the first time in his life), I had to drive his _Fiesta_ myself in my first long driving journey. At first I wasn't too sure I'd have enjoyed the drive, partly because of the long distance and partly because I was going to be alone with my grandpa for about six hours, and I was afraid of not be able to find enough topics of conversation... + +That fear went away almost instantly right a few minutes after we started the journey. +When we got on the motorway, I started complaining that my dad was going slightly over the limit with his brand new Peugeot 307: _"Look, he's already going at 140km/h and we just started the journey!"_ + +_"Cent&ucirc;c&auml;ranta chilumetri l'&ucirc;a... &ucirc; m&euml; aeruplannu p&ucirc;eiv&auml; f&acirc; &iuml; trex&euml;ntusinc&ucirc;anta c&ucirc;mme ninte!"_ +[140 kilometers per hour... my plane could easily do 350!] + +He normally used to speak in _zeneise_ ("Genovese"), Genoa's dialect, mixed with some Italian _if he really had to_. That was it: if you started talking about speed, technology, engines, history or any other topic which was _slightly_ related to his plane, the war, the regime etc. he always started off talking about his past and his plane, ignoring everything else. +My grandma used to get kinda annoyed about it... on every occasion, if he had a chance, he'd start talking about _that particular day in 193x/4x_ and so on: we all knew that, and actually I enjoyed listening to his stories, mostly because they were genuine and authentic relics of an old and glorious past. I think in his mind he wanted us all to remember him in that way, to always keep in mind that he was a pilot and how he enjoyed it, even when he went in jail for it, even when his plane was taken down... + +!<http://base--/img/pictures/Re2002.jpg! + +On that day right after he was assigned to a new base, they asked him to perform some exercises in the air, loops and all sort of acrobatics: _"&euml; s&ouml;lite c&ouml;se che s&euml; d&ucirc;vi&euml;iva f&auml; in t'&euml; l'avi&auml;si&ucirc;n"_ [the usual things you had to do in the airforce]. +He was just starting practicing the Re 2002 at the time, but he quickly found out that it was _extremely_ maneuvrable, at least to the standards of the time: the equivalent of a top range today's fighter. +He started off with some usual things, performing various twists in the air, loops, etc. etc. until he had to end his exhibition with a dive from an altitude of 10,000m down at maximum speed to a limit of 1500m... On that particular day a colonel from another base and some other high-ranking officer were down on the ground near the aircraft to enjoy the show, and check that everything was performed correctly. My grandpa was aware of that, so he decided to perform a great show especially for them that day: he went up to 10,000m, and then dove down accelerating, helped by gravity... he went down and down, faster and faster, people down on the ground were staring at him waiting for him to pull up the plane, but nothing, he still went down and down so that quickly the small crowd of captains and colonels got scared and run away in every direction: _"He'll crash, he'll crash!"_ +He did not crash, not that day... he went down up to slightly less than 100m and _then_ pulled up the plane: ar real wonderful _extreme_ performance. Now imagine this beast of a plane coming down at 300Km/h and accelerating, making a terrible noise typical of the engines of the time and then _pull up suddenly_ right above your head: one more second and he wouldn't have been able to tell that story. +He was called by the commander of the base who told him: _"Cevasco, you're hell of a skilled pilot, but now I have to put you in jail for a day for not obeying your orders of staying above 1500m"_ - That, I reckon, was one of the best days of my grandpa's life. + +He was never captured, but his plane was taken down by an English _Spitfire_ in the South of Italy. The war was nearly finished, and there were just those little air fights from time to time. He really risked a lot that day, and managed to attempt an emergency "landing" completely destroying his plane along as part of his jaw, which was alright after a few months. +Since then he never flew again, and managed to escape to be re-called in duty. But he did like flying back with his memories to those glorious days. + +A few years ago my dad showed him Microsoft's _"Flight Simulator 98"_, and some other flying games. He was amazed at the graphic, but not so satisfied with the whole _simulation_ thing: not even close to reality, too damn easy. + +_"C&auml;u m&euml;, te v&ucirc;eive vedde t&iuml;e a f&auml; v&ucirc;l&aacute; &ucirc; m&euml; aeruplannu"_ +[My dear, I'd have liked to see you trying to fly _my_ plane] + +...and that was it: the beginning of another journey back in time. + +He always had a very practical view of life and especially of technology. He wouldn't take you seriously and would not be interested in knowing about programming and the Internet, unless it could produce some concrete result: + +_"Ti che ti st&ucirc;ddi da insegn&euml; e che ti st&euml; sempre davanti a-&ucirc; cumputer, nun te puri&euml;sci truv&auml; &ucirc;n sistemm&auml; de an&auml; in t'&euml; a banca e piggi&euml; qualche mili&ucirc;n the Euro?"_ +[You that you're studying to become an engineer and that spend so long in front of the computer, couldn't you find a way to get into a bank and get out some million of Euro?] + +He'd have loved me to become a [rich] hacker, probably... But the last time I saw him, last Friday, he seemed happy enough to hear that I was just about to start working. + He realized that I finally found a good job after my studies, and then my dad told him Roxanne and I would have moved to the countryside, in Sessarego... He made a big effort to move the muscles of his mouth in a large smile: he was happy.
M content/articles/21.textilecontent/articles/21.textile

@@ -8,121 +8,120 @@

date: 2006-04-27 14:47:00 +02:00 tags: - website -- hosting - review type: article toc: true ----- -Today is my birthday! "Not too happy":http://base--/blog/view/20/, but still my birthday after all. What presents did I get from my relatives and friends? Well, various things, but I told my parents and uncles I actually needed some web space... _"What? Didn't you have the hosting sorted out?"_ -Well, I had, up to a few days ago when my friends and hosting provider, DeWayne Lehman, decided to close down his "company":http://www.block-house.com. The reason being, to cut a long story short, that he can't keep up with competition: he doesn't have enough customers, and he can't afford server upgrades, while other companies are literally giving space away. -That was a pity, not only because Block House used to host various non-profit orgs and initiatives, but also because the guy who run it was an excellent admin, always offering excellent support. - -Anyhow, in the end I'll have to transfer all five of my sites to a new host, so here we go again: _what's the best hosting company?_ -Obviously it depends a lot on what you're looking for, and here's what I need: - -* At least 4GB of space -* At least 30GB/month bandwidth -* PHP of course, but also other languages like Perl, Python and Ruby (+ Rails support) -* MySQL databases... at least 10-20 -* Be able to host 5-6 sites minimum -* Subdomains allowed (10 in total?) -* FTP _and SSH_ access -* Subversion, if possible - -All this for less than 10$/month, ideally 5$, on shared hosting. I already made my choice and if you're reading this post it means everything worked fine, but anyway, let's have a look at what the market can offer for my needs. I only went for US-based hosts: Italian hosts are terrible and US hosts are normally more reliable and cheaper. - -!<http://base--/img/pictures/dreamhost.gif! - -The first hosting company I was tempted by was "DreamHost":http://www.dreamhost.com. They can literally sell you anything but their mother, at stupidly cheap rates for what you get (apparently): - -* 20GB of space -* 1TB (!) bandwidth -* PHP4, PHP5 Perl, Python and Ruby + RoR support -* Unlimited databases -* Unlimited hosted domains -* Unlimited hosted subdomains -* FTP and SSH access -* Subversion and CVS -* ...and more - -For 7.95 if you pay two years in advance. And the first time you can get up to 97$ off by using one of the thousands referrer's coupons available on the net. OK, where's the catch? Well, there's a "bad review":http://futurosity.com/231/why-dreamhost-sucks about them which points out that their reliability is not too great, for example, and that the seem to be rather dodgy in general. "They are overselling, they'll soon enforce CPU restrictions" etc. etc. -_...let's move along_ - -!>http://base--/img/pictures/rails.gif! - -I might try out Ruby on Rails someday, so perhaps I thought it would be wise to choose a host supporting it, for a change. The first Rails friendly I thought about was "RailsPlayground":http://www.railsplayground.org, which started off as FREE Rails host and then ended up offering interesting commercial hosting plans. They are not bad, and I'd have probably gone with them if I had only one site to manage: for 60$ a year you get: - -* 3GB of space -* 30GB bandwidth -* PHP4, PHP5 Perl, Python and Ruby + RoR support -* Unlimited databases -* Unlimited add-on domains -* Unlimited hosted subdomains -* FTP and SSH access -* Subversion and CVS -* ...and more - -Well, the only reason why I didn't go with them was that I did slightly more space, only that. The plan for 5GB of space costs 11$/month, which was too expensive for my liking. - -!<http://base--/img/pictures/textdrive.gif! - -Since we're talking about Rails, why not "Textdrive":http://www.textdrive.com? Founded by 200 IT professional, hosts high quality sites, it's the official Rails host... An "elite" solution, here's what you get: - -* Use Apache and Lighttpd web servers side-by-side -* Host PHP4 and PHP5 web pages and applications -* Host a weblog using Textpattern, Wordpress, MovableType, Typo, etc -* Host Ruby and Ruby on Rails applications (including FCGI and hundreds of gems) -* Host Perl applications (including 100's of Perl modules) -* Host Python applications like Django -* Manage your code base with version control (Subversion, SVK, Darcs, Monotone & Arch) -* Share iCal files over WebDAV -* Mount a WebDAV drive on your desktop (like iDisk) -* Easily create free subdomains with wildcard DNS -* Store your Basecamp file uploads over SFTP -* Access your account via SFTP and SSH -* Add domains, unlimited IMAP and POP mail boxes and mail aliases through a control panel -* Check your email through Webmail -* Host Mailman mailing lists complete with archives -* Use MySQL (default), PostgreSQL, SQLite and Berkeley databases - -Plans start at 12$/month for 1GB of space and one website... The 3GB one is 40$/month, for 20 sites in total. Too bad it's too expensive for me as they are truly the top for shared hosting - I think. - - -"Host Gator":http://www.hostgator.com/, which seems to be one of the most frequently recommended at SitePoint.com forums, is not bad either. They have a "hatchling" plan for 3,5GB at 6.95, which wasn't bad, but it only allows one domain to be hosted. The "Baby" plan allows unlimited domains and is 9.95$/month, which is kinda dear. You get: - -* 5GB of space -* 75GB bandwidth -* PHP4, PHP5 Perl and Python -* Unlimited databases -* Unlimited add-on domains -* Unlimited hosted subdomains -* FTP access -* ...and more - -No SSH, no SVN and no Rails: out. - -"Site5":http://www.site5.com/ is also one of SitePoint's favourite, but still has limitations on the number of sites. I would have got the SuperHosting XTREME, for 7,77$/month: - -* 11GB of space -* 400GB bandwidth -* PHP4, PHP5 Perl, Python, Ruby + RoR support -* Unlimited databases -* 5 domains hosted -* Unlimited hosted subdomains -* FTP and SSH access -* ...and more - - Not bad, a little bit too much for only 5 sites... I needed 6, too bad :/ - -<div style="float:right; padding:3px;"><script src="http://www.bluehost.com/src/js/h3rald/CODE2/488x160/1.jpg"></script> </div> This site is currently hosted on "BlueHost":http://www.bluehost.com, a hosting company established in 1996, which seems to be reliable enough (not many complaints on the net) and seems serious enough. They don't offer subversion and WebDAV for "security reasons" and in order to get a shell account you have to send them a copy of an ID card. Annoying? Well, perhaps for some: this made me understand that they don't allow just anybody to get SSH access unconditionally, and I didn't mind. I sent them a scansion of my ID card and I got a friendly support email after a few minutes, confirming that it was activated. Here's what I got: - -* 15GB of space -* 400GB bandwidth -* PHP4, PHP5 Perl, Python, Ruby + RoR support -* 20 MySQL databases + 10 PostgreSQL databases -* 6 domains hosted in one account (easier for me!) -* 20 subdomains + 20 parked domains -* FTP and SSH access -* ...and more - -For 6,65$/month, 2 years pre-payment. One of the good things is that they are not fussy about giving the money back if you cancel. Anyhow... let's hope for the best, so far, so good. +Today is my birthday! "Not too happy":http://base--/blog/view/20/, but still my birthday after all. What presents did I get from my relatives and friends? Well, various things, but I told my parents and uncles I actually needed some web space... _"What? Didn't you have the hosting sorted out?"_ +Well, I had, up to a few days ago when my friends and hosting provider, DeWayne Lehman, decided to close down his "company":http://www.block-house.com. The reason being, to cut a long story short, that he can't keep up with competition: he doesn't have enough customers, and he can't afford server upgrades, while other companies are literally giving space away. +That was a pity, not only because Block House used to host various non-profit orgs and initiatives, but also because the guy who run it was an excellent admin, always offering excellent support. + +Anyhow, in the end I'll have to transfer all five of my sites to a new host, so here we go again: _what's the best hosting company?_ +Obviously it depends a lot on what you're looking for, and here's what I need: + +* At least 4GB of space +* At least 30GB/month bandwidth +* PHP of course, but also other languages like Perl, Python and Ruby (+ Rails support) +* MySQL databases... at least 10-20 +* Be able to host 5-6 sites minimum +* Subdomains allowed (10 in total?) +* FTP _and SSH_ access +* Subversion, if possible + +All this for less than 10$/month, ideally 5$, on shared hosting. I already made my choice and if you're reading this post it means everything worked fine, but anyway, let's have a look at what the market can offer for my needs. I only went for US-based hosts: Italian hosts are terrible and US hosts are normally more reliable and cheaper. + +!<http://base--/img/pictures/dreamhost.gif! + +The first hosting company I was tempted by was "DreamHost":http://www.dreamhost.com. They can literally sell you anything but their mother, at stupidly cheap rates for what you get (apparently): + +* 20GB of space +* 1TB (!) bandwidth +* PHP4, PHP5 Perl, Python and Ruby + RoR support +* Unlimited databases +* Unlimited hosted domains +* Unlimited hosted subdomains +* FTP and SSH access +* Subversion and CVS +* ...and more + +For 7.95 if you pay two years in advance. And the first time you can get up to 97$ off by using one of the thousands referrer's coupons available on the net. OK, where's the catch? Well, there's a "bad review":http://futurosity.com/231/why-dreamhost-sucks about them which points out that their reliability is not too great, for example, and that the seem to be rather dodgy in general. "They are overselling, they'll soon enforce CPU restrictions" etc. etc. +_...let's move along_ + +!>http://base--/img/pictures/rails.gif! + +I might try out Ruby on Rails someday, so perhaps I thought it would be wise to choose a host supporting it, for a change. The first Rails friendly I thought about was "RailsPlayground":http://www.railsplayground.org, which started off as FREE Rails host and then ended up offering interesting commercial hosting plans. They are not bad, and I'd have probably gone with them if I had only one site to manage: for 60$ a year you get: + +* 3GB of space +* 30GB bandwidth +* PHP4, PHP5 Perl, Python and Ruby + RoR support +* Unlimited databases +* Unlimited add-on domains +* Unlimited hosted subdomains +* FTP and SSH access +* Subversion and CVS +* ...and more + +Well, the only reason why I didn't go with them was that I did slightly more space, only that. The plan for 5GB of space costs 11$/month, which was too expensive for my liking. + +!<http://base--/img/pictures/textdrive.gif! + +Since we're talking about Rails, why not "Textdrive":http://www.textdrive.com? Founded by 200 IT professional, hosts high quality sites, it's the official Rails host... An "elite" solution, here's what you get: + +* Use Apache and Lighttpd web servers side-by-side +* Host PHP4 and PHP5 web pages and applications +* Host a weblog using Textpattern, Wordpress, MovableType, Typo, etc +* Host Ruby and Ruby on Rails applications (including FCGI and hundreds of gems) +* Host Perl applications (including 100's of Perl modules) +* Host Python applications like Django +* Manage your code base with version control (Subversion, SVK, Darcs, Monotone & Arch) +* Share iCal files over WebDAV +* Mount a WebDAV drive on your desktop (like iDisk) +* Easily create free subdomains with wildcard DNS +* Store your Basecamp file uploads over SFTP +* Access your account via SFTP and SSH +* Add domains, unlimited IMAP and POP mail boxes and mail aliases through a control panel +* Check your email through Webmail +* Host Mailman mailing lists complete with archives +* Use MySQL (default), PostgreSQL, SQLite and Berkeley databases + +Plans start at 12$/month for 1GB of space and one website... The 3GB one is 40$/month, for 20 sites in total. Too bad it's too expensive for me as they are truly the top for shared hosting - I think. + + +"Host Gator":http://www.hostgator.com/, which seems to be one of the most frequently recommended at SitePoint.com forums, is not bad either. They have a "hatchling" plan for 3,5GB at 6.95, which wasn't bad, but it only allows one domain to be hosted. The "Baby" plan allows unlimited domains and is 9.95$/month, which is kinda dear. You get: + +* 5GB of space +* 75GB bandwidth +* PHP4, PHP5 Perl and Python +* Unlimited databases +* Unlimited add-on domains +* Unlimited hosted subdomains +* FTP access +* ...and more + +No SSH, no SVN and no Rails: out. + +"Site5":http://www.site5.com/ is also one of SitePoint's favourite, but still has limitations on the number of sites. I would have got the SuperHosting XTREME, for 7,77$/month: + +* 11GB of space +* 400GB bandwidth +* PHP4, PHP5 Perl, Python, Ruby + RoR support +* Unlimited databases +* 5 domains hosted +* Unlimited hosted subdomains +* FTP and SSH access +* ...and more + + Not bad, a little bit too much for only 5 sites... I needed 6, too bad :/ + +<div style="float:right; padding:3px;"><script src="http://www.bluehost.com/src/js/h3rald/CODE2/488x160/1.jpg"></script> </div> This site is currently hosted on "BlueHost":http://www.bluehost.com, a hosting company established in 1996, which seems to be reliable enough (not many complaints on the net) and seems serious enough. They don't offer subversion and WebDAV for "security reasons" and in order to get a shell account you have to send them a copy of an ID card. Annoying? Well, perhaps for some: this made me understand that they don't allow just anybody to get SSH access unconditionally, and I didn't mind. I sent them a scansion of my ID card and I got a friendly support email after a few minutes, confirming that it was activated. Here's what I got: + +* 15GB of space +* 400GB bandwidth +* PHP4, PHP5 Perl, Python, Ruby + RoR support +* 20 MySQL databases + 10 PostgreSQL databases +* 6 domains hosted in one account (easier for me!) +* 20 subdomains + 20 parked domains +* FTP and SSH access +* ...and more + +For 6,65$/month, 2 years pre-payment. One of the good things is that they are not fussy about giving the money back if you cancel. Anyhow... let's hope for the best, so far, so good.
M content/articles/22.textilecontent/articles/22.textile

@@ -9,133 +9,133 @@ date: 2006-04-29 15:29:00 +02:00

tags: - cakephp - rails -- web-development +- webdevelopment type: article toc: true ----- -Today I decided to do something different, something I've been dying to do since before coming across CakePHP: give Rails a _proper_ try. Like many other PHP developers out there, when "Ruby on Rails":http://www.rubyonrails.org came out I felt damn jealous and terribly tempted to learn Ruby _only_ to start using such an amazing web development framework. At the time I actually even started reading various tutorials about it, and I was literally amazed at how RoR revolutioned the way of developing web applications. - -!<http://base--/img/pictures/rails.gif! - -One of the main problems which made me - sadly - abandon Rails was Ruby itself: personally I've never seen a programming language with a cleaner and more elegant syntax, but also - at least at the time - there weren't many hosts supporting it. LuckilyI found CakePHP quickly after that... -Now however, more and more hosting companies boast full Rails support, and so when recently I "had to move":http://base--/blog/view/21/ to a new host, I made sure it was Rails-friendly, _just in case I wanted to give Rails another try, someday_. -Oh well, the temptation was so strong that today, only a two days after switching to my new host, I felt I _had_ to try it, I _had_ to taste something different than the usual Cake. - -I decided to (re-)read and follow the "OnLamp tutorial":http://www.onlamp.com/pub/a/onlamp/2005/01/20/rails.html about RoR, step by step, once again. I quickly typed @rails cookbook@ from my shell and voil&aacute;, rails silently creates the skeleton of my application: - -README -Rakefile -app/ -components/ -config/ -db/ -doc/ -favicon.ico -index.html -lib/ -log/ -public/ -script/ -structure.txt -test/ -tmp/ -vendor/ - -That's familiar: it's very similar to what CakePHP's directory structure used to look like. Now Cake _evolved_ and adopted its own schema, which - I must say - seems more functional than RoR's, at least at a first glance: - -* app/ -** config/ -** controllers/ -** models/ -** plugins/ -** tmp/ -** vendors/ -** views/ -** webroot/ -* cake/ -** config/ -** docs/ -** libs/ -* vendors/ - -!>http://base--/img/pictures/cakephp.png! - -Cake felt the necessity to divide what you can mess with (@app/@, @vendors/@) from what you'd better not touch (@cake/@). Rails just left everything on the same level. - -After creating my database and the necessary tables I have to edit @config/database.yml@, which corresponds to Cake's @app/config/database.php@. Then things start to become a bit different from Cake, as Rails offers some very handy built in scripts which can be used to automatically create your application's files, i.e. executing @ruby script/generate controller Recipe@ creates the controller and other bits: - -bc. exists app/controllers/ -exists app/helpers/ -create app/views/recipe -exists test/functional/ -create app/controllers/recipe_controller.rb -create test/functional/recipe_controller_test.rb -create app/helpers/recipe_helper.rb - - -And so on. Anyhow... I followed the tutorial and yes, it was a nice read. CakePHP borrowed a lot from Rails but not everything. Inevitably Ruby's syntax is less verbose and looks very very clean: - -<pre><code> -class RecipeController < ApplicationController - scaffold :recipe - - def list - @recipes = Recipe.find_all - end - - def edit - @recipe = Recipe.find(@params["id"]) - @categories = Category.find_all - end -end -</code></pre> - -While CakePHP's, simply because it uses PHP and not Ruby, looks less pretty: - -<pre><code> -class RecipesController extends AppController -{ - var $scaffold; - - function list() - { - $this->set('recipes', $this->Recipe->findAll()); - } - - function edit($id) - { - $this->set('recipe', $this->Recipe->find("id = $id")); - $this->set('categories', $this->Category->findAll()); - } - -} -</code></pre> - -CakePHP Development Team did a great job translating some of Rails functionalities into PHP, and the while CakePHP's syntax is *much* cleaner if compared to PHP's standard spaghetti-code approach, Ruby just looks much more clear, sorry. _Imagine a world without funny unnecessary brackets, pointless semicolons and where everything just looks better_: that's Ruby. - -Sigh. Now I do understand why Rails was built in Ruby and not in PHP: simply because a PHP's Rails would have been outscored by its "Ruby port"! - -One thing I liked about Rails which has not been ported in Cake (yet) is a somehow smarter way of scaffolding. While the Ruby code above actually works, the CakePHP's edit method doesn't, or better, it does but not as expected: when you remove @var $scaffold@ the scaffold is just plain gone, and you have to code everything yourself, while in Ruby you can leave the scaffold and then develop methods one by one, and still be able to use scaffolded methods if you didn't define the custom ones. - -The other thing I noticed about RoR is that it definitely handles errors better! This is probably another language issue. I basically forgot to set a category for the recipes, and when executing my custom list of recipes I got a very, very well structured error page showing something like: - -<pre><code> -NoMethodError in Recipe#index - -Showing app/views/recipe/index.rhtml where line #18 raised: - -You have a nil object when you didn't expect it! -The error occured while evaluating nil.name - -Extracted source (around line #18): - -15: <% @recipes.each do |recipe| %> -16: <tr> -17: <td><%= link_to recipe.title, :action => "show", :id => recipe.id %></td> -18: <td><%= recipe.category.name %></td> -19: <td><%= recipe.date %></td> -20: </tr> -21: <% end %> -</code></pre> - +Today I decided to do something different, something I've been dying to do since before coming across CakePHP: give Rails a _proper_ try. Like many other PHP developers out there, when "Ruby on Rails":http://www.rubyonrails.org came out I felt damn jealous and terribly tempted to learn Ruby _only_ to start using such an amazing web development framework. At the time I actually even started reading various tutorials about it, and I was literally amazed at how RoR revolutioned the way of developing web applications. + +!<http://base--/img/pictures/rails.gif! + +One of the main problems which made me - sadly - abandon Rails was Ruby itself: personally I've never seen a programming language with a cleaner and more elegant syntax, but also - at least at the time - there weren't many hosts supporting it. LuckilyI found CakePHP quickly after that... +Now however, more and more hosting companies boast full Rails support, and so when recently I "had to move":http://base--/blog/view/21/ to a new host, I made sure it was Rails-friendly, _just in case I wanted to give Rails another try, someday_. +Oh well, the temptation was so strong that today, only a two days after switching to my new host, I felt I _had_ to try it, I _had_ to taste something different than the usual Cake. + +I decided to (re-)read and follow the "OnLamp tutorial":http://www.onlamp.com/pub/a/onlamp/2005/01/20/rails.html about RoR, step by step, once again. I quickly typed @rails cookbook@ from my shell and voil&aacute;, rails silently creates the skeleton of my application: + +README +Rakefile +app/ +components/ +config/ +db/ +doc/ +favicon.ico +index.html +lib/ +log/ +public/ +script/ +structure.txt +test/ +tmp/ +vendor/ + +That's familiar: it's very similar to what CakePHP's directory structure used to look like. Now Cake _evolved_ and adopted its own schema, which - I must say - seems more functional than RoR's, at least at a first glance: + +* app/ +** config/ +** controllers/ +** models/ +** plugins/ +** tmp/ +** vendors/ +** views/ +** webroot/ +* cake/ +** config/ +** docs/ +** libs/ +* vendors/ + +!>http://base--/img/pictures/cakephp.png! + +Cake felt the necessity to divide what you can mess with (@app/@, @vendors/@) from what you'd better not touch (@cake/@). Rails just left everything on the same level. + +After creating my database and the necessary tables I have to edit @config/database.yml@, which corresponds to Cake's @app/config/database.php@. Then things start to become a bit different from Cake, as Rails offers some very handy built in scripts which can be used to automatically create your application's files, i.e. executing @ruby script/generate controller Recipe@ creates the controller and other bits: + +bc. exists app/controllers/ +exists app/helpers/ +create app/views/recipe +exists test/functional/ +create app/controllers/recipe_controller.rb +create test/functional/recipe_controller_test.rb +create app/helpers/recipe_helper.rb + + +And so on. Anyhow... I followed the tutorial and yes, it was a nice read. CakePHP borrowed a lot from Rails but not everything. Inevitably Ruby's syntax is less verbose and looks very very clean: + +<pre><code> +class RecipeController < ApplicationController + scaffold :recipe + + def list + @recipes = Recipe.find_all + end + + def edit + @recipe = Recipe.find(@params["id"]) + @categories = Category.find_all + end +end +</code></pre> + +While CakePHP's, simply because it uses PHP and not Ruby, looks less pretty: + +<pre><code> +class RecipesController extends AppController +{ + var $scaffold; + + function list() + { + $this->set('recipes', $this->Recipe->findAll()); + } + + function edit($id) + { + $this->set('recipe', $this->Recipe->find("id = $id")); + $this->set('categories', $this->Category->findAll()); + } + +} +</code></pre> + +CakePHP Development Team did a great job translating some of Rails functionalities into PHP, and the while CakePHP's syntax is *much* cleaner if compared to PHP's standard spaghetti-code approach, Ruby just looks much more clear, sorry. _Imagine a world without funny unnecessary brackets, pointless semicolons and where everything just looks better_: that's Ruby. + +Sigh. Now I do understand why Rails was built in Ruby and not in PHP: simply because a PHP's Rails would have been outscored by its "Ruby port"! + +One thing I liked about Rails which has not been ported in Cake (yet) is a somehow smarter way of scaffolding. While the Ruby code above actually works, the CakePHP's edit method doesn't, or better, it does but not as expected: when you remove @var $scaffold@ the scaffold is just plain gone, and you have to code everything yourself, while in Ruby you can leave the scaffold and then develop methods one by one, and still be able to use scaffolded methods if you didn't define the custom ones. + +The other thing I noticed about RoR is that it definitely handles errors better! This is probably another language issue. I basically forgot to set a category for the recipes, and when executing my custom list of recipes I got a very, very well structured error page showing something like: + +<pre><code> +NoMethodError in Recipe#index + +Showing app/views/recipe/index.rhtml where line #18 raised: + +You have a nil object when you didn't expect it! +The error occured while evaluating nil.name + +Extracted source (around line #18): + +15: <% @recipes.each do |recipe| %> +16: <tr> +17: <td><%= link_to recipe.title, :action => "show", :id => recipe.id %></td> +18: <td><%= recipe.category.name %></td> +19: <td><%= recipe.date %></td> +20: </tr> +21: <% end %> +</code></pre> + I took a screenshot of the page, because it was too nice: "check it out":http://base--/img/pictures/rails_error.jpg. This error page really tells you what's wrong, and even prints the lines of code around the error! It also lets the developer check the full backtrace and every sort of information... Can we have this in CakePHP please? I actually started to develop something like this, but seemed quite hard to do in PHP.
M content/articles/24.textilecontent/articles/24.textile

@@ -8,58 +8,58 @@

date: 2006-05-03 05:06:00 +02:00 tags: - cakephp -- web-development +- webdevelopment type: article toc: true ----- -As "Digg":http://digg.com/programming/CakePHP_1.0_has_been_released_ points out, the first _stable_ version of CakePHP was released, yesterday. I should have posted yesterday about it, and no, I didn't forget: I was just busy downloading the new version, have a look at the new site, talk to people etc. - -Anyhow, it's ready, just baked and smells damn good. Go get it if you didn't already, it's available at "the usual place":http://cakeforge.org/frs/?group_id=23, even this time you won't be disappointed. CakePHP now reached the 1.0 milestone, in a way which reminds me a lot about Mozilla Firefox: a lot of people were already using it _before_ it went stable officially! - -!<http://base--/img/pictures/CakePHP_1.0.png! - -The CakePHP Team has been humble enough not to declare their product _stable_ before the time. I personally considered CakePHP stable _enough_ since RC2... and considering that this site and many others have been built on alpha, beta and RC version, I think people can get an idea of Cake's reliability. -Nothing (too) new came out the oven this time: CakePHP 1.0 is mainly a bugfix release, with all the features we've learnt to love. It's just _better_: a lot of things have been fixed, model associations work better, etc. etc. You can read the "changelog/announcement":http://cakeforge.org/frs/shownotes.php?group_id=23&release_id=85 or have a look below for a quick summary of the new features and most interesting fixes: - -<pre><code> -Revision: [2420] -Added fix for Ticket #320. -Fixed Model::save() so it will only allow a model to save itself. -Fixed Model::save() when saving a HABTM association - -Revision: [2437] -Adding fix for Model::findNeighbours(). -Was returning all associations and fields. Now recursive -is set to 0 and only returns the prev and next keys array - -Revision: [2456] -"Enables use of Controller::$data in addition to Controller::$params['data']" - -Revision: [2490] -Fixing a bug that occurs when connecting to two different -databases on the same server, and enabling cross-database -model associations - -Revision: [2491] -Adding Microsoft SQL Server driver [EXPERIMENTAL] - -Revision: [2577] -Adding $alias property to enable future Oracle support - -Revision: [2625] -Bringing all DB drivers up to date - -Revision: [2653] -Adding check for custom error class in app/. -Added check for AppController::appError(); will be called if this method -is in AppController. -</code></pre> - -!>http://base--/img/pictures/cakesite.png! - -If you're not too excited about this new release, maybe you should have a look at "www.cakephp.org":http://www.cakephp.org. Different? Damn right it is: it looks like someone listened to our prayers for a new website design. The merciful soul is "Armando Sosa":http://www.nolimit-studio.com/, the winner of CakePHP's design contest. He's a latin-american web designer who had the GREAT idea of thinking about an _innovative_ design for the Cake site... Actually my dad didn't think that way: _"That's not new, that way of advertising was all over the place when I was a kid!"_ And he's right, Armando thought that a fifties-like template would have been perfect for Cake. Forget all the smooth, roundy-and-chubby, toons-like "official" Web 2.0 designs (beta), the new Cake site needs to stand out of the crowd... - -!<http://base--/img/pictures/fonz.jpg! - -<br /><br /> +As "Digg":http://digg.com/programming/CakePHP_1.0_has_been_released_ points out, the first _stable_ version of CakePHP was released, yesterday. I should have posted yesterday about it, and no, I didn't forget: I was just busy downloading the new version, have a look at the new site, talk to people etc. + +Anyhow, it's ready, just baked and smells damn good. Go get it if you didn't already, it's available at "the usual place":http://cakeforge.org/frs/?group_id=23, even this time you won't be disappointed. CakePHP now reached the 1.0 milestone, in a way which reminds me a lot about Mozilla Firefox: a lot of people were already using it _before_ it went stable officially! + +!<http://base--/img/pictures/CakePHP_1.0.png! + +The CakePHP Team has been humble enough not to declare their product _stable_ before the time. I personally considered CakePHP stable _enough_ since RC2... and considering that this site and many others have been built on alpha, beta and RC version, I think people can get an idea of Cake's reliability. +Nothing (too) new came out the oven this time: CakePHP 1.0 is mainly a bugfix release, with all the features we've learnt to love. It's just _better_: a lot of things have been fixed, model associations work better, etc. etc. You can read the "changelog/announcement":http://cakeforge.org/frs/shownotes.php?group_id=23&release_id=85 or have a look below for a quick summary of the new features and most interesting fixes: + +<pre><code> +Revision: [2420] +Added fix for Ticket #320. +Fixed Model::save() so it will only allow a model to save itself. +Fixed Model::save() when saving a HABTM association + +Revision: [2437] +Adding fix for Model::findNeighbours(). +Was returning all associations and fields. Now recursive +is set to 0 and only returns the prev and next keys array + +Revision: [2456] +"Enables use of Controller::$data in addition to Controller::$params['data']" + +Revision: [2490] +Fixing a bug that occurs when connecting to two different +databases on the same server, and enabling cross-database +model associations + +Revision: [2491] +Adding Microsoft SQL Server driver [EXPERIMENTAL] + +Revision: [2577] +Adding $alias property to enable future Oracle support + +Revision: [2625] +Bringing all DB drivers up to date + +Revision: [2653] +Adding check for custom error class in app/. +Added check for AppController::appError(); will be called if this method +is in AppController. +</code></pre> + +!>http://base--/img/pictures/cakesite.png! + +If you're not too excited about this new release, maybe you should have a look at "www.cakephp.org":http://www.cakephp.org. Different? Damn right it is: it looks like someone listened to our prayers for a new website design. The merciful soul is "Armando Sosa":http://www.nolimit-studio.com/, the winner of CakePHP's design contest. He's a latin-american web designer who had the GREAT idea of thinking about an _innovative_ design for the Cake site... Actually my dad didn't think that way: _"That's not new, that way of advertising was all over the place when I was a kid!"_ And he's right, Armando thought that a fifties-like template would have been perfect for Cake. Forget all the smooth, roundy-and-chubby, toons-like "official" Web 2.0 designs (beta), the new Cake site needs to stand out of the crowd... + +!<http://base--/img/pictures/fonz.jpg! + +<br /><br /> _Heyyy! Well done guys..._
M content/articles/25.textilecontent/articles/25.textile

@@ -7,33 +7,32 @@ comments: []

date: 2006-05-05 03:59:00 +02:00 tags: -- digg - web20 -- web development +- web-development - internet type: article toc: true ----- -...So it turns out that my "last article":http://www.h3rald.com/articles/view/rails-inspired-php-frameworks/ appeared on "Digg":http://www.digg.com homepage. -This was quite a pleasant surprise: I didn't expect that an article submitted to _my own site_ could make it that far! I thought you'd need a relatively well-known website, mafia's support, some divine intervention and a terrific amount of luck, but it seems that sometimes an interesting article about an interesting subject can be enough. I'll probably write a more detailed report of what happened soon, in another article rather than a blog post, but for now I just wanted to post a short summary here. - -Two days ago I decided to write a roundup of the six Rails-inspired PHP frameworks, CakePHP, Symfony, PHP on Trax, Code Igniter, Biscuit and Pipeline. The reason for this was that I couldn't find anything comparing all of them and such comparison could have been useful for some new _bakers_. OK, I confess, when I started writing the article I thought I'd submit it to Digg and see what happens: I saw that another "roundup":http://www.phpit.net/article/ten-different-php-frameworks/ made it to the first page and people were quoting it everywhere on the net. It's a nice article, but - in my humble opinion - not too exhaustive. -Then I read a comment by someone to the "digg":http://digg.com/programming/CakePHP_1.0_has_been_released_ of the latest Cake release stating: - -bq. Yes, they are similar - both were inspired by Rails, but Cake has gone further to differentiate themselves. Here's a decent (but not great) overview of some frameworks: http://www.phpit.net/article/ten-different-php-frameworks/ - -At that point, I thought that another round up, perhaps more Cake-centric, was in order. The other reason was that in one of my recent "blog posts":http://www.h3rald.com/blog/view/23/ I tried to compare CakePHP and Symfony, but obviously my emotions got in the way and in the end I noticed I was kinda _attacking_ Symfony. That was a blog post though, and that's half-allowed, but I felt that I should have written a slightly more objective _article_ mentioning also all the other competitors. - -Anyhow, right when I went to submit my article to Digg, it turns out that another guy wrote "a similar round up":http://digg.com/programming/5_Next_Generation_PHP_Frameworks, which made it to Digg's homepage. That was an annoying cohincidence, but in the end things didn't go too bad: his roundup was more generic, while mine was more specific and detailed. - -!<http://base--/img/pictures/dugg_detail.png! - -After submitting my article the reaction wasn't instantaneous... 5, 7, 10, 13 diggs in the first two hours. Then shortly I made it to 30 and when the 40th visitor dugg it my article was moved to the first page! -I immediately noticed it when I refreshed my stats page: a minute before my girlfriend was here telling me "oh look, over 400 visitors... not too bad". Then I refreshed the page and it said _539_, I refreshed again and said 600-something... eeep... Digg effect! - -A special praise goes to my new hosting company, "BlueHost":http://www.bluehost.com/track/h3rald/CODE5: the server didn't go down and it managed the extra traffic fine! A good test for CakePHP as well, since I built this site with it. - -So here I am... over 5000 visitors read my article, about 600 people dugg it, nearly 40 people commented it on digg.com and 20 directly on my site. And - except for the usual _Rails-is-better-than-anything-else_ comments - they were generally positive. Over 250 people bookmarked on del.icio.us and many blogs mentioned it in many different countries. - -Money? Didn't make much with adsense at all: programmers _don't_ click on ads! +...So it turns out that my "last article":http://www.h3rald.com/articles/view/rails-inspired-php-frameworks/ appeared on "Digg":http://www.digg.com homepage. +This was quite a pleasant surprise: I didn't expect that an article submitted to _my own site_ could make it that far! I thought you'd need a relatively well-known website, mafia's support, some divine intervention and a terrific amount of luck, but it seems that sometimes an interesting article about an interesting subject can be enough. I'll probably write a more detailed report of what happened soon, in another article rather than a blog post, but for now I just wanted to post a short summary here. + +Two days ago I decided to write a roundup of the six Rails-inspired PHP frameworks, CakePHP, Symfony, PHP on Trax, Code Igniter, Biscuit and Pipeline. The reason for this was that I couldn't find anything comparing all of them and such comparison could have been useful for some new _bakers_. OK, I confess, when I started writing the article I thought I'd submit it to Digg and see what happens: I saw that another "roundup":http://www.phpit.net/article/ten-different-php-frameworks/ made it to the first page and people were quoting it everywhere on the net. It's a nice article, but - in my humble opinion - not too exhaustive. +Then I read a comment by someone to the "digg":http://digg.com/programming/CakePHP_1.0_has_been_released_ of the latest Cake release stating: + +bq. Yes, they are similar - both were inspired by Rails, but Cake has gone further to differentiate themselves. Here's a decent (but not great) overview of some frameworks: http://www.phpit.net/article/ten-different-php-frameworks/ + +At that point, I thought that another round up, perhaps more Cake-centric, was in order. The other reason was that in one of my recent "blog posts":http://www.h3rald.com/blog/view/23/ I tried to compare CakePHP and Symfony, but obviously my emotions got in the way and in the end I noticed I was kinda _attacking_ Symfony. That was a blog post though, and that's half-allowed, but I felt that I should have written a slightly more objective _article_ mentioning also all the other competitors. + +Anyhow, right when I went to submit my article to Digg, it turns out that another guy wrote "a similar round up":http://digg.com/programming/5_Next_Generation_PHP_Frameworks, which made it to Digg's homepage. That was an annoying cohincidence, but in the end things didn't go too bad: his roundup was more generic, while mine was more specific and detailed. + +!<http://base--/img/pictures/dugg_detail.png! + +After submitting my article the reaction wasn't instantaneous... 5, 7, 10, 13 diggs in the first two hours. Then shortly I made it to 30 and when the 40th visitor dugg it my article was moved to the first page! +I immediately noticed it when I refreshed my stats page: a minute before my girlfriend was here telling me "oh look, over 400 visitors... not too bad". Then I refreshed the page and it said _539_, I refreshed again and said 600-something... eeep... Digg effect! + +A special praise goes to my new hosting company, "BlueHost":http://www.bluehost.com/track/h3rald/CODE5: the server didn't go down and it managed the extra traffic fine! A good test for CakePHP as well, since I built this site with it. + +So here I am... over 5000 visitors read my article, about 600 people dugg it, nearly 40 people commented it on digg.com and 20 directly on my site. And - except for the usual _Rails-is-better-than-anything-else_ comments - they were generally positive. Over 250 people bookmarked on del.icio.us and many blogs mentioned it in many different countries. + +Money? Didn't make much with adsense at all: programmers _don't_ click on ads! Bandwidth? About 1GB was gone in the first five hours, now is obviously slowing down: oh well, I still have another 398GB available till the end of the month :P
D content/articles/28.textile

@@ -1,28 +0,0 @@

------ -permalink: "28" -filters_pre: -- redcloth -title: (Ready to start) working at Siemens -comments: [] - -date: 2006-05-10 09:55:26 +02:00 -tags: [] - -type: article -toc: true ------ -I signed it yesterday, around 3PM. I gave "them":http://base--/bookmarks/view/siemens/ all the necessary documents and they presented me their contract to sign, I'll have to hand it in on Tuesday at 9AM, my first day at work. - -My new job! For the first time in my life (I'm still "young":http://base--/about/ , c'mon...) I'll start working 40 hours a week, all year, with paid holidays and meals and all the other stuff I was raving about in my last job-related "blog entry":http://base--/blog/view/19/ turns out to be true then: I'm in, I'll be working at "Siemens A&D":http://base--/bookmarks/view/siemens-automation-and-drives! - -!<http://base--/img/pictures/siemens/simatic-tech.jpg! They already set up a nice schedule for me and on Tuesday I'll start my two weeks preliminary training, then another week of training in the Documentation Dept. (where I'll be working) and then I'll start the real tough stuff. -The training period on the "corporate framework":http://base--/bookmarks/view/simatic will obviously be in English (thanks God for that, I wouldn't bare learning that stuff in Italian first), and then I'll start writing documentation on some new project in English as well: it looks like I'm gonna forget Italian totally :) -Nah, I'll still use my mother tongue on the phone to my parents or when I'll be visiting them. - -Scared? A bit. I'll still be writing stuff, nothing new there, but I believe that working for a big company may be a bit different than writing about what I want, whenever I want, wherever I want with my laptop... Nevertheless, it will be fun: it sounds like a dream job for me and I couldn't ask for more. Some may fear to lose their individuality, but I don't: I'm not that bothered honestly, and I still have this very individual website, at any rate! -Oh, by the way: by contract I cannot reveal any technical details of all the wonders and miracles I'll see in there, so don't even ask. So *everything on this site tagged with the "Siemens tag":http://base--/tags/show/siemens/ will never contain any corporate information or stuff which is not already available on the Internet publicly*. I wrote this in bold so that if any collegue/boss comes across this page doesn't start panicking about that :) - -!>http://base--/img/pictures/siemens/siemens.gif! Then what... well, it seems they're using Microsoft technologies there, so I'll probably have to as well. Not that bothered, but I hope Firefox will be allowed: it's more secure, it offers more features and it has tabs. Hell I can't imagine browsing the Net without tabs! At worst I'll install a beta of IE7. -I'll also use email a lot and this translated into MS terms means that I'll have to use Outlook... that kinda freaks me out because I never used it. You can laugh as much as you like but I never used outlook or outlook express properly: if I _had to_ use an email client I always used Netscape or Thunderbird. Oh well, not a big deal actually. - -What will happen to this site, and all the CakePHP-related stuff? Nothing much: I'll have probably less time but I'll still be writing about Cake. Maybe I won't code a lot tough: it seems clear at this point of my life that I'll be a writer rather than a developer.
D content/articles/30.textile

@@ -1,25 +0,0 @@

------ -permalink: "30" -filters_pre: -- redcloth -title: Working! -comments: [] - -date: 2006-05-18 13:13:07 +02:00 -tags: [] - -type: article -toc: true ------ -Yes, I started "working" at the "Siemens/Microsoft MES Expertise Center":http://base--/bookmarks/view/siemens-mes/ two days ago, and you can tell from the lack of activity on my blog, for example. That's the first _real_ and _full-time_ job for me, and yes, I noticed the difference from an "I-get-up-whenever-and-do-whatever" policy to a slightly stricter "get-up-at-seven-and-go-to-work" policy: I obviously don't have the same amount of free time as before, nevertheless I really can't complain. - -!<http://base--/img/pictures/siemens/mes.jpg! For the first two weeks I have to attend the compulsory introductionary course about the "Simatic IT":http://base--/bookmarks/view/simatic-it/ framework, and it's not that bad: the topics of the course are not that difficult (for now), I can understand everything (for now) and people seem really nice and chatty (for now). I'm still a bit scared of the _corporate environment_, the main reason being that it seems _too nice to be true_: especially for me it's really great to have a chance of meeting people from other countries, attend courses _in English_, talk mainly _in English_ and basically be able to forget that _outside_ those walls there's Italy. Not that I particularly hate being in Italy, I like my city in particular, but I relate much better with foreigners and/or English-speakers. - -Everyone has a different accent: you can tell where everyone is from simply after hearing them talking for a few seconds! Oh well, I suppose people can tell I'm Italian from my accent as well, perhaps. I almost immediately made friends with the other four Italians in the training room and also an Austrian guy from one of Siemens' branches in Linz... great people, easy-going and friendly. - -In two weeks time I'll start working _properly_ writing stuff and maybe things won't be as easy... or maybe they will be - I hope - because normally I really like writing about anything, especially in English. - -!>http://base--/img/pictures/roxy/roxy.png! The only bad thing is that this week and maybe even the next I'll have to stay apart from my fiance&eacute; Roxanne, as she's staying at her parents' place (100Km far from me) since we're in the process of restoring our future house. I really miss her terribly and she does as well. The good news is that we'll meet again tomorrow evening as I'll be driving down there immediately for the weekend! -She's actually worrying a bit because of the huge chunk of time that my job will require, but I hope we'll be able to live together in our _own_ house soon: for now our 1st priority is finding a suitable and decent fitted kitchen... anyone? - -Another thing I need to get used to is answering _all_ my emails (and they are a lot in these days) in the evening, without mixing up or forgetting somebody: I got some really good news recently concerning my activity of _freelance writer_, along with various offers from online magazines. I'm also pleased to announce that some editor just got back to me about my new introductive CakePHP article, and it will soon be featured on another (fairly well known) website... a good publicity for myself, my _site_ and CakePHP, that's the most important _point_ ;)
M content/articles/33.textilecontent/articles/33.textile

@@ -9,70 +9,69 @@ date: 2006-06-02 06:10:00 +02:00

tags: - productivity - writing -- note-taking type: article toc: true ----- -As I thought, my job also represents a great opportunity to learn new things. I don't mean only new technical stuff, but also a great deal of tips, best practices and methods to efficiently write documentation material in proper English. Some theory about "Information Mapping":http://www.infomap.com/ was by far the most interesting topic I learnt about this week. - -h3. What is Information Mapping? - -*Definition[1]* -<blockquote>The Information Mapping method is a research-based approach to the analysis, organization, and visual presentation of information.</blockquote> - -*Information Mapping is media independent* -<blockquote>The method is both subject matter and media independent; that is, it can be applied to the subject matter of any industry, and it can be presented on paper, on a computer screen, verbally, or in a multimedia presentation. </blockquote> - -*Key Concepts* -<blockquote>Information Mapping is an integrated set of easy-to-learn principles, techniques, and standards. It enables authors to break complex information into its most basic elements and then present those elements optimally for readers. The result is a set of precisely defined information modules that are consistent from author to author and document to document.</blockquote> - - -*Purpose* -<blockquote> -The method helps writers analyze, organize, and present information with clarity focus and impact. Information That Works. The goal of the analysis component is to determine the - -* purpose -* audience needs, and -* information types. - -The goal of the organization is to create an overall structure for the information, based on the results of your analysis. Finally, the goal of the presentation component is to format the information to make it clear and accessible to your audience. -</blockquote> - -fn1. Contents were taken from "InfoMap.com":http://www.infomap.com/index.cfm/TheMethod/ and were re-formatted and re-organized into an information map. - - -h3. Key Concepts - -*Introduction* -<blockquote>The Information Mapping method relies on some important principles according to which information should be organized. This method also defines new units of information to replace paragraphs, sections and chapters and tries to divide information into a few main set types, each with its own rules and structures.</blockquote> - -*Principles* -<blockquote> - -| *Name* | *Explanation* | -| Chuncking | Writers should group information into small, manageable units. | -| Relevance | Writers should make sure that al information in a chunck relates to one main point (function or purpose). | -| Labeling | Writers should provide a label for every unit of information. | -| Consistency | Writers should use similar labels, word, formats for similar subject matters. | -| Integrated Graphics | The use of tables, images, diagrams and lists is encouraged. | -| Accessible Detail | Documents should provide sufficient details where necessary, to make the information more accessible for the readers. | -| Hierarchy | Small, relevant units of information should be organized into a hierarchy. | - -</blockquote> - -*Information Types* -<blockquote> - -| *Name* | *Definition* | -| Procedure | Set of steps to obtain a specified outcome | -| Process | A series of changes through the time for some purpose | -| Structure | Something which can be defined into multiple parts | -| Concept | Group of physical objects, conditions, relations, ... | -| Principle | Statement of what should be done, assumptions | -| Fact | Statement presented with no supporting evidence | -| Classification | The sorting of a group of specimen into classes | - -</blockquote> - -*Conclusion* +As I thought, my job also represents a great opportunity to learn new things. I don't mean only new technical stuff, but also a great deal of tips, best practices and methods to efficiently write documentation material in proper English. Some theory about "Information Mapping":http://www.infomap.com/ was by far the most interesting topic I learnt about this week. + +h3. What is Information Mapping? + +*Definition[1]* +<blockquote>The Information Mapping method is a research-based approach to the analysis, organization, and visual presentation of information.</blockquote> + +*Information Mapping is media independent* +<blockquote>The method is both subject matter and media independent; that is, it can be applied to the subject matter of any industry, and it can be presented on paper, on a computer screen, verbally, or in a multimedia presentation. </blockquote> + +*Key Concepts* +<blockquote>Information Mapping is an integrated set of easy-to-learn principles, techniques, and standards. It enables authors to break complex information into its most basic elements and then present those elements optimally for readers. The result is a set of precisely defined information modules that are consistent from author to author and document to document.</blockquote> + + +*Purpose* +<blockquote> +The method helps writers analyze, organize, and present information with clarity focus and impact. Information That Works. The goal of the analysis component is to determine the + +* purpose +* audience needs, and +* information types. + +The goal of the organization is to create an overall structure for the information, based on the results of your analysis. Finally, the goal of the presentation component is to format the information to make it clear and accessible to your audience. +</blockquote> + +fn1. Contents were taken from "InfoMap.com":http://www.infomap.com/index.cfm/TheMethod/ and were re-formatted and re-organized into an information map. + + +h3. Key Concepts + +*Introduction* +<blockquote>The Information Mapping method relies on some important principles according to which information should be organized. This method also defines new units of information to replace paragraphs, sections and chapters and tries to divide information into a few main set types, each with its own rules and structures.</blockquote> + +*Principles* +<blockquote> + +| *Name* | *Explanation* | +| Chuncking | Writers should group information into small, manageable units. | +| Relevance | Writers should make sure that al information in a chunck relates to one main point (function or purpose). | +| Labeling | Writers should provide a label for every unit of information. | +| Consistency | Writers should use similar labels, word, formats for similar subject matters. | +| Integrated Graphics | The use of tables, images, diagrams and lists is encouraged. | +| Accessible Detail | Documents should provide sufficient details where necessary, to make the information more accessible for the readers. | +| Hierarchy | Small, relevant units of information should be organized into a hierarchy. | + +</blockquote> + +*Information Types* +<blockquote> + +| *Name* | *Definition* | +| Procedure | Set of steps to obtain a specified outcome | +| Process | A series of changes through the time for some purpose | +| Structure | Something which can be defined into multiple parts | +| Concept | Group of physical objects, conditions, relations, ... | +| Principle | Statement of what should be done, assumptions | +| Fact | Statement presented with no supporting evidence | +| Classification | The sorting of a group of specimen into classes | + +</blockquote> + +*Conclusion* <blockquote>Although it may initially seem too schematic, Information Mapping is a valid method to organize and present information to those readers who just need "facts" without any unnecessary distraction. This method it is used with some modifications in many technical manuals and documentation written by many companies.</blockquote>
D content/articles/35.textile

@@ -1,66 +0,0 @@

------ -permalink: "35" -filters_pre: -- redcloth -title: Some essential tools to survive in a corporate environment -comments: [] - -date: 2006-06-18 07:55:26 +02:00 -tags: [] - -type: article -toc: true ------ -A month has passed since I started working at the "MES Expertise Center":http://base--/bookmarks/view/mes-expertise.center/, and I must say I'm very impressed after all. I started with a two-weeks course on SIMATIC IT Production Suite, the flagship product developed by Siemens here in Genoa, and it was a real piece of cake: the trainers were very prepared and everything was explained very clearly for both us internal workers and the customers attending the lessons. In my opinion this is one of the most successful things Siemens and Microsoft achieved when they opened the MES Expertise Center: creating a place where both Siemens staff and partners can learn and experiment new cutting-edge MES-related products. Even during the course, when someone asked a particularly complex question and the trainer couldn't answer, consultants or even R&D staff were immediately contacted (also because they were literally next door...) to provide an authoritative and exhaustive answer. - -OK, enough with the promotional speech now, let's talk about what I did _after_ the course, during the last two weeks. I thought I'd start writing some manual or online help as I was originally told, but my boss wanted me to spend six weeks down with the consultants to learn more about SIMATIC IT and acively work with it in real-world application. "This is not a drill, soldier" comes to mind... ;) - -SIT consultants -- I tought -- are tough people who travel around the world to customers plants to deploy and create taylored MES solutions for various kinds of industries, from Food and Beverage to Automotive. Indeed they are, but they are damn great and fun to work with: in these two weeks these guys made me learn a lot of things simply by working on their testing servers and virtual machines, making you _feel_ you're doing something useful. I soon learnt the importance, for the morale, of those rituals they call "coffee breaks": I still can't stop crying for laughter (literally) when people start competing with each other by telling the most hilarious (and true) stories about their "adventures" in foreign countries. - -!<http://base--/img/pictures/siemens/e8020.jpg! Another great thing of working in a company which among other things "makes computers":http://www.fujitsu-siemens.com/ is the equipment they provide. Right after attending the course I was given a brand new "LifeBook E8020":http://reviews.zdnet.co.uk/hardware/notebooks/0,39023985,39191340,00.htm to use for work, and the only bad thing about it is that I can't take it at home! The complaints about the low battery life are complete nonsense, as that little baby can stay up for about 5-6 hours (no kidding!), and it also came with a huge 2GB RAM - the maximum it can handle, I think. - -What software I used most, so far? Read on... - - -h3. VMware Workstation - -!>http://base--/img/pictures/tools/vmware.gif! Why the scary amount of RAM? Simple: for virtual machines. Most of the tests and work is done using "VMware":http://www.vmware.com Workstation and pre-built virtual machines represent the best and fastest way to work, especially when testing software because: - -* No installation is required: just transfer a 8GB file on your machine, double-click on it and there you go -- and yes, this means a lot of time saved -* If you mess something up, you don't compromise your "real" operating system and you just change virtual machine -- and since we do anyway every three weeks once a new build of the product comes out, it's not a big deal - -The downside of virtualization is that you need plenty of resources available on your host OS, memory in particular, but as I said 2GB of RAM (one of which goes to the virtual machine) are more than enough. - -h3. Internet Explorer 7 beta 2 (FREE) - -!>http://base--/img/pictures/tools/ie7.gif! ??"So now you're connected to the main network, and you can now use Internet Explorer to access both the intranet and the Internet of course".?? -*Wrong*. I won't use the bloody thing: Internet Explorer 6 simply sucks, and we all know why. Really, I tried to use it, but then after five minutes of "tabless" browsing and other annoyances I downloaded and installed Firefox. There, done. -*Wrong again*. Half of the corporate intranet sites and portals were build in ASP using proprietary technologies (== ActiveX galore!), so yes, half of the pages didn't come up right in Firefox. And if the portal for corporate quality standards is not displayed correctly a few days before a big company audit... well, that's simply not good, so I thought about choosing a Firefox alternative: "Internet Explorer 7 beta 2":http://www.microsoft.com/windows/ie/default.mspx. -Nevermind the official page, I couldn't stop laughing at what uncle Bill wrote there: - -_We heard you._ - -_You wanted it easier and more secure_ - -For a few moments I thought they were introducing a new, revolutionary brand of condoms. Unfortunately it's just a web browser. - -Of course no problems with the WGA crap since obviously I'm running a genuine copy of Windows XP Professional (another good thing of working for a certified Microsoft partner): I immediately downloaded and installed IE7, and now things are slightly better. It is obviously not as versatile as Firefox, but it does the job alright, I must say. - -h3. SyncToy (FREE) - -Once in a while Microsoft comes up with a little useful FREE utility. I must spend more time on MS download center because I'm sure I'll find some more useful tools: "someone":http://techtics.iblogzz.com/2006/04/30/windows-defender-genuine-crack/ even managed to crack Windows Defender installation using the Orca MSI package editor, which is part of Microsoft Platform SDK components... So yes, searching carefully in MS downloads is worth it! -I didn't need to find anything like that of course, but I did need a free, fully-featured synchronization utility! I use my USB flash drive a lot in these days, and especially now that I have a laptop at home, a laptop at work and a few virtual machines, keeping the stuff up to date was becoming a problem. Yes, there are some other sync utilities available on the Net, but most of them are commercial or shareware, Microsoft "SyncToy":http://base--/bookmarks/view/synctoy, amazingly, can help you to keep your stuff synchronized totally for free. - -SyncToy can manage many "folder pairs" on different locations and perform various types of actions: synchronize, echo, contribute, combine and subscribe, according to your needs. Furthermore, a handy "preview" shows the user what files will be created/overwritten/moved/delete before a particular action is performed... truly a wonderful little utility. - - -h3. Notepad++ (FREE) - -Last but not least, another free tool, GPL-licensed this time: "Notepad++":http://base--/bookmarks/view/notepadplus/: a portable, lightweight, feature-rich multi-purpose text editor. It's absolutely free to use and distribute and it's 100% portable: it lives permanently on my USB drive, but I also installed it on both my laptops and it's currently my text editor of choice. -Two weeks ago they told me I'd have "programmed" something using "G2":http://www.gensym.com/?p=what_it_is_g2, a proprietary, real-time rule engine platform by Gensym. The thing uses its own "natural" programming language, with its own syntax, its functions etc. etc. -Now, imagine having to write some _structures_ like this: - -structure('entity_name': "TEST", 'entity_content': sequence(structure('entity_name': "TEST2", 'attribute1: "some text", 'attribute2: "more text", 'entity_content': sequence("some content")))) - -...This is just a simple example, things are much more complex than this in reality and believe me, I really felt I needed some custom editor able to handle that syntax. -The easiest solution for all my problems was just Notepad++: in a few minutes I was able to create a custom language highlighter for g2, and everything became really much easier.
M content/articles/36.textilecontent/articles/36.textile

@@ -7,31 +7,30 @@ comments: []

date: 2006-07-12 09:19:00 +02:00 tags: -- sport -- soccer +- italy type: article toc: true ----- -_*Italy has won the World Cup!*_ - -It doesn't matter if Zidane first scored on a totally unfair penalty kick at the 7th minute and then, totally out of his mind, headbutted Materazzi... WE WON, AND WE KICKED THEIR ASS, end of story :) - -<div align="center"> -!http://base--/img/italy/worldcup.jpg! </div> - -<blockquote> -!<http://base--/img/italy/grosso.jpg! - -"Italy beat France 5-3 in a penalty shoot-out to win the World Cup after an absorbing 1-1 draw in Berlin. - -!>http://base--/img/italy/italy1.jpg! - -Fabio Grosso scored the winning goal after France's David Trezeguet missed. - -Playing his last game before retiring, Zinedine Zidane's career ended in disgrace after he was sent off for crazily headbutting Marco Materazzi. - -Zidane had put France ahead early on with a coolly-taken chipped penalty, before Materazzi levelled with a header from an Andrea Pirlo corner. -The result caps an incredible period for Italian football, with the domestic game embroiled in a corruption scandal similar to 1982 when they last won the World Cup. " -</blockquote> - -"Read More":http://news.bbc.co.uk/sport2/hi/football/world_cup_2006/4991652.stm +_*Italy has won the World Cup!*_ + +It doesn't matter if Zidane first scored on a totally unfair penalty kick at the 7th minute and then, totally out of his mind, headbutted Materazzi... WE WON, AND WE KICKED THEIR ASS, end of story :) + +<div align="center"> +!http://base--/img/italy/worldcup.jpg! </div> + +<blockquote> +!<http://base--/img/italy/grosso.jpg! + +"Italy beat France 5-3 in a penalty shoot-out to win the World Cup after an absorbing 1-1 draw in Berlin. + +!>http://base--/img/italy/italy1.jpg! + +Fabio Grosso scored the winning goal after France's David Trezeguet missed. + +Playing his last game before retiring, Zinedine Zidane's career ended in disgrace after he was sent off for crazily headbutting Marco Materazzi. + +Zidane had put France ahead early on with a coolly-taken chipped penalty, before Materazzi levelled with a header from an Andrea Pirlo corner. +The result caps an incredible period for Italian football, with the domestic game embroiled in a corruption scandal similar to 1982 when they last won the World Cup. " +</blockquote> + +"Read More":http://news.bbc.co.uk/sport2/hi/football/world_cup_2006/4991652.stm
M content/articles/37.textilecontent/articles/37.textile

@@ -9,37 +9,36 @@ date: 2006-07-25 03:07:00 +02:00

tags: - website - cakephp -- design type: article toc: true ----- -Quite a bit of time passed since the last blog post, and I'm actually sorry about that, but as I thought, I don't have as much free time as I used to be. Work is work, after all! -This post will be multipurpose as actually I bluid up a few things to write about in the last few days... erhm, ok, _weeks_. - -h3. New Website Design - -Something different eh? Yep, definitely! Some time ago I started a small project called "h3raLd.com Re-design":http://base--/projects/view/h3rald-redesign hoping that some GFX guru could provide a new template for this website, and actually in the end I decided to accept the work of _*Bartus F. Teipel*_ a Brazilian CakePHP enthusiast. -Bartus is obviously (MUCH) more talented than me when it comes to design, and I was amazed at the quality of the template he provided, in a really short time. -Unfortunately he didn't yet provide a link to his main website/portfolio, but for now all I can show you is his website for party pics, "CircusCircus":http://www.circuscircus.com.br/. - -The new template sports a more contemporary Web2.0-ish look which I like a lot, and Bartus used libraries like "prototype":http://prototype.conio.net/, "moo.fx":http://moofx.mad4milk.net/ and "Nifty Corners Cube":http://www.html.it/articoli/niftycube/index.html for the AJAX effects and functionalities. -A really outstanding work, thanks Bartus! - -h3. The CakePHP Herald project has been completed - -With my "latest article":http://www.h3rald.com/articles/view/cakephp-first-bite/ about CakePHP published on SitePoint, the "CakePHP Herald":http://base--/projects/view/cakephp-herald/ project was completed. -I must say that I really enjoyed writing all those articles about CakePHP, and the only thing I regret is not to have written anything (yet) about some more advanced topic about CakePHP. This was mostly due to - again - lack of time to focus on advanced topic and produce some quality examples. - -However, judging by the positive feedback I received about the articles, I am really happy of the final result: even more people discovered the power of CakePHP and became _bakers_. Happy baking to all of you! - -_So... no more articles about Cake?_ Maybe not for a while, I think I'll be rather busy in the following months. Curious? Read on :-) - -h3. My biggest and most important project - -I actually got really pissed off with Larry, Garret & the other Master Bakers because of what they wrote on the "announcement":http://cakeforge.org/forum/forum.php?forum_id=244 for the latest CakePHP release: - -bq. "[...]In other news, some new articles were published on Sitepoint [3] and in the International PHP magazine [4]. Fabio Cevasco [5] is the man behind these articles. Together with Fabio, we will be writing a book that will be published [...]" - -After all this time I spent _trying desperately not to say a word about it_ they came out and heralded it out of nowhere. Sigh... they ruined the surprise effect! Oh well, it's too late now, isn't it? - +Quite a bit of time passed since the last blog post, and I'm actually sorry about that, but as I thought, I don't have as much free time as I used to be. Work is work, after all! +This post will be multipurpose as actually I bluid up a few things to write about in the last few days... erhm, ok, _weeks_. + +h3. New Website Design + +Something different eh? Yep, definitely! Some time ago I started a small project called "h3raLd.com Re-design":http://base--/projects/view/h3rald-redesign hoping that some GFX guru could provide a new template for this website, and actually in the end I decided to accept the work of _*Bartus F. Teipel*_ a Brazilian CakePHP enthusiast. +Bartus is obviously (MUCH) more talented than me when it comes to design, and I was amazed at the quality of the template he provided, in a really short time. +Unfortunately he didn't yet provide a link to his main website/portfolio, but for now all I can show you is his website for party pics, "CircusCircus":http://www.circuscircus.com.br/. + +The new template sports a more contemporary Web2.0-ish look which I like a lot, and Bartus used libraries like "prototype":http://prototype.conio.net/, "moo.fx":http://moofx.mad4milk.net/ and "Nifty Corners Cube":http://www.html.it/articoli/niftycube/index.html for the AJAX effects and functionalities. +A really outstanding work, thanks Bartus! + +h3. The CakePHP Herald project has been completed + +With my "latest article":http://www.h3rald.com/articles/view/cakephp-first-bite/ about CakePHP published on SitePoint, the "CakePHP Herald":http://base--/projects/view/cakephp-herald/ project was completed. +I must say that I really enjoyed writing all those articles about CakePHP, and the only thing I regret is not to have written anything (yet) about some more advanced topic about CakePHP. This was mostly due to - again - lack of time to focus on advanced topic and produce some quality examples. + +However, judging by the positive feedback I received about the articles, I am really happy of the final result: even more people discovered the power of CakePHP and became _bakers_. Happy baking to all of you! + +_So... no more articles about Cake?_ Maybe not for a while, I think I'll be rather busy in the following months. Curious? Read on :-) + +h3. My biggest and most important project + +I actually got really pissed off with Larry, Garret & the other Master Bakers because of what they wrote on the "announcement":http://cakeforge.org/forum/forum.php?forum_id=244 for the latest CakePHP release: + +bq. "[...]In other news, some new articles were published on Sitepoint [3] and in the International PHP magazine [4]. Fabio Cevasco [5] is the man behind these articles. Together with Fabio, we will be writing a book that will be published [...]" + +After all this time I spent _trying desperately not to say a word about it_ they came out and heralded it out of nowhere. Sigh... they ruined the surprise effect! Oh well, it's too late now, isn't it? + So yes, when I say that I'm spending at least 60% of my time (at work and at home) writing I really mean it. The rest? Well, I do have a lovely girlfriend after all!!!
M content/articles/38.textilecontent/articles/38.textile

@@ -18,101 +18,101 @@ date: 2006-08-02 01:33:00 +02:00

tags: - frameworks - php -- web-development +- webdevelopment - review type: article toc: true ----- -Bermi Ferrer kept his promise, and even if a few were skeptic on the "pre-announced":http://base--/blog/view/34/ features of his upcoming Akelos framework, last week he sent me a "development preview" and a few days ago he opened the development SVN repository to the public: - -<a href="svn://akelos.org/trunk" target="_blank">svn://akelos.org/trunk</a> - -Go, get it: it's worthwhile (see below). - -"[...] The Akelos Framework is an open-source port of Ruby on Rails to the PHP programming language. -The main goal of the Akelos Framework is to help programmers to build multilingual database-backed web applications according to the Model-View-Control pattern. It lets you write less code by favoring conventions over configuration." - -At the Akelos Framework Features page you can find detailed information about what has been already implemented into the framework. -</blockquote> - -I think it says it all, well almost. Some people will undoubtedly be disgusted by yet-another-hopeless-Rails-clone: _not again!_ I hear them crying... - -Well, yeah, I think this - to be honest - should be the last attempt someone makes to port Rails to PHP or at least port _some features and the overall philosophy_, like "CakePHP":http://base--/bookmarks/view/cakephp did: there are honestly too many for one single language. Look at Python, "Django":http://www.djangoproject.com/ seems to be the only "Rails-inspired" framework available and everyone is happy with it, while as a general rule PHP folks are never happy with what they already got. - -Bermi is undoubtedly one of them, and that's the reason he decided to code his very own Rails-inspired framework for PHP, which is, to date, the most remarkable of the ones I left out (it wasn't available at the time) in my "article":http://base--/articles/rails-inspired-php-frameworks/. - -h3. Confirmed Features & Contents - -So well, although I didn't really have a proper chance to play with Akelos I can certainly herald some of its - verified, this time - features. - -For one, it's huge. Take Cake, add _every excellent, useful third party library or class you can possibly thing of_ and you'll get Akelos. No kidding. The unzipped source of the whole framework is a massive 16MB, 8.5 of which constitute the @vendors@ folder. What's in it? Well, all this: - -* ADOdb -* Domit -* FPDF -* Excel (reader library) -* Hyper Estraier full-text search system -* Inutio XML-RPC Library -* _Many_ PEAR packages -* PHPCodeAnalyzer -* PHPmailer -* SimpleTest -* A Simple PHP YAML Class -* Textile - -Then, similarly, all the state-of-the-art Javascript/AJAX hyper-hyped libraries are included: - -* AFLAX -* Behaviour -* Builder -* various Scriptaculous packages -* Prototype -* FileUploader (by the author, using prototype) -* Window -* EventSelectors - -!<http://base--/img/pictures/frameworks/akelos_framework_logo.gif! - -Good, well, kind of: that's just what _others_ did, but it's worth noting that it's all there and - apparently - integrated with the framework, hopefully not too tightly. But people are fussy, and do not get excited easily anymore, long gone are the early days of Rails, when the whole Internet shake at hearing about _code generators_... Aye, there are in Akelos as well, of course! - -Coming to the more juicy stuff, _lo' and behold, ye contents of /lib folder (with comments):_ - -* AkActionController (controller) -* AkActionView (view) -* AkActionWebservice (Web services) -* AkActiveRecord (model) -* AkAdodbCache (content caching) -* AkCharset (utf8 support, includes _all_ mappings) -* AkConfig (load config settings) -* AkConverters (conversions!) -** DBDesigner > AkelosDatabaseDesign -** Excel > Array (bi-dimensional) -** Excel > CSV -** HTML > RTF -** HTML > Text -** Word > Unicode -** PDF > Text -** Xdoc > Text -* AkHeaders (HTTP headers, redirections) -* AkImages (Image operations, resizing) -* AkLocalize (Localization, countries and timezones) -* AkInflector -* AkLogger -* AkFtp -* AkInstaller -* AkRouter -* AkZip -* ... - -Well, it's all there, at any rate. The best way to know if it all works, and _how_ it works, is simply to try it out: "www.akelos.org":http://www.akelos.org/. - -h3. Remarks - -As I said earlier, Akelos looks like _CakePHP on steroids_: agreed, the Cake philosophy of "no we-may-use-it code in the trunk" has been _completely_ (and intentionally) ignored, but this is our chance to peek at what CakePHP could have become if such philosophy didn't become a lifestyle for the Cake Dev Team. -Akelos code is Rails-inspired, so yes, it's _very_ similar to Cake, although with some rough edges and some re-used parts, but it's the work of ONE person with no community support (yet), don't forget. Remarkable. - -And he needs co-developers, by the looks of it, so there you are then: there's _your_ chance! - -My personal opinion about it? Well, I think Akelos can learn from CakePHP and vice-versa: a merge? Well, at least it would reduce the number of Rails-inspired framework for PHP and _possibly_ meet the needs of more people: those who want just the essentials, as a framework, and those who like to be _virtually almighty_ and be able to do anything, _if they wanted to_. - +Bermi Ferrer kept his promise, and even if a few were skeptic on the "pre-announced":http://base--/blog/view/34/ features of his upcoming Akelos framework, last week he sent me a "development preview" and a few days ago he opened the development SVN repository to the public: + +<a href="svn://akelos.org/trunk" target="_blank">svn://akelos.org/trunk</a> + +Go, get it: it's worthwhile (see below). + +"[...] The Akelos Framework is an open-source port of Ruby on Rails to the PHP programming language. +The main goal of the Akelos Framework is to help programmers to build multilingual database-backed web applications according to the Model-View-Control pattern. It lets you write less code by favoring conventions over configuration." + +At the Akelos Framework Features page you can find detailed information about what has been already implemented into the framework. +</blockquote> + +I think it says it all, well almost. Some people will undoubtedly be disgusted by yet-another-hopeless-Rails-clone: _not again!_ I hear them crying... + +Well, yeah, I think this - to be honest - should be the last attempt someone makes to port Rails to PHP or at least port _some features and the overall philosophy_, like "CakePHP":http://base--/bookmarks/view/cakephp did: there are honestly too many for one single language. Look at Python, "Django":http://www.djangoproject.com/ seems to be the only "Rails-inspired" framework available and everyone is happy with it, while as a general rule PHP folks are never happy with what they already got. + +Bermi is undoubtedly one of them, and that's the reason he decided to code his very own Rails-inspired framework for PHP, which is, to date, the most remarkable of the ones I left out (it wasn't available at the time) in my "article":http://base--/articles/rails-inspired-php-frameworks/. + +h3. Confirmed Features & Contents + +So well, although I didn't really have a proper chance to play with Akelos I can certainly herald some of its - verified, this time - features. + +For one, it's huge. Take Cake, add _every excellent, useful third party library or class you can possibly thing of_ and you'll get Akelos. No kidding. The unzipped source of the whole framework is a massive 16MB, 8.5 of which constitute the @vendors@ folder. What's in it? Well, all this: + +* ADOdb +* Domit +* FPDF +* Excel (reader library) +* Hyper Estraier full-text search system +* Inutio XML-RPC Library +* _Many_ PEAR packages +* PHPCodeAnalyzer +* PHPmailer +* SimpleTest +* A Simple PHP YAML Class +* Textile + +Then, similarly, all the state-of-the-art Javascript/AJAX hyper-hyped libraries are included: + +* AFLAX +* Behaviour +* Builder +* various Scriptaculous packages +* Prototype +* FileUploader (by the author, using prototype) +* Window +* EventSelectors + +!<http://base--/img/pictures/frameworks/akelos_framework_logo.gif! + +Good, well, kind of: that's just what _others_ did, but it's worth noting that it's all there and - apparently - integrated with the framework, hopefully not too tightly. But people are fussy, and do not get excited easily anymore, long gone are the early days of Rails, when the whole Internet shake at hearing about _code generators_... Aye, there are in Akelos as well, of course! + +Coming to the more juicy stuff, _lo' and behold, ye contents of /lib folder (with comments):_ + +* AkActionController (controller) +* AkActionView (view) +* AkActionWebservice (Web services) +* AkActiveRecord (model) +* AkAdodbCache (content caching) +* AkCharset (utf8 support, includes _all_ mappings) +* AkConfig (load config settings) +* AkConverters (conversions!) +** DBDesigner > AkelosDatabaseDesign +** Excel > Array (bi-dimensional) +** Excel > CSV +** HTML > RTF +** HTML > Text +** Word > Unicode +** PDF > Text +** Xdoc > Text +* AkHeaders (HTTP headers, redirections) +* AkImages (Image operations, resizing) +* AkLocalize (Localization, countries and timezones) +* AkInflector +* AkLogger +* AkFtp +* AkInstaller +* AkRouter +* AkZip +* ... + +Well, it's all there, at any rate. The best way to know if it all works, and _how_ it works, is simply to try it out: "www.akelos.org":http://www.akelos.org/. + +h3. Remarks + +As I said earlier, Akelos looks like _CakePHP on steroids_: agreed, the Cake philosophy of "no we-may-use-it code in the trunk" has been _completely_ (and intentionally) ignored, but this is our chance to peek at what CakePHP could have become if such philosophy didn't become a lifestyle for the Cake Dev Team. +Akelos code is Rails-inspired, so yes, it's _very_ similar to Cake, although with some rough edges and some re-used parts, but it's the work of ONE person with no community support (yet), don't forget. Remarkable. + +And he needs co-developers, by the looks of it, so there you are then: there's _your_ chance! + +My personal opinion about it? Well, I think Akelos can learn from CakePHP and vice-versa: a merge? Well, at least it would reduce the number of Rails-inspired framework for PHP and _possibly_ meet the needs of more people: those who want just the essentials, as a framework, and those who like to be _virtually almighty_ and be able to do anything, _if they wanted to_. + Two flavours of the same framework? _CakePHP_ and _cAkePHP_ (note the case)? Bah, let's stop raving now, shall we?
M content/articles/8.textilecontent/articles/8.textile

@@ -8,12 +8,12 @@

date: 2006-04-06 16:57:00 +02:00 tags: - website -- web-development +- webdevelopment - cakephp type: article toc: true ----- -Yes, it works. Perhaps it's a tiny bit slower than expected but the new h3raLd.com seems to work. -I'll probably find some new exciting bugs to fix in the next few hours, as usual - that will be annoying but perfectly normal. - +Yes, it works. Perhaps it's a tiny bit slower than expected but the new h3raLd.com seems to work. +I'll probably find some new exciting bugs to fix in the next few hours, as usual - that will be annoying but perfectly normal. + -The good thing is that the new template seems to load faster, mostly due to the fact that I hardly used images- <- [not true, te new site appears to be slower, maybe not due to the images], at any rate, let's see how it goes. I can imagine I'll have to implement some sort of caching system for the tagging system in particular, but fortunately "CakePHP":http://www.cakephp.org/ apparently comes with a built-in caching mechanism for views, models etc. etc. although the documentation available seems to be "scarce":http://groups.google.com/group/cake-php/browse_thread/thread/f0f96751bb61bc7b/bcb43c97e91923c7?q=caching&rnum=1#bcb43c97e91923c7 at the moment, and I've been to lazy to investigate any further.
M content/articles/a-look-at-drupal.bbcodecontent/articles/a-look-at-drupal.bbcode

@@ -8,190 +8,190 @@

date: 2006-01-12 07:42:44 +01:00 tags: - php -- web-development +- webdevelopment - review type: article toc: true ----- -[i][b]Important Notice:[/b] This article is about changes occurring to zZine Magazine's site[1]. At the time of writing, www.zzine.org uses the old site, and not the Drupal-based one presented in this article, which is currently under construction[18].[/i] - -"Why can't we log who edits the articles?" -"Can we send newsletters?" -"We should really have a members' area..." - -zZine.org[1] is a scratch-built site, coded from the ground up to offer zZine journalists, editors and readers all the functionalities and features they wanted. I'm not totally against sites being coded from scratch, but what happens if something needs to be fixed, or new functionalities have to be implemented and you realize that the code cannot be extended or patched easily?[b]Case Study: zZine Magazine[/b] - -zZine Magazine is an online magazine which publishes not only IT-related and other articles on a weekly basis, but also monthly publications containing CyberArmy[2] digests, special columns, and featured articles. A team of journalists, researchers, editors, publishers and outside contributors has access to the zZine site to write, submit, and edit articles, manage publications and perform various other tasks through a password-protected administration area. This is common to approximately 75% of the websites on the Internet: they have a front-end to present content to the general public and a semi-hidden administration backend which is normally more difficult and tedious to code. That's why someone started developing [i]Content Management Systems[/i][3]: ready-made, fully-featured administrative back-ends for creating and managing almost any kind of website, from blogs to eCommerce portals. - -Could a CMS be used for zZine Magazine? Probably - zZine doesn't need any innovative or advanced features, just a bunch of commonly-used functionalities like: -[list] - [*]Add, delete, edit and publish articles - [*]Customizable user permissions, ideally role-based (writer, editor, publisher, etc.) - [*]Creating and managing monthly publications - [*]Editor's tests - [*]User signups, notifications, etc. - [*]RSS feed generation - [*]Sending newsletters to subscribers - [*]Logging user actions -[/list] -Some members of my team raised some concerns regarding the usage of a CMS, which were mostly based on our past experience with just a particular product and not CMSes in general. Everybody agreed that if we were to go back to a CMS, we [i]had[/i] to choose the [i]best[/i] this time: something flexible, easy to use, fast, search-engine friendly, and extensible. I spent some time researching CMSes, because while I knew that there's no such thing as the best CMS, there was certainly a CMS that was best for our needs. - - -[b]Making the right choice[/b] - -In the past, I had played around with Xoops[4] when I first thought about creating websites, and I used Mambo[5] for some other sites. I admit that I never actually spent time creating complex Mambo components and modules, but I must say that in the end I felt somehow tied to third-party modules and unable to understand how they really worked: Mambo seemed to give developers too much freedom, and had neither a solid API nor conventions to follow, at least when I used it. - -So I decided to have a look around again, starting from the two most important sites people should look at when choosing the most suitable CMS for their work. -The first site is CMS Matrix[6] which - as the name implies - provides a really handy [i]matrix[/i], or chart, to compare the various features offered by nearly all CMS available, both proprietary and open-source. - -I remember choosing Mambo last time I used the matrix simply because it appeared to be one of the most feature-rich. This is actually something [i]not[/i] to do when choosing a CMS: always concentrate on what your site needs rather than what the CMS is able to offer. Otherwise, you run the risk of having too much to work with. - -The other important website to visit when choosing a Content Management System is OpenSourceCMS[7], which basically allows you to try a demo of every open source CMS online. This is perhaps more useful, but also much more time-consuming: it's better to narrow down the list of possible CMSes after checking CMS Matrix and then try each one rather than just picking one at random. - -At this point, an experienced CyberArmy staff member[8] suggested Drupal[9]. I asked her why, and she simply said that it seemed to be the best choice according to zZine's needs, as it basically offered all the features we were looking for, either natively or through modules. She also admitted to be biased, as she's actually [i]part of Drupal's documentation team[/i] and involved with Drupal development[10]. - -Before making any kind of commitment, I checked out Drupal's website to see how they organized things, and I was quite impressed. I immediately noticed the Handbooks section[11], which contains all the official Drupal documentation and it seemed pretty much complete. No "under construction", "please write content here" or "we're a new project, help us write the documentation" notes, just a load of good-quality documentation, including a fully documented and [i]stable[/i] API![12] - -This surprised me, because some projects I came across, even really good ones, lacked a proper documentation section. I think this is a common problem with new open source projects, and Drupal for this reason gave me the impression to be quite mature and useable already. After visiting the very clear and organized Downloads Section[13], I downloaded the CMS and a few modules and installed it on my laptop. - - -[b]Installation[/b] - -Drupal needs three things to run: -[list] - [*]A web server - Apache is fine, and ISS is reported to be working - [*]PHP - Either version 4 or 5, Drupal started supporting PHP5 since 4.6.0 release - [*]A PHP-compatible database - MySQL or PostgreSQL is recommended -[/list] -I used a WAMP[14] installation to test Drupal. First of all, I created a MySQL database, granting ALL privileges to the database user accessing the Drupal database. When I uploaded the site to the remote server, later on, I had some problems because the LOCK TABLES privilege wasn't granted by the host. Drupal requires this, so I had to contact my host to solve the problem. I then imported the database scheme located in the [i]database[/i] directory under the installation directory and modified the configuration settings (sites/default/settings.php) to allow Drupal to access the database. Installation complete. - -Drupal was now up and running with the default configuration settings, with a minimum of fuss. For all the details concerning the installation process, consult the exhaustive documentation.[15] I didn't read it when I installed it, but it can really be useful in some situations. - - There are actually two non-critical things to consider if you're planning to use Drupal for a medium-sized project: the first involves changing a few settings on php.ini, in particular increasing the amount of memory allocated to PHP from 8MB to 16MB, especially if you're planning to use either a lot of simple modules or a few complex ones, and the second is setting up your crontab to execute [i]http://www.yoursite.com/cron.php[/i] every hour or so. This is required by some semi-essential modules like the site-wide search, but a common alternative (if you don't want to setup the [i]cron[/i] task manually) is the poorman's [i]cron[/i] module[15], which I used myself and found to be workable. - - -[b]Keeping your site under control[/b] - -Perhaps one of the best things Drupal has to offer is a rock-solid general-purpose administrative backend. The first thing I found in the backend which really impressed me (and that also I never found in another CMS) is the ability to create [i]custom[/i] role-based user accounts and access permissions for [i]everything[/i]: every module can be configured so that, for example, not all people can see its output and just a few can administer and modify it. - -For zZine, I created four types of accounts: -[list] - [*][i]Administrator[/i] - Able to access everything and change every setting of the site - [*][i]Publisher[/i] - Able to write, edit and publish every kind of content on the site, but not able to administer user accounts, permissions and similar administrator-only tasks. - [*][i]Editor[/i] - Able to write and edit anything on the site, but not to publish it. - [*][i]Writer[/i] - Able to write articles, blogs and similar content, but in some cases not allowed to edit it. -[/list] -These were precisely the account types I was looking for in a CMS. Granted, other products offer them by default, but having pre-defined account types is one thing, and being able to customize them completely is another. - -User accounts are great, but sometimes it's good to know what the users of your sites are doing as well. On our old site we had user accounts for editors and administrators, and even if only a few people had access we had no way to determine who edited an article or who published something unless that person told us. Drupal comes with a radical solution to this: Almost every action is automatically logged by the [i]watchdog[/i] core module. Every website error, every page not found, and every PHP or MySQL error is logged, as well as every content submission or modification. Page accesses, meanwhile, can be logged through the statistics module. - -Themes & Templates - -"We shouldn't use a CMS: I don't want zZine to have the overly used *nuke-style look." I've heard this too many times. Sometimes people associate the word "CMS" with "lack of original design", and that's not true by any means, especially for Drupal. Of course, there are plenty of ready made themes[16] which can be freely used or modified for any Drupal-based site. - -I must confess that when I first saw the themes section I feared that Drupal "themes" used their own template engine, like some CMSes do nowadays, but I was wrong: currently Drupal supports some template engines[17] but also pure PHP-based ones. Theme engines do their job wonderfully and can offer some interesting features, but templates written natively in PHP tend to perform better, simply because there's no extra parsing or additional overhead involved. - -I decided to have a look at a standard PHP theme. Basically, it's nothing more than a PHP-enriched xHTML file and its corresponding stylesheet. There are a few functions which must be used to perform particular tasks, like showing the main navigation links, but nothing too hard to understand. It's also [i]very[/i] customizable. In fact, we're already working on a custom zZine theme, which doesn't seem any harder than coding a standard xHTML template. As design should always be the last thing to worry about, I decided to use a temporary template I created by slightly modifying an existing one.[18] - - -[b]To switch or not to switch?[/b] - -When creating a new site for an organization which already has one, there's something very important to consider: [i]what happens to the old data[/i]? -Assuming the old site was dynamic and using a database of some sort, there are three possibilities: -[list] - [*]Don't bother doing anything: any data on the old site will not be transferred to the new one. - [*]Make the old website available somewhere else as an [i]archive[/i] of old documents. - [*]Import all the data from the old site to the new one. -[/list] -Obviously we went straight for the third one, which is the most difficult to implement, but it was necessary: there were over 1000 articles on the old site- - -Of course, in reality, I didn't even mention the possibility of using Drupal until I figured out a way to import the old data into the new database structure. Never praise features or convince people to switch unless you're 100% sure you can handle the situation. Luckily for me, it turned out that everything could be imported easily enough. - -The first difference I found between Drupal and zZine was that we didn't really have proper user accounts. Every article had an author, but it was stored as a field in the article's record, and that was all. Drupal, on the other hand, supports (and perhaps requires) user accounts - everything present on the site must be written or edited by an existing user. - -The solution I cam eup with was rather drastic: I created about 120 user accounts, retrieving usernames from the articles and inserting them through a custom PHP script into Drupal's user table. Of course, those users never registered on the new site[18], so I didn't personalize the accounts at all: I simply put a notice on the first page asking everyone who contributed to zZine before to contact me in some way to enable their account with a valid email address. - -After this initial difficulty, importing articles was relatively easy. Pretty much every type of content in Drupal is, in its simplest form, a [i]node[/i]. Nodes have a title, which is a teaser generated automatically from the body text, and an author (the node table in the database has more fields, but these are the key ones for us). Essentially, Drupal's two default models for writing [i]stories[/i] and [i]pages[/i] write data to this table only. The most important thing to understand about Drupal is that almost every module used to create [i]something[/i] on the site - an article, a blog entry, even songs - will use the node table, and add everything else on other tables. This makes the whole system much easier to administer: every node can potentially be extended [i]in any way[/i] by third party modules! - -What about categories? Well, Drupal has become famous for its taxonomy module: whereas most CMSes only support, or in fact [i]impose[/i], a one- or two-level hierarchy for categories, Drupal's taxonomy module supports the creation of as many different terms to describe data as you can think of. Each piece of content (categorization can be applied to [i]any[/i] node, and since almost everything is a node-) can belong to none or [i]n[/i] different categories, which can be nested in a [i]n[/i]-level hierarchy. Since the zZine articles were already divided into categories, I imported all of them directly into Drupal. On the old zZine site, every article could have at most one category, which is fine, but it's good to know that we can now configure the system to support a more advanced categorizing system. - -After importing the articles, the last important thing to transfer to the new site were the zZine Publications. Publications are what we call the article collections that we release as an issue every month. I could have created a new module for this, and it wouldn't have been that hard, but there was already an excellent module for that. This was pure luck, but the [i]epublish[/i][19] module seemed like it was tailored specifically for our needs. - - -[b]Drupal API and Modules[/b] - -We were lucky enough to be able to use existing modules for the main functionalities of our site, but in some cases you might not be able to find [i]exactly[/i] what you're looking for. - -In our case, even if we could have used the [i]story[/i] module, which is part of the default installation, for zZine articles (stories have a body, a teaser, a title and an author, exactly like our articles) we decided not to. I wanted our editors and writers to know what to use when submitting articles, and the name "stories" sounds a bit too ambiguous for my liking. So, I decided to have a look at the standard story module to see how modules work, and create something similar. - -[i]Note: I'm curious by nature and I didn't read anything in the Drupal API[12], or about developing custom modules; I looked at the story module without any prior knowledge of Drupal's conventions.[/i] - -All I found in the story module was a bunch of functions like: -[code] -/** - * Implementation of hook_node_name(). - */ -function story_node_name($node) { - return t('story'); -} -[/code] - - which seemed to be enough to tell the Drupal core what to do. I was used to Mambo components, where developers have more liberty to do what they want, including outputting HTML code anywhere. Drupal is nothing like that; on the contrary, it has its own structure and coding conventions that developers have to follow when creating custom modules. Even if a simple function like the one above is fully commented, it has to have a standard indentation (two spaces) and an obviously standardized name. I noticed that all the functions similar to this one started with "[i]story_[/i]", so I created a new file named [i]zzarticle.module[/i], copied and pasted the story module code into it, and changed every function accordingly, like this: -[code] -/** - * Implementation of hook_node_name(). - */ -function zzarticle_node_name($node) { - return t('zZine Article'); -} -[/code] -Trivial enough, and it worked fine! I put my shamefully copied module in the /modules directory and I was able to create "zZine Articles" (which were nothing but stories with a different name). - -At this point I decided to have a proper look at the API, and read about hooks: - -[quote][i]"Drupal's module system is based on the concept of "hooks". A hook is a PHP function that is named foo_bar(), where "foo" is the name of the module (whose filename is thus foo.module) and "bar" is the name of the hook. Each hook has a defined set of parameters and a specified result type. - To extend Drupal, a module need simply implement a hook. When Drupal wishes to allow intervention from modules, it determines which modules implement a hook and call that hook in all enabled modules that implement it. [-]"[/i][/quote] -A [i]hook[/i] was used for the previously mentioned function, and this was diligently commented: - -[code] -/** - * Implementation of hook_node_name(). - */ -[/code] - -This made me understand how Drupal is actually geared towards developers and at the same time suitable for non-technical users. Wait a minute, what if someone is not familiar with PHP and still needs custom modules and features? Is there any way to extend Drupal without having to physically code new things? Yes, there is, and two modules come to mind: -[list] - - [*][i]Webform[/i] - allows the creation of any kind of web form. Users can customize field types, values, labels and messages. The module also provides ways to process forms by either saving data to the database or emailing it, which we can use for things like the Editor's Test and surveys. - [*][i]Flexynode[/i] - This module is simple and powerful - it allows users to create their own content types without coding a single line. In my example, I cloned the story module to create the zZine Article content type. This is easy to do, and functional, but what happens if someone wants to include an additional field to the article submission form? I can probably do this using hooks, but if I was lazy I could do the same thing with the [i]flexynode[/i] module. I actually used this module for our podcast section[20], and it did an excellent job. -[/list] - -[b]Conclusions[/b] - -For now I must say I'm very happy with what Drupal has to offer, and if there's something we need for the site, we can code it ourselves and then integrate it into Drupal. -One of the major strengths of this CMS is definitely its developer-friendliness: while other CMSes mainly focus on users at the price of limiting extensibility and trapping developers into predefined modules, Drupal even encourages developers to integrate their code into the existing structure, opening virtually unlimited possibilities. Granted, it may seem difficult to understand at first, some people I talked to told me that 'Drupal is too complex' or has a rather steep learning curve, but I just think everything becomes clearer after reading parts of the vast documentation section: this is the only price to pay, and believe me, it is definitely worthwhile. - - -[b]Notes[/b] -[small] -[1] zZine Magazine: [url]http://www.zzine.org[/url] -[2] CyberArmy Community: [url]http://www.cyberarmy.net[/url] -[3] Content Management System, Wikipedia page: [url]http://en.wikipedia.org/wiki/Content_management_system[/url] -[4] Xoops - Official Page [url]http://www.xoops.org/[/url] -[5] Mambo - Official Page: [url]http://www.mamboserver.com[/url] -[6]CMS Matrix: [url]http://cmsmatrix.org/[/url] -[7] Open Source CMS: [url]http://opensourcecms.com/[/url] -[8] Snarkles's CyberArmy Profile: [url]http://www.cyberarmy.net/~snarkles[/url] -[9] Drupal - Official Page: [url]http://www.drupal.org[/url] -[10]Webchick's Drupal Profile: [url]http://drupal.org/user/24967[/url] -[11] Drupal - Handbooks: [url]http://www.drupal.org/handbooks/[/url] -[12] Drupal API: [url]http://drupaldocs.org/api/head[/url] -[13] Drupal Downloads: [url]http://www.drupal.org/project/[/url] -[14] WAMP Server Package: [url]http://www.wampserver.com[/url] -[15] Drupal - Installing and Upgrading documentation: [url] http://drupal.org/node/258[/url] -[16] Drupal - Themes: [url]http://drupal.org/project/Themes[/url] -[17] Drupal - Theme Engines: [url]http://drupal.org/node/509[/url] -[18] zZine Beta site: [url]http://beta.zzine.org[/url] -[19] Drupal - ePublish module: [url]http://drupal.org/project/epublish[/url] -[20] zZine Podcasts: [url]http://beta.zzine.org/podcasts[/url] +[i][b]Important Notice:[/b] This article is about changes occurring to zZine Magazine's site[1]. At the time of writing, www.zzine.org uses the old site, and not the Drupal-based one presented in this article, which is currently under construction[18].[/i] + +"Why can't we log who edits the articles?" +"Can we send newsletters?" +"We should really have a members' area..." + +zZine.org[1] is a scratch-built site, coded from the ground up to offer zZine journalists, editors and readers all the functionalities and features they wanted. I'm not totally against sites being coded from scratch, but what happens if something needs to be fixed, or new functionalities have to be implemented and you realize that the code cannot be extended or patched easily?[b]Case Study: zZine Magazine[/b] + +zZine Magazine is an online magazine which publishes not only IT-related and other articles on a weekly basis, but also monthly publications containing CyberArmy[2] digests, special columns, and featured articles. A team of journalists, researchers, editors, publishers and outside contributors has access to the zZine site to write, submit, and edit articles, manage publications and perform various other tasks through a password-protected administration area. This is common to approximately 75% of the websites on the Internet: they have a front-end to present content to the general public and a semi-hidden administration backend which is normally more difficult and tedious to code. That's why someone started developing [i]Content Management Systems[/i][3]: ready-made, fully-featured administrative back-ends for creating and managing almost any kind of website, from blogs to eCommerce portals. + +Could a CMS be used for zZine Magazine? Probably - zZine doesn't need any innovative or advanced features, just a bunch of commonly-used functionalities like: +[list] + [*]Add, delete, edit and publish articles + [*]Customizable user permissions, ideally role-based (writer, editor, publisher, etc.) + [*]Creating and managing monthly publications + [*]Editor's tests + [*]User signups, notifications, etc. + [*]RSS feed generation + [*]Sending newsletters to subscribers + [*]Logging user actions +[/list] +Some members of my team raised some concerns regarding the usage of a CMS, which were mostly based on our past experience with just a particular product and not CMSes in general. Everybody agreed that if we were to go back to a CMS, we [i]had[/i] to choose the [i]best[/i] this time: something flexible, easy to use, fast, search-engine friendly, and extensible. I spent some time researching CMSes, because while I knew that there's no such thing as the best CMS, there was certainly a CMS that was best for our needs. + + +[b]Making the right choice[/b] + +In the past, I had played around with Xoops[4] when I first thought about creating websites, and I used Mambo[5] for some other sites. I admit that I never actually spent time creating complex Mambo components and modules, but I must say that in the end I felt somehow tied to third-party modules and unable to understand how they really worked: Mambo seemed to give developers too much freedom, and had neither a solid API nor conventions to follow, at least when I used it. + +So I decided to have a look around again, starting from the two most important sites people should look at when choosing the most suitable CMS for their work. +The first site is CMS Matrix[6] which - as the name implies - provides a really handy [i]matrix[/i], or chart, to compare the various features offered by nearly all CMS available, both proprietary and open-source. + +I remember choosing Mambo last time I used the matrix simply because it appeared to be one of the most feature-rich. This is actually something [i]not[/i] to do when choosing a CMS: always concentrate on what your site needs rather than what the CMS is able to offer. Otherwise, you run the risk of having too much to work with. + +The other important website to visit when choosing a Content Management System is OpenSourceCMS[7], which basically allows you to try a demo of every open source CMS online. This is perhaps more useful, but also much more time-consuming: it's better to narrow down the list of possible CMSes after checking CMS Matrix and then try each one rather than just picking one at random. + +At this point, an experienced CyberArmy staff member[8] suggested Drupal[9]. I asked her why, and she simply said that it seemed to be the best choice according to zZine's needs, as it basically offered all the features we were looking for, either natively or through modules. She also admitted to be biased, as she's actually [i]part of Drupal's documentation team[/i] and involved with Drupal development[10]. + +Before making any kind of commitment, I checked out Drupal's website to see how they organized things, and I was quite impressed. I immediately noticed the Handbooks section[11], which contains all the official Drupal documentation and it seemed pretty much complete. No "under construction", "please write content here" or "we're a new project, help us write the documentation" notes, just a load of good-quality documentation, including a fully documented and [i]stable[/i] API![12] + +This surprised me, because some projects I came across, even really good ones, lacked a proper documentation section. I think this is a common problem with new open source projects, and Drupal for this reason gave me the impression to be quite mature and useable already. After visiting the very clear and organized Downloads Section[13], I downloaded the CMS and a few modules and installed it on my laptop. + + +[b]Installation[/b] + +Drupal needs three things to run: +[list] + [*]A web server - Apache is fine, and ISS is reported to be working + [*]PHP - Either version 4 or 5, Drupal started supporting PHP5 since 4.6.0 release + [*]A PHP-compatible database - MySQL or PostgreSQL is recommended +[/list] +I used a WAMP[14] installation to test Drupal. First of all, I created a MySQL database, granting ALL privileges to the database user accessing the Drupal database. When I uploaded the site to the remote server, later on, I had some problems because the LOCK TABLES privilege wasn't granted by the host. Drupal requires this, so I had to contact my host to solve the problem. I then imported the database scheme located in the [i]database[/i] directory under the installation directory and modified the configuration settings (sites/default/settings.php) to allow Drupal to access the database. Installation complete. + +Drupal was now up and running with the default configuration settings, with a minimum of fuss. For all the details concerning the installation process, consult the exhaustive documentation.[15] I didn't read it when I installed it, but it can really be useful in some situations. + + There are actually two non-critical things to consider if you're planning to use Drupal for a medium-sized project: the first involves changing a few settings on php.ini, in particular increasing the amount of memory allocated to PHP from 8MB to 16MB, especially if you're planning to use either a lot of simple modules or a few complex ones, and the second is setting up your crontab to execute [i]http://www.yoursite.com/cron.php[/i] every hour or so. This is required by some semi-essential modules like the site-wide search, but a common alternative (if you don't want to setup the [i]cron[/i] task manually) is the poorman's [i]cron[/i] module[15], which I used myself and found to be workable. + + +[b]Keeping your site under control[/b] + +Perhaps one of the best things Drupal has to offer is a rock-solid general-purpose administrative backend. The first thing I found in the backend which really impressed me (and that also I never found in another CMS) is the ability to create [i]custom[/i] role-based user accounts and access permissions for [i]everything[/i]: every module can be configured so that, for example, not all people can see its output and just a few can administer and modify it. + +For zZine, I created four types of accounts: +[list] + [*][i]Administrator[/i] - Able to access everything and change every setting of the site + [*][i]Publisher[/i] - Able to write, edit and publish every kind of content on the site, but not able to administer user accounts, permissions and similar administrator-only tasks. + [*][i]Editor[/i] - Able to write and edit anything on the site, but not to publish it. + [*][i]Writer[/i] - Able to write articles, blogs and similar content, but in some cases not allowed to edit it. +[/list] +These were precisely the account types I was looking for in a CMS. Granted, other products offer them by default, but having pre-defined account types is one thing, and being able to customize them completely is another. + +User accounts are great, but sometimes it's good to know what the users of your sites are doing as well. On our old site we had user accounts for editors and administrators, and even if only a few people had access we had no way to determine who edited an article or who published something unless that person told us. Drupal comes with a radical solution to this: Almost every action is automatically logged by the [i]watchdog[/i] core module. Every website error, every page not found, and every PHP or MySQL error is logged, as well as every content submission or modification. Page accesses, meanwhile, can be logged through the statistics module. + +Themes & Templates + +"We shouldn't use a CMS: I don't want zZine to have the overly used *nuke-style look." I've heard this too many times. Sometimes people associate the word "CMS" with "lack of original design", and that's not true by any means, especially for Drupal. Of course, there are plenty of ready made themes[16] which can be freely used or modified for any Drupal-based site. + +I must confess that when I first saw the themes section I feared that Drupal "themes" used their own template engine, like some CMSes do nowadays, but I was wrong: currently Drupal supports some template engines[17] but also pure PHP-based ones. Theme engines do their job wonderfully and can offer some interesting features, but templates written natively in PHP tend to perform better, simply because there's no extra parsing or additional overhead involved. + +I decided to have a look at a standard PHP theme. Basically, it's nothing more than a PHP-enriched xHTML file and its corresponding stylesheet. There are a few functions which must be used to perform particular tasks, like showing the main navigation links, but nothing too hard to understand. It's also [i]very[/i] customizable. In fact, we're already working on a custom zZine theme, which doesn't seem any harder than coding a standard xHTML template. As design should always be the last thing to worry about, I decided to use a temporary template I created by slightly modifying an existing one.[18] + + +[b]To switch or not to switch?[/b] + +When creating a new site for an organization which already has one, there's something very important to consider: [i]what happens to the old data[/i]? +Assuming the old site was dynamic and using a database of some sort, there are three possibilities: +[list] + [*]Don't bother doing anything: any data on the old site will not be transferred to the new one. + [*]Make the old website available somewhere else as an [i]archive[/i] of old documents. + [*]Import all the data from the old site to the new one. +[/list] +Obviously we went straight for the third one, which is the most difficult to implement, but it was necessary: there were over 1000 articles on the old site- + +Of course, in reality, I didn't even mention the possibility of using Drupal until I figured out a way to import the old data into the new database structure. Never praise features or convince people to switch unless you're 100% sure you can handle the situation. Luckily for me, it turned out that everything could be imported easily enough. + +The first difference I found between Drupal and zZine was that we didn't really have proper user accounts. Every article had an author, but it was stored as a field in the article's record, and that was all. Drupal, on the other hand, supports (and perhaps requires) user accounts - everything present on the site must be written or edited by an existing user. + +The solution I cam eup with was rather drastic: I created about 120 user accounts, retrieving usernames from the articles and inserting them through a custom PHP script into Drupal's user table. Of course, those users never registered on the new site[18], so I didn't personalize the accounts at all: I simply put a notice on the first page asking everyone who contributed to zZine before to contact me in some way to enable their account with a valid email address. + +After this initial difficulty, importing articles was relatively easy. Pretty much every type of content in Drupal is, in its simplest form, a [i]node[/i]. Nodes have a title, which is a teaser generated automatically from the body text, and an author (the node table in the database has more fields, but these are the key ones for us). Essentially, Drupal's two default models for writing [i]stories[/i] and [i]pages[/i] write data to this table only. The most important thing to understand about Drupal is that almost every module used to create [i]something[/i] on the site - an article, a blog entry, even songs - will use the node table, and add everything else on other tables. This makes the whole system much easier to administer: every node can potentially be extended [i]in any way[/i] by third party modules! + +What about categories? Well, Drupal has become famous for its taxonomy module: whereas most CMSes only support, or in fact [i]impose[/i], a one- or two-level hierarchy for categories, Drupal's taxonomy module supports the creation of as many different terms to describe data as you can think of. Each piece of content (categorization can be applied to [i]any[/i] node, and since almost everything is a node-) can belong to none or [i]n[/i] different categories, which can be nested in a [i]n[/i]-level hierarchy. Since the zZine articles were already divided into categories, I imported all of them directly into Drupal. On the old zZine site, every article could have at most one category, which is fine, but it's good to know that we can now configure the system to support a more advanced categorizing system. + +After importing the articles, the last important thing to transfer to the new site were the zZine Publications. Publications are what we call the article collections that we release as an issue every month. I could have created a new module for this, and it wouldn't have been that hard, but there was already an excellent module for that. This was pure luck, but the [i]epublish[/i][19] module seemed like it was tailored specifically for our needs. + + +[b]Drupal API and Modules[/b] + +We were lucky enough to be able to use existing modules for the main functionalities of our site, but in some cases you might not be able to find [i]exactly[/i] what you're looking for. + +In our case, even if we could have used the [i]story[/i] module, which is part of the default installation, for zZine articles (stories have a body, a teaser, a title and an author, exactly like our articles) we decided not to. I wanted our editors and writers to know what to use when submitting articles, and the name "stories" sounds a bit too ambiguous for my liking. So, I decided to have a look at the standard story module to see how modules work, and create something similar. + +[i]Note: I'm curious by nature and I didn't read anything in the Drupal API[12], or about developing custom modules; I looked at the story module without any prior knowledge of Drupal's conventions.[/i] + +All I found in the story module was a bunch of functions like: +[code] +/** + * Implementation of hook_node_name(). + */ +function story_node_name($node) { + return t('story'); +} +[/code] + + which seemed to be enough to tell the Drupal core what to do. I was used to Mambo components, where developers have more liberty to do what they want, including outputting HTML code anywhere. Drupal is nothing like that; on the contrary, it has its own structure and coding conventions that developers have to follow when creating custom modules. Even if a simple function like the one above is fully commented, it has to have a standard indentation (two spaces) and an obviously standardized name. I noticed that all the functions similar to this one started with "[i]story_[/i]", so I created a new file named [i]zzarticle.module[/i], copied and pasted the story module code into it, and changed every function accordingly, like this: +[code] +/** + * Implementation of hook_node_name(). + */ +function zzarticle_node_name($node) { + return t('zZine Article'); +} +[/code] +Trivial enough, and it worked fine! I put my shamefully copied module in the /modules directory and I was able to create "zZine Articles" (which were nothing but stories with a different name). + +At this point I decided to have a proper look at the API, and read about hooks: + +[quote][i]"Drupal's module system is based on the concept of "hooks". A hook is a PHP function that is named foo_bar(), where "foo" is the name of the module (whose filename is thus foo.module) and "bar" is the name of the hook. Each hook has a defined set of parameters and a specified result type. + To extend Drupal, a module need simply implement a hook. When Drupal wishes to allow intervention from modules, it determines which modules implement a hook and call that hook in all enabled modules that implement it. [-]"[/i][/quote] +A [i]hook[/i] was used for the previously mentioned function, and this was diligently commented: + +[code] +/** + * Implementation of hook_node_name(). + */ +[/code] + +This made me understand how Drupal is actually geared towards developers and at the same time suitable for non-technical users. Wait a minute, what if someone is not familiar with PHP and still needs custom modules and features? Is there any way to extend Drupal without having to physically code new things? Yes, there is, and two modules come to mind: +[list] + + [*][i]Webform[/i] - allows the creation of any kind of web form. Users can customize field types, values, labels and messages. The module also provides ways to process forms by either saving data to the database or emailing it, which we can use for things like the Editor's Test and surveys. + [*][i]Flexynode[/i] - This module is simple and powerful - it allows users to create their own content types without coding a single line. In my example, I cloned the story module to create the zZine Article content type. This is easy to do, and functional, but what happens if someone wants to include an additional field to the article submission form? I can probably do this using hooks, but if I was lazy I could do the same thing with the [i]flexynode[/i] module. I actually used this module for our podcast section[20], and it did an excellent job. +[/list] + +[b]Conclusions[/b] + +For now I must say I'm very happy with what Drupal has to offer, and if there's something we need for the site, we can code it ourselves and then integrate it into Drupal. +One of the major strengths of this CMS is definitely its developer-friendliness: while other CMSes mainly focus on users at the price of limiting extensibility and trapping developers into predefined modules, Drupal even encourages developers to integrate their code into the existing structure, opening virtually unlimited possibilities. Granted, it may seem difficult to understand at first, some people I talked to told me that 'Drupal is too complex' or has a rather steep learning curve, but I just think everything becomes clearer after reading parts of the vast documentation section: this is the only price to pay, and believe me, it is definitely worthwhile. + + +[b]Notes[/b] +[small] +[1] zZine Magazine: [url]http://www.zzine.org[/url] +[2] CyberArmy Community: [url]http://www.cyberarmy.net[/url] +[3] Content Management System, Wikipedia page: [url]http://en.wikipedia.org/wiki/Content_management_system[/url] +[4] Xoops - Official Page [url]http://www.xoops.org/[/url] +[5] Mambo - Official Page: [url]http://www.mamboserver.com[/url] +[6]CMS Matrix: [url]http://cmsmatrix.org/[/url] +[7] Open Source CMS: [url]http://opensourcecms.com/[/url] +[8] Snarkles's CyberArmy Profile: [url]http://www.cyberarmy.net/~snarkles[/url] +[9] Drupal - Official Page: [url]http://www.drupal.org[/url] +[10]Webchick's Drupal Profile: [url]http://drupal.org/user/24967[/url] +[11] Drupal - Handbooks: [url]http://www.drupal.org/handbooks/[/url] +[12] Drupal API: [url]http://drupaldocs.org/api/head[/url] +[13] Drupal Downloads: [url]http://www.drupal.org/project/[/url] +[14] WAMP Server Package: [url]http://www.wampserver.com[/url] +[15] Drupal - Installing and Upgrading documentation: [url] http://drupal.org/node/258[/url] +[16] Drupal - Themes: [url]http://drupal.org/project/Themes[/url] +[17] Drupal - Theme Engines: [url]http://drupal.org/node/509[/url] +[18] zZine Beta site: [url]http://beta.zzine.org[/url] +[19] Drupal - ePublish module: [url]http://drupal.org/project/epublish[/url] +[20] zZine Podcasts: [url]http://beta.zzine.org/podcasts[/url] [/small]
M content/articles/back-from-holiday.textilecontent/articles/back-from-holiday.textile

@@ -13,10 +13,10 @@ - writing

type: article toc: true ----- -I'm back. I was so eager to go on holiday that I didn't even bother writing a post about it, too bad. I actually when on holiday for a week but I thought I'd take three weeks off from my blog duties in favor of laziness and relax, but unfortunately my laptop decided to go wrong as well, so I didn't actually manage to relax that much. - -Now everything is fine. I still have to send in my laptop for assistance but it's usable at least, and I finally found the time (and the money) to buy a desktop PC. I always wanted to build my own, actually, but in the end I decided to opt for a pre-made Fujitsu Siemens, mainly for econimic reasons and time constraints. I won't publish the specs, but it's alright for me and my fianc&eacute;e. - -So what now? Well... the usual: more posts will soon be added to the "Simply On Rails":/tags/simplyonrails series, a Ruby-related article is on the way (it will be edited by the excellent "CyberArmy":http://www.cyberarmy.net Publication Editing Staff this time), I may venture in a site upgrade whenever they decide to release version 4.2 of Typo which is supposed to be imminent and I'll eventually complete another pet project of mine, but that will take more time... - -Stay tuned. +I'm back. I was so eager to go on holiday that I didn't even bother writing a post about it, too bad. I actually when on holiday for a week but I thought I'd take three weeks off from my blog duties in favor of laziness and relax, but unfortunately my laptop decided to go wrong as well, so I didn't actually manage to relax that much. + +Now everything is fine. I still have to send in my laptop for assistance but it's usable at least, and I finally found the time (and the money) to buy a desktop PC. I always wanted to build my own, actually, but in the end I decided to opt for a pre-made Fujitsu Siemens, mainly for economic reasons and time constraints. I won't publish the specs, but it's alright for me and my fianc&eacute;e. + +So what now? Well... the usual: more posts will soon be added to the "Simply On Rails":/tags/simplyonrails series, a Ruby-related article is on the way (it will be edited by the excellent "CyberArmy":http://www.cyberarmy.net Publication Editing Staff this time), I may venture in a site upgrade whenever they decide to release version 4.2 of Typo which is supposed to be imminent and I'll eventually complete another pet project of mine, but that will take more time... + +Stay tuned.
M content/articles/cakephp.bbcodecontent/articles/cakephp.bbcode

@@ -17,425 +17,425 @@ tags:

- cakephp - review - frameworks -- web-development +- webdevelopment type: article toc: true ----- -Web developers can either love or hate PHP, and one of the criticisms of this easy-to-use programming language which is repeated over and over on IRC, forums and blogs is that "PHP is disorganized". -Is this really true? If so, is there any possible way to write a PHP application in a logical and clean way? Read on...Every web developer has certainly heard of PHP. Some people like it and consider it a powerful and easy-to-use way to create complex websites or web applications, while others are convinced that it is merely a bad copy of Perl. Opinions are certainly mixed on the matter. - -One thing to keep in mind when reading criticisms of PHP is its origins, as therein lies the crux of the matter. PHP was created as a form interpreter, initially offering only a [i]very limited[/i] range of functionality. Its main purpose was to make life easier for web developers who wanted to do simple tasks, like manipulating form data. - -People liked the concept - PHP was free and it quickly became popular among developers. More functionality was added and continues to be added with each new release, and PHP is now one of the most popular and powerful programming languages available for web development.It is relatively easy to learn, compared to Perl, ASP, or JSP, and it can be used for almost anything[1]. - -The sheer simplicity of the language was most likely the cause of the enormous amount of exploits discovered through the years which earned PHP the label "[i]too dangerous to use in 'proper' applications[/i]". The danger, however, lies not in the language itself, but rather in the [i]way[/i] developers make use of the language: PHP's simplicity makes writing bad or exploitable code extremely easy. Furthermore, PHP's ability to be placed within any HTML page with the greatest of ease tempted developers to write ever-increasing amounts of 'spaghetti code', which by its very nature is neither organized nor clean code, and certainly does not help a developer learn how to write organized or clean code. - -These problems, however, can be solved. There are many ways to go about doing this, but the easiest, most effective way is to create a framework[2]. - - -[b]Bringing Order to Chaos[/b] - -After learning some PHP myself, I remember noticing that my applications were growing in a disorganized and uncontrollable manner. Things tended to be added at the last minute, and bugs were fixed and patched 'on the fly' wherever they occurred. PHP lacked the structure that is present in most other programming languages. I remember reading the word [i]framework[/i] for the first time not too long ago while I was downloading a Windows Update of the .NET framework[3]. That inspired me to start searching the Internet for a 'PHP framework'. That led me to an interesting blog entry[4] where a solution was proposed - a solution to [i]bring order to chaos[/i]: - -[quote] -[...] The answer is simple: create our own class library, some kind of framework, the PHP framework. The similar in many ways to that one which is already well known to Java or .NET programmers. We could set the standards, structure and main guidelines. [...] -[/quote] - -That blog post made me think about developing my own framework, until I noticed that there were many projects already in progress, and some in fact completed; the end result being a fully functional PHP framework. I read a lot about some of them[5], and abandoned the idea of developing my own, because as a good developer, I believe I should never re-invent the wheel. So I kept looking. I found Pear[6], although that's more a repository of PHP classes with a common standard than a framework, while I was looking for THE solution to developing many types of applications, not merely how to do one thing in particular. - -I came across a very promising project named Prado[7], which won the latest Zend contest, and was considered the best PHP5 application of the year. It is a masterpiece of coding and PHP5 usage, so I tried to learn it. I even developed a website with it. - -Prado lets the developer design the application without imposing any ready-made components, but I found its event-driven[8] approach neither easy to learn nor suitable for everyday web applications. I did not like the idea of having to code a reaction to every event (like a click on a button or different phases of page rendering): that is the approach that ASP takes, and at least in that respect, Prado seems to be inspired by the .NET framework. Event-driven programming is suitable for GUI development and desktop-based interfaces, but not for web applications. - -After trying Prado, I was still unsatisfied, so I once again began my search for a solution to improve my programming. My meanderings took me to Ruby on Rails[9], one of the most recent examples of technology hype on the Net. At the same time,to a certain extent, it is also a successful tool. - - -[b]The Rails Phenomenon[/b] - -[quote] -"Rails is a full-stack, open-source web framework in Ruby for writing real-world applications with joy and less code than most frameworks spend doing XML sit-ups." -[/quote] - -That sounded like what I was looking for, and I started reading more about it in the vast and varied help sections[10] available both on and off of the official site. The Rails team did an outstanding job promoting and marketing the framework, and also in providing comprehensive textual documentation (and even video tutorials) to help both beginners as well as experienced programmers get started with it. - -Briefly, Rails uses Ruby's object oriented programming, in conjunction with the MVC pattern and various automated scripts (generators), to help developers program their applications quickly and in a solid and organized way. However, as that is neither clear nor convincing, let's spend a few moments on the MVC Pattern[11], which will also be useful to understanding the following sections. - -MVC stands for [b]M[/b]odel [b]V[/b]iew [b]C[/b]ontroller: these three words enclose - and this is just a personal opinion - all the wisdom and philosophy of web development, describing - once again, in my opinion - the three most logical parts a web application [i]should[/i] be divided into to achieve code robustness, order and power, all at the same time. Let's look at what each of the component parts mean in detail: - -[list] -[*][b]Model[/b]: The model represents the very essence of the [i]information[/i] and [i]content[/i] of a web application. Imagine this as an object able to gather the information and content of your webpages from a particular resource, such as a database. The model is the only entity able to access resources. -[*][b]View[/b]: The view is an attempt to separate the most unstable part of an application: the user front-end. A view is only responsible for presenting the information that the Model gathered. A view does nothing but format the output, and can be compared to a template or report. In all MVC frameworks for web applications, only view files contain (X)HTML code, and mostly only that. They can therefore be changed [i]at any time[/i] without having to touch a single line of the business logic of your application. -[*][b]Controller[/b]: The controller is the 'brain' of the application. Consider it to be the only part of your program that can 'think' and manage the other parts. Controller files are the only ones able to [i]order[/i] the Model to gather information and then pass the information obtained to the view for display. -[/list] - -Although the MVC seems to make things more complicated, that is part of the objective. Since one of the advantages (and weaknesses) of PHP was its simplicity, the MVC adds complexity to bring more order and logic to the design process. The three entities are separated for just that reason, and trying to put them together can result in potential disasters, since it causes the whole pattern to fail. - -Coming back to Rails, I was quite impressed by the features it offered, but there was a small problem: the Ruby programming language itself. I experienced some difficulties in setting up the environment properly, and I also discovered that most standard hosting companies do not offer Ruby hosting plans as standard. Hosting issues aside, I would have had to learn Ruby in order to master Rails, and I really did not have the time for that: I had to develop a website quickly and easily, preferably with languages I already knew. - -After deciding to abandon Rails (for the moment, anyway), I was amazed by the number of projects in other programming languages that try to emulate the famous Ruby framework, to the point of being considered [i]clones[/i] or ports of it to another language. To my knowledge, the [i]Rails disease[/i] contaminated the following programming languages: -[list] -[*]PHP[12] -[*]Python[13] -[*]Java [14] -[*]Perl [15] -[/list] - -I said [i]disease[/i] because Rails developers think that Ruby on Rails was made in Ruby for a reason, namely that Ruby offered some unique features that were not available in other languages. I will not delve into that topic here; more information is available[16] for those who are interested. However, suffice it to say that there are some Rails ports in PHP that were immediately attacked because of the fact or legend that the creator of Rails originally wanted to develop his framework in PHP and then switched to Ruby. Let's examine one of those PHP frameworks in detail. - - -[b]CakePHP: Just Another Rails Clone?[/b] - -I chose to learn CakePHP (or "Cake")[17] mainly because it offered more features than the other two PHP alternatives. It also seemed to be a more original and actively developed project. In particular, I'd like to quote one of CakePHP's developers, from when he introduced the framework in a comment to a blog post[16]: - -[quote] -"While it's difficult to copy Rails in PHP, it's quite possible to write an equivalent system. I like the terseness of Ruby code, but I need the structure that Rails provides, how it makes me organize my code into something sustainable. That's why I'm ripping off Rails in Cake." -[/quote] - -Cake's developers (bakers?) are developing their own framework which uses many principles of Ruby on Rails, revisited and re-proposed in an extremely flexible and easy to use PHP tool, rather than simply trying to port Rails to PHP. I also liked the fact that they bothered to choose an original name for their project, unlike others: there are too many "<insert language here>-on-Rails" frameworks, and while the whole "Rails" thing is innovative and catchy the first time, it loses its appeal quickly when people use the word everywhere just because it is "fashionable". - -Quoting from CakePHP's website: - -[quote] -"Cake is a rapid development framework for PHP which uses commonly known design patterns like ActiveRecord, Association Data Mapping, Front Controller and MVC. Our primary goal is to provide a structured framework that enables PHP users at all levels to rapidly develop robust web applications, without any loss to flexibility." -[/quote] - -That sounds like the Holy Grail for PHP developers, and I must admit I'm quite impressed myself after using it on various little projects, but is it really all true? What are Cake's features? Are there any limitations? - - -[b]The Ingredients[/b] - -So what is Cake? In the previous sections, I introduced some general concepts and ideas common to Ruby on Rails and CakePHP, but nothing in particular was said about the structure of the framework itself. Let's now turn to that and discuss it in some detail, particularly as it pertains to Cake. - -The first thing to understand about Cake (and Rails as well) is that one of their aims was to avoid editing long and complex configuration files in order to run the environment. The approach in this sense is to use [i]conventions[/i] over [i]configuration[/i]. This may sound terribly restrictive, but in reality it proved to make things much simpler. After all, I said I wanted to use a framework because I needed a solid structure to base my applications on, not that I needed to be able to create and personalize my own structure and system. Cake uses some simple rules in order to run properly, and the easiest way to explain them is through Cake's directory structure, which represents the skeleton of every CakePHP application. - -[b][i]/ ----app/ -------config/ -------controllers/ ----------components/ -------models/ -------plugins/ -------views/ ----------elements/ ----------errors/ ----------helpers/ ----------layouts/ ----------pages/ -------webroot/ ----------css/ ----------files/ ----------img/ ----------js/ -[/b]---cake/ -------config/ ----------inflections/ -------docs/ -------libs/ ----------controller/ ----------generator/ ----------model/ ----------view/ -------scripts/ ----tmp/ -------cache/ -------distro/ -------logs/ -------tests/ ----vendors/[/i] - -I expanded only the first three levels of the tree, although there are more levels in the [i]/cake/[/i] directory. They won't be considered here simply because the [i]/cake/[/i] directory contains CakePHP's internal libraries, which normally will not be modified when developing an application. The [i]/tmp/[/i] directory also will not be elaborated upon either, because it is only used to store temporary files. However, the [i]/vendor/[/i] directory should contain third party scripts and libraries that you may want to use in your application, but they are not normally integrated with Cake's framework. 95% of your application will reside within the [i]/app/[/i] directory, which we therefore need to examine in greater detail. - -[u][i]/config/[/i][/u] -When I said that Cake strives to use conventions over configuration, I really meant it. This directory does not contain thousands of configuration files, only five very small ones. They represent the only items which [i]might[/i] need to be configured. - -[list] -[*][b]acl.ini.php[/b]: This file must be edited only if you plan to use Cake's default ACL (access control list) system for your application. It sets permissions for the application, so it should be used to list every group, user, and their respective rights. This can be useful for small sites with a few well known users, but for anything else, you should develop your own ACL or authentication system that relies on a database. -[*][b]core.php[/b]: This file can be edited to change some default options, such as the level of the error messages and notices that the application will output. This comes in very handy while developing an application. -[*][b]database.php.default[/b]: This should be renamed to database.php and edited if you plan to use any databases with Cake. The settings are fairly straightforward, and include the type of database used (mysql, postrgres, sqlite, or any other supported by the AdoDB library[18]), username, password and database name. -[*][b]paths.php[/b]: Unless you are very particular, you should leave this file alone. It tells Cake where to look for CSS files, images, controllers, etc. If you are planning to adopt Cake's directory structure - which is the most logical option - you can ignore this. -[*][b]routes.php[/b]: Following Rails' example, CakePHP features a "routing system" for user-friendly URLs. By default, your URLs will look like this: [i]http://sitename/controller-name/action-name/eventual/action/parameters[/i], which is a really nice way to organize a site, but you may want to change something if you have particular requirements. -[/list] - - -[u][i]Controllers[/i][/u] -As mentioned previously, a controller represents the "brain" of the MVC pattern, the part which controls what the other parts are doing. Imagine a controller like a section of your site: its name will be present on the address bar, and each of these sections will have a file named <something>_controller.php, and will also contain a class named SomethingController that extends the AppController class. This class will have some methods that correspond to some standard actions like [i]index[/i] (the default action called when you access the http://sitename/controller/ page) or other user-defined ones like [i]add[/i] or [i]list[/i] or [i]admin[/i], depending on the application. As a general rule, you want to add any 'business logic' you want to implement in your application in controllers - for example, calculations or a database query that produces a result. [i]Then[/i] once all the mess is done, the result (usually an array or a variable) is passed to the view (see [i]views[/i] below). - -If this is starting to sound too technical for you, I recommend reading a tutorial[19] available on the CakePHP website about creating a simple blog application. The tutorial will explain most of Cake's basics, including how to pass a variable from a Controller to the corresponding view [i]($this-set('variableNameInView', $variable))[/i] and other useful things. - -Recently [i]Components[/i] have been added to CakePHP, and quoting from the corresponding wiki page[20]: -[quote] -"Components are the preferred way to provide additional functionality to your controller. To make a component available you would add var $component = array('myComponent') inside of your controller's definition, add your file to the /app/controllers/components, name your class MyComponent, and create your methods." -[/quote] - - -[u][i]Models[/i][/u] -A model is an object able to access the database. In Cake's terms, that is any class extending the AppModel class. That class is directly under the [i]/cake/[/i] directory (along with the previously mentioned AppController class), and can be moved to the [i]/app/[/i] directory and modified if you want to add some particular site-wide behavior to it which will be inherited by all models extending it. - -In even simpler terms, you need to create a Model class for every table you're planning to use in your database. A convention in Cake says that database table names should be plural and that the corresponding model should be singular. If you use a table named 'mice', your model should be named 'mouse': Cake is smart enough to understand irregular plurals through an [i]Inflector[/i] class. - -Creating a model class for basic use is trivial: - - -class Post extends AppModel -{ - var $name = 'Post'; -} - - -Then you'll be able to access the model (and therefore the database) from a controller via simple instructions like $this->Post->findAll(). This instruction will query the database and return all records within the Posts table in your database. You can also perform more complex operations, and also specify SQL queries to execute, if you need to, but remeber that models can only be accessed through controllers! If you need some information stored in your database to be displayed on a view, execute the query from the controller and pass it to the view as per the MVC pattern. It can prevent you from cluttering views with business logic and thereby making code updates much harder. - - -[u][i]Views[/i][/u] -Views are used to present information gathered with a model and a controller to the public. They are mostly HTML pages with some PHP tags in them, prints of variables and maybe some [i]foreach[/i] loops. Nothing more than that should be used in a view! - -Views must be placed in this directory and obey the following conventions: - -1. They must be named after a controller's action to allow the controller to refer to a particular view automatically. The same view can be used by multiple controllers, but it must be either set manually or through a layout (see below). -2. Views referring to an action of a particular controller must be placed under a subfolder named after the controller. -3. All views must have a .thtml extension. - -Any site-wide view, like the site's template, must be placed under the [i]layouts[/i] subfolder. In particular, the default.thtml file in the folder represents the global template for your application: page titles and specific pages (views) will be invoked automatically by using $title_for_layout and $content_for_layout respectively. - -Similarly to what was said about components, [i]helpers[/i] can be used to extend views functionalities[20]: - -[quote] -"Helpers are all about the view. You know about the helpers in Cake, but you need a little bit more. You want to have your own methods to display formatted info. To achieve this, you need to add var $helpers = array('myHelper'). - -Now, throw your myhelper.php file into the /app/views/helpers/, create the class MyHelper, and $myHelper is available in the view." -[/quote] - -Cake comes with some very useful default helpers to create links and HTML tags, import JavaScript, create forms, and use AJAX code easily. Unlike most other frameworks, Cake neither has nor uses a third party template engine (like Smarty[21]) for views, but helpers can be used to achieve similar results more quickly than an engine can. - - -[u][i]Plugins[/i][/u] - -Plugins are user-developed enhancements for Cake. Unlike the files placed under the [i]vendor[/i] directory, a plugin is an application specifically made to be used within the CakePHP environment. At the moment this feature is still under development. - -[u][i]Webroot[/i][/u] - -If you read carefully what I wrote above about routes, you might be wondering if [i]every[/i] page must have a controller and a view in order to be displayed properly. What about images, JavaScript and CSS files? The answer is this directory: everything you place here will not be seen as part of the MVC-based environment; CSS files can be stored in the [i]/css[/i] folder, Javascript under [i]/js[/i], and so on. Additionally, some helpers can provide a easier way to access or display images, scripts, CSS, etc. - - -[u][i]Other Features[/i][/u] -Cake offers even more than this; the latest releases have introduced a few more Rails-inspired features: - -[list] -[*][b]Scaffolding[/b]: Do you want to test your application without spending time writing all the CRUD (Create, Read, Update, Delete) code? That's where the concept of scaffolding comes in: by setting a few variables in the right places[22], Cake will generate basic mechanisms to add, edit, list, and delete records in your database, along with all the associated view files. You won't have to code a single form, as everything will be generated automatically by the framework according to SQL field types. -[*][b]Bake[/b]: Another Rails-inspired feature revisited in PHP. Rails uses a set of scripts and in particular the [i]rake[/i] utility to instantaneously create the foundation for a Rails application with scaffolds already in place. CakePHP offers the same functionality through the [i]bake[/i] utility, which is currently available as either a batch file or a PHP script. -[*][b]ACL[/b]: As previously mentioned, Cake comes with a ready-made Access Control List (ACL) system, which can be extended and used to restrict particular areas of a Cake application to certain users or user groups. -[*][b]Compatibility[/b]: CakePHP is fully compatible with both PHP and PHP5. -[/list] - - -[b]Meet the Bakers[/b] - -After reading all these things about CakePHP and its framework, you may have some questions, or be curious about some aspect of the project. PHPNut and gwoo, two of CakePHP's creators and lead developers, offered to answer some questions exclusively for zZine readers. This interview took place on Oct. 26th, 2005, in #dev-cakephp on irc.freenode.org. - -[i][u]h3rald[/u]:[/i] Thanks to both of you for allowing me to interview you about your project, CakePHP. Where did the name come from, anyway? - -[i]PHPnut:[/i] The original project was started by Michal Tatarynowicz aka Pies (hence the name), and when I saw his release, last March, I decided to contact him. I told him that the company I own supports projects like Cake, and also that I was in the process of developing something along the same lines. - -[i][u]h3raLd[/u]:[/i] Is Cake released under the GPL? How many developers are helping out? - -[i]gwoo:[/i] Cake is released under the MIT license, and the development team is composed of me and PHPnut, plus four other contributors. Then there's the Documentation Team, currently 3-5 people. Documentation has to follow the releases, so it usually lags behind a bit: we made so many modifications in the recent release that the Doc Team has a lot to catch up on, but it's getting there. - -[i]PHPnut:[/i] With this release you will see that the docs are going to be much better. The code is very stable now, and hopefully very little changes on that. - -[i][u]h3raLd[/u]:[/i] Some people, at first glance, may think that Cake is a PHP port of Ruby on Rails. How true is that? What are the differences and similarities between these two frameworks? - -[i]PHPnut:[/i] Cake started as a port, but has evolved into something more: we discussed using the concepts that RoR offered and including them in a framework for users of PHP. I have used PHP for a number of years, and I am comfortable with it; this is where my passion is, and I think people who use Cake have those same passions as we developers do. - -[i][u]h3raLd[/u]:[/i] I read once that Rails was developed in Ruby because only Ruby can offer certain functionalities and features... - -[i]gwoo:[/i] I would disagree, and I think that is proven in what we have done: sure RoR has a built in server and some other nice things, but PHP is everywhere. - -[i][u]h3raLd[/u]:[/i] Some developers, especially Perl programmers, tend to consider PHP an "inferior" language sometimes. What do you think of that? - -[i]PHPnut:[/i] My name says what I think about them all. - -[i]gwoo:[/i] PHP is a web programming language; that's what it was designed for, and that's what it does best: It all boils down to what you are comfortable with. - -[i][u]h3raLd[/u]:[/i] Did you try any other PHP frameworks, MVC-based (Mojavi, for example), or event-driven, like Prado? What do you think about them? In what ways can Cake be better or worse? - -[i]gwoo:[/i] They are all so complex, in my opinion, and I tried nearly all of them. Cake breaks apart the MVC and handle the CRUD in a logical way, and Cake syntax is super easy to learn. - -[i][u]h3raLd[/u]:[/i] Ruby on Rails has been ported to various languages, including Java and Python. There are three PHP frameworks inspired by the famous Ruby project: Biscuit, PHP on Tracks and CakePHP. What do you think of that? Any chance of a merge? Did you have a look at them? - -[i]gwoo:[/i] You forgot Symfony[27], a PHP5-only port: I tried it but it seems much harder to learn than Cake. - -[i]PHPnut:[/i] I could be wrong, but I think these other projects are behind us in ease of use, in what the framework is capable of doing, and in features, not to mention community support. - -[i]gwoo:[/i] I tried all of the PHP ports of Ruby on Rails and none of them has the features, the community,or a lexicon as good as Cake's. - -[i][u]h3raLd[/u]:[/i] Why don't you consider CakePHP a port? In what way is it evolving from Rails? - -[i]PHPnut:[/i] Rails and CakePHP share a lot: MVC pattern, Active Record pattern...but we're not strictly following Rails, and we're able to think by ourselves. Recently we changed the directory structure, and in my opinion our is more functional than the Ruby on Rails one. - -[i][u]h3raLd[/u]:[/i] What can Cake be used for? What kind of projects? Are there any limitations? - -[i]gwoo:[/i] Personally I think that Cake is the most extensible framework out there for PHP: with components, helpers and vendor access you can do anything you want! - -[i]PHPnut:[/i] We are limited only by what a web server (generally Apache, but IIS seems to work as well) and a database can do. We may be limited by PHP itself, but we twist that in our own little sick ways sometimes. - -[i][u]h3raLd[/u]:[/i] Any thought about AJAX? I saw some nice demos made with Cake. What do you think of this new trend in web development? Some people consider it the future, while others are concerned about compatibility, and still others are relatively indifferent to it. What about you? - -[i]gwoo:[/i] AJAX can be very useful in creating an application, but should not be overused. People have become very comfortable with how the Web works:i f you start doing tons of drag and drop and no refreshes, users will feel lost in how to operate the site. - -[i][u]h3raLd[/u]:[/i] Thank you very much for your time, both of you. Is there anything you'd like to add to this interview? Something you'd like to say to users interested in trying out Cake? - -[i]PHPnut:[/i] Come and enjoy: we are here to help... - -[i]gwoo:[/i] ...And plan to be here for a very long time! - - -[b]Let's cook...[/b] - -One of the most positive things about CakePHP is that even though it is a fairly new project (most of the code is 100% useable already,but they still consider the projectto be in the 'alpha' stage), it's maintained by many dedicated developers and PHP enthusiasts. I was amazed to see how the whole documentation evolves and is quite literally updatedon a daily basis. -Anybody can contribute to the framework or simply test it and share their experiences. - -[u][i]CakePHP Wiki[/i][/u] - -Anybody can register an account for free and contribute tutorials and documentation to the new CakePHP Wiki[23]. This is currently the most up-to-date source for documentation files and tutorials. - -[u][i]CakePHP User Group[/i][/u] - -If you need assistance or you want to contact the Cake developers or other Cake users, you can post a message on their Google User Group[24]: people will reply with useful comments, usually on the same day, and the developers [i]do[/i] listen to user suggestions. - -[u][i]CakePHP IRC Channel[/i][/u] - -If you want to offer (or receive) real-time assistance, feel free to join #cakephp on FreeNode (irc.freenode.org). I went there disguised as a total newbie (it wasn't much of a stretch) and they helped me a lot, explaining basic concepts of the framework and pointing me to the right documentation files. - -[u][i]CakePHP Development[/i][/u] - -Experienced PHP developers are more than welcome to contribute to the project. People may be accepted to the core development team if they have sufficient knowledge and spare time, or alternatively,components or code can be submitted through the newly created CakeForge[24]. - - -[b]...Or Just Eat[/b] [small][i] by Marc Abramowitz[/i][/small] - -If you don't feel ready to contribute and you'd like to try out the framework first, it can be downloaded directly from the CakePHP site[25] as either a [i]release[/i] or a [i]nightly[/i] build: the zip file is less than 300KB. - -I wanted to include a [i]success story[/i] written by Marc Abramowitz, an experienced PHP programmer who decided to adopt CakePHP as a framework to use in a production environment: he persuaded his colleagues to use it and they all seem happy with it. He writes: - -[i]For the past few years, I've done quite a bit of work in PHP, working on production code that runs on a very high traffic web site. PHP has served us well, as it is easy to write and read, quite efficient, and easy to integrate with existing C++ code as the site grew. - -Lately, there has been a lot of buzz in the web development community about Ruby on Rails. Like many others, I took some interest in Ruby on Rails because I was intrigued by the apparent power and elegance of Ruby and because I wondered if a Model/View/Controller (MVC) framework like Rails would help enforce a more consistent code structure that would make the code easier to understand and maintain. Additionally, I wondered if an MVC framework would enable very rapid prototyping. - -Some people are very wary of frameworks that impose structure, as they like to have the freedom to do things however they want. However, there is a tradeoff between structure and flexibility. If you're working on a small team or a relatively small project, then you may not find structure to be very helpful; you may even find that it gets in your way. - -However, as teams and projects get larger, structure becomes more and more valuable, as it enforces consistent patterns of how to do things and rather than being something that limits, it in fact liberates, because it abstracts away the small details and allows us to therefore concentrate on the larger problem. Think of the lines that are painted on our roadways - although they add structure, we don't find them to be limiting. On the contrary, they help us to drive without worrying about crashing into each other at every moment - they free us from being concerned with small details so that we can concentrate on getting where we're going. - -Rapid prototyping appeals to me, because I find it helps me to better present my ideas for new apps and features. A mockup can only go so far - there is no substitute for a working prototype. When clients get their hands on a functional prototype, they get a better idea of what is possible and it forces them to clarify their requirements for the product. This results in a better dialogue between the developer and the client, which leads to better upfront decisions, more stable requirements, less stress, and a better product. - -So, Rails appealed to me not only because of the potentially valuable structure that it could add, but also because it could enable rapid prototyping. However, I knew that there was no chance of Rails being used for production code in my organization, because we run some very high traffic web sites that require the utmost in efficiency. We are also by and large a PHP shop. - -However, when my manager approached me and asked me to develop a database-backed internal tool, I thought of Rails again. I then considered the fact that I would probably someday have to hand this app off to someone else, and that someone would probably know PHP but not Ruby. Heck, even I had several years of experience with PHP (including writing some PHP extensions) but I had only done a little bit of reading about Ruby, and I also had no practical experience with it. - -Furthermore, with PHP I had access to a large number of PHP extensions that wrapped various internal libraries. So PHP was the natural choice. Ideally, I wanted to use PHP with a Rails-like MVC framework that would facilitate rapid development, and this is what led me to CakePHP. - -I began by downloading CakePHP 0.9.2 and following the sample tutorial that walks you through creating a simple blog application (note that at the time of this writing, the current version of Cake is now 0.10.0.1076, so some of the details of using Cake have changed). I was pleased to find that the process was quite similar to the process for Rails. One difference that I noted was that Rails tutorials always emphasize using scripts to generate models, controller, and scaffolds, whereas the Cake tutorial walked me through explicitly writing out all the code. I noticed that the Cake download came with a script called "bake" which looked like something that could potentially do some of the code generation, but since it wasn't mentioned in the tutorial, I chose not to use it. - -The process of creating a first application using the tutorial was quite easy. Here are the steps in brief (consult the tutorial for more details): - -1. Create the database table. Cake requires tables to have some extra -fields: - - id, an auto_increment primary key - - created, a datetime - - updated, a datetime -2. Configure Cake to access the database by editing the config/database.php file -3. Create a model class which extends AppModel (a Cake provided class) -4. Create a controller class which extends AppController (a Cake provided class) and write one or more controller methods -5. Create a view which is a PHP file with a .thtml extension and is meant to be mostly HTML with very little embedded PHP - typically just echoing of variables and some simple control structures like [i]foreach[/i]. -Cake also provides some simple convenience methods that write out certain HTML constructs for you. - -That's it! That alone is enough to create a basic but functional application. The tutorial goes on to show you how to add additional functionality to the blogging app. After that there's a shorter, more advanced tutorial that shows you how to add a few more things to the blogging app. - -Once I had gotten comfortable with Cake by following the tutorial, I proceeded to write my own application. Getting started was easy - I followed the same steps as in the tutorial to create my first table, model, controller, and views, then my second table, model, controller, and views. Then my app got a bit more complicated. I needed to have many-to-many relations and more elaborate queries than the default ones that Cake provides. I began to worry that Cake would break down here. I had heard people grumble that MVC frameworks like Rails and Cake were great for little toy apps that only do CRUD (Create, Read, Update, Delete), but that they couldn't handle complex queries using joins and the like. I poked around in the Cake source code and was pleased to find that there were nice lower level methods that allowed me to bypass the Cake defaults and do whatever custom queries I liked. For example, I wrote something like this in one of my models: - -function index(){ - return $this-findBySql( - "SELECT id, title, AVG(rating) avg_rating, MIN(rating) min_rating, MAX(rating) max_rating, COUNT(rating) num_ratings " . - "FROM ideas LEFT JOIN ratings ON ideas.id = -ratings.skill_id " . - "GROUP BY id " . - "ORDER BY title"); - } - - -So what I have is a model that does [i]not[/i] have a one-to-one mapping with a single table. It actually retrieves data from more than one table. - -Over time, I picked up a few more Cake concepts. For example, at some point we decided that every page of the app would have a similar look and feel with a particular masthead and logo, and all the pages in one section of the site would show tabs for all of the various views with the currently selected tab highlighted. At first, I just used the same code at the top of each of my views to display the masthead, logo, and tabs. This, of course, became a pain when I needed to change the layout, since I needed to make the same change in several different views. - -Then one day I realized that Cake had a concept of layouts, which are high level templates in [i]app/views/layouts[/i] that define the basic structure of pages. The individual views are just content that gets embedded in these high level layout templates. So I took the common masthead and logo, put it in my default layout, and removed it from the individual views. Now when I wanted to change the look of the masthead, I only had to do it in one place. For the tabs, I discovered the concept of elements. I placed the code for my tabs in [i]apps/views/elements/tabs.thtml[/i]. Then the tabs could be displayed in any template using: - -<?php echo $this-renderElement('tabs') ? - -Rather than stick the above statement in all of the many pages that were supposed to display tabs, I created a new layout in [i]apps/views/layouts/tabbed.thtml[/i] (which uses renderElement to render the tabs). Then I used - -$this-layout = "tabbed" - -in the controller to tell it to use the tabbed layout rather than the default (non-tabbed) layout. - -After a couple of days of work on this application, it was time to demo it to the VP, who was very impressed with what I was able to accomplish in such a short period of time. It was brought up that before I took on the project they had asked some other folks how long it would take them to build it in Java and they had said that it would take on the order of months what I had built in a couple of days. Morals of the story: - -1. Cake is very lightweight and productive -2. Cake might be very beneficial to your career - -Eventually, I was assigned to another project and my manager wanted me to transition my Cake project to another engineer, who was experienced with PHP but not with Cake. I sat down with the new engineer and in about 20 or 30 minutes of explanation and walking him through the code, -he felt ready to code. Not only did he feel that he knew enough to start working with the application, I could tell from the smile on his face that he was very impressed by the power and succinctness of Cake, which was the same reaction that I initially had. After a couple of days, I checked back with him and he had made a remarkable amount of progress on the application - there were a ton of new pages and features. - -So you see, Cake is a very productive environment. For a very small investment in the initial learning curve, you can get a significant increase in productivity. -[/i] - -[b]...And the icing?[/b] - -So that's what CakePHP is about. The project may only have just entered alpha stage, but the code is already very stable and useable, as PHPnut, gwoo and Marc said. So what's going to be included in the beta and stable releases? I researched a bit and asked the developers, and here's how Cake will probably evolve in the following months: - -[list] -[*]Cake's built-in [b]data-validation[/b] capabilities will be extended. A validator class - which already exists, by the way - will be extended to include more data types and expressions to be validated before being stored in a database. -[*]A new default [b]ACL system[/b] will be included and will support database access and .ini files as well. -[*] The [b]AJAX[/b] helper class and AJAX support will be enhanced, featuring unobtrusive JavaScript and ALA behavior[28]. -[*] [b]Multiple applications[/b] with the same core files. In the future developers will be able to create their own Cake application which could be placed in the app/plugins directory and be seamlessly integrated and auto-linked to other Cake applications. -[/list] - -After learning all this about Cake and after trying it out myself, I really think that I have found the solution to all of my PHP web development problems. CakePHP can really help PHP developers a lot if properly used and understood. Still not convinced? Just try it out then, will you?[17] - - -[b]Notes and Related Resources[/b] - -Special thanks to: -[list] -[*][b]Larry E. Masters aka [i]PhpNut[/i][/b] and Garrett J. Woodworth [b]gwoo[/b] for providing all the answers to my questions and contributing to create such a wonderful tool for the PHP community. -[*][b]Marc Abramowitz[/b] for sharing his experiences with the CakePHP framework and providing the content for the '...let's eat' section. -[/list] - -[small] -[1] PHP functions reference, [url]http://www.php.net/manual/en/funcref.php[/url] -[2] Framework, Wikipedia Page - [url]http://en.wikipedia.org/wiki/Framework[/url] -[3] .NET framework overview - [url]http://msdn.microsoft.com/netframework/technologyinfo/default.aspx[/url] -[4] "PHP Framework", delorian's blog, PHP Community - [url]http://www.phpcommunity.org/node/100[/url] -[5]Some popular PHP frameworks: Mojavi ([url]http://www.mojavi.org/[/url]), phpMVC ([url]http://www.phpmvc.net/[/url]), BlueShoes ([url]http://www.blueshoes.org/[/url]), Seagull ([url]http://seagull.phpkitchen.com/[/url]). -[6] PEAR - [url]http://pear.php.net/[/url] -[7] Prado - PHP Rapid Application Development Object-Oriented, [url]http://www.xisc.com/[/url] -[8] Event Driven Programming, Wikipedia Page - [url]http://en.wikipedia.org/w/index.php?title=Event_driven_programming[/url] -[9] Ruby on Rails, Official Page - [url]http://www.rubyonrails.org/[/url] -[10] Ruby on Rails, Doumentation - [url]http://documentation.rubyonrails.com/[/url] -[11] Model View Controller, Wikipedia Page - [url]http://en.wikipedia.org/w/index.php?title=Model-View-Controller[/url] -[12] PHP frameworks inspired by Rails: [url]http://phpontrax.com/[/url], [url]http://flinn.activeintra.net/biscuit/[/url], [url]http://www.cakephp.org/[/url] -[13]Python frameworks inspired by Rails: [url]http://fanery.sourceforge.net/[/url], [url]http://fanery.sourceforge.net/[/url], [url]http://subway.python-hosting.com/[/url] -[14]Java framework inspired by Rails: [url]https://trails.dev.java.net/[/url] -[15]Perl frameworks inspired by Rails: -[url]http://search.cpan.org/dist/Catalyst/lib/Catalyst/Manual/Intro.pod[/url], [url]http://perlonrails.org/index.php/Main_Page[/url] -[16] "Rails Clones: Blood suckers or useful drones?", RedHanded - [url]http://redhanded.hobix.com/cult/railsClonesBloodsuckersOrUsefulDrones.html[/url] -[17] CakePHP - Rails-inpired PHP framework, [url]http://www.cakephp.org/[/url] -[18] AdoDB, PHP Database Abstraction Layer - [url]http://adodb.sourceforge.net/[/url] -[19] CakePHP blog tutorial - [url]http://wiki.cakephp.org/tutorials:blog_tutorial_-_1[/url] -[20] Extending CakePHP - [url]http://wiki.cakephp.org/tutorials:extending_cake[/url] -[21] Smarty, PHP Template Engine - [url]http://smarty.php.net/[/url] -[22] Scaffolding a Blog, CakePHP Wiki - [url]http://wiki.cakephp.org/tutorials:scaffolding_a_blog[/url] -[23] CakePHP Wiki - [url]http://wiki.cakephp.org/[/url] -[24] CakePHP Google User Group - [url]http://groups.google.com/group/cake-php[/url] -[25] CakeForge - [url]http://cakeforge.org/[/url] -[26] CakePHP Downloads Page - [url]http://cakephp.org/downloads/[/url] -[27] Simfony, PHP5 framework - [url]http://www.symfony-project.com/[/url] -[28] ALA behavior - [url]http://bennolan.com/behaviour/[/url] -[/small] +Web developers can either love or hate PHP, and one of the criticisms of this easy-to-use programming language which is repeated over and over on IRC, forums and blogs is that "PHP is disorganized". +Is this really true? If so, is there any possible way to write a PHP application in a logical and clean way? Read on...Every web developer has certainly heard of PHP. Some people like it and consider it a powerful and easy-to-use way to create complex websites or web applications, while others are convinced that it is merely a bad copy of Perl. Opinions are certainly mixed on the matter. + +One thing to keep in mind when reading criticisms of PHP is its origins, as therein lies the crux of the matter. PHP was created as a form interpreter, initially offering only a [i]very limited[/i] range of functionality. Its main purpose was to make life easier for web developers who wanted to do simple tasks, like manipulating form data. + +People liked the concept - PHP was free and it quickly became popular among developers. More functionality was added and continues to be added with each new release, and PHP is now one of the most popular and powerful programming languages available for web development.It is relatively easy to learn, compared to Perl, ASP, or JSP, and it can be used for almost anything[1]. + +The sheer simplicity of the language was most likely the cause of the enormous amount of exploits discovered through the years which earned PHP the label "[i]too dangerous to use in 'proper' applications[/i]". The danger, however, lies not in the language itself, but rather in the [i]way[/i] developers make use of the language: PHP's simplicity makes writing bad or exploitable code extremely easy. Furthermore, PHP's ability to be placed within any HTML page with the greatest of ease tempted developers to write ever-increasing amounts of 'spaghetti code', which by its very nature is neither organized nor clean code, and certainly does not help a developer learn how to write organized or clean code. + +These problems, however, can be solved. There are many ways to go about doing this, but the easiest, most effective way is to create a framework[2]. + + +[b]Bringing Order to Chaos[/b] + +After learning some PHP myself, I remember noticing that my applications were growing in a disorganized and uncontrollable manner. Things tended to be added at the last minute, and bugs were fixed and patched 'on the fly' wherever they occurred. PHP lacked the structure that is present in most other programming languages. I remember reading the word [i]framework[/i] for the first time not too long ago while I was downloading a Windows Update of the .NET framework[3]. That inspired me to start searching the Internet for a 'PHP framework'. That led me to an interesting blog entry[4] where a solution was proposed - a solution to [i]bring order to chaos[/i]: + +[quote] +[...] The answer is simple: create our own class library, some kind of framework, the PHP framework. The similar in many ways to that one which is already well known to Java or .NET programmers. We could set the standards, structure and main guidelines. [...] +[/quote] + +That blog post made me think about developing my own framework, until I noticed that there were many projects already in progress, and some in fact completed; the end result being a fully functional PHP framework. I read a lot about some of them[5], and abandoned the idea of developing my own, because as a good developer, I believe I should never re-invent the wheel. So I kept looking. I found Pear[6], although that's more a repository of PHP classes with a common standard than a framework, while I was looking for THE solution to developing many types of applications, not merely how to do one thing in particular. + +I came across a very promising project named Prado[7], which won the latest Zend contest, and was considered the best PHP5 application of the year. It is a masterpiece of coding and PHP5 usage, so I tried to learn it. I even developed a website with it. + +Prado lets the developer design the application without imposing any ready-made components, but I found its event-driven[8] approach neither easy to learn nor suitable for everyday web applications. I did not like the idea of having to code a reaction to every event (like a click on a button or different phases of page rendering): that is the approach that ASP takes, and at least in that respect, Prado seems to be inspired by the .NET framework. Event-driven programming is suitable for GUI development and desktop-based interfaces, but not for web applications. + +After trying Prado, I was still unsatisfied, so I once again began my search for a solution to improve my programming. My meanderings took me to Ruby on Rails[9], one of the most recent examples of technology hype on the Net. At the same time,to a certain extent, it is also a successful tool. + + +[b]The Rails Phenomenon[/b] + +[quote] +"Rails is a full-stack, open-source web framework in Ruby for writing real-world applications with joy and less code than most frameworks spend doing XML sit-ups." +[/quote] + +That sounded like what I was looking for, and I started reading more about it in the vast and varied help sections[10] available both on and off of the official site. The Rails team did an outstanding job promoting and marketing the framework, and also in providing comprehensive textual documentation (and even video tutorials) to help both beginners as well as experienced programmers get started with it. + +Briefly, Rails uses Ruby's object oriented programming, in conjunction with the MVC pattern and various automated scripts (generators), to help developers program their applications quickly and in a solid and organized way. However, as that is neither clear nor convincing, let's spend a few moments on the MVC Pattern[11], which will also be useful to understanding the following sections. + +MVC stands for [b]M[/b]odel [b]V[/b]iew [b]C[/b]ontroller: these three words enclose - and this is just a personal opinion - all the wisdom and philosophy of web development, describing - once again, in my opinion - the three most logical parts a web application [i]should[/i] be divided into to achieve code robustness, order and power, all at the same time. Let's look at what each of the component parts mean in detail: + +[list] +[*][b]Model[/b]: The model represents the very essence of the [i]information[/i] and [i]content[/i] of a web application. Imagine this as an object able to gather the information and content of your webpages from a particular resource, such as a database. The model is the only entity able to access resources. +[*][b]View[/b]: The view is an attempt to separate the most unstable part of an application: the user front-end. A view is only responsible for presenting the information that the Model gathered. A view does nothing but format the output, and can be compared to a template or report. In all MVC frameworks for web applications, only view files contain (X)HTML code, and mostly only that. They can therefore be changed [i]at any time[/i] without having to touch a single line of the business logic of your application. +[*][b]Controller[/b]: The controller is the 'brain' of the application. Consider it to be the only part of your program that can 'think' and manage the other parts. Controller files are the only ones able to [i]order[/i] the Model to gather information and then pass the information obtained to the view for display. +[/list] + +Although the MVC seems to make things more complicated, that is part of the objective. Since one of the advantages (and weaknesses) of PHP was its simplicity, the MVC adds complexity to bring more order and logic to the design process. The three entities are separated for just that reason, and trying to put them together can result in potential disasters, since it causes the whole pattern to fail. + +Coming back to Rails, I was quite impressed by the features it offered, but there was a small problem: the Ruby programming language itself. I experienced some difficulties in setting up the environment properly, and I also discovered that most standard hosting companies do not offer Ruby hosting plans as standard. Hosting issues aside, I would have had to learn Ruby in order to master Rails, and I really did not have the time for that: I had to develop a website quickly and easily, preferably with languages I already knew. + +After deciding to abandon Rails (for the moment, anyway), I was amazed by the number of projects in other programming languages that try to emulate the famous Ruby framework, to the point of being considered [i]clones[/i] or ports of it to another language. To my knowledge, the [i]Rails disease[/i] contaminated the following programming languages: +[list] +[*]PHP[12] +[*]Python[13] +[*]Java [14] +[*]Perl [15] +[/list] + +I said [i]disease[/i] because Rails developers think that Ruby on Rails was made in Ruby for a reason, namely that Ruby offered some unique features that were not available in other languages. I will not delve into that topic here; more information is available[16] for those who are interested. However, suffice it to say that there are some Rails ports in PHP that were immediately attacked because of the fact or legend that the creator of Rails originally wanted to develop his framework in PHP and then switched to Ruby. Let's examine one of those PHP frameworks in detail. + + +[b]CakePHP: Just Another Rails Clone?[/b] + +I chose to learn CakePHP (or "Cake")[17] mainly because it offered more features than the other two PHP alternatives. It also seemed to be a more original and actively developed project. In particular, I'd like to quote one of CakePHP's developers, from when he introduced the framework in a comment to a blog post[16]: + +[quote] +"While it's difficult to copy Rails in PHP, it's quite possible to write an equivalent system. I like the terseness of Ruby code, but I need the structure that Rails provides, how it makes me organize my code into something sustainable. That's why I'm ripping off Rails in Cake." +[/quote] + +Cake's developers (bakers?) are developing their own framework which uses many principles of Ruby on Rails, revisited and re-proposed in an extremely flexible and easy to use PHP tool, rather than simply trying to port Rails to PHP. I also liked the fact that they bothered to choose an original name for their project, unlike others: there are too many "<insert language here>-on-Rails" frameworks, and while the whole "Rails" thing is innovative and catchy the first time, it loses its appeal quickly when people use the word everywhere just because it is "fashionable". + +Quoting from CakePHP's website: + +[quote] +"Cake is a rapid development framework for PHP which uses commonly known design patterns like ActiveRecord, Association Data Mapping, Front Controller and MVC. Our primary goal is to provide a structured framework that enables PHP users at all levels to rapidly develop robust web applications, without any loss to flexibility." +[/quote] + +That sounds like the Holy Grail for PHP developers, and I must admit I'm quite impressed myself after using it on various little projects, but is it really all true? What are Cake's features? Are there any limitations? + + +[b]The Ingredients[/b] + +So what is Cake? In the previous sections, I introduced some general concepts and ideas common to Ruby on Rails and CakePHP, but nothing in particular was said about the structure of the framework itself. Let's now turn to that and discuss it in some detail, particularly as it pertains to Cake. + +The first thing to understand about Cake (and Rails as well) is that one of their aims was to avoid editing long and complex configuration files in order to run the environment. The approach in this sense is to use [i]conventions[/i] over [i]configuration[/i]. This may sound terribly restrictive, but in reality it proved to make things much simpler. After all, I said I wanted to use a framework because I needed a solid structure to base my applications on, not that I needed to be able to create and personalize my own structure and system. Cake uses some simple rules in order to run properly, and the easiest way to explain them is through Cake's directory structure, which represents the skeleton of every CakePHP application. + +[b][i]/ +---app/ +------config/ +------controllers/ +---------components/ +------models/ +------plugins/ +------views/ +---------elements/ +---------errors/ +---------helpers/ +---------layouts/ +---------pages/ +------webroot/ +---------css/ +---------files/ +---------img/ +---------js/ +[/b]---cake/ +------config/ +---------inflections/ +------docs/ +------libs/ +---------controller/ +---------generator/ +---------model/ +---------view/ +------scripts/ +---tmp/ +------cache/ +------distro/ +------logs/ +------tests/ +---vendors/[/i] + +I expanded only the first three levels of the tree, although there are more levels in the [i]/cake/[/i] directory. They won't be considered here simply because the [i]/cake/[/i] directory contains CakePHP's internal libraries, which normally will not be modified when developing an application. The [i]/tmp/[/i] directory also will not be elaborated upon either, because it is only used to store temporary files. However, the [i]/vendor/[/i] directory should contain third party scripts and libraries that you may want to use in your application, but they are not normally integrated with Cake's framework. 95% of your application will reside within the [i]/app/[/i] directory, which we therefore need to examine in greater detail. + +[u][i]/config/[/i][/u] +When I said that Cake strives to use conventions over configuration, I really meant it. This directory does not contain thousands of configuration files, only five very small ones. They represent the only items which [i]might[/i] need to be configured. + +[list] +[*][b]acl.ini.php[/b]: This file must be edited only if you plan to use Cake's default ACL (access control list) system for your application. It sets permissions for the application, so it should be used to list every group, user, and their respective rights. This can be useful for small sites with a few well known users, but for anything else, you should develop your own ACL or authentication system that relies on a database. +[*][b]core.php[/b]: This file can be edited to change some default options, such as the level of the error messages and notices that the application will output. This comes in very handy while developing an application. +[*][b]database.php.default[/b]: This should be renamed to database.php and edited if you plan to use any databases with Cake. The settings are fairly straightforward, and include the type of database used (mysql, postrgres, sqlite, or any other supported by the AdoDB library[18]), username, password and database name. +[*][b]paths.php[/b]: Unless you are very particular, you should leave this file alone. It tells Cake where to look for CSS files, images, controllers, etc. If you are planning to adopt Cake's directory structure - which is the most logical option - you can ignore this. +[*][b]routes.php[/b]: Following Rails' example, CakePHP features a "routing system" for user-friendly URLs. By default, your URLs will look like this: [i]http://sitename/controller-name/action-name/eventual/action/parameters[/i], which is a really nice way to organize a site, but you may want to change something if you have particular requirements. +[/list] + + +[u][i]Controllers[/i][/u] +As mentioned previously, a controller represents the "brain" of the MVC pattern, the part which controls what the other parts are doing. Imagine a controller like a section of your site: its name will be present on the address bar, and each of these sections will have a file named <something>_controller.php, and will also contain a class named SomethingController that extends the AppController class. This class will have some methods that correspond to some standard actions like [i]index[/i] (the default action called when you access the http://sitename/controller/ page) or other user-defined ones like [i]add[/i] or [i]list[/i] or [i]admin[/i], depending on the application. As a general rule, you want to add any 'business logic' you want to implement in your application in controllers - for example, calculations or a database query that produces a result. [i]Then[/i] once all the mess is done, the result (usually an array or a variable) is passed to the view (see [i]views[/i] below). + +If this is starting to sound too technical for you, I recommend reading a tutorial[19] available on the CakePHP website about creating a simple blog application. The tutorial will explain most of Cake's basics, including how to pass a variable from a Controller to the corresponding view [i]($this-set('variableNameInView', $variable))[/i] and other useful things. + +Recently [i]Components[/i] have been added to CakePHP, and quoting from the corresponding wiki page[20]: +[quote] +"Components are the preferred way to provide additional functionality to your controller. To make a component available you would add var $component = array('myComponent') inside of your controller's definition, add your file to the /app/controllers/components, name your class MyComponent, and create your methods." +[/quote] + + +[u][i]Models[/i][/u] +A model is an object able to access the database. In Cake's terms, that is any class extending the AppModel class. That class is directly under the [i]/cake/[/i] directory (along with the previously mentioned AppController class), and can be moved to the [i]/app/[/i] directory and modified if you want to add some particular site-wide behavior to it which will be inherited by all models extending it. + +In even simpler terms, you need to create a Model class for every table you're planning to use in your database. A convention in Cake says that database table names should be plural and that the corresponding model should be singular. If you use a table named 'mice', your model should be named 'mouse': Cake is smart enough to understand irregular plurals through an [i]Inflector[/i] class. + +Creating a model class for basic use is trivial: + + +class Post extends AppModel +{ + var $name = 'Post'; +} + + +Then you'll be able to access the model (and therefore the database) from a controller via simple instructions like $this->Post->findAll(). This instruction will query the database and return all records within the Posts table in your database. You can also perform more complex operations, and also specify SQL queries to execute, if you need to, but remeber that models can only be accessed through controllers! If you need some information stored in your database to be displayed on a view, execute the query from the controller and pass it to the view as per the MVC pattern. It can prevent you from cluttering views with business logic and thereby making code updates much harder. + + +[u][i]Views[/i][/u] +Views are used to present information gathered with a model and a controller to the public. They are mostly HTML pages with some PHP tags in them, prints of variables and maybe some [i]foreach[/i] loops. Nothing more than that should be used in a view! + +Views must be placed in this directory and obey the following conventions: + +1. They must be named after a controller's action to allow the controller to refer to a particular view automatically. The same view can be used by multiple controllers, but it must be either set manually or through a layout (see below). +2. Views referring to an action of a particular controller must be placed under a subfolder named after the controller. +3. All views must have a .thtml extension. + +Any site-wide view, like the site's template, must be placed under the [i]layouts[/i] subfolder. In particular, the default.thtml file in the folder represents the global template for your application: page titles and specific pages (views) will be invoked automatically by using $title_for_layout and $content_for_layout respectively. + +Similarly to what was said about components, [i]helpers[/i] can be used to extend views functionalities[20]: + +[quote] +"Helpers are all about the view. You know about the helpers in Cake, but you need a little bit more. You want to have your own methods to display formatted info. To achieve this, you need to add var $helpers = array('myHelper'). + +Now, throw your myhelper.php file into the /app/views/helpers/, create the class MyHelper, and $myHelper is available in the view." +[/quote] + +Cake comes with some very useful default helpers to create links and HTML tags, import JavaScript, create forms, and use AJAX code easily. Unlike most other frameworks, Cake neither has nor uses a third party template engine (like Smarty[21]) for views, but helpers can be used to achieve similar results more quickly than an engine can. + + +[u][i]Plugins[/i][/u] + +Plugins are user-developed enhancements for Cake. Unlike the files placed under the [i]vendor[/i] directory, a plugin is an application specifically made to be used within the CakePHP environment. At the moment this feature is still under development. + +[u][i]Webroot[/i][/u] + +If you read carefully what I wrote above about routes, you might be wondering if [i]every[/i] page must have a controller and a view in order to be displayed properly. What about images, JavaScript and CSS files? The answer is this directory: everything you place here will not be seen as part of the MVC-based environment; CSS files can be stored in the [i]/css[/i] folder, Javascript under [i]/js[/i], and so on. Additionally, some helpers can provide a easier way to access or display images, scripts, CSS, etc. + + +[u][i]Other Features[/i][/u] +Cake offers even more than this; the latest releases have introduced a few more Rails-inspired features: + +[list] +[*][b]Scaffolding[/b]: Do you want to test your application without spending time writing all the CRUD (Create, Read, Update, Delete) code? That's where the concept of scaffolding comes in: by setting a few variables in the right places[22], Cake will generate basic mechanisms to add, edit, list, and delete records in your database, along with all the associated view files. You won't have to code a single form, as everything will be generated automatically by the framework according to SQL field types. +[*][b]Bake[/b]: Another Rails-inspired feature revisited in PHP. Rails uses a set of scripts and in particular the [i]rake[/i] utility to instantaneously create the foundation for a Rails application with scaffolds already in place. CakePHP offers the same functionality through the [i]bake[/i] utility, which is currently available as either a batch file or a PHP script. +[*][b]ACL[/b]: As previously mentioned, Cake comes with a ready-made Access Control List (ACL) system, which can be extended and used to restrict particular areas of a Cake application to certain users or user groups. +[*][b]Compatibility[/b]: CakePHP is fully compatible with both PHP and PHP5. +[/list] + + +[b]Meet the Bakers[/b] + +After reading all these things about CakePHP and its framework, you may have some questions, or be curious about some aspect of the project. PHPNut and gwoo, two of CakePHP's creators and lead developers, offered to answer some questions exclusively for zZine readers. This interview took place on Oct. 26th, 2005, in #dev-cakephp on irc.freenode.org. + +[i][u]h3rald[/u]:[/i] Thanks to both of you for allowing me to interview you about your project, CakePHP. Where did the name come from, anyway? + +[i]PHPnut:[/i] The original project was started by Michal Tatarynowicz aka Pies (hence the name), and when I saw his release, last March, I decided to contact him. I told him that the company I own supports projects like Cake, and also that I was in the process of developing something along the same lines. + +[i][u]h3raLd[/u]:[/i] Is Cake released under the GPL? How many developers are helping out? + +[i]gwoo:[/i] Cake is released under the MIT license, and the development team is composed of me and PHPnut, plus four other contributors. Then there's the Documentation Team, currently 3-5 people. Documentation has to follow the releases, so it usually lags behind a bit: we made so many modifications in the recent release that the Doc Team has a lot to catch up on, but it's getting there. + +[i]PHPnut:[/i] With this release you will see that the docs are going to be much better. The code is very stable now, and hopefully very little changes on that. + +[i][u]h3raLd[/u]:[/i] Some people, at first glance, may think that Cake is a PHP port of Ruby on Rails. How true is that? What are the differences and similarities between these two frameworks? + +[i]PHPnut:[/i] Cake started as a port, but has evolved into something more: we discussed using the concepts that RoR offered and including them in a framework for users of PHP. I have used PHP for a number of years, and I am comfortable with it; this is where my passion is, and I think people who use Cake have those same passions as we developers do. + +[i][u]h3raLd[/u]:[/i] I read once that Rails was developed in Ruby because only Ruby can offer certain functionalities and features... + +[i]gwoo:[/i] I would disagree, and I think that is proven in what we have done: sure RoR has a built in server and some other nice things, but PHP is everywhere. + +[i][u]h3raLd[/u]:[/i] Some developers, especially Perl programmers, tend to consider PHP an "inferior" language sometimes. What do you think of that? + +[i]PHPnut:[/i] My name says what I think about them all. + +[i]gwoo:[/i] PHP is a web programming language; that's what it was designed for, and that's what it does best: It all boils down to what you are comfortable with. + +[i][u]h3raLd[/u]:[/i] Did you try any other PHP frameworks, MVC-based (Mojavi, for example), or event-driven, like Prado? What do you think about them? In what ways can Cake be better or worse? + +[i]gwoo:[/i] They are all so complex, in my opinion, and I tried nearly all of them. Cake breaks apart the MVC and handle the CRUD in a logical way, and Cake syntax is super easy to learn. + +[i][u]h3raLd[/u]:[/i] Ruby on Rails has been ported to various languages, including Java and Python. There are three PHP frameworks inspired by the famous Ruby project: Biscuit, PHP on Tracks and CakePHP. What do you think of that? Any chance of a merge? Did you have a look at them? + +[i]gwoo:[/i] You forgot Symfony[27], a PHP5-only port: I tried it but it seems much harder to learn than Cake. + +[i]PHPnut:[/i] I could be wrong, but I think these other projects are behind us in ease of use, in what the framework is capable of doing, and in features, not to mention community support. + +[i]gwoo:[/i] I tried all of the PHP ports of Ruby on Rails and none of them has the features, the community,or a lexicon as good as Cake's. + +[i][u]h3raLd[/u]:[/i] Why don't you consider CakePHP a port? In what way is it evolving from Rails? + +[i]PHPnut:[/i] Rails and CakePHP share a lot: MVC pattern, Active Record pattern...but we're not strictly following Rails, and we're able to think by ourselves. Recently we changed the directory structure, and in my opinion our is more functional than the Ruby on Rails one. + +[i][u]h3raLd[/u]:[/i] What can Cake be used for? What kind of projects? Are there any limitations? + +[i]gwoo:[/i] Personally I think that Cake is the most extensible framework out there for PHP: with components, helpers and vendor access you can do anything you want! + +[i]PHPnut:[/i] We are limited only by what a web server (generally Apache, but IIS seems to work as well) and a database can do. We may be limited by PHP itself, but we twist that in our own little sick ways sometimes. + +[i][u]h3raLd[/u]:[/i] Any thought about AJAX? I saw some nice demos made with Cake. What do you think of this new trend in web development? Some people consider it the future, while others are concerned about compatibility, and still others are relatively indifferent to it. What about you? + +[i]gwoo:[/i] AJAX can be very useful in creating an application, but should not be overused. People have become very comfortable with how the Web works:i f you start doing tons of drag and drop and no refreshes, users will feel lost in how to operate the site. + +[i][u]h3raLd[/u]:[/i] Thank you very much for your time, both of you. Is there anything you'd like to add to this interview? Something you'd like to say to users interested in trying out Cake? + +[i]PHPnut:[/i] Come and enjoy: we are here to help... + +[i]gwoo:[/i] ...And plan to be here for a very long time! + + +[b]Let's cook...[/b] + +One of the most positive things about CakePHP is that even though it is a fairly new project (most of the code is 100% useable already,but they still consider the projectto be in the 'alpha' stage), it's maintained by many dedicated developers and PHP enthusiasts. I was amazed to see how the whole documentation evolves and is quite literally updatedon a daily basis. +Anybody can contribute to the framework or simply test it and share their experiences. + +[u][i]CakePHP Wiki[/i][/u] + +Anybody can register an account for free and contribute tutorials and documentation to the new CakePHP Wiki[23]. This is currently the most up-to-date source for documentation files and tutorials. + +[u][i]CakePHP User Group[/i][/u] + +If you need assistance or you want to contact the Cake developers or other Cake users, you can post a message on their Google User Group[24]: people will reply with useful comments, usually on the same day, and the developers [i]do[/i] listen to user suggestions. + +[u][i]CakePHP IRC Channel[/i][/u] + +If you want to offer (or receive) real-time assistance, feel free to join #cakephp on FreeNode (irc.freenode.org). I went there disguised as a total newbie (it wasn't much of a stretch) and they helped me a lot, explaining basic concepts of the framework and pointing me to the right documentation files. + +[u][i]CakePHP Development[/i][/u] + +Experienced PHP developers are more than welcome to contribute to the project. People may be accepted to the core development team if they have sufficient knowledge and spare time, or alternatively,components or code can be submitted through the newly created CakeForge[24]. + + +[b]...Or Just Eat[/b] [small][i] by Marc Abramowitz[/i][/small] + +If you don't feel ready to contribute and you'd like to try out the framework first, it can be downloaded directly from the CakePHP site[25] as either a [i]release[/i] or a [i]nightly[/i] build: the zip file is less than 300KB. + +I wanted to include a [i]success story[/i] written by Marc Abramowitz, an experienced PHP programmer who decided to adopt CakePHP as a framework to use in a production environment: he persuaded his colleagues to use it and they all seem happy with it. He writes: + +[i]For the past few years, I've done quite a bit of work in PHP, working on production code that runs on a very high traffic web site. PHP has served us well, as it is easy to write and read, quite efficient, and easy to integrate with existing C++ code as the site grew. + +Lately, there has been a lot of buzz in the web development community about Ruby on Rails. Like many others, I took some interest in Ruby on Rails because I was intrigued by the apparent power and elegance of Ruby and because I wondered if a Model/View/Controller (MVC) framework like Rails would help enforce a more consistent code structure that would make the code easier to understand and maintain. Additionally, I wondered if an MVC framework would enable very rapid prototyping. + +Some people are very wary of frameworks that impose structure, as they like to have the freedom to do things however they want. However, there is a tradeoff between structure and flexibility. If you're working on a small team or a relatively small project, then you may not find structure to be very helpful; you may even find that it gets in your way. + +However, as teams and projects get larger, structure becomes more and more valuable, as it enforces consistent patterns of how to do things and rather than being something that limits, it in fact liberates, because it abstracts away the small details and allows us to therefore concentrate on the larger problem. Think of the lines that are painted on our roadways - although they add structure, we don't find them to be limiting. On the contrary, they help us to drive without worrying about crashing into each other at every moment - they free us from being concerned with small details so that we can concentrate on getting where we're going. + +Rapid prototyping appeals to me, because I find it helps me to better present my ideas for new apps and features. A mockup can only go so far - there is no substitute for a working prototype. When clients get their hands on a functional prototype, they get a better idea of what is possible and it forces them to clarify their requirements for the product. This results in a better dialogue between the developer and the client, which leads to better upfront decisions, more stable requirements, less stress, and a better product. + +So, Rails appealed to me not only because of the potentially valuable structure that it could add, but also because it could enable rapid prototyping. However, I knew that there was no chance of Rails being used for production code in my organization, because we run some very high traffic web sites that require the utmost in efficiency. We are also by and large a PHP shop. + +However, when my manager approached me and asked me to develop a database-backed internal tool, I thought of Rails again. I then considered the fact that I would probably someday have to hand this app off to someone else, and that someone would probably know PHP but not Ruby. Heck, even I had several years of experience with PHP (including writing some PHP extensions) but I had only done a little bit of reading about Ruby, and I also had no practical experience with it. + +Furthermore, with PHP I had access to a large number of PHP extensions that wrapped various internal libraries. So PHP was the natural choice. Ideally, I wanted to use PHP with a Rails-like MVC framework that would facilitate rapid development, and this is what led me to CakePHP. + +I began by downloading CakePHP 0.9.2 and following the sample tutorial that walks you through creating a simple blog application (note that at the time of this writing, the current version of Cake is now 0.10.0.1076, so some of the details of using Cake have changed). I was pleased to find that the process was quite similar to the process for Rails. One difference that I noted was that Rails tutorials always emphasize using scripts to generate models, controller, and scaffolds, whereas the Cake tutorial walked me through explicitly writing out all the code. I noticed that the Cake download came with a script called "bake" which looked like something that could potentially do some of the code generation, but since it wasn't mentioned in the tutorial, I chose not to use it. + +The process of creating a first application using the tutorial was quite easy. Here are the steps in brief (consult the tutorial for more details): + +1. Create the database table. Cake requires tables to have some extra +fields: + - id, an auto_increment primary key + - created, a datetime + - updated, a datetime +2. Configure Cake to access the database by editing the config/database.php file +3. Create a model class which extends AppModel (a Cake provided class) +4. Create a controller class which extends AppController (a Cake provided class) and write one or more controller methods +5. Create a view which is a PHP file with a .thtml extension and is meant to be mostly HTML with very little embedded PHP - typically just echoing of variables and some simple control structures like [i]foreach[/i]. +Cake also provides some simple convenience methods that write out certain HTML constructs for you. + +That's it! That alone is enough to create a basic but functional application. The tutorial goes on to show you how to add additional functionality to the blogging app. After that there's a shorter, more advanced tutorial that shows you how to add a few more things to the blogging app. + +Once I had gotten comfortable with Cake by following the tutorial, I proceeded to write my own application. Getting started was easy - I followed the same steps as in the tutorial to create my first table, model, controller, and views, then my second table, model, controller, and views. Then my app got a bit more complicated. I needed to have many-to-many relations and more elaborate queries than the default ones that Cake provides. I began to worry that Cake would break down here. I had heard people grumble that MVC frameworks like Rails and Cake were great for little toy apps that only do CRUD (Create, Read, Update, Delete), but that they couldn't handle complex queries using joins and the like. I poked around in the Cake source code and was pleased to find that there were nice lower level methods that allowed me to bypass the Cake defaults and do whatever custom queries I liked. For example, I wrote something like this in one of my models: + +function index(){ + return $this-findBySql( + "SELECT id, title, AVG(rating) avg_rating, MIN(rating) min_rating, MAX(rating) max_rating, COUNT(rating) num_ratings " . + "FROM ideas LEFT JOIN ratings ON ideas.id = +ratings.skill_id " . + "GROUP BY id " . + "ORDER BY title"); + } + + +So what I have is a model that does [i]not[/i] have a one-to-one mapping with a single table. It actually retrieves data from more than one table. + +Over time, I picked up a few more Cake concepts. For example, at some point we decided that every page of the app would have a similar look and feel with a particular masthead and logo, and all the pages in one section of the site would show tabs for all of the various views with the currently selected tab highlighted. At first, I just used the same code at the top of each of my views to display the masthead, logo, and tabs. This, of course, became a pain when I needed to change the layout, since I needed to make the same change in several different views. + +Then one day I realized that Cake had a concept of layouts, which are high level templates in [i]app/views/layouts[/i] that define the basic structure of pages. The individual views are just content that gets embedded in these high level layout templates. So I took the common masthead and logo, put it in my default layout, and removed it from the individual views. Now when I wanted to change the look of the masthead, I only had to do it in one place. For the tabs, I discovered the concept of elements. I placed the code for my tabs in [i]apps/views/elements/tabs.thtml[/i]. Then the tabs could be displayed in any template using: + +<?php echo $this-renderElement('tabs') ? + +Rather than stick the above statement in all of the many pages that were supposed to display tabs, I created a new layout in [i]apps/views/layouts/tabbed.thtml[/i] (which uses renderElement to render the tabs). Then I used + +$this-layout = "tabbed" + +in the controller to tell it to use the tabbed layout rather than the default (non-tabbed) layout. + +After a couple of days of work on this application, it was time to demo it to the VP, who was very impressed with what I was able to accomplish in such a short period of time. It was brought up that before I took on the project they had asked some other folks how long it would take them to build it in Java and they had said that it would take on the order of months what I had built in a couple of days. Morals of the story: + +1. Cake is very lightweight and productive +2. Cake might be very beneficial to your career + +Eventually, I was assigned to another project and my manager wanted me to transition my Cake project to another engineer, who was experienced with PHP but not with Cake. I sat down with the new engineer and in about 20 or 30 minutes of explanation and walking him through the code, +he felt ready to code. Not only did he feel that he knew enough to start working with the application, I could tell from the smile on his face that he was very impressed by the power and succinctness of Cake, which was the same reaction that I initially had. After a couple of days, I checked back with him and he had made a remarkable amount of progress on the application - there were a ton of new pages and features. + +So you see, Cake is a very productive environment. For a very small investment in the initial learning curve, you can get a significant increase in productivity. +[/i] + +[b]...And the icing?[/b] + +So that's what CakePHP is about. The project may only have just entered alpha stage, but the code is already very stable and useable, as PHPnut, gwoo and Marc said. So what's going to be included in the beta and stable releases? I researched a bit and asked the developers, and here's how Cake will probably evolve in the following months: + +[list] +[*]Cake's built-in [b]data-validation[/b] capabilities will be extended. A validator class - which already exists, by the way - will be extended to include more data types and expressions to be validated before being stored in a database. +[*]A new default [b]ACL system[/b] will be included and will support database access and .ini files as well. +[*] The [b]AJAX[/b] helper class and AJAX support will be enhanced, featuring unobtrusive JavaScript and ALA behavior[28]. +[*] [b]Multiple applications[/b] with the same core files. In the future developers will be able to create their own Cake application which could be placed in the app/plugins directory and be seamlessly integrated and auto-linked to other Cake applications. +[/list] + +After learning all this about Cake and after trying it out myself, I really think that I have found the solution to all of my PHP web development problems. CakePHP can really help PHP developers a lot if properly used and understood. Still not convinced? Just try it out then, will you?[17] + + +[b]Notes and Related Resources[/b] + +Special thanks to: +[list] +[*][b]Larry E. Masters aka [i]PhpNut[/i][/b] and Garrett J. Woodworth [b]gwoo[/b] for providing all the answers to my questions and contributing to create such a wonderful tool for the PHP community. +[*][b]Marc Abramowitz[/b] for sharing his experiences with the CakePHP framework and providing the content for the '...let's eat' section. +[/list] + +[small] +[1] PHP functions reference, [url]http://www.php.net/manual/en/funcref.php[/url] +[2] Framework, Wikipedia Page - [url]http://en.wikipedia.org/wiki/Framework[/url] +[3] .NET framework overview - [url]http://msdn.microsoft.com/netframework/technologyinfo/default.aspx[/url] +[4] "PHP Framework", delorian's blog, PHP Community - [url]http://www.phpcommunity.org/node/100[/url] +[5]Some popular PHP frameworks: Mojavi ([url]http://www.mojavi.org/[/url]), phpMVC ([url]http://www.phpmvc.net/[/url]), BlueShoes ([url]http://www.blueshoes.org/[/url]), Seagull ([url]http://seagull.phpkitchen.com/[/url]). +[6] PEAR - [url]http://pear.php.net/[/url] +[7] Prado - PHP Rapid Application Development Object-Oriented, [url]http://www.xisc.com/[/url] +[8] Event Driven Programming, Wikipedia Page - [url]http://en.wikipedia.org/w/index.php?title=Event_driven_programming[/url] +[9] Ruby on Rails, Official Page - [url]http://www.rubyonrails.org/[/url] +[10] Ruby on Rails, Doumentation - [url]http://documentation.rubyonrails.com/[/url] +[11] Model View Controller, Wikipedia Page - [url]http://en.wikipedia.org/w/index.php?title=Model-View-Controller[/url] +[12] PHP frameworks inspired by Rails: [url]http://phpontrax.com/[/url], [url]http://flinn.activeintra.net/biscuit/[/url], [url]http://www.cakephp.org/[/url] +[13]Python frameworks inspired by Rails: [url]http://fanery.sourceforge.net/[/url], [url]http://fanery.sourceforge.net/[/url], [url]http://subway.python-hosting.com/[/url] +[14]Java framework inspired by Rails: [url]https://trails.dev.java.net/[/url] +[15]Perl frameworks inspired by Rails: +[url]http://search.cpan.org/dist/Catalyst/lib/Catalyst/Manual/Intro.pod[/url], [url]http://perlonrails.org/index.php/Main_Page[/url] +[16] "Rails Clones: Blood suckers or useful drones?", RedHanded - [url]http://redhanded.hobix.com/cult/railsClonesBloodsuckersOrUsefulDrones.html[/url] +[17] CakePHP - Rails-inpired PHP framework, [url]http://www.cakephp.org/[/url] +[18] AdoDB, PHP Database Abstraction Layer - [url]http://adodb.sourceforge.net/[/url] +[19] CakePHP blog tutorial - [url]http://wiki.cakephp.org/tutorials:blog_tutorial_-_1[/url] +[20] Extending CakePHP - [url]http://wiki.cakephp.org/tutorials:extending_cake[/url] +[21] Smarty, PHP Template Engine - [url]http://smarty.php.net/[/url] +[22] Scaffolding a Blog, CakePHP Wiki - [url]http://wiki.cakephp.org/tutorials:scaffolding_a_blog[/url] +[23] CakePHP Wiki - [url]http://wiki.cakephp.org/[/url] +[24] CakePHP Google User Group - [url]http://groups.google.com/group/cake-php[/url] +[25] CakeForge - [url]http://cakeforge.org/[/url] +[26] CakePHP Downloads Page - [url]http://cakephp.org/downloads/[/url] +[27] Simfony, PHP5 framework - [url]http://www.symfony-project.com/[/url] +[28] ALA behavior - [url]http://bennolan.com/behaviour/[/url] +[/small]
M content/articles/mongrel-shortcut-review.textilecontent/articles/mongrel-shortcut-review.textile

@@ -14,150 +14,150 @@ - ruby

type: article toc: true ----- -If you ever considered about developing an deploying a Rails application in the last year or so, you must have heard of "Mongrel":http://mongrel.rubyforge.org/index.html before. If you didn't, I'd recommend you learn more about it because up to now it proved to be one of the few essential ingredients for deploying _scalable_ Rails applications. - -Mongrel is a creation of "Zed Shaw":http://www.zedshaw.com/ who started writing a replacement for FastCGI to use with Rails, and ended up creating a brand new, HTTP web server who turned out to be one of the best things the Rails community ever saw happening. - -It was created to be simple to use and configure, nevertheless it _does_ require some skill to set it up and tune it. Documentation is there, along with plenty of blog posts, but there's also an interesting "book":http://www.informit.com/store/product.aspx?isbn=0321483502&rl=1 from "Addison Wesley Professional":http://www.awprofessional.com/ which is definetely worth a read. - -!>/files/mongrel_shortcut.jpeg! - -"Mongrel: Serving, Deploying, and Extending Your Ruby Applications" &ndash; that's the title of the book. A _Digital Shortcut_, 100-odd pages long, in _landscape_ format to make it easier to read on a computer, straight to the point with no added sugar for just 15$ (PDF only). I must say Addison Wesley got it right: the book's format is, as a matter of fact, _optimized for web developers_, especially those who can't afford to read a 500-pages book covering everything about a subject just to find that one thing they don't know about. -This _shortcut_ can be seen, essentially, as an expanded cheatsheet which will teach you the basics about Mongrel and also give you plenty of advice on how to learn more about it. - -Let's have a closer look at it. - - - -h3. Overview, Introduction & Getting Started - -The first three -chapters- sections (there are no chapters, just _sections_) of the book are meant to be a gentle introduction to Mongrel and its world. The main author is "Matt Pelletier":http://www.informit.com/authors/bio.aspx?a=0260912e-6ed8-4ed1-882a-c357e644feec, but Zed Show's contributions are definitely one of the book's best selling points. -Zed's thoughts are scattered here and there in many _sidebars_ throughout the book (there's at least one in each section): you'll see an odd-looking face (Zed's self-caricature) with some text next to it; when you read it, you'll notice that they are _actually_ Zed's own thoughts, straight from his mind, with no editorial filter whatsoever in-between. -Be warned: the text included within the *Zed Sez* sidebars is highly opinionated, that's precisely what Zed _feels_ to say about something, and he'll just say it: just the plain, simple thoughts of an experienced programmer. As the author explains in *Section 1*: _"[...] You may not agree with everything he says, but you probably should."_ - -*Section 2* is a general introduction about Mongrel. It explains _what_ it is, _when_ and _why_ it was made, and _how_ it works. There's nothing new to learn if you already used Mongrel before, probably, but it's definitely the first thing to show to someone who's new to Mongrel and its world, and possibly a bit skeptical about it. -The last subsection _"What can Mongrel do for me"_ is an attempt to -brainwash- persuade you to fully embrace Mongrel and its philosophy, whether you are a developer, a sysadmin or even a manager: assertions like _"Mongrel is pretty damned secure."_ and _"Mongrel's license is capitalist-friendly."_ will definitaly make some of you (managers) happy. - -*Section 3* is slightly more juicy than the previous one, as it explains how to install and use Mongrel. Basically that's what everyone who ever used it already knows, but it's still necessary for the book's consistency, after all. After reading this section, you'll probably have your first Mongrel up and running and serving your little Rails application's pages, and you'll begin to wonder why the hell you need to keep reading this book now that everything seems to work already... - - -h3. Section 4: Configurations - -...aka "a truly useful Mongrel cheatsheet". This section dives deep(er) into Mongrel's configuration by explaining what each start parameter does in detail. The parameters are presented in tabular form in a very well-organized way. As you would expect from an high-quality cheatsheet. - -Then the author will explore a few commonly used deployment scenarios, in particular: - -* *Standalone* &ndash; The simplest configuration possible, with just one Mongrel instance serving both static and dynamic pages. -* *mongrel&#95;cluster* &ndash; How to use _"a pack of mongrels"_ together to handle more traffic. -* *Behind a static web server* &ndash; The most common (and most scalable) option, used to serve static content faster using a front-end server and use Mongrel only to handle Ruby pages. - -Towards the end of the section, for the developer's delight, the author will discuss two common, useful scenarios where Mongrel can be used: - -* *Apache 2 + mod_proxy_balancer + mongrel&#95;cluster* -* *Nginx + mongrel&#95;cluster* - -The difference here is that detailed instructions are provided on how to setup and configure each server, including example file sources. This can be particularly useful for the Nginx example, as most of the documentation for this fantastic, lightweight Mongrel fron-end is scattered around the web (or written in Russian in a "well known place":http://sysoev.ru/nginx/). - - -h3. Section 5: Production Deployment - -This section introduces one of the most important part of the life cycle of a Rails application: the deployment on a production server. The author is pretty honest about the whole subject: - -<blockquote> -<em>"You will not do this in a day. If you are expecting to code until 1 minute before your deadline and then simply point and click and have an instant server then you need to take some kind of -medication because you are violently hallucinating. You will need at least a week of 8 hours days to make sure your first deployment works and to have the time to do it right."</em> -</blockquote> - -Sounds terribly true. Especially for larger projects demanding good performance under heavy traffic. Scared? Probably, if you never deployed a Rails application "properly" before, but at least the book comes to the rescue by providing an overview of what you need to perform a deployment and why it is such a complex and delicate process. - -Not only this, but also a "Best Practices Rubric" is also provided for the developer's own private enjoyement. It's written as a list of questions like: - -_11. Do you have a shared location where you can document the deployment, such as a Wiki or CMS?_ -_12. Do you know how to use httperf or ab and know what the statistics mean?_ - -After these 13 questions, the author provides the key to give a meaning to your answers: - -<blockquote> -<em>"For each question you answer with "NO", add 10 hours to your time estimate for completion. This may seem unrealistic, since saying "NO" to everything means it'll take 190 hours (about one -month), but this estimate is actually low according to most first deployment experiences."</em> -</blockquote> - -If you answered "NO" too many times to these questions, you may want to read on through the next subsection which states 17 "worst practices": an invaluable read for beginners! - -But after all this section is not only about stating the obvious (...right?): a full example scenario is describedand examined throughly to give you an idea of how a deployment _should_ be made, using three different machines: - -* One for Apache (as a front-end to Mongrel) -* One for the Mongrel cluster and the Rails application -* One for the database - -Maybe something you'll never do if you just want to run your grandma's site on Rails, but certainly something you may want to start looking at if your grandma becomes really popular and your small server gets grounded by several thousands of visitors per day. - -The last part of the section will give you a brief introduction on monitoring your applications and on which tools you should be using, although it does not discuss the subject in detail at all, it's just meant to point you to the right direction. - - -h3. Section 6: Extending Mongrel - -This section digs deeper into the software code internals and describes _how to teach new tricks to your Mongrel_, i.e. how to extend its functionality. - -Before you begin, though, don't forget what Zed himself has to say about Mongrel's simplicity: - -<blockquote> -_"I've always had a different aesthetic sense when I write my software. I value simplicity and directness and try to write software that follows this approach. I jokingly call it the Shibumi School of Software Structure. All I do is apply this rule: When given two possible designs with equal end results, pick the simpler one. I then ruthlessly strip the solution down to its finest elements, but no more."_ -</blockquote> - -Mongrel's architecture is not that complex, and this section is sufficient to get you started by providing an overview of the main classes involved (HttpServer, HttpRequest, HttpResponse, HttpHandler, URIClassifier), and how they work together. -Note that the book won't describe anything about the APIs of these classes. but after all, the project's "RDoc documentation":http://mongrel.rubyforge.org/rdoc/files/README.html should cover all the details you need. - -The rest of the section focuses on how to extend Mongrel, by: - -* Writing custom handlers in Ruby -* Creating custom filters to perform security checks, clean up requests and preliminary file processing -* Creating plugins and distributing them as rubygems - -Two working examples are also provided: - -* An example handler to deflate content (if the browser supports deflate) -* An example "duck" plugin, to make Mongrel quack like a duck when it's started (not the most useful thing in the world, but serves the purpose) - - -h2. Debugging, Performance & Security - -The last three sections deals with other important aspects concerning the deployment of your application, how to debug, how to improve performance and how to secure your application. - -*Section 7* introduces two debugging modes: - -* Dash-Bee logging (-B) -* USR1 logging (lighter) - -And also gives you an idea on what to look for when debugging an application. Nothing too detailed, granted, but enough to make sure you are pointed in the right direction. - -Again, Zed's wisdom and wit are remarkable: - -<blockquote> -<em>"These people's problem is they suffer from Potpourri Turd Syndrome—a belief that their you-know-what don't stink and smells like fine dew on freshly cut grass. Whenever there's a bug, they go -running like kids in a candy store to other people's code trying to find fault and just assume that it's nothing they wrote. -[...] -When you run into a problem with your application, always assume it's your fault first. Mongrel's not perfect, but its code is minuscule compared to the size of Rails and most likely even your own appli-cation code. Mongrel also powers many large and medium deployments without any problems. If there's an error, the evidence already says it's in your code, so bite the bullet and start investigating it as if it's your problem."</em> -</blockquote> - -Similarly, *Section 8* is a short but useful overview on performance tips and tricks and deployment tuning. The most useful thing is probably the checklist of the "tuning process", which illustrates the simple steps to take to tune your application. - -Finally, *Section 9* addresses some common security concerns and clarifies how Mongrel deals with them. The answer is normally "Mongrel strictly does this" or "Mongrel doesn't support this feature". After all, you should have understood by now that Mongrel is an example of simplicity and that it deliberately does not aim to offer all the feature you'd expect by a server like Apache: - -<blockquote> -<em>"As you probably see, Mongrel say, "No" in many places where most Web servers say, "Yes, OK." Sometimes this is because no one using Mongrel has needed it yet, sometimes it's because there's a -better, simpler way to accomplish the same goal. Mongrel is a different kind of Web server, and frequently you can solve your problem with a different solution."</em> -</blockquote> - - -h2. Conclusion - -If Mongrel is opinionated software, this is definitely an opinionated book which fully embraces the project's philosopy of simplicity above everything else. It's an interesting read and it won't bore you to death by deliberately skipping long and potentially tedious subjects and adding interesting insights instead (like the Zed Sez sidebars). Perhaps it is a bit too direct towards certain people, who may get even get offended (as planned) by some of the author's assertions. - -Despite being a 100-pages book, this _shortcut_ covers pretty much everything you need to know *about Mongrel*. It will _not_ teach you everything about deployment, security, performance tweaks and debugging though: as the authors often state throughout the book, a lot of (big) books are available on those subject, and it wouldn't make sense to even attempt to discuss them in this shortcut. - -Similarly, you won't find complex examples either, but that's acceptable because simple examples are often the only thing you need to grasp the basics of a concept or feature, and then use them as a "scaffold" for your own code. - -Globally, the book is well balanced and _optimized_ for its size: lightweight introductory sections at first, then the "real juice" in the middle, and a few overview sections on advanced topics towards the end. You can read it easily in a few hours, perhaps less, and whenever you need to look something up in a hurry it will be fairly easy to locate. - -A good read, and a _must_ for everyone who wants to learn more about Mongrel or Rails deployment. +If you ever considered about developing an deploying a Rails application in the last year or so, you must have heard of "Mongrel":http://mongrel.rubyforge.org/index.html before. If you didn't, I'd recommend you learn more about it because up to now it proved to be one of the few essential ingredients for deploying _scalable_ Rails applications. + +Mongrel is a creation of "Zed Shaw":http://www.zedshaw.com/ who started writing a replacement for FastCGI to use with Rails, and ended up creating a brand new, HTTP web server who turned out to be one of the best things the Rails community ever saw happening. + +It was created to be simple to use and configure, nevertheless it _does_ require some skill to set it up and tune it. Documentation is there, along with plenty of blog posts, but there's also an interesting "book":http://www.informit.com/store/product.aspx?isbn=0321483502&rl=1 from "Addison Wesley Professional":http://www.awprofessional.com/ which is definetely worth a read. + +!>/files/mongrel_shortcut.jpeg! + +"Mongrel: Serving, Deploying, and Extending Your Ruby Applications" &ndash; that's the title of the book. A _Digital Shortcut_, 100-odd pages long, in _landscape_ format to make it easier to read on a computer, straight to the point with no added sugar for just 15$ (PDF only). I must say Addison Wesley got it right: the book's format is, as a matter of fact, _optimized for web developers_, especially those who can't afford to read a 500-pages book covering everything about a subject just to find that one thing they don't know about. +This _shortcut_ can be seen, essentially, as an expanded cheatsheet which will teach you the basics about Mongrel and also give you plenty of advice on how to learn more about it. + +Let's have a closer look at it. + + + +h3. Overview, Introduction & Getting Started + +The first three -chapters- sections (there are no chapters, just _sections_) of the book are meant to be a gentle introduction to Mongrel and its world. The main author is "Matt Pelletier":http://www.informit.com/authors/bio.aspx?a=0260912e-6ed8-4ed1-882a-c357e644feec, but Zed Show's contributions are definitely one of the book's best selling points. +Zed's thoughts are scattered here and there in many _sidebars_ throughout the book (there's at least one in each section): you'll see an odd-looking face (Zed's self-caricature) with some text next to it; when you read it, you'll notice that they are _actually_ Zed's own thoughts, straight from his mind, with no editorial filter whatsoever in-between. +Be warned: the text included within the *Zed Sez* sidebars is highly opinionated, that's precisely what Zed _feels_ to say about something, and he'll just say it: just the plain, simple thoughts of an experienced programmer. As the author explains in *Section 1*: _"[...] You may not agree with everything he says, but you probably should."_ + +*Section 2* is a general introduction about Mongrel. It explains _what_ it is, _when_ and _why_ it was made, and _how_ it works. There's nothing new to learn if you already used Mongrel before, probably, but it's definitely the first thing to show to someone who's new to Mongrel and its world, and possibly a bit skeptical about it. +The last subsection _"What can Mongrel do for me"_ is an attempt to -brainwash- persuade you to fully embrace Mongrel and its philosophy, whether you are a developer, a sysadmin or even a manager: assertions like _"Mongrel is pretty damned secure."_ and _"Mongrel's license is capitalist-friendly."_ will definitaly make some of you (managers) happy. + +*Section 3* is slightly more juicy than the previous one, as it explains how to install and use Mongrel. Basically that's what everyone who ever used it already knows, but it's still necessary for the book's consistency, after all. After reading this section, you'll probably have your first Mongrel up and running and serving your little Rails application's pages, and you'll begin to wonder why the hell you need to keep reading this book now that everything seems to work already... + + +h3. Section 4: Configurations + +...aka "a truly useful Mongrel cheatsheet". This section dives deep(er) into Mongrel's configuration by explaining what each start parameter does in detail. The parameters are presented in tabular form in a very well-organized way. As you would expect from an high-quality cheatsheet. + +Then the author will explore a few commonly used deployment scenarios, in particular: + +* *Standalone* &ndash; The simplest configuration possible, with just one Mongrel instance serving both static and dynamic pages. +* *mongrel&#95;cluster* &ndash; How to use _"a pack of mongrels"_ together to handle more traffic. +* *Behind a static web server* &ndash; The most common (and most scalable) option, used to serve static content faster using a front-end server and use Mongrel only to handle Ruby pages. + +Towards the end of the section, for the developer's delight, the author will discuss two common, useful scenarios where Mongrel can be used: + +* *Apache 2 + mod_proxy_balancer + mongrel&#95;cluster* +* *Nginx + mongrel&#95;cluster* + +The difference here is that detailed instructions are provided on how to setup and configure each server, including example file sources. This can be particularly useful for the Nginx example, as most of the documentation for this fantastic, lightweight Mongrel fron-end is scattered around the web (or written in Russian in a "well known place":http://sysoev.ru/nginx/). + + +h3. Section 5: Production Deployment + +This section introduces one of the most important part of the life cycle of a Rails application: the deployment on a production server. The author is pretty honest about the whole subject: + +<blockquote> +<em>"You will not do this in a day. If you are expecting to code until 1 minute before your deadline and then simply point and click and have an instant server then you need to take some kind of +medication because you are violently hallucinating. You will need at least a week of 8 hours days to make sure your first deployment works and to have the time to do it right."</em> +</blockquote> + +Sounds terribly true. Especially for larger projects demanding good performance under heavy traffic. Scared? Probably, if you never deployed a Rails application "properly" before, but at least the book comes to the rescue by providing an overview of what you need to perform a deployment and why it is such a complex and delicate process. + +Not only this, but also a "Best Practices Rubric" is also provided for the developer's own private enjoyement. It's written as a list of questions like: + +_11. Do you have a shared location where you can document the deployment, such as a Wiki or CMS?_ +_12. Do you know how to use httperf or ab and know what the statistics mean?_ + +After these 13 questions, the author provides the key to give a meaning to your answers: + +<blockquote> +<em>"For each question you answer with "NO", add 10 hours to your time estimate for completion. This may seem unrealistic, since saying "NO" to everything means it'll take 190 hours (about one +month), but this estimate is actually low according to most first deployment experiences."</em> +</blockquote> + +If you answered "NO" too many times to these questions, you may want to read on through the next subsection which states 17 "worst practices": an invaluable read for beginners! + +But after all this section is not only about stating the obvious (...right?): a full example scenario is describedand examined throughly to give you an idea of how a deployment _should_ be made, using three different machines: + +* One for Apache (as a front-end to Mongrel) +* One for the Mongrel cluster and the Rails application +* One for the database + +Maybe something you'll never do if you just want to run your grandma's site on Rails, but certainly something you may want to start looking at if your grandma becomes really popular and your small server gets grounded by several thousands of visitors per day. + +The last part of the section will give you a brief introduction on monitoring your applications and on which tools you should be using, although it does not discuss the subject in detail at all, it's just meant to point you to the right direction. + + +h3. Section 6: Extending Mongrel + +This section digs deeper into the software code internals and describes _how to teach new tricks to your Mongrel_, i.e. how to extend its functionality. + +Before you begin, though, don't forget what Zed himself has to say about Mongrel's simplicity: + +<blockquote> +_"I've always had a different aesthetic sense when I write my software. I value simplicity and directness and try to write software that follows this approach. I jokingly call it the Shibumi School of Software Structure. All I do is apply this rule: When given two possible designs with equal end results, pick the simpler one. I then ruthlessly strip the solution down to its finest elements, but no more."_ +</blockquote> + +Mongrel's architecture is not that complex, and this section is sufficient to get you started by providing an overview of the main classes involved (HttpServer, HttpRequest, HttpResponse, HttpHandler, URIClassifier), and how they work together. +Note that the book won't describe anything about the APIs of these classes. but after all, the project's "RDoc documentation":http://mongrel.rubyforge.org/rdoc/files/README.html should cover all the details you need. + +The rest of the section focuses on how to extend Mongrel, by: + +* Writing custom handlers in Ruby +* Creating custom filters to perform security checks, clean up requests and preliminary file processing +* Creating plugins and distributing them as rubygems + +Two working examples are also provided: + +* An example handler to deflate content (if the browser supports deflate) +* An example "duck" plugin, to make Mongrel quack like a duck when it's started (not the most useful thing in the world, but serves the purpose) + + +h3. Debugging, Performance & Security + +The last three sections deals with other important aspects concerning the deployment of your application, how to debug, how to improve performance and how to secure your application. + +*Section 7* introduces two debugging modes: + +* Dash-Bee logging (-B) +* USR1 logging (lighter) + +And also gives you an idea on what to look for when debugging an application. Nothing too detailed, granted, but enough to make sure you are pointed in the right direction. + +Again, Zed's wisdom and wit are remarkable: + +<blockquote> +<em>"These people's problem is they suffer from Potpourri Turd Syndrome—a belief that their you-know-what don't stink and smells like fine dew on freshly cut grass. Whenever there's a bug, they go +running like kids in a candy store to other people's code trying to find fault and just assume that it's nothing they wrote. +[...] +When you run into a problem with your application, always assume it's your fault first. Mongrel's not perfect, but its code is minuscule compared to the size of Rails and most likely even your own appli-cation code. Mongrel also powers many large and medium deployments without any problems. If there's an error, the evidence already says it's in your code, so bite the bullet and start investigating it as if it's your problem."</em> +</blockquote> + +Similarly, *Section 8* is a short but useful overview on performance tips and tricks and deployment tuning. The most useful thing is probably the checklist of the "tuning process", which illustrates the simple steps to take to tune your application. + +Finally, *Section 9* addresses some common security concerns and clarifies how Mongrel deals with them. The answer is normally "Mongrel strictly does this" or "Mongrel doesn't support this feature". After all, you should have understood by now that Mongrel is an example of simplicity and that it deliberately does not aim to offer all the feature you'd expect by a server like Apache: + +<blockquote> +<em>"As you probably see, Mongrel say, "No" in many places where most Web servers say, "Yes, OK." Sometimes this is because no one using Mongrel has needed it yet, sometimes it's because there's a +better, simpler way to accomplish the same goal. Mongrel is a different kind of Web server, and frequently you can solve your problem with a different solution."</em> +</blockquote> + + +h3. Conclusion + +If Mongrel is opinionated software, this is definitely an opinionated book which fully embraces the project's philosopy of simplicity above everything else. It's an interesting read and it won't bore you to death by deliberately skipping long and potentially tedious subjects and adding interesting insights instead (like the Zed Sez sidebars). Perhaps it is a bit too direct towards certain people, who may get even get offended (as planned) by some of the author's assertions. + +Despite being a 100-pages book, this _shortcut_ covers pretty much everything you need to know *about Mongrel*. It will _not_ teach you everything about deployment, security, performance tweaks and debugging though: as the authors often state throughout the book, a lot of (big) books are available on those subject, and it wouldn't make sense to even attempt to discuss them in this shortcut. + +Similarly, you won't find complex examples either, but that's acceptable because simple examples are often the only thing you need to grasp the basics of a concept or feature, and then use them as a "scaffold" for your own code. + +Globally, the book is well balanced and _optimized_ for its size: lightweight introductory sections at first, then the "real juice" in the middle, and a few overview sections on advanced topics towards the end. You can read it easily in a few hours, perhaps less, and whenever you need to look something up in a hurry it will be fairly easy to locate. + +A good read, and a _must_ for everyone who wants to learn more about Mongrel or Rails deployment.
M content/articles/next-generation-dvds.bbcodecontent/articles/next-generation-dvds.bbcode

@@ -8,136 +8,134 @@

date: 2005-12-10 12:53:46 +01:00 tags: - review -- blueray -- hd-dvd type: article toc: true ----- -Get a full comparative and analytical view of the HD-DVD and Blu-Ray disc formats. Why do we need them? Are they the perfect answer? Which one of them (if any...) will eventually take the throne? The answers to all these questions (and more) are inside! -[b]The endless quest for space[/b] -I remember when I showed a 3.5" floppy disk to my dad and he said, "That's so small, and it can store 1.44MB of information! That's over a million bytes!" He was used to working with big tapes of data that probably held much less, so I guess a floppy disk a big shock for him, at the time. - -When I got my first computer, it had a CD-ROM drive, and the CDs were supposed to hold 500MB of data. They eventually started supporting more, and got up to 900 in the end. Finally, we got DVDs, which are able to store up to 4.7GB of data, and once people noticed they could write another layer of data, the capacity doubled. - -Over the years, storage devices have evolve, and it seems now more than ever that mankind is on an endless "quest for space" - not with NASA (which nowadays is being much more careful before sending out a shuttle), trying to go where no one has gone before, but with a bunch of leading OEM companies, IT industries and Hollywood studios trying to write unbelievable amounts of information on a 12cm disk made out of plastic and other lesser known materials. - -Furthermore, despite me persuading my family to buy a "new" DVD player, the industry now claims that this relatively new commercial technology is going to be dead: apparently we'll soon have disks capable of holding 15-25 GB of data [i]per layer[/i], which will come to the aid of High Definition TeleVision ([url=http://en.wikipedia.org/wiki/HDTV]HDTV[/url]) which will deliver images at 1920x1080 pixels (versus 640x480 pixels on a normal DVD). This means that you'll be able to see - with your brand new HDTV-capable home theater - the imperfections of Jessica Alba's skin when she's dancing in [i][url=http://www.imdb.com/title/tt0401792/]Sin City[/url][/i] if you look close enough, which brings up another question: "who wants this kind of technology?" - if nothing else, you'll have to pay a lot for it! - -As I previously stated, the evolution in storage media is unstoppable and yet necessary at the same time: having more storage space available proved to be a key factor for computer development. - - -[b]A New War has Begun[/b] -As the history of the computer industry has shown us, when the possibility of innovation arises, there's never just one group who tries it out. In the past, this led to the determination of two or more [i]de facto[/i] standards by competitors promoting similar solutions. Perhaps the most familiar cases in the recent past were the introduction of the VHS and DVD formats. The first standard - for VHS - was adopted after a "war" against Sony's Betamax format - which was supposedly technologically superior - and the determining factor (or one of the main ones, anyway) was that Sony, "jealous" of its proprietary format, didn't want to license support for it to all the Original Equipment Manufactors (OEMs), while JVC and Matsushita [Panasonic]'s VHS licenses were basically given to anyone who even remotely suggested adopting the format. - -Sony was involved in another "war", for the successor of the CD format: they pushed for their Multimedia CD (MMCD), while Toshiba had their Super Density CD (SD). Perhaps because Sony was wary of another defeat, history didn't repeat itself this time, and the two manufacturers agreed to develop a hybrid format which is now widely known as the Digital Versatile (previously "Video") Disk, or more commonly, the DVD. - -However, once again, Sony is proposing its own format for next generation DVDs, called [url=http://en.wikipedia.org/wiki/Blu-ray_Disc]Blu-Ray Disc[/url] (BD) and once again, it's opposed by Toshiba (and others) with the High Density Digital Versatile Disk (HD-DVD). Both formats aim to increase space by using a blue laser for writing instead of the traditional red one used for DVDs. Other than that, the two formats are (for now) quite incompatible with each other as they use two different approaches to this same technology. Most of the following technical information is taken from an [url=http://www.cdfreaks.com/article/186/]article[/url] that appeared on CDfreaks.com. - - -[b]The Contenders: HD-DVD[/b] -Let's now examine the first of the two contenders to the "throne": High Density Digital Versatile Disk ([url=http://www.hddvd.org/hddvd/]HD-DVD[/url]). This format was the one that appeared first and is mainly promoted by Toshiba, along with NEC and Sanyo. The capacity is around 15GB per layer and it could be defined - for its structure mainly - as an application of newer laser technology to the older DVD format. - -[i][u]Disk structure[/u][/i] -As the diameter of the disk is the same and the information is coded roughly in the same way, the areas of improvement obviously reside in optimizing the physical space of the disk to hold more information. As with CDs and DVDs, data on a disk is written in tracks following a spiral path, from the center to the border of the support: in a CD, the gap between the two rows of the track (the [i]Track Pitch[/i]) was 780nm; then it was reduced for DVDs (650nm), and again for HD-DVDs (400nm), so that we can store more information in the same space (because there are more rows). In order to achieve this, the laser must be more sensitive to be able to detect tracks correctly (that's why the laser is now blue; blue has a smaller wavelength), and the lens that gathers and concentrates the light needs to be changed. The measure that defines the shape (convexity) of the lens is called [i]Numerical Amplitude[/i]: for CDs, it is 0.45, 0.6 for DVDs and 0.65 for HD-DVDs. These "tweaks" made more space available on the disk, and HD-DVDs, as previously stated, can store up to 15GB single layer and 30GB in double layer. - -Another characteristic that makes HD-DVDs similar to DVDs is the amount of the disk which is used for actual data storage and the amount which is used as "protective coating": HD-DVDs are 1.2mm thick, with 0.6mm used to store information and 0.6mm for protection. - - -[i][u]Information processing and error correction[/u][/i] -Data sent through a channel is subjected to "noise" of various kinds, and a similar phenomena occurs when writing information on a support, so various ways of preserving the data and correcting possible errors were developed. HD-DVD, in particular, uses a particular type of modulation called ETM (Eight to Twelve Modulation), which is once again similar to the technique used in CDs and DVDs: each byte of data is converted into twelve bits, and all bits set to 1 must satisfy an RLL(1,10) code (all '1' bits must be separated by at least 1 and at most 10 zeros). -Furthermore, disks must be able to bear scratches and other damage which could potentially corrupt bytes. Personally, I found that CDs are much more scratch-proof than DVDs, partly due to the fact that when you scratch a DVD (don't do it, just trust me!) more bytes get corrupted because of a higher data concentration: imagine what will happen now with 3-5x more data in the same space! -HD-DVD has the same correction techniques and data containers as the DVD format, the only exception being that the [url=http://en.wikipedia.org/wiki/Error-correcting_code]ECC[/url] blocks on HD-DVDs are twice as large, resulting in a longer correctable burst error length (7.1mm, where DVD is about 6mm). - - -[i][u]Writing formats and copy protection[/u][/i] -Even though HD-DVD has so far been quite similar to DVD (except for the obvious differences in laser, lens, and track pitch caused by the technology), there's an exception concerning the Rewritable format: it can hold more data than the ROM format (20GB instead of 15). This has been achieved by employing some technologies used in DVD-RAM. Despite the improvement, it might represent a problem for OEMs, because it makes HD-DVD RW handling totally different from the read-only format. - -For protection against piracy and illegal copying in general, HD-DVD format abandons the Content Scrambling System (CSS) used in DVDs (which has been shown to be unsuccessful) in favour of AACS (Advanced Access Content System), which uses a completely different key scheme. - -AACS has been introduced for both HD-DVD and Blu Ray formats, and it involves the so-called "device keys": a unique key is assigned to each player's model, and before playing a protected disk, the player will have to retrieve its key (encoded in a three-way tree on the disk). Obviously, if a particular key is cracked, the manufacturers will be informed and will update the key in newer disks (which won't play in the cracked player at all). The technology is quite controversial at the moment, because "protection" is achieved at a high price: if someone cracks the key of your player, it simply won't play newer HD-DVDs, even if you weren't actually involved in any illegal activity. Solutions are currently being debated. - - - -[b]The Contenders: Blu-Ray Disks[/b] - -Where Toshiba's HD-DVD adopted a somewhat conservative strategy, basing itself more or less on the DVD standard, Sony decided to use a much more experimental approach for its [url=http://www.bluraydisc.com/]Blu-Ray[/url] (BD) format, which appears to be more technologically advanced and offer even more space. -Blu-Ray disks can hold up to 25GB of data per layer, and this represents a great leap over HD-DVD's 15GB, but this has been achieved at the price of compatibility. - - -[i][u]Disk structure[/u][/i] -In order to reach the capacity it does BD uses the same type of blue/violet laser of HD-DVD but - as a necessity - the [i]Numeric Amplitude[/i] of the lens has been increased to 0.85 (vs. 0.65 on HD-DVD), and the [i]Track Pitch[/i] has been decreased to 320nm, so the additional space is explained by noting that the distance between the spiral rows is even smaller! - -Furthermore, BD can vary the length of the "pits" where data is written; by reducing it, more space on the disk can be obtained. Currently BD has 3 sub-formats, corresponding to 3 different capacities (23.3, 25 and 27GB), and associated to three different pit lengths (160, 149, and 138nm respectively) while HD-DVD has a fixed pit length of 204nm. - -Another innovation was introduced regarding the amount of disk used for data and for protection: disks are still 1.2mm thick, but 1.1mm are used for data storage and only 0.1mm for the protective coating! - -This was necessary in order to achieve the improved values for NA and Track Pitch, because the laser goes through only 0.1mm of protection before reading the data, meaning it can be more sensitive, but this also means that BDs are MUCH more vulnerable to scratches than HD-DVDs. Luckily, TDK immediately announced a new hyper-resistant protective coating which can offer improved protection from scratches and still be 0.1mm thick. - - -[i][u]Information processing and error correction[/u][/i] -BD decided to adopt its own modulation system (instead of using ETM like HD-DVD), called "17PP". The acronym basically means that each "1" must be separated by 1-7 "0" bits [RLL(1,7)] and also that the modulated sequence must have the same parity as the original data plus additional rules. -Error correction is then achieved using two codes similar to the [url=http://en.wikipedia.org/wiki/Reed-Solomon_code]Reed-Solomon[/url] code: LDC (Long Distance Code) and BIS (Burst Indication Subcode). Without going into too much detail, these two proprietary techniques can achieve almost the same result as HD-DVD's ECC, being able to correct corrupted data up to more than 7mm, which is quite remarkable considering the particularly delicate disk structure. - - -Blu-Ray also introduces two new modulation methods: the first one is called ?MSK-cos? (Minimum Shift Keying ? cosine variant), which is a special frequency modulation, and the second one is called ?HMW? (Harmonic Modulated Wave), which consists of replacing parts of the sine wave with sawtooths. - -[i][u]Copy protection[/u][/i] - -BD originally proposed its own control system, BD-CPS, for copy protection, but recently seems to have opted for AACS. This means that the same situation arises for both formats: they are both planning on implementing an advanced exchange key-based system to fight piracy. - -As another anti-piracy method, both formats also introduce a sort of "signature" called a [i]Volume Identifier[/i] which will be very difficult to duplicate on a cloned disk. - - -[b]The World Takes Sides[/b] - -After discussing the two formats sufficiently in depth, it's now possible to itemize the pros and cons of each format: - -[i][u]HD-DVD[/u][/i] -Pros: -[list] -[*]Backward compatibility with CD/DVD will be available soon -[*]Reduced production costs, both for disks and players - cheaper to buy -[*]Improved durability -[*]Available relatively soon on the market -[/list] -Cons: -[list] -[*]Incompatible with the competitor's format -[*]Less space than competitor's format -[/list] - -[i][u]Blu-Ray[/u][/i] -Pros: -[list] -[*]Backward compatibility with CD/DVD will be available soon -[*]More space than competitor's format -[*]Technologically more advanced, longer life-span -[*]Higher recording speed -[/list] -Cons: -[list] -[*]Incompatible with the competitor's format -[*]More expensive to produce and to buy -[*]More vulnerable to scratches (the TDK solution notwithstanding) -[*]Still relatively experimental -[/list] - -At this point, HD-DVD seems to be the "natural" successor to the DVD format: it inherits already-tested technologies and offers acceptable improvements regarding capacity. On the other hand, Blu-Ray is an innovative alternative, which, while more technologically advanced, needs to be tested more fully and is more expensive because of its innovation. Manufacturers will have to have separate machinery to produce Blu-Ray disks, while it appears that only some tweaks in existing structures will be necessary to support HD-DVD production on a mass scale at contained prices. - -Obviously, all the industries with interests in these new magnetic supports took sides with one or the other format: - -[i]HD-DVD:[/i]Toshiba, Sanyo, NEC, Paramount Pictures, Universal Pictures, New Line Cinema, Warner Bros Studios, Time Warner, and, apparently, [i][b]Microsoft[/b][/i]. - -[i]Blu-Ray:[/i] DELL, HP, Hitachi, LG-Electronics, Mitsubishi Electric, Panasonic, Pioneer, Philips, Samsung, Sharp, Sony, TDK, Thomson, 20th Century Fox, Walt Disney, Texas Instruments, Sun Microsystems, Electronic Arts, and Vivendi Universal Games. - -HD-DVD is supported mainly by film studios (Paramount and Universal) and multimedia companies (Time Warner). This is expected, since these industries advocate a product which is cheap, tested, and reliable. On the other hand, Blu-Ray is supported by IT industries that see a new technology for improved capacity and high recording speed. However, Walt Disney and 20th Century Fox seem to support this format, and they represent a sizable share of the family entertainment movie business. - -Microsoft recently seemed to [url=http://news.softpedia.com/news/Microsoft-Sides-With-Toshiba-Against-Sony-s-Blu-ray-3798.shtml]support HD-DVD[/url] technology. This was predictable, at least to a certain extent: Microsoft and Toshiba have always had a strong and productive working relationship, and Microsoft is probably trying to oppose Sony, who will probably use Blu-Ray for its upcoming PlayStation 3. Microsoft will probably opt for HD-DVD for the XBox, but it's too soon to say, especially since the big names of video games (like EA) seem to support Blu-Ray. - - - -[b]The End of the War[/b] -So a new [i]Standards War[/i] has begun, and it's still too soon to know how it will end. Recently, the possibility of a hybrid standard has seemed more plausible, even if Toshiba's format arrives on the market much sooner than Blu-Ray. Toshiba itself advocates a [url=http://www.pcpro.co.uk/news/73241/hddvd-bluray-marriage-back-on.html]single standard[/url], but seems also keen on [i]seeing how it goes[/i] first, when both the two products are on the market. - -Actually there's [url=http://news.softpedia.com/news/The-chronicles-of-a-futile-battle-Blu-Ray-vs-HD-DVD-631.shtml]someone[/url] who predicts a different ending for this war: no one format will win, especially if the "conflict" lasts for too long. There's a chance that [url=http://www.techtree.com/techtree/jsp/article.jsp?article_id=57500]Holographic Versatile Disks[/url] (HVD) will eventually destroy both contenders by offering, on the same disk, 1TB of space at 1Gbps transfer speed! -As a matter of fact, Japan's [url=http://www.optware.co.jp/english/what_040823.htm]Optware Corp.[/url] might be the revelation that [i]saves the world[/i]... +Get a full comparative and analytical view of the HD-DVD and Blu-Ray disc formats. Why do we need them? Are they the perfect answer? Which one of them (if any...) will eventually take the throne? The answers to all these questions (and more) are inside! +[b]The endless quest for space[/b] +I remember when I showed a 3.5" floppy disk to my dad and he said, "That's so small, and it can store 1.44MB of information! That's over a million bytes!" He was used to working with big tapes of data that probably held much less, so I guess a floppy disk a big shock for him, at the time. + +When I got my first computer, it had a CD-ROM drive, and the CDs were supposed to hold 500MB of data. They eventually started supporting more, and got up to 900 in the end. Finally, we got DVDs, which are able to store up to 4.7GB of data, and once people noticed they could write another layer of data, the capacity doubled. + +Over the years, storage devices have evolve, and it seems now more than ever that mankind is on an endless "quest for space" - not with NASA (which nowadays is being much more careful before sending out a shuttle), trying to go where no one has gone before, but with a bunch of leading OEM companies, IT industries and Hollywood studios trying to write unbelievable amounts of information on a 12cm disk made out of plastic and other lesser known materials. + +Furthermore, despite me persuading my family to buy a "new" DVD player, the industry now claims that this relatively new commercial technology is going to be dead: apparently we'll soon have disks capable of holding 15-25 GB of data [i]per layer[/i], which will come to the aid of High Definition TeleVision ([url=http://en.wikipedia.org/wiki/HDTV]HDTV[/url]) which will deliver images at 1920x1080 pixels (versus 640x480 pixels on a normal DVD). This means that you'll be able to see - with your brand new HDTV-capable home theater - the imperfections of Jessica Alba's skin when she's dancing in [i][url=http://www.imdb.com/title/tt0401792/]Sin City[/url][/i] if you look close enough, which brings up another question: "who wants this kind of technology?" - if nothing else, you'll have to pay a lot for it! + +As I previously stated, the evolution in storage media is unstoppable and yet necessary at the same time: having more storage space available proved to be a key factor for computer development. + + +[b]A New War has Begun[/b] +As the history of the computer industry has shown us, when the possibility of innovation arises, there's never just one group who tries it out. In the past, this led to the determination of two or more [i]de facto[/i] standards by competitors promoting similar solutions. Perhaps the most familiar cases in the recent past were the introduction of the VHS and DVD formats. The first standard - for VHS - was adopted after a "war" against Sony's Betamax format - which was supposedly technologically superior - and the determining factor (or one of the main ones, anyway) was that Sony, "jealous" of its proprietary format, didn't want to license support for it to all the Original Equipment Manufactors (OEMs), while JVC and Matsushita [Panasonic]'s VHS licenses were basically given to anyone who even remotely suggested adopting the format. + +Sony was involved in another "war", for the successor of the CD format: they pushed for their Multimedia CD (MMCD), while Toshiba had their Super Density CD (SD). Perhaps because Sony was wary of another defeat, history didn't repeat itself this time, and the two manufacturers agreed to develop a hybrid format which is now widely known as the Digital Versatile (previously "Video") Disk, or more commonly, the DVD. + +However, once again, Sony is proposing its own format for next generation DVDs, called [url=http://en.wikipedia.org/wiki/Blu-ray_Disc]Blu-Ray Disc[/url] (BD) and once again, it's opposed by Toshiba (and others) with the High Density Digital Versatile Disk (HD-DVD). Both formats aim to increase space by using a blue laser for writing instead of the traditional red one used for DVDs. Other than that, the two formats are (for now) quite incompatible with each other as they use two different approaches to this same technology. Most of the following technical information is taken from an [url=http://www.cdfreaks.com/article/186/]article[/url] that appeared on CDfreaks.com. + + +[b]The Contenders: HD-DVD[/b] +Let's now examine the first of the two contenders to the "throne": High Density Digital Versatile Disk ([url=http://www.hddvd.org/hddvd/]HD-DVD[/url]). This format was the one that appeared first and is mainly promoted by Toshiba, along with NEC and Sanyo. The capacity is around 15GB per layer and it could be defined - for its structure mainly - as an application of newer laser technology to the older DVD format. + +[i][u]Disk structure[/u][/i] +As the diameter of the disk is the same and the information is coded roughly in the same way, the areas of improvement obviously reside in optimizing the physical space of the disk to hold more information. As with CDs and DVDs, data on a disk is written in tracks following a spiral path, from the center to the border of the support: in a CD, the gap between the two rows of the track (the [i]Track Pitch[/i]) was 780nm; then it was reduced for DVDs (650nm), and again for HD-DVDs (400nm), so that we can store more information in the same space (because there are more rows). In order to achieve this, the laser must be more sensitive to be able to detect tracks correctly (that's why the laser is now blue; blue has a smaller wavelength), and the lens that gathers and concentrates the light needs to be changed. The measure that defines the shape (convexity) of the lens is called [i]Numerical Amplitude[/i]: for CDs, it is 0.45, 0.6 for DVDs and 0.65 for HD-DVDs. These "tweaks" made more space available on the disk, and HD-DVDs, as previously stated, can store up to 15GB single layer and 30GB in double layer. + +Another characteristic that makes HD-DVDs similar to DVDs is the amount of the disk which is used for actual data storage and the amount which is used as "protective coating": HD-DVDs are 1.2mm thick, with 0.6mm used to store information and 0.6mm for protection. + + +[i][u]Information processing and error correction[/u][/i] +Data sent through a channel is subjected to "noise" of various kinds, and a similar phenomena occurs when writing information on a support, so various ways of preserving the data and correcting possible errors were developed. HD-DVD, in particular, uses a particular type of modulation called ETM (Eight to Twelve Modulation), which is once again similar to the technique used in CDs and DVDs: each byte of data is converted into twelve bits, and all bits set to 1 must satisfy an RLL(1,10) code (all '1' bits must be separated by at least 1 and at most 10 zeros). +Furthermore, disks must be able to bear scratches and other damage which could potentially corrupt bytes. Personally, I found that CDs are much more scratch-proof than DVDs, partly due to the fact that when you scratch a DVD (don't do it, just trust me!) more bytes get corrupted because of a higher data concentration: imagine what will happen now with 3-5x more data in the same space! +HD-DVD has the same correction techniques and data containers as the DVD format, the only exception being that the [url=http://en.wikipedia.org/wiki/Error-correcting_code]ECC[/url] blocks on HD-DVDs are twice as large, resulting in a longer correctable burst error length (7.1mm, where DVD is about 6mm). + + +[i][u]Writing formats and copy protection[/u][/i] +Even though HD-DVD has so far been quite similar to DVD (except for the obvious differences in laser, lens, and track pitch caused by the technology), there's an exception concerning the Rewritable format: it can hold more data than the ROM format (20GB instead of 15). This has been achieved by employing some technologies used in DVD-RAM. Despite the improvement, it might represent a problem for OEMs, because it makes HD-DVD RW handling totally different from the read-only format. + +For protection against piracy and illegal copying in general, HD-DVD format abandons the Content Scrambling System (CSS) used in DVDs (which has been shown to be unsuccessful) in favour of AACS (Advanced Access Content System), which uses a completely different key scheme. + +AACS has been introduced for both HD-DVD and Blu Ray formats, and it involves the so-called "device keys": a unique key is assigned to each player's model, and before playing a protected disk, the player will have to retrieve its key (encoded in a three-way tree on the disk). Obviously, if a particular key is cracked, the manufacturers will be informed and will update the key in newer disks (which won't play in the cracked player at all). The technology is quite controversial at the moment, because "protection" is achieved at a high price: if someone cracks the key of your player, it simply won't play newer HD-DVDs, even if you weren't actually involved in any illegal activity. Solutions are currently being debated. + + + +[b]The Contenders: Blu-Ray Disks[/b] + +Where Toshiba's HD-DVD adopted a somewhat conservative strategy, basing itself more or less on the DVD standard, Sony decided to use a much more experimental approach for its [url=http://www.bluraydisc.com/]Blu-Ray[/url] (BD) format, which appears to be more technologically advanced and offer even more space. +Blu-Ray disks can hold up to 25GB of data per layer, and this represents a great leap over HD-DVD's 15GB, but this has been achieved at the price of compatibility. + + +[i][u]Disk structure[/u][/i] +In order to reach the capacity it does BD uses the same type of blue/violet laser of HD-DVD but - as a necessity - the [i]Numeric Amplitude[/i] of the lens has been increased to 0.85 (vs. 0.65 on HD-DVD), and the [i]Track Pitch[/i] has been decreased to 320nm, so the additional space is explained by noting that the distance between the spiral rows is even smaller! + +Furthermore, BD can vary the length of the "pits" where data is written; by reducing it, more space on the disk can be obtained. Currently BD has 3 sub-formats, corresponding to 3 different capacities (23.3, 25 and 27GB), and associated to three different pit lengths (160, 149, and 138nm respectively) while HD-DVD has a fixed pit length of 204nm. + +Another innovation was introduced regarding the amount of disk used for data and for protection: disks are still 1.2mm thick, but 1.1mm are used for data storage and only 0.1mm for the protective coating! + +This was necessary in order to achieve the improved values for NA and Track Pitch, because the laser goes through only 0.1mm of protection before reading the data, meaning it can be more sensitive, but this also means that BDs are MUCH more vulnerable to scratches than HD-DVDs. Luckily, TDK immediately announced a new hyper-resistant protective coating which can offer improved protection from scratches and still be 0.1mm thick. + + +[i][u]Information processing and error correction[/u][/i] +BD decided to adopt its own modulation system (instead of using ETM like HD-DVD), called "17PP". The acronym basically means that each "1" must be separated by 1-7 "0" bits [RLL(1,7)] and also that the modulated sequence must have the same parity as the original data plus additional rules. +Error correction is then achieved using two codes similar to the [url=http://en.wikipedia.org/wiki/Reed-Solomon_code]Reed-Solomon[/url] code: LDC (Long Distance Code) and BIS (Burst Indication Subcode). Without going into too much detail, these two proprietary techniques can achieve almost the same result as HD-DVD's ECC, being able to correct corrupted data up to more than 7mm, which is quite remarkable considering the particularly delicate disk structure. + + +Blu-Ray also introduces two new modulation methods: the first one is called ?MSK-cos? (Minimum Shift Keying ? cosine variant), which is a special frequency modulation, and the second one is called ?HMW? (Harmonic Modulated Wave), which consists of replacing parts of the sine wave with sawtooths. + +[i][u]Copy protection[/u][/i] + +BD originally proposed its own control system, BD-CPS, for copy protection, but recently seems to have opted for AACS. This means that the same situation arises for both formats: they are both planning on implementing an advanced exchange key-based system to fight piracy. + +As another anti-piracy method, both formats also introduce a sort of "signature" called a [i]Volume Identifier[/i] which will be very difficult to duplicate on a cloned disk. + + +[b]The World Takes Sides[/b] + +After discussing the two formats sufficiently in depth, it's now possible to itemize the pros and cons of each format: + +[i][u]HD-DVD[/u][/i] +Pros: +[list] +[*]Backward compatibility with CD/DVD will be available soon +[*]Reduced production costs, both for disks and players - cheaper to buy +[*]Improved durability +[*]Available relatively soon on the market +[/list] +Cons: +[list] +[*]Incompatible with the competitor's format +[*]Less space than competitor's format +[/list] + +[i][u]Blu-Ray[/u][/i] +Pros: +[list] +[*]Backward compatibility with CD/DVD will be available soon +[*]More space than competitor's format +[*]Technologically more advanced, longer life-span +[*]Higher recording speed +[/list] +Cons: +[list] +[*]Incompatible with the competitor's format +[*]More expensive to produce and to buy +[*]More vulnerable to scratches (the TDK solution notwithstanding) +[*]Still relatively experimental +[/list] + +At this point, HD-DVD seems to be the "natural" successor to the DVD format: it inherits already-tested technologies and offers acceptable improvements regarding capacity. On the other hand, Blu-Ray is an innovative alternative, which, while more technologically advanced, needs to be tested more fully and is more expensive because of its innovation. Manufacturers will have to have separate machinery to produce Blu-Ray disks, while it appears that only some tweaks in existing structures will be necessary to support HD-DVD production on a mass scale at contained prices. + +Obviously, all the industries with interests in these new magnetic supports took sides with one or the other format: + +[i]HD-DVD:[/i]Toshiba, Sanyo, NEC, Paramount Pictures, Universal Pictures, New Line Cinema, Warner Bros Studios, Time Warner, and, apparently, [i][b]Microsoft[/b][/i]. + +[i]Blu-Ray:[/i] DELL, HP, Hitachi, LG-Electronics, Mitsubishi Electric, Panasonic, Pioneer, Philips, Samsung, Sharp, Sony, TDK, Thomson, 20th Century Fox, Walt Disney, Texas Instruments, Sun Microsystems, Electronic Arts, and Vivendi Universal Games. + +HD-DVD is supported mainly by film studios (Paramount and Universal) and multimedia companies (Time Warner). This is expected, since these industries advocate a product which is cheap, tested, and reliable. On the other hand, Blu-Ray is supported by IT industries that see a new technology for improved capacity and high recording speed. However, Walt Disney and 20th Century Fox seem to support this format, and they represent a sizable share of the family entertainment movie business. + +Microsoft recently seemed to [url=http://news.softpedia.com/news/Microsoft-Sides-With-Toshiba-Against-Sony-s-Blu-ray-3798.shtml]support HD-DVD[/url] technology. This was predictable, at least to a certain extent: Microsoft and Toshiba have always had a strong and productive working relationship, and Microsoft is probably trying to oppose Sony, who will probably use Blu-Ray for its upcoming PlayStation 3. Microsoft will probably opt for HD-DVD for the XBox, but it's too soon to say, especially since the big names of video games (like EA) seem to support Blu-Ray. + + + +[b]The End of the War[/b] +So a new [i]Standards War[/i] has begun, and it's still too soon to know how it will end. Recently, the possibility of a hybrid standard has seemed more plausible, even if Toshiba's format arrives on the market much sooner than Blu-Ray. Toshiba itself advocates a [url=http://www.pcpro.co.uk/news/73241/hddvd-bluray-marriage-back-on.html]single standard[/url], but seems also keen on [i]seeing how it goes[/i] first, when both the two products are on the market. + +Actually there's [url=http://news.softpedia.com/news/The-chronicles-of-a-futile-battle-Blu-Ray-vs-HD-DVD-631.shtml]someone[/url] who predicts a different ending for this war: no one format will win, especially if the "conflict" lasts for too long. There's a chance that [url=http://www.techtree.com/techtree/jsp/article.jsp?article_id=57500]Holographic Versatile Disks[/url] (HVD) will eventually destroy both contenders by offering, on the same disk, 1TB of space at 1Gbps transfer speed! +As a matter of fact, Japan's [url=http://www.optware.co.jp/english/what_040823.htm]Optware Corp.[/url] might be the revelation that [i]saves the world[/i]...
M content/articles/project-windstone.bbcodecontent/articles/project-windstone.bbcode

@@ -8,112 +8,112 @@

date: 2005-12-10 12:59:23 +01:00 tags: - internet -- open-source +- opensource type: article toc: true ----- -I think most of the people who currently use the Internet have tried Microsoft Hotmail[1] at least once. Many of you probably don't use it anymore because you found something better, but the point is that Hotmail has been around for a long time, and so has its authentication method, MSN Passport, which is a universal login system used not only for Hotmail but also for many other non-Microsoft websites and services. -If you don't like the idea of using Microsoft-owned technology as an authentication system, we have an alternative for you... [b]Show me your Passport[/b] -[quote]"Create your sign-in credentials (e-mail and password) once, then use them everywhere on the Microsoft Passport Network. You can even set the site to remember your credentials for you!"[/quote] - -This is what the MSN Passport does, in a nutshell: it provides a [i]universal[/i] login system so that members only need to remember their email address and one password in order to be authenticated on every site that uses the Passport technology. It has been adopted quite happily by some websites and portals[3], and particularly by merchant sites, who liked the idea of making life easier for their users. So far, so good. - -Like nearly every Microsoft technology seems to at one point or another, the MSN Passport became an object of criticism and concern, as shown in a 2002 MIT document[4]. The main problem is this: among the data collected by Microsoft upon a user's registration is a significant amount of personal information (such as age, date of birth, and addresses) which is stored on the Microsoft servers. What if someone gains access to that information? Who guarantees that that information will not be used by third parties? - -Aside from the privacy issues, some people are concerned about the system's internal security and by the fact that the system is entirely dependent on Microsoft servers to work: - -[quote]"As more services and components depend on remote servers, functionality can grind to a halt if there is a failure on the centralized Passport system."[5][/quote] - -People have concerns, but what has been done? Are there any alternatives? Well, yes and no. Apparently the [i]Liberty Alliance Project[/i][6] was created to offer a valid and perhaps more democratic alternative to the Microsoft Passport: - -[quote]"The Liberty Alliance Project was formed in September 2001 to serve as the premier open standards organization for federated identity and identity-based services. The Alliance is delivering specifications and guidelines to enable a complete network identity infrastructure that will resolve many of the technology and business issues hindering the deployment of identity-based Web services."[7][/quote] - -The project's founders (160 IT organizations, including Sun Microsystems and VeriSign) aim to create a [i]distributed[/i] authentication system, as opposed to the [i]centralized[/i] MSN Passport. This will undoubtedly solve some of the problems, but the system is still under development. - -[b]Introducing Project Windstone[/b] -CyberArmy[8] is obviously like neither Microsoft or Sun Microsystems; it's a community of volunteers whose aim is sharing their knowledge and making the Internet a better place. Volunteers don't get paid, but sometimes something gets done, and some projects are released to the general public. Among these is a system for (if you haven't guessed already)a system for universal user authentication, called Project Windstone[9]. - -Project Windstone was developed by SoundWave on behalf of Special Operations and Security[10] to provide a universal authentication system that is easy to use and deploy on websites and in applications. Furthermore, the Windstone protocol is language-independent and functions via HTTP POST transactions between clients and the Windstone server, so virtually any website coded in any language or any application able to communicate with a web server can implement it. - -It seems great so far, but what can Windstone be used for? As previously said, it is a system to allow users to authenticate themselves with the same credentials on many different websites and share profiles and information between those websites at the same time. Furthermore, users can send each other private messages that can be retrieved on any website that implements Windstone, with the added benefit of all transactions taking place in a secure and private environment. - -On second thought, Windstone features seem to lead to some perplexity, especially among users who are particularly concerned about their own privacy: apparently a single centralized server is involved, and users can share their profile and send messages with each other, so what warranties does Windstone offers as far as privacy/security goes? Here's something which should reassure most of us: - -[list] -[*]The information provided by users in their public profiles is entirely up to their discretion: in other words, it's up to the user if they want to list their credit card numbers on their profile or talk about their cat, as the Windstone server itself does not require any specific personal information in order to create a profile. -[*]The username can be any valid email address submitted by the user. -[*]User profiles are available only after authentication with the Windstone server, and only if the person requesting the profile already knows the email address used by another user for Windstone services. Currently, Windstone does not implement any form of listing of existing users among the standard commands. -[*]The password chosen for user authentication is NEVER saved in any form; not within the client applications, not on the central server, and not in cookies. -[*] Data sent from client to server and vice-versa is encrypted. -[/list] - -[b]Some more technical details[/b] -I am actually planning to implement the system on one of my sites, so I started reading the short but straightforward documentation[11] available on the Windstone site to learn more about how the system works, and it seems quite simple and able to do what it does in a logical way; the Windstone "standard" contains a bunch of commands[12] which are used by the clients (agents) and the server to request information exchange such as requests for initialization, possible server replies, and so on. Commands and data are sent using the following format (excerpt from the official documentation): - -[i] -The format of this command string is as follows: - -AAAA.*BBBBBBBBBB.*CCCC::DDDDDDDDDDDDDDDDDDDD::EEEE::FFFFFFFFFF - -A. This is the command. Commands tell us what kind of request or response is being made with the command string. It also lets us know how many elements of data to expect (see F). - -B. This is the agent system identifier. Each website or IEP receives a unique alphanumeric ten (10) character identifier upon registration, which is used to identify this system within the network. - -C. This is the protocol version number. Generally, the version number will not change much, if at all, but it must be present. The protocol version goes with all command strings to let other systems and the Windstone server know what version of the protocol you are using. If certain versions are incompatible with each other, or if there is an upgrade or change to the protocol you are using, the version number will be used to determine that. - -D. This is the transaction identifier. Usually, this is not used, so the default information that should go here is six zeros ("000000"). The transaction identifier helps to link command strings into groups for processing and is most often used during the user login process. - -E. This is the sequence number. The sequence number, in conjunction with the transaction identifier, is used to put grouped command strings into their logical order. The sequence numbers have no specified numbering sequence, default start value, or length limit: the only requirement is that a sequence number must be in order from lowest to highest. When not using a transaction identifier or sequence number, the default information that should go here is a simple "X" (note that when "X" is being used in a command string by itself, it should always be capitalized). - -F. This is the data section. The data section is the heart of the command string. It is important to note that, at the minimum, all data sections need to be base-64 encoded prior to transmission - at no time should there be information in plain text format in the data section. -[/i] - -Obviously, command strings can be manipulated to access each section separately and the manipulation can be done with virtually any programming language used on the client side. - -Normally, the client will send a command to the Windstone server to start the authentication process and then retrieve some information; the server will reply accordingly to the client's command strings with its own responses wrapped in command strings. Let's suppose a Windstone Agent is being used to perform the following actions: - -- Initialize the system -- perform a login -- retrieve user profile from the Windstone server - -In this simulation I will not use the actual command strings but just the codes for the various commands. - -[i][u]Agent[/u]: 0000 :: SETUP_INITIALIZE[/i] - The Windstone agent sends a request to the server to initialize the authentication process, supplying the software identifier, the software type ("PC-Based" or "Web-Based"), the command landing URL and the URL to redirect logins to. - -[i][u]Server[/u]: 0002 :: SETUP_COMPLETE [/i]- Everything looks good to the server, which replies with the following information: Unique agent identifier, primary authentication token, secondary authentication token, activation key, security code, shared encryption key (255 random characters, non-binary), registration completion date and time (epoch). These parameters will be used by the agent afterwards and are necessary to identify the agent on the Windstone server. - -[i][u]Agent[/u]: 1102 :: USER_LOGIN_REDIRECT[/i] - The agent requests to start the authentication process and sends the email address of the user to the server along with the URL where the user's password will be entered. - - -[i][u]Server[/u]: 1105 :: USER_AUTH_SAVE[/i] - User credentials are checked by the Windstone server. Everything is fine, so the server sends this response to the agent. The response contains the authentication token which will be used to authenticate the user during the session, as well as the user's display name. - -[i][u]Agent[/u]: 1107 :: USER_INFO[/i] - The agent can now request the user's profile from the Windstone Server. - -[i][u]Server[/u]: 1108 :: USER_PROFILE[/i] - After checking the user's authentication token, the server can now send the following information to the agent: Email address, display name, user "About Me" text, last login date and time, account created date and time, online status. - -This is just a simple example of how the Windstone protocol can be used; as mentioned earlier, there are various other commands[12] which can be used to perform various actions. - -[b]Development and deployment[/b] -The Windstone protocol is fully operational and can be implemented on any website or application able to communicate with a web server. The developer made a very basic PHP-based example of an Agent system available online[13]; it may not be a masterpiece of PHP coding (as the developer himself pointed out), but it can be useful in understanding how to develop a Windstone Agent System. - -If you'd like to start developing your own Agent System or you just want to create a Windstone account, it can be done on the Windstone registration page[14]: you'll be asked to provide an email address, a display name and a profile (the last two can be modified afterwards). Then the system will prompt you for a password, and an email will be sent to the address you provided to confirm and activate your account. Once you have an account, you can login to any website or application implementing the Windstone protocol, such as the Windstone website itself[15]. - -Windstone is certainly not yet comparable to the MSN Passport technology - it's not used by a lot of important sites, and it's much simpler and offers fewer services, but it's undoubtedly an interesting approach to a free to use, secure and private system of universal user authentication. -Check it out![9] - -[b]Notes and Resources[/b] -[1] Microsoft Hotmail Service, [url]http://www.hotmail.com[/url] -[2] MSN Passport Network: [url]https://accountservices.passport.net/ppnetworkhome.srf?vv=320&lc=1033[/url] -[3] List of sites using MSN Passport, Passport@everything2: [url]http://www.everything2.com/index.pl?node=passport[/url] -[4] "Microsoft .NET Passport and Wallet: Approach with Caution!", [url]http://web.mit.edu/ist/isnews/v17/n04/170408.html[/url] -[5] "Microsoft Hailstorm and Passport", go-mono.com, [url]http://www.go-mono.com/passport.html[/url] -[6] Liberty Alliance Project, Official Page, [url]http://www.projectliberty.org/index.php[/url] -[7] Liberty Alliance Project, FAQs, [url]http://www.projectliberty.org/about/faq.php[/url] -[8] CyberArmy, Official Page, [url]http://www.cyberarmy.net/[/url] -[9] Project Windstone, Official Page, [url]http://windstone.x-mirror.com/v2/[/url] -[10] Special Operations and Security, official website, [url]http://sos.x-mirror.com/[/url] -[11] Windstone Communications Protocol, Development Whitepaper, [url]http://windstone.x-mirror.com/v2/development.php[/url] -[12] Windstone Protocol Commands, [url]http://windstone.x-mirror.com/v2/commands.php[/url] -[13] Example of PHP Agent System (ZIP file), [url]http://windstone.x-mirror.com/v2/ws-testbed.zip[/url] -[14] Windstone Registration, [url]http://windstone.x-mirror.com/v2/register.php[/url] +I think most of the people who currently use the Internet have tried Microsoft Hotmail[1] at least once. Many of you probably don't use it anymore because you found something better, but the point is that Hotmail has been around for a long time, and so has its authentication method, MSN Passport, which is a universal login system used not only for Hotmail but also for many other non-Microsoft websites and services. +If you don't like the idea of using Microsoft-owned technology as an authentication system, we have an alternative for you... [b]Show me your Passport[/b] +[quote]"Create your sign-in credentials (e-mail and password) once, then use them everywhere on the Microsoft Passport Network. You can even set the site to remember your credentials for you!"[/quote] + +This is what the MSN Passport does, in a nutshell: it provides a [i]universal[/i] login system so that members only need to remember their email address and one password in order to be authenticated on every site that uses the Passport technology. It has been adopted quite happily by some websites and portals[3], and particularly by merchant sites, who liked the idea of making life easier for their users. So far, so good. + +Like nearly every Microsoft technology seems to at one point or another, the MSN Passport became an object of criticism and concern, as shown in a 2002 MIT document[4]. The main problem is this: among the data collected by Microsoft upon a user's registration is a significant amount of personal information (such as age, date of birth, and addresses) which is stored on the Microsoft servers. What if someone gains access to that information? Who guarantees that that information will not be used by third parties? + +Aside from the privacy issues, some people are concerned about the system's internal security and by the fact that the system is entirely dependent on Microsoft servers to work: + +[quote]"As more services and components depend on remote servers, functionality can grind to a halt if there is a failure on the centralized Passport system."[5][/quote] + +People have concerns, but what has been done? Are there any alternatives? Well, yes and no. Apparently the [i]Liberty Alliance Project[/i][6] was created to offer a valid and perhaps more democratic alternative to the Microsoft Passport: + +[quote]"The Liberty Alliance Project was formed in September 2001 to serve as the premier open standards organization for federated identity and identity-based services. The Alliance is delivering specifications and guidelines to enable a complete network identity infrastructure that will resolve many of the technology and business issues hindering the deployment of identity-based Web services."[7][/quote] + +The project's founders (160 IT organizations, including Sun Microsystems and VeriSign) aim to create a [i]distributed[/i] authentication system, as opposed to the [i]centralized[/i] MSN Passport. This will undoubtedly solve some of the problems, but the system is still under development. + +[b]Introducing Project Windstone[/b] +CyberArmy[8] is obviously like neither Microsoft or Sun Microsystems; it's a community of volunteers whose aim is sharing their knowledge and making the Internet a better place. Volunteers don't get paid, but sometimes something gets done, and some projects are released to the general public. Among these is a system for (if you haven't guessed already)a system for universal user authentication, called Project Windstone[9]. + +Project Windstone was developed by SoundWave on behalf of Special Operations and Security[10] to provide a universal authentication system that is easy to use and deploy on websites and in applications. Furthermore, the Windstone protocol is language-independent and functions via HTTP POST transactions between clients and the Windstone server, so virtually any website coded in any language or any application able to communicate with a web server can implement it. + +It seems great so far, but what can Windstone be used for? As previously said, it is a system to allow users to authenticate themselves with the same credentials on many different websites and share profiles and information between those websites at the same time. Furthermore, users can send each other private messages that can be retrieved on any website that implements Windstone, with the added benefit of all transactions taking place in a secure and private environment. + +On second thought, Windstone features seem to lead to some perplexity, especially among users who are particularly concerned about their own privacy: apparently a single centralized server is involved, and users can share their profile and send messages with each other, so what warranties does Windstone offers as far as privacy/security goes? Here's something which should reassure most of us: + +[list] +[*]The information provided by users in their public profiles is entirely up to their discretion: in other words, it's up to the user if they want to list their credit card numbers on their profile or talk about their cat, as the Windstone server itself does not require any specific personal information in order to create a profile. +[*]The username can be any valid email address submitted by the user. +[*]User profiles are available only after authentication with the Windstone server, and only if the person requesting the profile already knows the email address used by another user for Windstone services. Currently, Windstone does not implement any form of listing of existing users among the standard commands. +[*]The password chosen for user authentication is NEVER saved in any form; not within the client applications, not on the central server, and not in cookies. +[*] Data sent from client to server and vice-versa is encrypted. +[/list] + +[b]Some more technical details[/b] +I am actually planning to implement the system on one of my sites, so I started reading the short but straightforward documentation[11] available on the Windstone site to learn more about how the system works, and it seems quite simple and able to do what it does in a logical way; the Windstone "standard" contains a bunch of commands[12] which are used by the clients (agents) and the server to request information exchange such as requests for initialization, possible server replies, and so on. Commands and data are sent using the following format (excerpt from the official documentation): + +[i] +The format of this command string is as follows: + +AAAA.*BBBBBBBBBB.*CCCC::DDDDDDDDDDDDDDDDDDDD::EEEE::FFFFFFFFFF + +A. This is the command. Commands tell us what kind of request or response is being made with the command string. It also lets us know how many elements of data to expect (see F). + +B. This is the agent system identifier. Each website or IEP receives a unique alphanumeric ten (10) character identifier upon registration, which is used to identify this system within the network. + +C. This is the protocol version number. Generally, the version number will not change much, if at all, but it must be present. The protocol version goes with all command strings to let other systems and the Windstone server know what version of the protocol you are using. If certain versions are incompatible with each other, or if there is an upgrade or change to the protocol you are using, the version number will be used to determine that. + +D. This is the transaction identifier. Usually, this is not used, so the default information that should go here is six zeros ("000000"). The transaction identifier helps to link command strings into groups for processing and is most often used during the user login process. + +E. This is the sequence number. The sequence number, in conjunction with the transaction identifier, is used to put grouped command strings into their logical order. The sequence numbers have no specified numbering sequence, default start value, or length limit: the only requirement is that a sequence number must be in order from lowest to highest. When not using a transaction identifier or sequence number, the default information that should go here is a simple "X" (note that when "X" is being used in a command string by itself, it should always be capitalized). + +F. This is the data section. The data section is the heart of the command string. It is important to note that, at the minimum, all data sections need to be base-64 encoded prior to transmission - at no time should there be information in plain text format in the data section. +[/i] + +Obviously, command strings can be manipulated to access each section separately and the manipulation can be done with virtually any programming language used on the client side. + +Normally, the client will send a command to the Windstone server to start the authentication process and then retrieve some information; the server will reply accordingly to the client's command strings with its own responses wrapped in command strings. Let's suppose a Windstone Agent is being used to perform the following actions: + +- Initialize the system +- perform a login +- retrieve user profile from the Windstone server + +In this simulation I will not use the actual command strings but just the codes for the various commands. + +[i][u]Agent[/u]: 0000 :: SETUP_INITIALIZE[/i] - The Windstone agent sends a request to the server to initialize the authentication process, supplying the software identifier, the software type ("PC-Based" or "Web-Based"), the command landing URL and the URL to redirect logins to. + +[i][u]Server[/u]: 0002 :: SETUP_COMPLETE [/i]- Everything looks good to the server, which replies with the following information: Unique agent identifier, primary authentication token, secondary authentication token, activation key, security code, shared encryption key (255 random characters, non-binary), registration completion date and time (epoch). These parameters will be used by the agent afterwards and are necessary to identify the agent on the Windstone server. + +[i][u]Agent[/u]: 1102 :: USER_LOGIN_REDIRECT[/i] - The agent requests to start the authentication process and sends the email address of the user to the server along with the URL where the user's password will be entered. + + +[i][u]Server[/u]: 1105 :: USER_AUTH_SAVE[/i] - User credentials are checked by the Windstone server. Everything is fine, so the server sends this response to the agent. The response contains the authentication token which will be used to authenticate the user during the session, as well as the user's display name. + +[i][u]Agent[/u]: 1107 :: USER_INFO[/i] - The agent can now request the user's profile from the Windstone Server. + +[i][u]Server[/u]: 1108 :: USER_PROFILE[/i] - After checking the user's authentication token, the server can now send the following information to the agent: Email address, display name, user "About Me" text, last login date and time, account created date and time, online status. + +This is just a simple example of how the Windstone protocol can be used; as mentioned earlier, there are various other commands[12] which can be used to perform various actions. + +[b]Development and deployment[/b] +The Windstone protocol is fully operational and can be implemented on any website or application able to communicate with a web server. The developer made a very basic PHP-based example of an Agent system available online[13]; it may not be a masterpiece of PHP coding (as the developer himself pointed out), but it can be useful in understanding how to develop a Windstone Agent System. + +If you'd like to start developing your own Agent System or you just want to create a Windstone account, it can be done on the Windstone registration page[14]: you'll be asked to provide an email address, a display name and a profile (the last two can be modified afterwards). Then the system will prompt you for a password, and an email will be sent to the address you provided to confirm and activate your account. Once you have an account, you can login to any website or application implementing the Windstone protocol, such as the Windstone website itself[15]. + +Windstone is certainly not yet comparable to the MSN Passport technology - it's not used by a lot of important sites, and it's much simpler and offers fewer services, but it's undoubtedly an interesting approach to a free to use, secure and private system of universal user authentication. +Check it out![9] + +[b]Notes and Resources[/b] +[1] Microsoft Hotmail Service, [url]http://www.hotmail.com[/url] +[2] MSN Passport Network: [url]https://accountservices.passport.net/ppnetworkhome.srf?vv=320&lc=1033[/url] +[3] List of sites using MSN Passport, Passport@everything2: [url]http://www.everything2.com/index.pl?node=passport[/url] +[4] "Microsoft .NET Passport and Wallet: Approach with Caution!", [url]http://web.mit.edu/ist/isnews/v17/n04/170408.html[/url] +[5] "Microsoft Hailstorm and Passport", go-mono.com, [url]http://www.go-mono.com/passport.html[/url] +[6] Liberty Alliance Project, Official Page, [url]http://www.projectliberty.org/index.php[/url] +[7] Liberty Alliance Project, FAQs, [url]http://www.projectliberty.org/about/faq.php[/url] +[8] CyberArmy, Official Page, [url]http://www.cyberarmy.net/[/url] +[9] Project Windstone, Official Page, [url]http://windstone.x-mirror.com/v2/[/url] +[10] Special Operations and Security, official website, [url]http://sos.x-mirror.com/[/url] +[11] Windstone Communications Protocol, Development Whitepaper, [url]http://windstone.x-mirror.com/v2/development.php[/url] +[12] Windstone Protocol Commands, [url]http://windstone.x-mirror.com/v2/commands.php[/url] +[13] Example of PHP Agent System (ZIP file), [url]http://windstone.x-mirror.com/v2/ws-testbed.zip[/url] +[14] Windstone Registration, [url]http://windstone.x-mirror.com/v2/register.php[/url] [15] Windstone Login Page, [url]http://windstone.x-mirror.com/v2/login.php[/url]
D content/articles/ruby-facets.textile

@@ -1,104 +0,0 @@

------ -permalink: ruby-facets -filters_pre: -- erb -- redcloth -title: A glance at Ruby facets -comments: [] - -date: 2007-07-01 12:11:00 +02:00 -tags: -- ruby -- review -- programming -type: article -toc: true ------ -_"Code is poetry"._ - -Oddly enough, this is a quote from WordPress.org[1], the home of the most popular blog platform on the Internet. Odd because WordPress is written in PHP, whose syntax &mdash; with all due respect &mdash; is not the most elegant or poetic at all. -I've been programming in PHP for quite some time, I studied Pascal at high school, I learnt C++ at university, I used Java for my thesis and I know what Perl and Python look like. I never ventured in the Lisp world, it looks fascinating but a bit too esoteric for my linking. -I've been looking for a programming language of choice since my first C++ exam: _there must be a way_ &mdash; I thought &mdash; _to do all this in a much simpler way_. I was delighted to experiment languages like Java, which seemed to make life a little bit easier for developers, but not quite. It all comes to personal tastes, of course, but I always wanted a programming language which besides being powerful and flexible was also elegant and natural. -That &mdash; I believe &mdash; is one of the reasons why we have a Ruby on Rails[2] and not a PHP on Rails framework (what happened afterwards is another story[3]), among other things. - -When I first had a brief glance at Ruby[4], I knew I'd become addicted to it. First of all because it _looks_ nice, then, of course, because it is extremely versatile and its code is highly manageable. - -This article does not intend to teach you how to program in Ruby, but rather it aims to show _some_ of Ruby's aspects to the curious among you. I'll try to describe, as someone who's just discovered the beauty of this language, quite a few of its many facets. - -h3. Syntax Overview - -Forget semicolons, you'll never use one ever again in Ruby, as there's no need to add them at the end of each line. Same goes with those annoying curly brackets: they are just used for delimiting hashes and blocks (more on all this later on). Ruby uses _def_ and _end_ keywords instead: you'll never believe how this does _not_ add unnecessary verbosity to your code, but rather helps you manage it. -This is a relief for me especially, because on Italian keyboards you have to press Alt Gr+SHIFT+&egrave; to get an open curly bracket, which says it all. So let's take a look at our first silly Ruby function, shall we? - -<% highlight :ruby do %> -def hello(name=nil) - if name then - print 'Hello, '+name+'!' - else - print 'Hello!' - end -end -<% end %> - - - - - - -- optional parenthesis -- no semicolon -- def .. end -- no for, other loops - -h3. Objects, Classes and Modules - -- everything is an object -- nil -- open classes -- modules, mixins -- everything has a value (returns not necessary) - -h3. Variables - -- no references -- multiple assignments -- hashes and arrays -- accessors -- symbols - -h3. Methods - -- alias -- ?, ! -- method_missing -- *something - -h3. Operators - -- << -- ||=, &&= -- =~ -- redefine - -h3. Blocks - --iterators -- lambda, Proc -- yield -- & - -h3. Other Goodies - -- irb -- exceptions -- marshalling -- RDoc, ri -- YAML - -fn1. WordPress, blogging platform, "www.wordpress.org":http://www.wordpress.org - -fn2. Ruby on Rails, web development framework, "www.rubyonrails.org":http://www.rubyonrails.org - -fn3. For a list of frameworks inspired by Ruby on Rails, refer to "Rails-inspired PHP frameworks":http://www.h3rald.com/articles/rails-inspired-php-frameworks. - -fn4. Ruby programming language, "www.ruby-lang.org":http://www.ruby-lang.org/en/
D content/articles/ruby-thanks.textile

@@ -1,26 +0,0 @@

------ -permalink: ruby-thanks -filters_pre: -- redcloth -title: Thanks -comments: [] - -date: 2007-09-14 11:43:00 +02:00 -tags: -- ruby -- writing -- internet -type: article -toc: true ------ -It looks like my "last article":/articles/ten-reasons-to-learn-ruby was not too bad after all. Quite a few thousands of people ended up reading it since it was published nearly 10 days ago: not too bad. - -It didn't get on Digg but it was featured on Dzone's front page for a while and on del.icio.us as well, hence the extra traffic. -This is the first non-PHP-related article of mine which gets this kind of attention, and to me this is quite an achievement: it kinda feels like I've been re-christened, metaphorically speaking. - -I'd like to spend a few words to thank a few people who contributed to this article's popularity: - -* _Halley_ from "CyberArmy.net":http://www.cyberarmy.net, who did a great job polishing the article's rough edges, as always. -* The folks at "DZone":http://www.dzone.com who voted and viewed my article. DZone seems to be truly great, by the way, I didn't realize that. -* All the people who bookmarked the article, all those who posted a comment (even the negative ones, which indeed always help) to the article. -* Peter Cooper, from "RubyInside":http://www.rubyinside.com, one of the best blogs out there, for mentioning my article in one of his "latest posts":http://www.rubyinside.com/interesting-ruby-tidbits-that-dont-warrant-separate-posts-1-600.html. This was truly a honour.
M content/articles/server-packages.bbcodecontent/articles/server-packages.bbcode

@@ -8,74 +8,74 @@

date: 2005-06-28 22:12:19 +02:00 tags: - review -- web-development +- webdevelopment - php - databases type: article toc: true ----- -The first and most obvious difference between, say, a C++ programmer and a PHP developer is that the PHP developer needs a server with PHP support up and running somewhere in order to "show" others that the application is working. This normally means that a PHP developer must either have remote access to a server, or have one set up on his machine. Installing and configuring a server can be tricky sometimes, especially if you want to configure it "properly", but in some cases - for Linux/BSD users mainly - there are some pre-configured servers you can download and install. - -I won't examine all these methods in this article, but I'll describe three alternatives for installing and run a webserver on windows in 10 minutes or less. - -[b]Preliminary considerations[/b] -Let's assume that you just want to have a server set up on your computer for [i]internal use[/i] only, for testing purposes. That means that you wouldn't need to be concerned about "security" or similar issues - you just want to be able to run your PHP scripts and access your database(s) quickly and easily. - -As I said earlier, Linux users would probably opt for some package available for their favourite distros - they would only have to download and install an .rpm or .deb package for (presumably) Apache httpd, PHP and MySQL, and just use a basic configuration. There are other tools around which can help if you want to compile or configure Apache, but that is beyond the scope of this article. - -Let's just focus on Windows users, then. Normally they like things that are easy to install and can be configured in a few minutes [i]maximum[/i] or not at all. Finally, let's assume that as a Windows user, you don't want to spend more money for a new operating system with a bundled server, like Windows 2003, because you can use [url=http://www.apache.org]Apache[/url] on Windows as well, for free. Having said this, I actually found 3 possible solutions that are handy for PHP (or Perl) developers who don't want to spend time learning how to configure a server. There are people like that, including myself to some extent. - - -[b]WAMPserver[/b] -[url=http://www.wampserver.com]WAMP[/url] stands for "Windows Apache MySQL PHP", and I must say that this product happens to be my choice. The current version, available at the time of writing, offers: - -- PHP 5.0.4 -- Apache 1.3.33 -- MySQL 4.1.10a -- phpMyadmin 2.6.1-pl3 -- SQLitemanager 1.0.4 - -This is basically a fully working PHP5 environment, with other tools like phpMyadmin to administer your MySQL database even more easily (more laziness!), and, if you're into the new functionalities of PHP5, it also comes with sqlitemanager, a php application similar to phpMyAdmin but for sqlite databases, which are supported by default in PHP5. -You download it, you start the installation program, and it's DONE. That's it. In 5 minutes you have your own little apache/php/mysql(ite) environment up and running and you can start showing off your sites to your friends and co-workers right away. - -The program also installs two services which can be run at startup, a little icon in the system tray to access all the tools and, of course, http://localhost in your favourite browser. - -If all this is still not enough for you, and you want more things more easily, you can install addons to set up PHP4 (and seamlessly switch between the two with a single click!), Perl, Zend Accelerator, and so forth. - - -[b]EasyPHP[/b] -The second suite I will briefly describe is [url=http://www.easyphp.org]EasyPHP[/url]. This is a French project (like the previous one, actually), which offers PHP4, MySQL and Apache, plus phpMyAdmin to administer the MySQL databases. However, it doesn't offer PHP5 support yet (so it's not my favourite) and thus there's no sqlite support either. - -Apart from that, it works exactly like WAMP: you download it, you install it, and it's done. Services are installed and you have - again - your little icon on the system tray to access all its functions and tools. It works well, but it doesn't seem to have any add-ons available like WAMP does. - -[b]XAMPP[/b] -This is by far the most complete distribution of the three I am focusing on. This project is developed by [url=http://www.apachefriends.org]Apache Friends[/url] and has a lot of features and flavours. XAMPP currently includes: - -- Apache HTTPD 2.0.54 -- MySQL 4.1.12 -- PHP 5.0.4 + 4.3.11 + PEAR + Switch -- MiniPerl 5.8.6 -- Openssl 0.9.7g -- PHPMyAdmin 2.6.2-pl1 -- XAMPP Control Panel 1.0 -- eAccelerator 0.9.3 -- Webalizer 2.01-10 -- Mercury Mail Transport System for Win32 and NetWare Systems v4.01a -- FileZilla FTP Server 0.9.8a -- SQLite 2.8.15 -- ADODB 4.63 -- Zend Optimizer 2.5.7 -- XAMPP Security for Windows 98, 2000, XP - -Honestly, you can't ask for more! If by chance you want to run this suite on other platforms, there's a version for Mac OS X, Solaris, and even Linux. - -The installation method for XAMPP is slightly more difficult than the other suites - you actually have to download and unzip it in a folder of your choice. Then you're off and running. - -Unfortunately (or fortunately), there's no icon on the system tray, so you need to actually access http://localhost to get a list of services and tools. It also doesn't come with sqlitemanager, but you can download it and install it in the documents folder (like I did). - -I actually use XAMPP - the "lite" edition, which is smaller and has less features - for my USB drive. Since it doesn't require any services to be installed in order to run, you can simply copy it onto a USB stick and run it from there! - -[b]Conclusion[/b] -I'm quite impressed by all of the server packages I reviewed; WAMP and XAMPP in particular. I can now carry around my websites and applications and instantly run them or show them to anyone who has a computer with a USB port. - +The first and most obvious difference between, say, a C++ programmer and a PHP developer is that the PHP developer needs a server with PHP support up and running somewhere in order to "show" others that the application is working. This normally means that a PHP developer must either have remote access to a server, or have one set up on his machine. Installing and configuring a server can be tricky sometimes, especially if you want to configure it "properly", but in some cases - for Linux/BSD users mainly - there are some pre-configured servers you can download and install. + +I won't examine all these methods in this article, but I'll describe three alternatives for installing and run a webserver on windows in 10 minutes or less. + +[b]Preliminary considerations[/b] +Let's assume that you just want to have a server set up on your computer for [i]internal use[/i] only, for testing purposes. That means that you wouldn't need to be concerned about "security" or similar issues - you just want to be able to run your PHP scripts and access your database(s) quickly and easily. + +As I said earlier, Linux users would probably opt for some package available for their favourite distros - they would only have to download and install an .rpm or .deb package for (presumably) Apache httpd, PHP and MySQL, and just use a basic configuration. There are other tools around which can help if you want to compile or configure Apache, but that is beyond the scope of this article. + +Let's just focus on Windows users, then. Normally they like things that are easy to install and can be configured in a few minutes [i]maximum[/i] or not at all. Finally, let's assume that as a Windows user, you don't want to spend more money for a new operating system with a bundled server, like Windows 2003, because you can use [url=http://www.apache.org]Apache[/url] on Windows as well, for free. Having said this, I actually found 3 possible solutions that are handy for PHP (or Perl) developers who don't want to spend time learning how to configure a server. There are people like that, including myself to some extent. + + +[b]WAMPserver[/b] +[url=http://www.wampserver.com]WAMP[/url] stands for "Windows Apache MySQL PHP", and I must say that this product happens to be my choice. The current version, available at the time of writing, offers: + +- PHP 5.0.4 +- Apache 1.3.33 +- MySQL 4.1.10a +- phpMyadmin 2.6.1-pl3 +- SQLitemanager 1.0.4 + +This is basically a fully working PHP5 environment, with other tools like phpMyadmin to administer your MySQL database even more easily (more laziness!), and, if you're into the new functionalities of PHP5, it also comes with sqlitemanager, a php application similar to phpMyAdmin but for sqlite databases, which are supported by default in PHP5. +You download it, you start the installation program, and it's DONE. That's it. In 5 minutes you have your own little apache/php/mysql(ite) environment up and running and you can start showing off your sites to your friends and co-workers right away. + +The program also installs two services which can be run at startup, a little icon in the system tray to access all the tools and, of course, http://localhost in your favourite browser. + +If all this is still not enough for you, and you want more things more easily, you can install addons to set up PHP4 (and seamlessly switch between the two with a single click!), Perl, Zend Accelerator, and so forth. + + +[b]EasyPHP[/b] +The second suite I will briefly describe is [url=http://www.easyphp.org]EasyPHP[/url]. This is a French project (like the previous one, actually), which offers PHP4, MySQL and Apache, plus phpMyAdmin to administer the MySQL databases. However, it doesn't offer PHP5 support yet (so it's not my favourite) and thus there's no sqlite support either. + +Apart from that, it works exactly like WAMP: you download it, you install it, and it's done. Services are installed and you have - again - your little icon on the system tray to access all its functions and tools. It works well, but it doesn't seem to have any add-ons available like WAMP does. + +[b]XAMPP[/b] +This is by far the most complete distribution of the three I am focusing on. This project is developed by [url=http://www.apachefriends.org]Apache Friends[/url] and has a lot of features and flavours. XAMPP currently includes: + +- Apache HTTPD 2.0.54 +- MySQL 4.1.12 +- PHP 5.0.4 + 4.3.11 + PEAR + Switch +- MiniPerl 5.8.6 +- Openssl 0.9.7g +- PHPMyAdmin 2.6.2-pl1 +- XAMPP Control Panel 1.0 +- eAccelerator 0.9.3 +- Webalizer 2.01-10 +- Mercury Mail Transport System for Win32 and NetWare Systems v4.01a +- FileZilla FTP Server 0.9.8a +- SQLite 2.8.15 +- ADODB 4.63 +- Zend Optimizer 2.5.7 +- XAMPP Security for Windows 98, 2000, XP + +Honestly, you can't ask for more! If by chance you want to run this suite on other platforms, there's a version for Mac OS X, Solaris, and even Linux. + +The installation method for XAMPP is slightly more difficult than the other suites - you actually have to download and unzip it in a folder of your choice. Then you're off and running. + +Unfortunately (or fortunately), there's no icon on the system tray, so you need to actually access http://localhost to get a list of services and tools. It also doesn't come with sqlitemanager, but you can download it and install it in the documents folder (like I did). + +I actually use XAMPP - the "lite" edition, which is smaller and has less features - for my USB drive. Since it doesn't require any services to be installed in order to run, you can simply copy it onto a USB stick and run it from there! + +[b]Conclusion[/b] +I'm quite impressed by all of the server packages I reviewed; WAMP and XAMPP in particular. I can now carry around my websites and applications and instantly run them or show them to anyone who has a computer with a USB port. + As I said in the beginning, these programs are NOT meant to be used in a production environment or to be accessed publicly, therefore, security is not a consideration here. In my opinion, they are simply excellent for testing purposes, and for now, that's what I need them for.
M content/articles/slax.bbcodecontent/articles/slax.bbcode

@@ -7,139 +7,138 @@ comments: []

date: 2006-02-05 17:17:46 +01:00 tags: -- linux - review type: article toc: true ----- -How can I learn how to use Linux? Simple, you grab a copy of any of the twelve thousands different 'distros' available out there, and you install it on your PC, hoping not to damage your existing Windows installation (if any). Or there's a more lazy and safe way, get one of the few dozens of 'Linux live CDs', burn the cd, boot from it, and you're all set...It's true, nowadays the best solutions for Linux newbies is trying out a few [i]live CDs[/i] before installing [i]the real deal[/i] on their machines: it's safe(r), takes less time and it's much more fun. Yes, some people may object saying that the fun in learning Linux is installing it on your hard drive first, but a few people I know who 'accidentally' overwrote their Master Boot Record or 'accidentally' damaged their Windows installation might disagree there... - -A live distribution[1] basically is a CD (or DVD or USB drive) containing a fully working operating system - Linux in the specific - which can be run directly from the CD itself and does not require an hard disk installation. The drawback is that normally some part of the operating system are loaded and run from a [i]ram disk [/i] and therefore the data written there will be erased once the system reboots. Due to the nature of CDs, saving data on the CD itself is obviously not possible, and this limitation can normally be bypassed by saving changes within a file to store either on your hard drive, remotely, or on some other media which allows read/writing like a floppy disk or USB stick. - -Linux is well known for the many different distributions available, each with its own features, pros and cons. The same happens for live distros: in the last few years the number grew a lot[2] and nearly all major distributions now have a [i]live[/i] counterpart, mostly to allow new users to preview their product. - -The most famous, and possibly one of the first LiveCD ever made was Knoppix[3], a Debian[4]-based CD featuring a KDE[5] desktop environment and many useful applications [i]squeezed[/i] into 700MB of space which can be used as a fully functional operating system. Add to this a truly impressive on-the-fly hardware detection ability, and there's the [i]best[/i] (arguably) multi-purpose linux Live distribution ever made. -If Knoppix is "so perfect", why do other distributions exist at all? Well, some people noticed that they wanted to remove something from the collection of applications Knoppix included in the default CD, others wanted to add other bits, so soon a long list of Knoppix-based [i]customized[/i] distros followed[6]... - -This is another story, I'd like focus my attention on perhaps the most valid Knoppix-alternative out there: Slax[7]. - -[b]Size vs. Features[/b] -Knoppix was the first Live CD I tried, but I didn't like one thing about it: its size. 700MB means one CD, and one CD means that I can't carry it in my pocket now can I? Not literally, anyway, at least not comfortably. So I started looking for a smaller alternative, and I found various possible candidates. Damn Small Linux[8] was one of the most extreme: 50MB in total, nothing more, nothing less, and it worked! Alright, I must say that now it's much better than it was when I first tried it but, it was more or less functional at the time (2003), although relatively new on the scene. -I liked it, really but, due to its size self-limitations the user interface wasn't too pretty, and the applications included weren't exactly what I was looking for: when you're used to Firefox (or better, Firebird, at the time) to browse the Net, Dillo[9] doesn't really look exactly appealing and feature-rich - although remarkable for its size. - -I decided that I wanted something more than that, also because I was planning to burn the live-linux distro on a [i]brand new[/i] (at the time) 8cm CD-RW with 180MB of space available. The best solution I could find, at the time and still now, perhaps, was Slackware Live CD, a very promising live distribution based on Slackware Linux[10]. -I was very impressed at the time, especially for the effort the developer put to create a mini-distribution which is also user-friendly and nice-looking as well, incorporating the KDE Desktop. These are not the only strengths of the project, as we'll see in the next sections but, certainly the first thing everyone can notice. - -After a while the project changed names and became "Slax", perhaps to create its own identity and expand itself following a different direction than its non-live predecessor: while the 'real' Slackware is often quite cautious on using latest technologies and normally includes [i]stable[/i] packages, Slax does quite the opposite, including more recent applications and solutions. - - -[b]Overview[/b] -Slax website[7] evolved quite a bit through the years, and now it's a true example of clarity and exhaustiveness. An essential clean design, access to a lot of information on how to use the live CD, solutions to common problems and also something for developers interested in creating their own live distro: the truly remarkable thing is that the biggest part of the work is done - apparently - by one single person, Tomas Matejicek[11], the founder of the project. - -The strength of Slax - as I anticipated before - is perhaps its ability to compress a few carefully selected, commonly used applications which allow the user to fully enjoy his live experience in 177MB of space. Certainly the choice of using the K Desktop Environment instead of a more lightweight one like Fluxbox or Xfce may seem illogical, but for sure new Linux users would feel more "at home" with KDE, especially if coming from Windows XP. KDE is by far the most user friendly desktop environment available for Linux, and Slax made it even more user friendly by carefully organizing menus in an optimal way without cluttering the desktop with a myriad of icons and overly-crowded navigation bars. -When it comes to the applications included, Slax offers nearly everything the average desktop user needs: word processor (KWord), spreadsheet (KSpread), browser (Konqueror), multimedia player (Kplayer), editors, games and much more[26]! In its simplicity and especially for its size, Slax is a well-rounded, multi-purpose distribution. There's an interesting article available on tuxs.org[12] which documents the author's [i]personal challenge[/i] of using [i]only[/i] Slax (version 4.1.4 at the time) for a whole week. Surprisingly, the writer was really impressed of the features offered by this little distro: he was able to connect to the Net, browse the web, check his mail, write and do various other "everyday task", with no difficulty or extra hassle. - -Slax is also [i]very[/i] fast: normally some other live CDs compress [i]the whole[/i] operating system on a single file, or a few, while Slax developed an optimized modular architecture: groups of programs or even single applications are compressed [i]separately[/i] into .mo files: this technique sensibly increases the performance and speed of the operating system: whenever I open KWord, for example, to write an article, the OS will access [i]just[/i] the KWord module on the disk, without touching other modules. -[i]Surely there's a way to add/remove modules...[/i] - Yes, there is, and this will be discussed later on. - -Finally, like various other live distros, Slax supports some handy "cheatcodes" which can be used to boot customize some options when booting the operating system. - -Some of the most interesting codes include: - -[code] -boot: slax webconfig=passphrase -boot: slax webconfig=ask -[/code] -This is a recent feature: Slax allows users to save their settings remotely, directly on Slax server. Every user has to choose a 10+ characters password in order to use this feature[27]. - -[code] -boot: slax toram (just alias for copy2ram) -boot: slax copy2ram -[/code] -This code can be used to copy the entire operating system to your computer's RAM: this may make the booting process slower, but Slax will run faster than light afterwards (256MB+ ram required) - -[code] -boot: slax changes=/dev/device -[/code] -Saves changes to a specified device using any linux filesystem, like a hard drive or a usb stick. - -[code] -boot: slax load=module -[/code] -Load optional modules stored in the /optional/ directory. For further information about modules, see the "Make your own!" section below. - -For a full list of all Slax cheat codes, see the cheatcodes page[13] on Slax website. - -[b]Different flavors[/b] -I defined Slax a multi-purpose mini distribution, but as always different people have different needs: some users may want to be able to run some windows applications through Wine[14], for example, or may prefer a more lightweight Desktop Environment. The huge - and logical - limitation of all live CDs is that they normally don't offer the possibility of adding applications and packages: when the operating system starts the "root" partition is transferred onto a ramdrive which allows - even if until reboot - read/write access. Although this limitation can be overcome at least through using some of the cheatcodes described before, having the application already installed could be much easier. - -That's why Slax developers decided to start creating different [i]flavors[/i] of Slax. Some of them are not available at the moment (the current slax version at the time of writing is 5.0.6), and others can be already downloaded from the official site[15]. - -[u]Slax "Kill Bill"[/u] - This is the first Slax customization which became available, and came out more or less at the same time as Tarantino's movie. [i]Bill[/i] Gates didn't seem to mind at all, even if this version actually allows users to run [i]some[/i] Windows applications like notepad on linux. Basically Wine[15] dosbox[16] and qemu[17] can make this possible, with limitations... nothing too exciting but, definitely fun to try out. - - -[u]Slax "Server"[/u] -[quote]SLAX SRV is a pocket operating system with many internet services ready to use. Includes DNS, DHCP, SMB, HTTP, FTP, MySQL, SMTP, POP3, IMAP, SSH.[/quote] -Unfortunately, this flavor of Slax is not yet available for download, but some updates concerning its status are available on the developer's TODO list[18]: - -[i]SE: mysql up and running -SE: httpd up and running, with PHP with MySQL -SE: DNS server up and running as a cache server -SE: DHCP server included but not started automatically, could confuse local network -SE: SSH server up and running -SE: MAIL server up and running, needs testing -SE: FTP server up and running[/i] - -This is definitely going to be an interesting project, and I'm really looking forward to it. In the meantime, there are two server-oriented live distribution available, which is also based on Slax: Slampp[19] and in particular Slampp Lite[20]. I tried Slampp Lite and I was really satisfied with its features: support for PHP, Perl, Python on Apache (basically includes XAMPP for Linux[21]), xfce desktop environment, the latest Firefox browser, antivirus, firewall, and more. - -[u]Slax "Popcorn"[/u] -This Slax flavor is more minimalist, and substantially different from the Standard Edition. For a start it features the more lightweight xfce Desktop Environment[22], and thus removes all KDE-based applications making more room for Firefox browser and Abiword, which are not included in the Standard version due to the presence of their [i]KDE counterparts[/i] (Konqueror and Kword). -Very fast, simple, and fits 128MB: suitable for small USB keys more than anything. - -[u]Slax "Frodo"[/u] -As the name implies, this version is smaller again (47MB), and it's basically the base for all other flavors as it includes just a Linux console and some scripts for hardware detection and setting up the live environment. - -[b]Make your own![/b] -[i]Nice! But I'd have included X instead of Y, then added Z as well, perhaps...[/i] -That's a common feeling: the truth is that people are never happy with what they get! If you're still not happy with what Slax in all its different flavors can offer you, well, you can make your own. Although some might want to start more or less from scratch, creating [i]Slax-based[/i] customizations (this was the only option until the more recent versions), now there's an easier way: modules and the documentation present on the official site is complete enough and describes the necessary steps to take to create, modify and use them[23]. Modules are basically files with .mo extension containing an application which will be loaded by Slax at startup, if placed in the /modules/ directory, or only if required by the user (see the corresponding cheatcode) if placed in the /optional/ directory. The easiest way to create a module which requires no particular skill is converting a Slackware package, by issuing this command: - -[code]tgz2mo application.tgz application.mo[/code] - -Of course there are other ways to create modules without converting Slackware packages, further details in the documentation[23]. There are also a lot (currently 576!) of user-contributed modules ready for use available for download and hosted on the Slax site[24], the only problem is that inevitably some of them seem to be out-of-date, and not constantly updated by their maintainers. - -Last but not least, the dream of all Windows users: MySlax Creator and MySlax Modulator[25], which allow Windows users to create their own Slax distribution with custom modules both for CD and USB drive and create Slax modules on windows respectively. Two really nice additions which make this project even more (Windows-)user-friendly! - -[b]Conclusions[/b] -Slax is exactly how advertised on its website: [i]"[a] fast and beautiful Linux operating system which fits on small (3.14") CD-ROM disc"[/i], nothing more, nothing less. Personally, I'd like to emphasize its user-friendliness, as it seems the most valid alternative to Knoppix, and perhaps even better: it does not include [i]as many applications as possible[/i] which could confuse Linux neophytes but, just a bunch of useful programs for everyday use to give users a [i]taste[/i] of what Linux is capable to do. -Normally, as Slax is mostly maintained by one person, Slax releases are not too frequent: normally 2-3 per year maximum. The version which was tested for this article was the 5.0.6 and (un)luckily a new one [i]just came out[/i] while I was writing the article: version 5.0.7b is now available for download[15] and features KDE 3.5. A few bugs were discovered immediately after its released and quickly fixed with a patch-module (hence the "b"): This YOUR chance to try it out before I do... - -Happy Sla[i]x[/i]ing! - - -[1]Linux Live CD - Wikipedia: [url]http://en.wikipedia.org/wiki/Linux_live_cd[/url] -[2]DrozenTech's LiveCD List: [url]http://www.frozentech.com/content/livecd.php[/url] -[3]Knoppix Official Site: [url]http://www.knoppix.org/[/url] -[4]Debian Official Site: [url]http://www.debian.org/[/url] -[5]K Desktop Environment: [url] http://www.kde.org/[/url] -[6]Knoppix Customizations: [url] http://www.knoppix.net/wiki/Knoppix_Customisations[/url] -[7]Slax Live CD: [url]http://slax.linux-live.org[/url] -[8]Damn Small Linux - Official Page: [url]http://www.damnsmalllinux.org/[/url] -[9]Dillo Browser, Official Page: [url]http://www.dillo.org/[/url] -[10]Slackware Linux, Official Page: [url]http://www.slackware.com/[/url] -[11]Slax - Developer's page: [url]http://slax.linux-live.org/credits.php[/url] -[12]Barney Matthews, "A week with Slax 4.1.4" - Tuxs.org: [url]http://www.tuxs.org/slax.htm[/url] -[13]Slax cheatcodes: [url]http://slax.linux-live.org/cheatcodes.php[/url] -[14]Wine HQ: [url]http://www.winehq.com/[/url] -[15]Slax download page: [url]http://slax.linux-live.org/download.php[/url] -[16]Dosbox Project: [url]http://dosbox.sourceforge.net/news.php?show_news=1[/url] -[17]Qemu Project: [url]http://fabrice.bellard.free.fr/qemu/[/url] -[18]Slax TODO list: [url]http://slax.linux-live.org/todo.php[/url] -[19]Slampp Official Page: [url]http://slampp.abangadek.com/wiki/wikka.php?wakka=HomePage[/url] -[20]Slampp Lite page: [url]http://slampp.abangadek.com/wiki/wikka.php?wakka=SlamppLite[/url] -[21]XAMPP for Linux: [url]http://www.apachefriends.org/en/xampp-linux.html[/url] -[22]Xfce desktop environment, official page: [url]http://www.xfce.org[/url] -[23]Slax Documentation - Modules: [url]http://slax.linux-live.org/doc_modules.php[/url] -[24]Slax modules page: [url]http://slax.linux-live.org/modules.php[/url] -[25]MySlax Projects: [url]http://myslax.bonsonno.org/[/url] -[26]Slax - installed packages: [url]http://slax.linux-live.org/installed_packages.txt[/url] +How can I learn how to use Linux? Simple, you grab a copy of any of the twelve thousands different 'distros' available out there, and you install it on your PC, hoping not to damage your existing Windows installation (if any). Or there's a more lazy and safe way, get one of the few dozens of 'Linux live CDs', burn the cd, boot from it, and you're all set...It's true, nowadays the best solutions for Linux newbies is trying out a few [i]live CDs[/i] before installing [i]the real deal[/i] on their machines: it's safe(r), takes less time and it's much more fun. Yes, some people may object saying that the fun in learning Linux is installing it on your hard drive first, but a few people I know who 'accidentally' overwrote their Master Boot Record or 'accidentally' damaged their Windows installation might disagree there... + +A live distribution[1] basically is a CD (or DVD or USB drive) containing a fully working operating system - Linux in the specific - which can be run directly from the CD itself and does not require an hard disk installation. The drawback is that normally some part of the operating system are loaded and run from a [i]ram disk [/i] and therefore the data written there will be erased once the system reboots. Due to the nature of CDs, saving data on the CD itself is obviously not possible, and this limitation can normally be bypassed by saving changes within a file to store either on your hard drive, remotely, or on some other media which allows read/writing like a floppy disk or USB stick. + +Linux is well known for the many different distributions available, each with its own features, pros and cons. The same happens for live distros: in the last few years the number grew a lot[2] and nearly all major distributions now have a [i]live[/i] counterpart, mostly to allow new users to preview their product. + +The most famous, and possibly one of the first LiveCD ever made was Knoppix[3], a Debian[4]-based CD featuring a KDE[5] desktop environment and many useful applications [i]squeezed[/i] into 700MB of space which can be used as a fully functional operating system. Add to this a truly impressive on-the-fly hardware detection ability, and there's the [i]best[/i] (arguably) multi-purpose linux Live distribution ever made. +If Knoppix is "so perfect", why do other distributions exist at all? Well, some people noticed that they wanted to remove something from the collection of applications Knoppix included in the default CD, others wanted to add other bits, so soon a long list of Knoppix-based [i]customized[/i] distros followed[6]... + +This is another story, I'd like focus my attention on perhaps the most valid Knoppix-alternative out there: Slax[7]. + +[b]Size vs. Features[/b] +Knoppix was the first Live CD I tried, but I didn't like one thing about it: its size. 700MB means one CD, and one CD means that I can't carry it in my pocket now can I? Not literally, anyway, at least not comfortably. So I started looking for a smaller alternative, and I found various possible candidates. Damn Small Linux[8] was one of the most extreme: 50MB in total, nothing more, nothing less, and it worked! Alright, I must say that now it's much better than it was when I first tried it but, it was more or less functional at the time (2003), although relatively new on the scene. +I liked it, really but, due to its size self-limitations the user interface wasn't too pretty, and the applications included weren't exactly what I was looking for: when you're used to Firefox (or better, Firebird, at the time) to browse the Net, Dillo[9] doesn't really look exactly appealing and feature-rich - although remarkable for its size. + +I decided that I wanted something more than that, also because I was planning to burn the live-linux distro on a [i]brand new[/i] (at the time) 8cm CD-RW with 180MB of space available. The best solution I could find, at the time and still now, perhaps, was Slackware Live CD, a very promising live distribution based on Slackware Linux[10]. +I was very impressed at the time, especially for the effort the developer put to create a mini-distribution which is also user-friendly and nice-looking as well, incorporating the KDE Desktop. These are not the only strengths of the project, as we'll see in the next sections but, certainly the first thing everyone can notice. + +After a while the project changed names and became "Slax", perhaps to create its own identity and expand itself following a different direction than its non-live predecessor: while the 'real' Slackware is often quite cautious on using latest technologies and normally includes [i]stable[/i] packages, Slax does quite the opposite, including more recent applications and solutions. + + +[b]Overview[/b] +Slax website[7] evolved quite a bit through the years, and now it's a true example of clarity and exhaustiveness. An essential clean design, access to a lot of information on how to use the live CD, solutions to common problems and also something for developers interested in creating their own live distro: the truly remarkable thing is that the biggest part of the work is done - apparently - by one single person, Tomas Matejicek[11], the founder of the project. + +The strength of Slax - as I anticipated before - is perhaps its ability to compress a few carefully selected, commonly used applications which allow the user to fully enjoy his live experience in 177MB of space. Certainly the choice of using the K Desktop Environment instead of a more lightweight one like Fluxbox or Xfce may seem illogical, but for sure new Linux users would feel more "at home" with KDE, especially if coming from Windows XP. KDE is by far the most user friendly desktop environment available for Linux, and Slax made it even more user friendly by carefully organizing menus in an optimal way without cluttering the desktop with a myriad of icons and overly-crowded navigation bars. +When it comes to the applications included, Slax offers nearly everything the average desktop user needs: word processor (KWord), spreadsheet (KSpread), browser (Konqueror), multimedia player (Kplayer), editors, games and much more[26]! In its simplicity and especially for its size, Slax is a well-rounded, multi-purpose distribution. There's an interesting article available on tuxs.org[12] which documents the author's [i]personal challenge[/i] of using [i]only[/i] Slax (version 4.1.4 at the time) for a whole week. Surprisingly, the writer was really impressed of the features offered by this little distro: he was able to connect to the Net, browse the web, check his mail, write and do various other "everyday task", with no difficulty or extra hassle. + +Slax is also [i]very[/i] fast: normally some other live CDs compress [i]the whole[/i] operating system on a single file, or a few, while Slax developed an optimized modular architecture: groups of programs or even single applications are compressed [i]separately[/i] into .mo files: this technique sensibly increases the performance and speed of the operating system: whenever I open KWord, for example, to write an article, the OS will access [i]just[/i] the KWord module on the disk, without touching other modules. +[i]Surely there's a way to add/remove modules...[/i] - Yes, there is, and this will be discussed later on. + +Finally, like various other live distros, Slax supports some handy "cheatcodes" which can be used to boot customize some options when booting the operating system. + +Some of the most interesting codes include: + +[code] +boot: slax webconfig=passphrase +boot: slax webconfig=ask +[/code] +This is a recent feature: Slax allows users to save their settings remotely, directly on Slax server. Every user has to choose a 10+ characters password in order to use this feature[27]. + +[code] +boot: slax toram (just alias for copy2ram) +boot: slax copy2ram +[/code] +This code can be used to copy the entire operating system to your computer's RAM: this may make the booting process slower, but Slax will run faster than light afterwards (256MB+ ram required) + +[code] +boot: slax changes=/dev/device +[/code] +Saves changes to a specified device using any linux filesystem, like a hard drive or a usb stick. + +[code] +boot: slax load=module +[/code] +Load optional modules stored in the /optional/ directory. For further information about modules, see the "Make your own!" section below. + +For a full list of all Slax cheat codes, see the cheatcodes page[13] on Slax website. + +[b]Different flavors[/b] +I defined Slax a multi-purpose mini distribution, but as always different people have different needs: some users may want to be able to run some windows applications through Wine[14], for example, or may prefer a more lightweight Desktop Environment. The huge - and logical - limitation of all live CDs is that they normally don't offer the possibility of adding applications and packages: when the operating system starts the "root" partition is transferred onto a ramdrive which allows - even if until reboot - read/write access. Although this limitation can be overcome at least through using some of the cheatcodes described before, having the application already installed could be much easier. + +That's why Slax developers decided to start creating different [i]flavors[/i] of Slax. Some of them are not available at the moment (the current slax version at the time of writing is 5.0.6), and others can be already downloaded from the official site[15]. + +[u]Slax "Kill Bill"[/u] - This is the first Slax customization which became available, and came out more or less at the same time as Tarantino's movie. [i]Bill[/i] Gates didn't seem to mind at all, even if this version actually allows users to run [i]some[/i] Windows applications like notepad on linux. Basically Wine[15] dosbox[16] and qemu[17] can make this possible, with limitations... nothing too exciting but, definitely fun to try out. + + +[u]Slax "Server"[/u] +[quote]SLAX SRV is a pocket operating system with many internet services ready to use. Includes DNS, DHCP, SMB, HTTP, FTP, MySQL, SMTP, POP3, IMAP, SSH.[/quote] +Unfortunately, this flavor of Slax is not yet available for download, but some updates concerning its status are available on the developer's TODO list[18]: + +[i]SE: mysql up and running +SE: httpd up and running, with PHP with MySQL +SE: DNS server up and running as a cache server +SE: DHCP server included but not started automatically, could confuse local network +SE: SSH server up and running +SE: MAIL server up and running, needs testing +SE: FTP server up and running[/i] + +This is definitely going to be an interesting project, and I'm really looking forward to it. In the meantime, there are two server-oriented live distribution available, which is also based on Slax: Slampp[19] and in particular Slampp Lite[20]. I tried Slampp Lite and I was really satisfied with its features: support for PHP, Perl, Python on Apache (basically includes XAMPP for Linux[21]), xfce desktop environment, the latest Firefox browser, antivirus, firewall, and more. + +[u]Slax "Popcorn"[/u] +This Slax flavor is more minimalist, and substantially different from the Standard Edition. For a start it features the more lightweight xfce Desktop Environment[22], and thus removes all KDE-based applications making more room for Firefox browser and Abiword, which are not included in the Standard version due to the presence of their [i]KDE counterparts[/i] (Konqueror and Kword). +Very fast, simple, and fits 128MB: suitable for small USB keys more than anything. + +[u]Slax "Frodo"[/u] +As the name implies, this version is smaller again (47MB), and it's basically the base for all other flavors as it includes just a Linux console and some scripts for hardware detection and setting up the live environment. + +[b]Make your own![/b] +[i]Nice! But I'd have included X instead of Y, then added Z as well, perhaps...[/i] +That's a common feeling: the truth is that people are never happy with what they get! If you're still not happy with what Slax in all its different flavors can offer you, well, you can make your own. Although some might want to start more or less from scratch, creating [i]Slax-based[/i] customizations (this was the only option until the more recent versions), now there's an easier way: modules and the documentation present on the official site is complete enough and describes the necessary steps to take to create, modify and use them[23]. Modules are basically files with .mo extension containing an application which will be loaded by Slax at startup, if placed in the /modules/ directory, or only if required by the user (see the corresponding cheatcode) if placed in the /optional/ directory. The easiest way to create a module which requires no particular skill is converting a Slackware package, by issuing this command: + +[code]tgz2mo application.tgz application.mo[/code] + +Of course there are other ways to create modules without converting Slackware packages, further details in the documentation[23]. There are also a lot (currently 576!) of user-contributed modules ready for use available for download and hosted on the Slax site[24], the only problem is that inevitably some of them seem to be out-of-date, and not constantly updated by their maintainers. + +Last but not least, the dream of all Windows users: MySlax Creator and MySlax Modulator[25], which allow Windows users to create their own Slax distribution with custom modules both for CD and USB drive and create Slax modules on windows respectively. Two really nice additions which make this project even more (Windows-)user-friendly! + +[b]Conclusions[/b] +Slax is exactly how advertised on its website: [i]"[a] fast and beautiful Linux operating system which fits on small (3.14") CD-ROM disc"[/i], nothing more, nothing less. Personally, I'd like to emphasize its user-friendliness, as it seems the most valid alternative to Knoppix, and perhaps even better: it does not include [i]as many applications as possible[/i] which could confuse Linux neophytes but, just a bunch of useful programs for everyday use to give users a [i]taste[/i] of what Linux is capable to do. +Normally, as Slax is mostly maintained by one person, Slax releases are not too frequent: normally 2-3 per year maximum. The version which was tested for this article was the 5.0.6 and (un)luckily a new one [i]just came out[/i] while I was writing the article: version 5.0.7b is now available for download[15] and features KDE 3.5. A few bugs were discovered immediately after its released and quickly fixed with a patch-module (hence the "b"): This YOUR chance to try it out before I do... + +Happy Sla[i]x[/i]ing! + + +[1]Linux Live CD - Wikipedia: [url]http://en.wikipedia.org/wiki/Linux_live_cd[/url] +[2]DrozenTech's LiveCD List: [url]http://www.frozentech.com/content/livecd.php[/url] +[3]Knoppix Official Site: [url]http://www.knoppix.org/[/url] +[4]Debian Official Site: [url]http://www.debian.org/[/url] +[5]K Desktop Environment: [url] http://www.kde.org/[/url] +[6]Knoppix Customizations: [url] http://www.knoppix.net/wiki/Knoppix_Customisations[/url] +[7]Slax Live CD: [url]http://slax.linux-live.org[/url] +[8]Damn Small Linux - Official Page: [url]http://www.damnsmalllinux.org/[/url] +[9]Dillo Browser, Official Page: [url]http://www.dillo.org/[/url] +[10]Slackware Linux, Official Page: [url]http://www.slackware.com/[/url] +[11]Slax - Developer's page: [url]http://slax.linux-live.org/credits.php[/url] +[12]Barney Matthews, "A week with Slax 4.1.4" - Tuxs.org: [url]http://www.tuxs.org/slax.htm[/url] +[13]Slax cheatcodes: [url]http://slax.linux-live.org/cheatcodes.php[/url] +[14]Wine HQ: [url]http://www.winehq.com/[/url] +[15]Slax download page: [url]http://slax.linux-live.org/download.php[/url] +[16]Dosbox Project: [url]http://dosbox.sourceforge.net/news.php?show_news=1[/url] +[17]Qemu Project: [url]http://fabrice.bellard.free.fr/qemu/[/url] +[18]Slax TODO list: [url]http://slax.linux-live.org/todo.php[/url] +[19]Slampp Official Page: [url]http://slampp.abangadek.com/wiki/wikka.php?wakka=HomePage[/url] +[20]Slampp Lite page: [url]http://slampp.abangadek.com/wiki/wikka.php?wakka=SlamppLite[/url] +[21]XAMPP for Linux: [url]http://www.apachefriends.org/en/xampp-linux.html[/url] +[22]Xfce desktop environment, official page: [url]http://www.xfce.org[/url] +[23]Slax Documentation - Modules: [url]http://slax.linux-live.org/doc_modules.php[/url] +[24]Slax modules page: [url]http://slax.linux-live.org/modules.php[/url] +[25]MySlax Projects: [url]http://myslax.bonsonno.org/[/url] +[26]Slax - installed packages: [url]http://slax.linux-live.org/installed_packages.txt[/url] [27]Slax - Webconfig: [url]http://slax.linux-live.org/webconfig.php[/url]
M content/articles/tweaking-windows-explorer.textilecontent/articles/tweaking-windows-explorer.textile

@@ -19,196 +19,195 @@

I'm on Fedora Core 9 at home but I have to use Windows at work... I recently changed my default shell (although still using Windows Explorer as main file manager) to "bb4Win":http://www.bb4win.org/news.php (BlackBox for Windows): it's just so much faster! date: 2007-06-29 11:28:00 +02:00 tags: -- windows - review - software type: article toc: true ----- -If you asked me what file manager I used on Windows, up to a month ago I'd have answered something like: "A43":http://www.primitus.us/a43/ or "CubicExplorer":http://www.cubicreality.com/, for sure _anything but Windows Explorer_. -Well, it turns out that I had to change my mind after all... - -There's a multitude of "Explorer Replacements" which aim to be more feature-rich, more user-friendly, less bloated than Bill's favorite, and I indeed tried quite a few of them, mostly the free ones of course. - -The only problem is that whenever I got close to choose "the one", I noticed that there always was one or two features missing somewhere, which were present in another and vice versa. Additionally, to be totally honest, the level of integration with Windows and other applications was never _complete_. - -These are a few stupid, silly things which tend to be lacking or at least are not 100% functioning \- not in all the file managers I tried, but at least in some: - -* Environment variables integration \- Alternative file managers normally are not able to parse Windows environment variables. -* Icon overlays \- Some file managers can't render Subversion's icon overlays. -* Strange context menus \- Sometimes right-clicking on a file or a directory may not open the standard Explorer context menu -* Open Folder \- Third-party application allowing you to open a folder, will always open it through Windows Explorer -* auto complete address bar.... -* Special Folders \- Some special folders (e.g. Control Panel) are now accessible using alternative file manager, but others may not (e.g. Network Connections). At any rate, typing "Control Panel" will _not_ open the Control Panel in an alternative file manager. - -_What about trying to "patch" Windows Explorer instead of using another program altogether?_ - -I never really thought of that until "LifeHacker":http://lifehacker.com/software/featured-windows-download/add-tabs-to-windows-explorer-with-qt-tabbar-260926.php featured the QT TabBar shell extension by "Quizo":http://members.at.infoseek.co.jp/Quizo/freeware/indexEn.html. That was my epiphany: I immediately thought I was going to "patch" Windows Explorer using a few really useful (and free, of course) Windows Shell Extensions. - -Here's _my_ file manager now: - -!/files/tweaked_explorer.jpg! - -Yes, it is Windows Explorer, with just a few addons: - -* "QT TabBar":http://members.at.infoseek.co.jp/Quizo/freeware/indexEn.html#qttab (Requires .NET framework 2.0) -* "QT Address Bar":http://members.at.infoseek.co.jp/Quizo/freeware/indexEn.html#qtadr (Requires .NET framework 2.0) -* "QU ToolBar 2":http://members.at.infoseek.co.jp/Quizo/freeware/indexEn.html#qtt2 (Requires .NET framework 2.0) -* "NTFS Link Shell Extension":http://schinagl.priv.at/nt/hardlinkshellext/hardlinkshellext.htm -* "FileMenu Tools":http://www.lopesoft.com/en/fmtools/info.htmlh3. Explorer Tabs - -For an instant gratification, download and install QT TabBar first, logoff and logon again for the changes to take effect (or install all the other extensions first, otherwise you'll have to re-logon after installing nearly each one). As the name implies, this will add tabs to Windows Explorer, just the way you expect them to be: clean, stable and really smart. - -!=/files/tabs.gif! - -After the installation, right-click anywhere in an existing window toolbar and enable the *QT Tab Standard Buttons* and voil&aacute;, a the tab bar will appear. You can click CTRL+N a few times to open new tabs. Take your time to position QT TabBar wherever is more convenient for you. - -Whenever you're ready, take your time to configure QT TabBar (right-click on it and choose "Options") General options: - -!=/files/tabbar_general.gif! - -...and at least the Window options: - -!=/files/tabbar_window.gif! - -*How do you create tabs?* There are many different ways to do it, choose whatever is best for you: - -* CTRL+N keyboard shortcut -* Drag and drop a folder or a shortcut on QT TabBar - Even from other applications! -* Right click on an tab and choose "Clone this" - -Other features? Sure, there's plenty more, e.g.: - -* *Single Instance* \- By enabling the appropriate option, you'll only have a single instance of Windows explorer, everything will be opened in new tabs. A must. -* *Rearrange tabs* \- Tabs can be rearranged by dragging and dropping. -* *Lock/Unlock* \- Lock a tab (right-click > Lock) to avoid closing it accidentally. -* *Folder Memo* \- It is possible to set a "folder memo" for a specific folder, which can be visualized and edited afterwards (right-click > Memo for this folder). -* *Folder Password* \- Password-protect a particular tab (right-click > Set Password...). -* *Picture Preview* \- Preview image files simply by hovering on them with the mouse. -* *Groups* \- It is possible to group more tabs together by adding them to groups (right-click > Add to Group > [Group Name]) which can be configured via the QT TabBar option dialog. -* *Keyboard Shortcuts* \- Open the folder in which you unzipped QT TabBar and run QTShortcutKeyEditor.exe and enable as many as you like (they are too many to list hered), the possibilities are endless. - -h3. Customizing Toolbars - -Windows Explorer allows users to choose the buttons which will be displayed in the *Standar Buttons* toolbar. To do so, proceed as follows: - -# If necessary, enable the Standard Buttons toolbar by selecting _View > Toolbars > Standard Buttons_ from the Explorer menu. -# Select _View > Toolbars > Customize_ from the Explorer menu. -# Choose the buttons you want to display. - -I picked the following: - -!=/files/standard_explorer_buttons.gif! - -i.e.: Up , Refresh, Search, Folders, History, Favorites, Undo, Delete, Cut, Copy, Paste, Properties, View, Map Drive and Disconnect. It's really up to you what you choose really. -I placed this toolbar right under the menu, on the top-left side. - -!>/files/tabbar_buttons.gif! - -Right next to it I placed some of the buttons available for *QT TabBar*: - -* Groups \- Load an existing tab group (configurable in the options) -* Recently Closed \- open recently-closed tabs -* Applications \- run custom applications (configurable in the options) -* Close \- Close current tab -* Lock \- Lock current tab -* Topmost \- Force explorer to stay on top of other windows - -Then I decided to enable the *Links* Explorer toolbar, which can be configured to display bookarks and shortcuts placed in the Favorites > Links folder. As shortcuts, I dragged each drive available on my system and voilà: poor man's Drive Toolbar! Unfortunately, unlike in the _proper_ drive toolbars offered by alternative file managers, all drive shortcuts will remain there (with a red question mark) even when the drive is not connected to the system. I can live with that. - -Right to the address bar (we're going to substitute it in the next section though), I decided to place *QT ToolBar 2*, which is available - hear, hear - after installing the QT ToolVar 2 extension. -At first it looks like a search filter toolbar, and yes, it can be used for this _as well_ Just type .jpg in the search box and it will show only the JPG files in the current folder. Easy enough. - -!</files/toolbar2.gif! - -Of course there's (much) more to it. A _search helper_ is provided (click the little arrow pointing downwards at the end of the toolbar and select Search Helper) to perform more complex searches: - -!=/files/toolbar2_search.gif! - -Additionally, ToolBar allows you to display a handy copy file name/path button and up to two buttons to access two applications you use frequently. To configure them select _Option_ from the dropdown menu accessible at the end of the toolbar, and configure your applications like this: - -!=/files/toolbar2_apps.gif! - -I choose the Command Prompt and the A43 file manager. The cool thing is that you can enable the "arguments for user application" and the the file path (if a file is selected) or the folder path will be passed automatically to the application, so my A43 file manage will open in the current folder. If you want to have more than two custom applications at your fingertips, all you have to do is to configure as many as you like in the Options tab of QT TabBar, and they'll become available via the Applications button. - -Two little utilities can also be used through QT TabBar 2, _MD5_, which instantly calculates the MD5 checksum of the selected file: - -!=/files/toolbar2_md5.gif! - -and _Folder Analyze_, which finds out the size of the current folder and how it is distributed across folders and files. A bit like a little "WinDirStat":windirstat.info but for the current folder only. It looks like this: - -!=/files/toolbar2_folder.gif! - -h3. Navigation Improvements - -Is there any way to make navigation through folder easier in Windows Explorer? Yep, more than one: - -h4. Breadcrumbs - -Vista offers a "Breadcrumb Bar":http://www.zdnet.com.au/insight/software/soa/Investigating-Windows-Vista-s-breadcrumb-bar-/0,139023769,139218189,00.htm, and XP doesn't. Quizo fixed it of course, with his *QT Address Bar*, which brings breadcrumbs navigation to Windows XP. Use it as an Explorer address bar replacement. By default breadcrumbs are displayed: - -!=/files/address-bar1.gif! - -...allowing you to navigate through your folder three within submenus without changing the current directory. Clicking it toggles the standard path: - -!=/files/address-bar2.gif! - -A nice thing to have. - -h4. Take back your Favorites! - -I don't use IE, I use Firefox, Opera, even Safari sometimes, but not IE unless I'm forced to do so. Hence I _hardly ever_ used Internet Explorer's Favorites, an I almost forgot about it, until I decided to begin tweaking Windows Explorer, and I (re-)discovered that Favorites are shared between the two... What's that got to do with anything? Well, you can simply put Favorites to good use and use them to store _only_ Windows Explorer folders. - -Simple and effective: click the Favorites button in the toolbar, they'll be loaded in a sidebar on the left, then simply drag a folder to QT TabBar and you'll get there. - -h4. Wormholes, anyone? - -Finally, *NTFS Link Shell Extension* does something totally different altogether: it can be used to create hardlinks (a bit like Unix symlinks, but for NTFS drives only) junctions and symbolic links (Vista only). For an explanation of what each object is, refer to the explanations provided on the "shell extension homepage":http://schinagl.priv.at/nt/hardlinkshellext/hardlinkshellext.html#hardlinks. For our purposes, we'll just use junctions now: - -bq."[...] Junctions are wormholes in the tree structure of a directed graph. By browsing a Junction a maybe far distant location in the file system is made available. Modifying, Creating, Renaming and Deleting files within a junction tree structure operates at the junction target, i.e. if you delete a file in a Junction it is deleted at the original location. [...]" - -Consider the following example. - -!>/files/junction.gif! - -1) Create a directory called "Gateway" in C:\. -2) With NTFS Link Shell Extension installed, right-click a directory "far, far away", on any of your NTFS drives, for example D:\My\Very\Long\Path\MyDirectory, and select "Pick Link Source". -3) Go back in your Gateway folder, right-click and select "Drop As > Junction". A folder with a small chain overlay will be created. -4) You will now be able to access all the contents in D:\My\Very\Long\Path\MyDirectory directly from C:\Gateway. - -*Important* - No, creating a shortcut is _not_ the same thing. the path C:\Gateway\MyDirectory is an actual _valid path_, i.e. you can use it to attach files to emails, and going up one level in C:\Gateway\MyDirectory will take you simply to C:\Gateway\, _not_ to D:\My\Very\Long\Path\. - -Both at home and at work, I use a "Gateway" folder containing junctions leading to commonly-accessed directories, and this speeds up navigations a lot. Just remember to delete junctions "properly" (right-click > Delete Junction), not like an ordinary directory... ;-) - -h3. De-cluttering the Context Menus - -Right now our Windows Explorer interface has been streamlined, folder navigation is easier, but there's still room for improvement. Where? Well, in the contex menus of course. -I spent ages trying to figure out an easy way to remove unnecessary or unwanted entries from the menus which appears on a right-click. Yes, they can be removed by fiddling with the Windows Registry, but that's not exactly user-friendly, is it? Now there's an easy alternative: *FileMenu Tools*. - -This nifty little utility allows you to remove rubbish from your context menus and add new entries as well. Entries are grouped by file type and can be enabled or disabled with a single click. Unfortunately I was not able to disabe some of them, probably due to restriction on my computer at work. - -!>/files/filemenu_tools.gif! - -Once the rubbish is gone, perhaps you can even evaluate the possibility to add some more. I chose to enable just _Attributes_ and _Advanced Renamer_, but there are many more predefined commands (each with its own pretty icon) you can choose from: - -* Synchronize Folders -* Extended Delete -* Find And Replace -* Delete Locked File -* Delete and no move to Recycle Bin -* Change Icon -* Run with Arguments -* Command Line From Here -* Split/Join File -* Copy/Move to... -* Copy Name/PAth/Content -* Change Time -* Register/Unregister DLL -* Create new folder - -Something missing? Well, you can always create your own entry, if you like! - - -h3. Conclusion - +If you asked me what file manager I used on Windows, up to a month ago I'd have answered something like: "A43":http://www.primitus.us/a43/ or "CubicExplorer":http://www.cubicreality.com/, for sure _anything but Windows Explorer_. +Well, it turns out that I had to change my mind after all... + +There's a multitude of "Explorer Replacements" which aim to be more feature-rich, more user-friendly, less bloated than Bill's favorite, and I indeed tried quite a few of them, mostly the free ones of course. + +The only problem is that whenever I got close to choose "the one", I noticed that there always was one or two features missing somewhere, which were present in another and vice versa. Additionally, to be totally honest, the level of integration with Windows and other applications was never _complete_. + +These are a few stupid, silly things which tend to be lacking or at least are not 100% functioning \- not in all the file managers I tried, but at least in some: + +* Environment variables integration \- Alternative file managers normally are not able to parse Windows environment variables. +* Icon overlays \- Some file managers can't render Subversion's icon overlays. +* Strange context menus \- Sometimes right-clicking on a file or a directory may not open the standard Explorer context menu +* Open Folder \- Third-party application allowing you to open a folder, will always open it through Windows Explorer +* auto complete address bar.... +* Special Folders \- Some special folders (e.g. Control Panel) are now accessible using alternative file manager, but others may not (e.g. Network Connections). At any rate, typing "Control Panel" will _not_ open the Control Panel in an alternative file manager. + +_What about trying to "patch" Windows Explorer instead of using another program altogether?_ + +I never really thought of that until "LifeHacker":http://lifehacker.com/software/featured-windows-download/add-tabs-to-windows-explorer-with-qt-tabbar-260926.php featured the QT TabBar shell extension by "Quizo":http://members.at.infoseek.co.jp/Quizo/freeware/indexEn.html. That was my epiphany: I immediately thought I was going to "patch" Windows Explorer using a few really useful (and free, of course) Windows Shell Extensions. + +Here's _my_ file manager now: + +!/files/tweaked_explorer.jpg! + +Yes, it is Windows Explorer, with just a few addons: + +* "QT TabBar":http://members.at.infoseek.co.jp/Quizo/freeware/indexEn.html#qttab (Requires .NET framework 2.0) +* "QT Address Bar":http://members.at.infoseek.co.jp/Quizo/freeware/indexEn.html#qtadr (Requires .NET framework 2.0) +* "QU ToolBar 2":http://members.at.infoseek.co.jp/Quizo/freeware/indexEn.html#qtt2 (Requires .NET framework 2.0) +* "NTFS Link Shell Extension":http://schinagl.priv.at/nt/hardlinkshellext/hardlinkshellext.htm +* "FileMenu Tools":http://www.lopesoft.com/en/fmtools/info.htmlh3. Explorer Tabs + +For an instant gratification, download and install QT TabBar first, logoff and logon again for the changes to take effect (or install all the other extensions first, otherwise you'll have to re-logon after installing nearly each one). As the name implies, this will add tabs to Windows Explorer, just the way you expect them to be: clean, stable and really smart. + +!=/files/tabs.gif! + +After the installation, right-click anywhere in an existing window toolbar and enable the *QT Tab Standard Buttons* and voil&aacute;, a the tab bar will appear. You can click CTRL+N a few times to open new tabs. Take your time to position QT TabBar wherever is more convenient for you. + +Whenever you're ready, take your time to configure QT TabBar (right-click on it and choose "Options") General options: + +!=/files/tabbar_general.gif! + +...and at least the Window options: + +!=/files/tabbar_window.gif! + +*How do you create tabs?* There are many different ways to do it, choose whatever is best for you: + +* CTRL+N keyboard shortcut +* Drag and drop a folder or a shortcut on QT TabBar - Even from other applications! +* Right click on an tab and choose "Clone this" + +Other features? Sure, there's plenty more, e.g.: + +* *Single Instance* \- By enabling the appropriate option, you'll only have a single instance of Windows explorer, everything will be opened in new tabs. A must. +* *Rearrange tabs* \- Tabs can be rearranged by dragging and dropping. +* *Lock/Unlock* \- Lock a tab (right-click > Lock) to avoid closing it accidentally. +* *Folder Memo* \- It is possible to set a "folder memo" for a specific folder, which can be visualized and edited afterwards (right-click > Memo for this folder). +* *Folder Password* \- Password-protect a particular tab (right-click > Set Password...). +* *Picture Preview* \- Preview image files simply by hovering on them with the mouse. +* *Groups* \- It is possible to group more tabs together by adding them to groups (right-click > Add to Group > [Group Name]) which can be configured via the QT TabBar option dialog. +* *Keyboard Shortcuts* \- Open the folder in which you unzipped QT TabBar and run QTShortcutKeyEditor.exe and enable as many as you like (they are too many to list hered), the possibilities are endless. + +h3. Customizing Toolbars + +Windows Explorer allows users to choose the buttons which will be displayed in the *Standar Buttons* toolbar. To do so, proceed as follows: + +# If necessary, enable the Standard Buttons toolbar by selecting _View > Toolbars > Standard Buttons_ from the Explorer menu. +# Select _View > Toolbars > Customize_ from the Explorer menu. +# Choose the buttons you want to display. + +I picked the following: + +!=/files/standard_explorer_buttons.gif! + +i.e.: Up , Refresh, Search, Folders, History, Favorites, Undo, Delete, Cut, Copy, Paste, Properties, View, Map Drive and Disconnect. It's really up to you what you choose really. +I placed this toolbar right under the menu, on the top-left side. + +!>/files/tabbar_buttons.gif! + +Right next to it I placed some of the buttons available for *QT TabBar*: + +* Groups \- Load an existing tab group (configurable in the options) +* Recently Closed \- open recently-closed tabs +* Applications \- run custom applications (configurable in the options) +* Close \- Close current tab +* Lock \- Lock current tab +* Topmost \- Force explorer to stay on top of other windows + +Then I decided to enable the *Links* Explorer toolbar, which can be configured to display bookarks and shortcuts placed in the Favorites > Links folder. As shortcuts, I dragged each drive available on my system and voilà: poor man's Drive Toolbar! Unfortunately, unlike in the _proper_ drive toolbars offered by alternative file managers, all drive shortcuts will remain there (with a red question mark) even when the drive is not connected to the system. I can live with that. + +Right to the address bar (we're going to substitute it in the next section though), I decided to place *QT ToolBar 2*, which is available - hear, hear - after installing the QT ToolVar 2 extension. +At first it looks like a search filter toolbar, and yes, it can be used for this _as well_ Just type .jpg in the search box and it will show only the JPG files in the current folder. Easy enough. + +!</files/toolbar2.gif! + +Of course there's (much) more to it. A _search helper_ is provided (click the little arrow pointing downwards at the end of the toolbar and select Search Helper) to perform more complex searches: + +!=/files/toolbar2_search.gif! + +Additionally, ToolBar allows you to display a handy copy file name/path button and up to two buttons to access two applications you use frequently. To configure them select _Option_ from the dropdown menu accessible at the end of the toolbar, and configure your applications like this: + +!=/files/toolbar2_apps.gif! + +I choose the Command Prompt and the A43 file manager. The cool thing is that you can enable the "arguments for user application" and the the file path (if a file is selected) or the folder path will be passed automatically to the application, so my A43 file manage will open in the current folder. If you want to have more than two custom applications at your fingertips, all you have to do is to configure as many as you like in the Options tab of QT TabBar, and they'll become available via the Applications button. + +Two little utilities can also be used through QT TabBar 2, _MD5_, which instantly calculates the MD5 checksum of the selected file: + +!=/files/toolbar2_md5.gif! + +and _Folder Analyze_, which finds out the size of the current folder and how it is distributed across folders and files. A bit like a little "WinDirStat":windirstat.info but for the current folder only. It looks like this: + +!=/files/toolbar2_folder.gif! + +h3. Navigation Improvements + +Is there any way to make navigation through folder easier in Windows Explorer? Yep, more than one: + +h4. Breadcrumbs + +Vista offers a "Breadcrumb Bar":http://www.zdnet.com.au/insight/software/soa/Investigating-Windows-Vista-s-breadcrumb-bar-/0,139023769,139218189,00.htm, and XP doesn't. Quizo fixed it of course, with his *QT Address Bar*, which brings breadcrumbs navigation to Windows XP. Use it as an Explorer address bar replacement. By default breadcrumbs are displayed: + +!=/files/address-bar1.gif! + +...allowing you to navigate through your folder three within submenus without changing the current directory. Clicking it toggles the standard path: + +!=/files/address-bar2.gif! + +A nice thing to have. + +h4. Take back your Favorites! + +I don't use IE, I use Firefox, Opera, even Safari sometimes, but not IE unless I'm forced to do so. Hence I _hardly ever_ used Internet Explorer's Favorites, an I almost forgot about it, until I decided to begin tweaking Windows Explorer, and I (re-)discovered that Favorites are shared between the two... What's that got to do with anything? Well, you can simply put Favorites to good use and use them to store _only_ Windows Explorer folders. + +Simple and effective: click the Favorites button in the toolbar, they'll be loaded in a sidebar on the left, then simply drag a folder to QT TabBar and you'll get there. + +h4. Wormholes, anyone? + +Finally, *NTFS Link Shell Extension* does something totally different altogether: it can be used to create hardlinks (a bit like Unix symlinks, but for NTFS drives only) junctions and symbolic links (Vista only). For an explanation of what each object is, refer to the explanations provided on the "shell extension homepage":http://schinagl.priv.at/nt/hardlinkshellext/hardlinkshellext.html#hardlinks. For our purposes, we'll just use junctions now: + +bq."[...] Junctions are wormholes in the tree structure of a directed graph. By browsing a Junction a maybe far distant location in the file system is made available. Modifying, Creating, Renaming and Deleting files within a junction tree structure operates at the junction target, i.e. if you delete a file in a Junction it is deleted at the original location. [...]" + +Consider the following example. + +!>/files/junction.gif! + +1) Create a directory called "Gateway" in C:\. +2) With NTFS Link Shell Extension installed, right-click a directory "far, far away", on any of your NTFS drives, for example D:\My\Very\Long\Path\MyDirectory, and select "Pick Link Source". +3) Go back in your Gateway folder, right-click and select "Drop As > Junction". A folder with a small chain overlay will be created. +4) You will now be able to access all the contents in D:\My\Very\Long\Path\MyDirectory directly from C:\Gateway. + +*Important* - No, creating a shortcut is _not_ the same thing. the path C:\Gateway\MyDirectory is an actual _valid path_, i.e. you can use it to attach files to emails, and going up one level in C:\Gateway\MyDirectory will take you simply to C:\Gateway\, _not_ to D:\My\Very\Long\Path\. + +Both at home and at work, I use a "Gateway" folder containing junctions leading to commonly-accessed directories, and this speeds up navigations a lot. Just remember to delete junctions "properly" (right-click > Delete Junction), not like an ordinary directory... ;-) + +h3. De-cluttering the Context Menus + +Right now our Windows Explorer interface has been streamlined, folder navigation is easier, but there's still room for improvement. Where? Well, in the contex menus of course. +I spent ages trying to figure out an easy way to remove unnecessary or unwanted entries from the menus which appears on a right-click. Yes, they can be removed by fiddling with the Windows Registry, but that's not exactly user-friendly, is it? Now there's an easy alternative: *FileMenu Tools*. + +This nifty little utility allows you to remove rubbish from your context menus and add new entries as well. Entries are grouped by file type and can be enabled or disabled with a single click. Unfortunately I was not able to disabe some of them, probably due to restriction on my computer at work. + +!>/files/filemenu_tools.gif! + +Once the rubbish is gone, perhaps you can even evaluate the possibility to add some more. I chose to enable just _Attributes_ and _Advanced Renamer_, but there are many more predefined commands (each with its own pretty icon) you can choose from: + +* Synchronize Folders +* Extended Delete +* Find And Replace +* Delete Locked File +* Delete and no move to Recycle Bin +* Change Icon +* Run with Arguments +* Command Line From Here +* Split/Join File +* Copy/Move to... +* Copy Name/PAth/Content +* Change Time +* Register/Unregister DLL +* Create new folder + +Something missing? Well, you can always create your own entry, if you like! + + +h3. Conclusion + I think that's enough for you to give Windows Explorer another shot \- or at least it was enough for me anyway. Be aware that there are and hopefully there will be more Windows shell extensions able to do neat things: "7-Zip":http://www.7-zip.org/, "Notepad++":http://notepad-plus.sourceforge.net/uk/site.htm and "Cream":http://cream.sourceforge.net/ all add very useful context menus, and don't forget "TortoiseSVN":http://tortoisesvn.tigris.org/, if you are a Windows-based developers (yes, they do exist).
M content/articles/web-promotion.bbcodecontent/articles/web-promotion.bbcode

@@ -8,105 +8,105 @@

date: 2005-12-09 14:08:27 +01:00 tags: - internet -- web-development +- webdevelopment type: article toc: true ----- -Everybody from magazines to canned pasta sellers wants a website to promote their business, but you need to promote your site before you promote your products or services through it. In Part 1 of this article, I will explain some of the basics of promoting a website, and show you how to implement a cost-free strategy to get the search engine placement you need to promote your website.[b]The Necessity of Website Promotion[/b] -As the World Wide Web kept growing over the years, people soon realised that keeping updated [i]list[/i]s of all the available pages on the Net was an impossible and pointless job. It became necessary to develop a new way to easily find and access the massive amount of content on the Web, and that is when [i]search engines[/i] became a reality. - -Everyone should know the [i]legend[/i] of the two lads from Stanford University who became multi-millionaires in a few years after developing and successfully marketing their easy-to-use, ultra-powerful search engine called Google. - -After it became clear that the Web was going to be (quite literally) dominated by search engines, IT professionals started developing strategies to cause their site to appearon the first page of search results. These strategies and techniques soon became known as [i]Search Engine Optimizations[/i] (SEO). Call it ?science?, ?magic? or simply a way to make money, SEO is a business, and so-called "SEO experts" often [i]do[/i] get a lot of cash just to take care of your website. - -Whether you like it or not, any website must be promoted in order to get visitors; some sort of marketing strategy [i]is[/i] necessary if you want to stand out from the crowd, and even if you just want someone to find your page. - -Now let's assume that you don't want to spend a penny marketing your site, but you still want to be known and noticed among either competitors or friends and get some visitors to your new, exceptional (for you) and extremely innovative (to your eyes) website. Is it possible to do this, or do you need to shell out some money to an SEO expert' - -I think that a zero-cost marketing strategy does exist, and I tried to put one into practice myself. I achieved relatively good results without spending anything but time. Patience and dedication are the keys to success in a zero-cost method: if you don't have those two qualities, you either need to start working on them or find a job to make money to spend for a [i]proper[/i] (but sometimes risky) marketing campaign. - - -[b]1. Plan your website[/b] - -Don't skip this part, because it's the most important step in the whole process: you have to come up with some clever ideas to make your site look unique and original! - -[i]2. Have a look around[/i] - -[i]?Well, if I were able to do [b]that[/b] I wouldn't need to promote my site at all, and I wouldn't be reading this article?[/i] - -This is true to some extent - coming up with an original idea nowadays is difficult if not impossible. [i]Offering something different[/i] or [i]presenting it in a different way[/i] can be done, as can offering the same thing [i]but better[/i] (that's what Google did). Once again, you need patience, dedication, and the belief that it is worth it. - -The best way to decide if it's worth creating a new website is to study your potential competitors, i.e. any other website that deals with the same stuff. Study the way these websites are created, list their weaknesses and strengths, and after comparing a few of them, start thinking about what [i]you[/i] can do to create a [i]better[/i] website. - -Then, [i]objectively[/i] evaluate your idea and decide if you have the ability to do it, what risks are involved, and how long it would take to create. After all this brainstorming, if you still want to spend time on your project, you can go on; if not, [i]this is your last chance to stop and think about something completely different[/i] - it doesn't mean you?re a coward, it just means you are capable of understanding your limits, which is something many people have trouble doing these days. - -[i]4. Create an identity[/i] -Now it's time to think about a proper [i]identity[/i] for your site, and this involves the following steps: - -[list] -[*]Define your objectives and purposes -[*]Define the audience of your site -[*]Think about a good name for your site -[*]Create some graphics and a logo -[*]Create slogans and descriptions -[/list] - -Of course, defining the objectives and purposes of your site is the most important thing on that entire list. Again, you have to be honest with yourself and not be afraid to admit your limitations: if you find you can't do something you?d like to, try to imagine your site without that particular feature, and if there?s still a hope of success, go ahead. If not, try looking at your ideas from a different point of view. - -A different point of view could mean a different audience: if you see that there?s absolutely no chance of selling canned pasta to Italians,you might have better luck with the English. Audience is extremely important: it's a factor which influences both the content and the design of your site, as well as the features offered. Doing something the way [i]you[/i] like it doesn't mean other people are going to like it, and for people to want to come to your site, they have to like it! - -Now, think about a good name for your site: it must be easy to remember, be somehow related to what you do, and most importantly, the domain must be available. Check on that before you commit to a particular name, or you might be in for a shock. There are plenty of places on the Net that can tell you if a particular domain with a particular TLD is available[1]. - -Next, I think you should come up with a logo, though some people say it's premature to think about graphics at this stage. It's probably true, but I find that having a visual representation of your goal can often be a morale booster that will help you to keep going. - -The last step is a slogan or a description. This is an important part of creating your site's identity. It should be honest, yet promising: it has to stick in the consumer's mind. How you do this is entirely up to you, and it can also be the most time-consuming step of the process - it will probably take you a few tries to come up with something you really like. - - -[i]4. Features, Services and Architecture[/i] - -Now it's time to do something less idealistic and slightly more practical: you should start listing the features and services your site will offer, and start thinking about how to present them. Don't plan on doing too many things or implementing unnecesssary features on your site - having a forum, a newsletter [i]and[/i] a blog on CannedPasta.com could be a bit too much, whereas having a gallery and a Testimonials area could be a much better use of resources. In short, add features because they can be useful, not because it's trendy to offer them. - -After you decide on your features, you have to think about the [i]architecture[/i] of your site, or [i]how[/i] people are going to find the services you offer on your site. Menus and navigation bars are a must, but keep them relatively uncluttered and easy to use: you must be able to grab the visitor?s attention and communicate what you do in the first 10 seconds; then, if the visitor remains on the site for another minute or two, he must be convinced by then that you are selling the best canned pasta he?s ever tried and cheaper than anyone else. This is accomplished mainly by putting links to relevant pages in at the right places: if a visitor can't find your content, he?ll never be persuaded to try your product! - - -[b]Site Development[/b] - -It's now time to start coding your site. Whether you do it yourself or have someone do it for you, the web developer should follow some important guidelines when coding the site. I will only touch on them very briefly. - -[i]Make it simple[/i] -don't do something unless you have to. The layout of your site must be decided according to the site?s purpose - that's why movie sites have a lot of graphics, Flash[3] and other eye-catching things, and why forums and news sites don't need that stuff at all. Show your products and describe them with the minimum amount of content; people who want to buy canned pasta normally don't want to know the history of it: they just want to see if it's worth buying it. - -[i]Cleaner is better[/i] -the code of your site should be clean,support web standards, and contain no errors. Although code validation[4] is not critical to acquire good placement in search engines, it can help to a certain extent. - -For the sake of code clarity, I normally recommend not using deprecated tags or and its attributes. Avoiding using tags attributes altogether, if possible: CSS[5] was created for a reason, and that's for making your life easier. A discussion of CSS is beyond the scope of this article, but I have included a reference link[6] for you to learn more about it. - -[i]Fundamentals of an SEO Strategy[/i] -[list] -[*]Always provide an ALT attribute for your image (crawlers[7] will process that instead of the image) -[*]Always provide a relevant TITLE attribute to your links -[*]Always use properly formatted h1, h2, etc. tags for your titles. -[*]The tag in the of every page should be different each time and either reflect the page?s content or provide a proper title for it. It should also be one of the first tags on the page. -[*]Always remember to provide an icon for your site (favicon[8]) -[*]Don't forget a valid robots.txt[9] file in the root directory of your site. -[/list] - -[i] Meta Tags[/i] -Although Google doesn't seem to care about them any more, you should always include some meta tags in every page, particularly for keywords and the site description. Ideally, these should vary according to the page's content, contain not more than 10-15 relevant keywords, and give a brief yet complete description of the page. - -[i] Search Engine Friendly (SEF) URLs[/i] -Even though all the major search engines can process dynamic URLs correctly, a URL like http://www.cannedpasta/products/spaghetti.php is much better than something like http://www.cannedpasta.com/index.php?a=show&cat=1256&id=234. The first one will not only be crawled by ANY search engine with no problems at all, but more importantly, users will remember it. If your site is dynamic (as are the majority of websites these days) and your pages are therefore automatically generated, you could try using mod_rewrite to transform complicated URLs into their simplified but more effective counterparts[10]. - -That's all for this part of the article. Next time I?ll discuss the final phases of your site?s zero-cost promotion campaign: website promotion, website maintenance, and what to do once you get things going. - - -[b]Notes, related links, and further reading:[/b] - -[1]You can do so here, for example: [url]http://www.mydomain.com[/url] -[2]The domain is fictitious and used as an example -[3]Macromedia Flash: [url] http://www.macromedia.com/software/flash/[/url] -[4]W3C validator: [url] http://validator.w3.org/ [/url] -[5]CSS: [url] http://www.w3.org/Style/CSS/ [/url] -[6]Official CSS tutorial: [url] http://www.w3schools.com/css/default.asp [/url] -[7]Web crawler, Wikipedia page: [url] http://en.wikipedia.org/wiki/Web_crawler[/url] -[8]Favicon, Wikipedia page: [url] http://en.wikipedia.org/wiki/Favicon[/url] -[9]Robot.txt tutorial: [url] http://www.searchengineworld.com/robots/robots_tutorial.htm[/url] +Everybody from magazines to canned pasta sellers wants a website to promote their business, but you need to promote your site before you promote your products or services through it. In Part 1 of this article, I will explain some of the basics of promoting a website, and show you how to implement a cost-free strategy to get the search engine placement you need to promote your website.[b]The Necessity of Website Promotion[/b] +As the World Wide Web kept growing over the years, people soon realised that keeping updated [i]list[/i]s of all the available pages on the Net was an impossible and pointless job. It became necessary to develop a new way to easily find and access the massive amount of content on the Web, and that is when [i]search engines[/i] became a reality. + +Everyone should know the [i]legend[/i] of the two lads from Stanford University who became multi-millionaires in a few years after developing and successfully marketing their easy-to-use, ultra-powerful search engine called Google. + +After it became clear that the Web was going to be (quite literally) dominated by search engines, IT professionals started developing strategies to cause their site to appearon the first page of search results. These strategies and techniques soon became known as [i]Search Engine Optimizations[/i] (SEO). Call it ?science?, ?magic? or simply a way to make money, SEO is a business, and so-called "SEO experts" often [i]do[/i] get a lot of cash just to take care of your website. + +Whether you like it or not, any website must be promoted in order to get visitors; some sort of marketing strategy [i]is[/i] necessary if you want to stand out from the crowd, and even if you just want someone to find your page. + +Now let's assume that you don't want to spend a penny marketing your site, but you still want to be known and noticed among either competitors or friends and get some visitors to your new, exceptional (for you) and extremely innovative (to your eyes) website. Is it possible to do this, or do you need to shell out some money to an SEO expert' + +I think that a zero-cost marketing strategy does exist, and I tried to put one into practice myself. I achieved relatively good results without spending anything but time. Patience and dedication are the keys to success in a zero-cost method: if you don't have those two qualities, you either need to start working on them or find a job to make money to spend for a [i]proper[/i] (but sometimes risky) marketing campaign. + + +[b]1. Plan your website[/b] + +Don't skip this part, because it's the most important step in the whole process: you have to come up with some clever ideas to make your site look unique and original! + +[i]2. Have a look around[/i] + +[i]?Well, if I were able to do [b]that[/b] I wouldn't need to promote my site at all, and I wouldn't be reading this article?[/i] + +This is true to some extent - coming up with an original idea nowadays is difficult if not impossible. [i]Offering something different[/i] or [i]presenting it in a different way[/i] can be done, as can offering the same thing [i]but better[/i] (that's what Google did). Once again, you need patience, dedication, and the belief that it is worth it. + +The best way to decide if it's worth creating a new website is to study your potential competitors, i.e. any other website that deals with the same stuff. Study the way these websites are created, list their weaknesses and strengths, and after comparing a few of them, start thinking about what [i]you[/i] can do to create a [i]better[/i] website. + +Then, [i]objectively[/i] evaluate your idea and decide if you have the ability to do it, what risks are involved, and how long it would take to create. After all this brainstorming, if you still want to spend time on your project, you can go on; if not, [i]this is your last chance to stop and think about something completely different[/i] - it doesn't mean you?re a coward, it just means you are capable of understanding your limits, which is something many people have trouble doing these days. + +[i]4. Create an identity[/i] +Now it's time to think about a proper [i]identity[/i] for your site, and this involves the following steps: + +[list] +[*]Define your objectives and purposes +[*]Define the audience of your site +[*]Think about a good name for your site +[*]Create some graphics and a logo +[*]Create slogans and descriptions +[/list] + +Of course, defining the objectives and purposes of your site is the most important thing on that entire list. Again, you have to be honest with yourself and not be afraid to admit your limitations: if you find you can't do something you?d like to, try to imagine your site without that particular feature, and if there?s still a hope of success, go ahead. If not, try looking at your ideas from a different point of view. + +A different point of view could mean a different audience: if you see that there?s absolutely no chance of selling canned pasta to Italians,you might have better luck with the English. Audience is extremely important: it's a factor which influences both the content and the design of your site, as well as the features offered. Doing something the way [i]you[/i] like it doesn't mean other people are going to like it, and for people to want to come to your site, they have to like it! + +Now, think about a good name for your site: it must be easy to remember, be somehow related to what you do, and most importantly, the domain must be available. Check on that before you commit to a particular name, or you might be in for a shock. There are plenty of places on the Net that can tell you if a particular domain with a particular TLD is available[1]. + +Next, I think you should come up with a logo, though some people say it's premature to think about graphics at this stage. It's probably true, but I find that having a visual representation of your goal can often be a morale booster that will help you to keep going. + +The last step is a slogan or a description. This is an important part of creating your site's identity. It should be honest, yet promising: it has to stick in the consumer's mind. How you do this is entirely up to you, and it can also be the most time-consuming step of the process - it will probably take you a few tries to come up with something you really like. + + +[i]4. Features, Services and Architecture[/i] + +Now it's time to do something less idealistic and slightly more practical: you should start listing the features and services your site will offer, and start thinking about how to present them. Don't plan on doing too many things or implementing unnecesssary features on your site - having a forum, a newsletter [i]and[/i] a blog on CannedPasta.com could be a bit too much, whereas having a gallery and a Testimonials area could be a much better use of resources. In short, add features because they can be useful, not because it's trendy to offer them. + +After you decide on your features, you have to think about the [i]architecture[/i] of your site, or [i]how[/i] people are going to find the services you offer on your site. Menus and navigation bars are a must, but keep them relatively uncluttered and easy to use: you must be able to grab the visitor?s attention and communicate what you do in the first 10 seconds; then, if the visitor remains on the site for another minute or two, he must be convinced by then that you are selling the best canned pasta he?s ever tried and cheaper than anyone else. This is accomplished mainly by putting links to relevant pages in at the right places: if a visitor can't find your content, he?ll never be persuaded to try your product! + + +[b]Site Development[/b] + +It's now time to start coding your site. Whether you do it yourself or have someone do it for you, the web developer should follow some important guidelines when coding the site. I will only touch on them very briefly. + +[i]Make it simple[/i] -don't do something unless you have to. The layout of your site must be decided according to the site?s purpose - that's why movie sites have a lot of graphics, Flash[3] and other eye-catching things, and why forums and news sites don't need that stuff at all. Show your products and describe them with the minimum amount of content; people who want to buy canned pasta normally don't want to know the history of it: they just want to see if it's worth buying it. + +[i]Cleaner is better[/i] -the code of your site should be clean,support web standards, and contain no errors. Although code validation[4] is not critical to acquire good placement in search engines, it can help to a certain extent. + +For the sake of code clarity, I normally recommend not using deprecated tags or and its attributes. Avoiding using tags attributes altogether, if possible: CSS[5] was created for a reason, and that's for making your life easier. A discussion of CSS is beyond the scope of this article, but I have included a reference link[6] for you to learn more about it. + +[i]Fundamentals of an SEO Strategy[/i] +[list] +[*]Always provide an ALT attribute for your image (crawlers[7] will process that instead of the image) +[*]Always provide a relevant TITLE attribute to your links +[*]Always use properly formatted h1, h2, etc. tags for your titles. +[*]The tag in the of every page should be different each time and either reflect the page?s content or provide a proper title for it. It should also be one of the first tags on the page. +[*]Always remember to provide an icon for your site (favicon[8]) +[*]Don't forget a valid robots.txt[9] file in the root directory of your site. +[/list] + +[i] Meta Tags[/i] +Although Google doesn't seem to care about them any more, you should always include some meta tags in every page, particularly for keywords and the site description. Ideally, these should vary according to the page's content, contain not more than 10-15 relevant keywords, and give a brief yet complete description of the page. + +[i] Search Engine Friendly (SEF) URLs[/i] +Even though all the major search engines can process dynamic URLs correctly, a URL like http://www.cannedpasta/products/spaghetti.php is much better than something like http://www.cannedpasta.com/index.php?a=show&cat=1256&id=234. The first one will not only be crawled by ANY search engine with no problems at all, but more importantly, users will remember it. If your site is dynamic (as are the majority of websites these days) and your pages are therefore automatically generated, you could try using mod_rewrite to transform complicated URLs into their simplified but more effective counterparts[10]. + +That's all for this part of the article. Next time I?ll discuss the final phases of your site?s zero-cost promotion campaign: website promotion, website maintenance, and what to do once you get things going. + + +[b]Notes, related links, and further reading:[/b] + +[1]You can do so here, for example: [url]http://www.mydomain.com[/url] +[2]The domain is fictitious and used as an example +[3]Macromedia Flash: [url] http://www.macromedia.com/software/flash/[/url] +[4]W3C validator: [url] http://validator.w3.org/ [/url] +[5]CSS: [url] http://www.w3.org/Style/CSS/ [/url] +[6]Official CSS tutorial: [url] http://www.w3schools.com/css/default.asp [/url] +[7]Web crawler, Wikipedia page: [url] http://en.wikipedia.org/wiki/Web_crawler[/url] +[8]Favicon, Wikipedia page: [url] http://en.wikipedia.org/wiki/Favicon[/url] +[9]Robot.txt tutorial: [url] http://www.searchengineworld.com/robots/robots_tutorial.htm[/url] [10]Apache mod_rewrite: [url] http://httpd.apache.org/docs/1.3/mod/mod_rewrite.html [/url]
M content/articles/what-is-ajax.bbcodecontent/articles/what-is-ajax.bbcode

@@ -10,218 +10,218 @@ tags:

- internet - web20 - ajax -- web-development +- webdevelopment type: article toc: true ----- -[i]"The Web is changing. The 30-year-old terminal-like technology it was originally is gradually giving way to new ways of doing things. The power of AJAX allows for rich user interaction without the trouble that has bugged traditional web applications."[/i]This is the introduction to the script.aculo.us[1] website, and regardless your opinion about the so-called AJAX [i]programming technique[/i], they are fundamentally right: the web is changing. AJAX is at least one way to do things in a different way, enhancing - although arguably, in some cases - users' browsing experience. - -[b]Application examples[/b] -What is AJAX then? Nothing too new, but not too old either. I'd define AJAX as the [i]rebirth of Javascript[/i], for example, it's not only Javascript we're talking about. The acronym stands for Asynchronous Javascript And XML and it already gives an idea of the fundamentals of the technology: something build on [i]asynchronous server requests and responses [/i]. This may be clear to coders, but the best way to try explaining this to everyday internet users is showing some famous applications: - -[i]Gmail[2][/i]: The first example? The most famous? The most used? Perhaps. Google aimed to impress both end users and geeks with it's free, long awaited email service. What's so unusual in this webmail application? -[list] -[*]An innovative and intuitive interface, more similar to a desktop application than a traditional webpage. -[*]Rich formatting through an effective, easy-to-use editor. -[*]Online spell checker. -[*]Instant (one click) email tagging, labels, contact groups etc. -[*]Email auto save. -[/list] - -[i]Kiko[3][/i]: This is a very neat online calendar, free to use and customizable. Features include: -[list] -[*]Multiple user/contacts/events administration. -[*]Personalization of the right click menu (it overrides your browser's default behavior). -[*]Drag and drop events across the calendar. -[*]Easily switch through different calendar views without any page refresh. -- [/list] - -[i]Writely[4][/i]: An online word processor. Although it is not as advanced as its desktop's cousins, this is a truly admirable effort to port a desktop application to the web. The service is free for now and it allows users to create, edit, share and export text documents. Among its features there are: -[list] -[*]High degree of document formatting - modify font size, style, colors, alignment, insert images and links etc. -[*]Enhanced exporting options - it can create html documents, Word documents, zip files etc. -[*]Online spell-checker. -[*]Ability to easily share and publish your work. -[/list] - -This list can continue[5], as new "AJAX-powered" applications are created nearly every day. -[quote]AJAX provides the web developer the ability to create web applications that look and feel like applications that run on the desktop. It does this by solving the 'partial update' problem. AJAX makes it possible for a web application to request data from the server (usually in response to a button click or other java script 'event') and change a part of the current page to reflect the result of the query. Prior to AJAX, if the web developer wanted to retrieve any information from the server a full page update was required. This may mean a full page load when the user clicks a help icon, spell checks a document or performs a drag and drop operation that changes data on the server. AJAX solves this problem and opens the door for a host of AJAX-powered web applications -There were some unconventional solutions to this problem prior to AJAX. I have ignored them for the purpose of this article as they were hacky or relied on a feature in a particular browser [/quote] - -[b]How does it work?[/b] -Ajax[7] is fundamentally the union of various technologies - not something new by itself: -[list] -[*] (X)HTML, CSS, etc., used as presentation layer and format the information retrieved by the server: nothing special here. -[*]The XMLHttpRequest[8] object, which allows data exchange between client and server "silently", in an asynchronous way, without the need of refreshing and reloading a whole web page -[*]The Dom Object Model (DOM)[9], a Object-Oriented way to represent and access HTML or XML. -[*]XML and XSLT used for data interchange and manipulation -[/list] - -The magic is undoubtedly in the XMLHttpRequest object, originally invented by Microsoft as an ActiveX object and then made available as a standard Javascript class by Mozilla-based browsers. At least something which [i]seems[/i] to be compatible with [i]most[/i] browsers then. - -A necessary step in any Javascript script using the XMLHttpRequest object would be something like: - -[code] -if (window.XMLHttpRequest) { // Mozilla, Safari, ... - http_request = new XMLHttpRequest(); -} else if (window.ActiveXObject) { // IE - http_request = new ActiveXObject("Microsoft.XMLHTTP"); -} -[/code] - -In order to have an http_request object to use later on which is independent from the browser type. - -Let's now examine an example of elementary Ajax application[10]. The following code is broken into different parts and commented, the uncommented source and a demo is available on degraeve.com[10]. - -For this simple example we need to create a simple server-side script which will be called by our Ajax application. The script can be in any language, this one is in Perl. - -[code] -#!/usr/bin/perl -w -use CGI; - -$query = new CGI; - -$secretword = $query-param('w'); -$remotehost = $query-remote_host(); - -print $query-header; -print "<p>The secret word is <b>$secretword</b> and your IP is <b>$remotehost</b>. - [/code] - -Basically it creates a new CGI object named $query, used to access the parameter which will be passed by our submission form, "w", and get the user's IP address. -The script will then print a the page header and a phrase containing the word entered in our form and the user's IP address. - -And here's the simple Ajax application: - -[code] -<html> -<head> -<title>Simple Ajax Example</title> - -<script language="Javascript"> -[/code] - -[i]Comment: Just the first HTML tags of the page, and the beginning of the script[/i] - -[code] -function xmlhttpPost(strURL) { - var xmlHttpReq = false; - var self = this; - // Mozilla/Safari - if (window.XMLHttpRequest) { - self.xmlHttpReq = new XMLHttpRequest(); - } - // IE - else if (window.ActiveXObject) { - self.xmlHttpReq = new ActiveXObject("Microsoft.XMLHTTP"); - } -[/code] - -[i]Comment: First of all we create a function named xmlhttpPost, which takes the parameter strURL, i.e. the web address of the script we created earlier. In the first part of the function, we create the HTMLHttpRequest object independently of the browser, which in this case is called self.xmlHttpReq. [/i] -[code] - - self.xmlHttpReq.open('POST', strURL, true); - - self.xmlHttpReq.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded'); -[/code] - -[i]Comment: with the method open we initialize the connection, specifying that we want to send a POST request to the page "strURL" and that the connection is asynchronous (true). The third parameter is actually true by default and could have been omitted in this case. -As we want to use the POST method, we need to set the content-type header for our request, in this case "application/x-www-form-urlencoded". [/i] - -[code] - self.xmlHttpReq.onreadystatechange = function() { - if (self.xmlHttpReq.readyState == 4) { - updatepage(self.xmlHttpReq.responseText); - } - } - self.xmlHttpReq.send(getquerystring()); -} -[/code] - - -[i]Comment: This is the crucial part, as we need to send the request and also define the behavior of our application once the response is received. The request is sent using the "send" method, which sends a properly formatted query string (see below), but before that we need to setup a "listener" to monitor what happens to our request. -The readyState variables is updated according to the status of the connection, and can assume the following values: -[list] -[*]0 - Uninitialised -[*]1 - Loading -[*]2 - Loaded -[*]3 - Interactive -[*]4 - Completed -[/list] - -We want to update our page once we are sure that the connection with the script has been established, therefore we setup a listener (onreadystatechange) to update the page via the function update page defined below only if the connection's state is "Completed" (self.xmlHttpReq.readyState == 4). The self.xmlHttpReq.responseText variable which is sent to the update page function contains the response generated by our CGI script. [/i] - -[code] -function getquerystring() { - var form = document.forms['f1']; - var word = form.word.value; - qstr = 'w=' + escape(word); // NOTE: no '?' before querystring - return qstr; -} -[/code] - -[i]Comment: This function simply formats the parameter sent to the script as "w=typedword" where "typedword" is the word typed in the form of our application. [/i] - -[code] -function updatepage(str){ - document.getElementById("result").innerHTML = str; -} -[/code] - -[i]Comment: Finally, this function inserts the response we got from the CGI script into an HTML element with id=result, through the method innerHTML. [/i] - -[code] -</script> -</head> - -<form name="f1"> - <pword: <input name="word" type="text" > - <input value="Go" type="button" >onclick='JavaScript:xmlhttpPost("/cgi-bin/simple-ajax-example.cgi")'</p> - <div id="result"></div> -</form> -</body> -</html> -[/code] - -[i]Comment: This is the final part of the application, which defines our form containing a text field and a submit button. Note that our xmlhttpPost function is called once the button is clicked, through the on click attribute. [/i] - -That's it. -The first reaction after reading so far would probably be "Ajax is not easy at all", well, I never said it was. To create a simple application which just prints something on the screen we had to go through a lot of code, and we could have done something similar with much less hassle. This was just a trivial example, very different from those large scale applications available online. - -There's good news though, there are plenty of frameworks and toolkits which makes life easier for developers interested in using this programming technique. There are in particular various libraries built upon the Prototype[11] framework such as the already mentioned Script.aculo.us[1] and Rico[12] for examples, and various frameworks which integrate Ajax in some way in any server side language, like Ruby on Rails[13] or CakePHP[14], for example. - -[b]Conclusion[/b] -Undoubtedly Ajax can be used to create really powerful and innovative applications, but it shouldn't be abused or mis-used. There are a few things to keep in mind, when developing an Ajax application: -[list] -[*]It requires Javascript to be enable on the client browser, and the developer obviously can't control that -[*]The application may not compatible with all browsers, in particular older browsers will definitely not be able to access it. -[*]It can be too much of a surprise for the user who never used an Ajax application before: it may experience delays in responses, some basic functionalities like the "Back" button might not work as expected etc. -[/list] - -There are actually many more things to consider [15] before even start planning to develop an application, and can basically be summarized as follows: - -[i]"Do not use Ajax in your web application unless you know what you're doing"[/i] - -Luckily, there are a lot of articles and resources[16] out there, waiting for you. - - -[b]Notes and Resources[/b] -[small] -[1] Script.aculo.us AJAX toolkit: [url]http://www.script.aculo.us [/url] -[2] Gmail - Google's online webmail: [url]http://mail.google.com/mail[/url] -[3] Kiko - Online calendar: [url]http://www.kiko.com/[/url] -[4] Writely - Online word processor: [url]http://www.writely.com/[/url] -[5] A venture forth Blog - Top 10 Ajax applications: [url]http://www.aventureforth.com/?p=13[/url] -[6] HTTP - Webopedia entry: [url]http://www.webopedia.com/TERM/H/HTTP.html[/url] -[7] AJAX - Wikipedia Page: [url]http://en.wikipedia.org/wiki/AJAX[/url] -[8] XMLHTTP Wikipedia Page: http://en.wikipedia.org/wiki/XMLHTTP - -[9] Dom Object Model - Wikipedia Page: [url]http://en.wikipedia.org/wiki/Document_Object_Model[/url] -[10] degraeve.com - Simple Ajax Example: [url]http://www.degraeve.com/reference/simple-ajax-example.php[/url] -[11] Prototype Javascript Framework: [url]http://prototype.conio.net/[/url] -[12] Rico open-source Javascript library: [url]http://openrico.org/[/url] -[13] Ruby on Rails: [url]http://www.rubyonrails.org[/url] -[14] CakePHP framework: [url]http://www.cakephp.org[/url] -[15] Alex Bosworth's Weblog: Ajax Mistakes: [url]http://sourcelabs.com/ajb/archives/2005/05/ajax_mistakes.html[/url] -[16] AjaxMatters.com: [url]http://www.ajaxmatters.com/r/welcome[/url] +[i]"The Web is changing. The 30-year-old terminal-like technology it was originally is gradually giving way to new ways of doing things. The power of AJAX allows for rich user interaction without the trouble that has bugged traditional web applications."[/i]This is the introduction to the script.aculo.us[1] website, and regardless your opinion about the so-called AJAX [i]programming technique[/i], they are fundamentally right: the web is changing. AJAX is at least one way to do things in a different way, enhancing - although arguably, in some cases - users' browsing experience. + +[b]Application examples[/b] +What is AJAX then? Nothing too new, but not too old either. I'd define AJAX as the [i]rebirth of Javascript[/i], for example, it's not only Javascript we're talking about. The acronym stands for Asynchronous Javascript And XML and it already gives an idea of the fundamentals of the technology: something build on [i]asynchronous server requests and responses [/i]. This may be clear to coders, but the best way to try explaining this to everyday internet users is showing some famous applications: + +[i]Gmail[2][/i]: The first example? The most famous? The most used? Perhaps. Google aimed to impress both end users and geeks with it's free, long awaited email service. What's so unusual in this webmail application? +[list] +[*]An innovative and intuitive interface, more similar to a desktop application than a traditional webpage. +[*]Rich formatting through an effective, easy-to-use editor. +[*]Online spell checker. +[*]Instant (one click) email tagging, labels, contact groups etc. +[*]Email auto save. +[/list] + +[i]Kiko[3][/i]: This is a very neat online calendar, free to use and customizable. Features include: +[list] +[*]Multiple user/contacts/events administration. +[*]Personalization of the right click menu (it overrides your browser's default behavior). +[*]Drag and drop events across the calendar. +[*]Easily switch through different calendar views without any page refresh. +- [/list] + +[i]Writely[4][/i]: An online word processor. Although it is not as advanced as its desktop's cousins, this is a truly admirable effort to port a desktop application to the web. The service is free for now and it allows users to create, edit, share and export text documents. Among its features there are: +[list] +[*]High degree of document formatting - modify font size, style, colors, alignment, insert images and links etc. +[*]Enhanced exporting options - it can create html documents, Word documents, zip files etc. +[*]Online spell-checker. +[*]Ability to easily share and publish your work. +[/list] + +This list can continue[5], as new "AJAX-powered" applications are created nearly every day. +[quote]AJAX provides the web developer the ability to create web applications that look and feel like applications that run on the desktop. It does this by solving the 'partial update' problem. AJAX makes it possible for a web application to request data from the server (usually in response to a button click or other java script 'event') and change a part of the current page to reflect the result of the query. Prior to AJAX, if the web developer wanted to retrieve any information from the server a full page update was required. This may mean a full page load when the user clicks a help icon, spell checks a document or performs a drag and drop operation that changes data on the server. AJAX solves this problem and opens the door for a host of AJAX-powered web applications +There were some unconventional solutions to this problem prior to AJAX. I have ignored them for the purpose of this article as they were hacky or relied on a feature in a particular browser [/quote] + +[b]How does it work?[/b] +Ajax[7] is fundamentally the union of various technologies - not something new by itself: +[list] +[*] (X)HTML, CSS, etc., used as presentation layer and format the information retrieved by the server: nothing special here. +[*]The XMLHttpRequest[8] object, which allows data exchange between client and server "silently", in an asynchronous way, without the need of refreshing and reloading a whole web page +[*]The Dom Object Model (DOM)[9], a Object-Oriented way to represent and access HTML or XML. +[*]XML and XSLT used for data interchange and manipulation +[/list] + +The magic is undoubtedly in the XMLHttpRequest object, originally invented by Microsoft as an ActiveX object and then made available as a standard Javascript class by Mozilla-based browsers. At least something which [i]seems[/i] to be compatible with [i]most[/i] browsers then. + +A necessary step in any Javascript script using the XMLHttpRequest object would be something like: + +[code] +if (window.XMLHttpRequest) { // Mozilla, Safari, ... + http_request = new XMLHttpRequest(); +} else if (window.ActiveXObject) { // IE + http_request = new ActiveXObject("Microsoft.XMLHTTP"); +} +[/code] + +In order to have an http_request object to use later on which is independent from the browser type. + +Let's now examine an example of elementary Ajax application[10]. The following code is broken into different parts and commented, the uncommented source and a demo is available on degraeve.com[10]. + +For this simple example we need to create a simple server-side script which will be called by our Ajax application. The script can be in any language, this one is in Perl. + +[code] +#!/usr/bin/perl -w +use CGI; + +$query = new CGI; + +$secretword = $query-param('w'); +$remotehost = $query-remote_host(); + +print $query-header; +print "<p>The secret word is <b>$secretword</b> and your IP is <b>$remotehost</b>. + [/code] + +Basically it creates a new CGI object named $query, used to access the parameter which will be passed by our submission form, "w", and get the user's IP address. +The script will then print a the page header and a phrase containing the word entered in our form and the user's IP address. + +And here's the simple Ajax application: + +[code] +<html> +<head> +<title>Simple Ajax Example</title> + +<script language="Javascript"> +[/code] + +[i]Comment: Just the first HTML tags of the page, and the beginning of the script[/i] + +[code] +function xmlhttpPost(strURL) { + var xmlHttpReq = false; + var self = this; + // Mozilla/Safari + if (window.XMLHttpRequest) { + self.xmlHttpReq = new XMLHttpRequest(); + } + // IE + else if (window.ActiveXObject) { + self.xmlHttpReq = new ActiveXObject("Microsoft.XMLHTTP"); + } +[/code] + +[i]Comment: First of all we create a function named xmlhttpPost, which takes the parameter strURL, i.e. the web address of the script we created earlier. In the first part of the function, we create the HTMLHttpRequest object independently of the browser, which in this case is called self.xmlHttpReq. [/i] +[code] + + self.xmlHttpReq.open('POST', strURL, true); + + self.xmlHttpReq.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded'); +[/code] + +[i]Comment: with the method open we initialize the connection, specifying that we want to send a POST request to the page "strURL" and that the connection is asynchronous (true). The third parameter is actually true by default and could have been omitted in this case. +As we want to use the POST method, we need to set the content-type header for our request, in this case "application/x-www-form-urlencoded". [/i] + +[code] + self.xmlHttpReq.onreadystatechange = function() { + if (self.xmlHttpReq.readyState == 4) { + updatepage(self.xmlHttpReq.responseText); + } + } + self.xmlHttpReq.send(getquerystring()); +} +[/code] + + +[i]Comment: This is the crucial part, as we need to send the request and also define the behavior of our application once the response is received. The request is sent using the "send" method, which sends a properly formatted query string (see below), but before that we need to setup a "listener" to monitor what happens to our request. +The readyState variables is updated according to the status of the connection, and can assume the following values: +[list] +[*]0 - Uninitialised +[*]1 - Loading +[*]2 - Loaded +[*]3 - Interactive +[*]4 - Completed +[/list] + +We want to update our page once we are sure that the connection with the script has been established, therefore we setup a listener (onreadystatechange) to update the page via the function update page defined below only if the connection's state is "Completed" (self.xmlHttpReq.readyState == 4). The self.xmlHttpReq.responseText variable which is sent to the update page function contains the response generated by our CGI script. [/i] + +[code] +function getquerystring() { + var form = document.forms['f1']; + var word = form.word.value; + qstr = 'w=' + escape(word); // NOTE: no '?' before querystring + return qstr; +} +[/code] + +[i]Comment: This function simply formats the parameter sent to the script as "w=typedword" where "typedword" is the word typed in the form of our application. [/i] + +[code] +function updatepage(str){ + document.getElementById("result").innerHTML = str; +} +[/code] + +[i]Comment: Finally, this function inserts the response we got from the CGI script into an HTML element with id=result, through the method innerHTML. [/i] + +[code] +</script> +</head> + +<form name="f1"> + <pword: <input name="word" type="text" > + <input value="Go" type="button" >onclick='JavaScript:xmlhttpPost("/cgi-bin/simple-ajax-example.cgi")'</p> + <div id="result"></div> +</form> +</body> +</html> +[/code] + +[i]Comment: This is the final part of the application, which defines our form containing a text field and a submit button. Note that our xmlhttpPost function is called once the button is clicked, through the on click attribute. [/i] + +That's it. +The first reaction after reading so far would probably be "Ajax is not easy at all", well, I never said it was. To create a simple application which just prints something on the screen we had to go through a lot of code, and we could have done something similar with much less hassle. This was just a trivial example, very different from those large scale applications available online. + +There's good news though, there are plenty of frameworks and toolkits which makes life easier for developers interested in using this programming technique. There are in particular various libraries built upon the Prototype[11] framework such as the already mentioned Script.aculo.us[1] and Rico[12] for examples, and various frameworks which integrate Ajax in some way in any server side language, like Ruby on Rails[13] or CakePHP[14], for example. + +[b]Conclusion[/b] +Undoubtedly Ajax can be used to create really powerful and innovative applications, but it shouldn't be abused or mis-used. There are a few things to keep in mind, when developing an Ajax application: +[list] +[*]It requires Javascript to be enable on the client browser, and the developer obviously can't control that +[*]The application may not compatible with all browsers, in particular older browsers will definitely not be able to access it. +[*]It can be too much of a surprise for the user who never used an Ajax application before: it may experience delays in responses, some basic functionalities like the "Back" button might not work as expected etc. +[/list] + +There are actually many more things to consider [15] before even start planning to develop an application, and can basically be summarized as follows: + +[i]"Do not use Ajax in your web application unless you know what you're doing"[/i] + +Luckily, there are a lot of articles and resources[16] out there, waiting for you. + + +[b]Notes and Resources[/b] +[small] +[1] Script.aculo.us AJAX toolkit: [url]http://www.script.aculo.us [/url] +[2] Gmail - Google's online webmail: [url]http://mail.google.com/mail[/url] +[3] Kiko - Online calendar: [url]http://www.kiko.com/[/url] +[4] Writely - Online word processor: [url]http://www.writely.com/[/url] +[5] A venture forth Blog - Top 10 Ajax applications: [url]http://www.aventureforth.com/?p=13[/url] +[6] HTTP - Webopedia entry: [url]http://www.webopedia.com/TERM/H/HTTP.html[/url] +[7] AJAX - Wikipedia Page: [url]http://en.wikipedia.org/wiki/AJAX[/url] +[8] XMLHTTP Wikipedia Page: http://en.wikipedia.org/wiki/XMLHTTP + +[9] Dom Object Model - Wikipedia Page: [url]http://en.wikipedia.org/wiki/Document_Object_Model[/url] +[10] degraeve.com - Simple Ajax Example: [url]http://www.degraeve.com/reference/simple-ajax-example.php[/url] +[11] Prototype Javascript Framework: [url]http://prototype.conio.net/[/url] +[12] Rico open-source Javascript library: [url]http://openrico.org/[/url] +[13] Ruby on Rails: [url]http://www.rubyonrails.org[/url] +[14] CakePHP framework: [url]http://www.cakephp.org[/url] +[15] Alex Bosworth's Weblog: Ajax Mistakes: [url]http://sourcelabs.com/ajb/archives/2005/05/ajax_mistakes.html[/url] +[16] AjaxMatters.com: [url]http://www.ajaxmatters.com/r/welcome[/url] [/small]
A content/tags/ajax.textile

@@ -0,0 +1,16 @@

+----- +:type: page +:permalink: ajax +:title: "Tag: ajax" +:filters_pre: +- erb +- redcloth +----- + +3 items are tagged with _ajax_: + +<% @site.pages.select{|p| p.attributes[:tags] && p.attributes[:tags].include?('ajax')}.sort{|a,b| a.attributes[:date] <=> b.attributes[:date]}.reverse.each do |pg| +dir = (pg.attributes[:type] == 'page') ? '' : '/articles' +%>* <span class="<%= pg.attributes[:type] %>_link"> <a href="<%= dir %>/<%= pg.attributes[:permalink] %>/"><%= pg.attributes[:title] %></a></span> +<% end %> +
A content/tags/books.textile

@@ -0,0 +1,16 @@

+----- +:type: page +:permalink: books +:title: "Tag: books" +:filters_pre: +- erb +- redcloth +----- + +8 items are tagged with _books_: + +<% @site.pages.select{|p| p.attributes[:tags] && p.attributes[:tags].include?('books')}.sort{|a,b| a.attributes[:date] <=> b.attributes[:date]}.reverse.each do |pg| +dir = (pg.attributes[:type] == 'page') ? '' : '/articles' +%>* <span class="<%= pg.attributes[:type] %>_link"> <a href="<%= dir %>/<%= pg.attributes[:permalink] %>/"><%= pg.attributes[:title] %></a></span> +<% end %> +
A content/tags/browsers.textile

@@ -0,0 +1,16 @@

+----- +:type: page +:permalink: browsers +:title: "Tag: browsers" +:filters_pre: +- erb +- redcloth +----- + +7 items are tagged with _browsers_: + +<% @site.pages.select{|p| p.attributes[:tags] && p.attributes[:tags].include?('browsers')}.sort{|a,b| a.attributes[:date] <=> b.attributes[:date]}.reverse.each do |pg| +dir = (pg.attributes[:type] == 'page') ? '' : '/articles' +%>* <span class="<%= pg.attributes[:type] %>_link"> <a href="<%= dir %>/<%= pg.attributes[:permalink] %>/"><%= pg.attributes[:title] %></a></span> +<% end %> +
A content/tags/cakephp.textile

@@ -0,0 +1,16 @@

+----- +:type: page +:permalink: cakephp +:title: "Tag: cakephp" +:filters_pre: +- erb +- redcloth +----- + +23 items are tagged with _cakephp_: + +<% @site.pages.select{|p| p.attributes[:tags] && p.attributes[:tags].include?('cakephp')}.sort{|a,b| a.attributes[:date] <=> b.attributes[:date]}.reverse.each do |pg| +dir = (pg.attributes[:type] == 'page') ? '' : '/articles' +%>* <span class="<%= pg.attributes[:type] %>_link"> <a href="<%= dir %>/<%= pg.attributes[:permalink] %>/"><%= pg.attributes[:title] %></a></span> +<% end %> +
A content/tags/concatenative.textile

@@ -0,0 +1,16 @@

+----- +:type: page +:permalink: concatenative +:title: "Tag: concatenative" +:filters_pre: +- erb +- redcloth +----- + +2 items are tagged with _concatenative_: + +<% @site.pages.select{|p| p.attributes[:tags] && p.attributes[:tags].include?('concatenative')}.sort{|a,b| a.attributes[:date] <=> b.attributes[:date]}.reverse.each do |pg| +dir = (pg.attributes[:type] == 'page') ? '' : '/articles' +%>* <span class="<%= pg.attributes[:type] %>_link"> <a href="<%= dir %>/<%= pg.attributes[:permalink] %>/"><%= pg.attributes[:title] %></a></span> +<% end %> +
A content/tags/databases.textile

@@ -0,0 +1,16 @@

+----- +:type: page +:permalink: databases +:title: "Tag: databases" +:filters_pre: +- erb +- redcloth +----- + +6 items are tagged with _databases_: + +<% @site.pages.select{|p| p.attributes[:tags] && p.attributes[:tags].include?('databases')}.sort{|a,b| a.attributes[:date] <=> b.attributes[:date]}.reverse.each do |pg| +dir = (pg.attributes[:type] == 'page') ? '' : '/articles' +%>* <span class="<%= pg.attributes[:type] %>_link"> <a href="<%= dir %>/<%= pg.attributes[:permalink] %>/"><%= pg.attributes[:title] %></a></span> +<% end %> +
A content/tags/firefox.textile

@@ -0,0 +1,16 @@

+----- +:type: page +:permalink: firefox +:title: "Tag: firefox" +:filters_pre: +- erb +- redcloth +----- + +6 items are tagged with _firefox_: + +<% @site.pages.select{|p| p.attributes[:tags] && p.attributes[:tags].include?('firefox')}.sort{|a,b| a.attributes[:date] <=> b.attributes[:date]}.reverse.each do |pg| +dir = (pg.attributes[:type] == 'page') ? '' : '/articles' +%>* <span class="<%= pg.attributes[:type] %>_link"> <a href="<%= dir %>/<%= pg.attributes[:permalink] %>/"><%= pg.attributes[:title] %></a></span> +<% end %> +
A content/tags/frameworks.textile

@@ -0,0 +1,16 @@

+----- +:type: page +:permalink: frameworks +:title: "Tag: frameworks" +:filters_pre: +- erb +- redcloth +----- + +6 items are tagged with _frameworks_: + +<% @site.pages.select{|p| p.attributes[:tags] && p.attributes[:tags].include?('frameworks')}.sort{|a,b| a.attributes[:date] <=> b.attributes[:date]}.reverse.each do |pg| +dir = (pg.attributes[:type] == 'page') ? '' : '/articles' +%>* <span class="<%= pg.attributes[:type] %>_link"> <a href="<%= dir %>/<%= pg.attributes[:permalink] %>/"><%= pg.attributes[:title] %></a></span> +<% end %> +
A content/tags/google.textile

@@ -0,0 +1,16 @@

+----- +:type: page +:permalink: google +:title: "Tag: google" +:filters_pre: +- erb +- redcloth +----- + +5 items are tagged with _google_: + +<% @site.pages.select{|p| p.attributes[:tags] && p.attributes[:tags].include?('google')}.sort{|a,b| a.attributes[:date] <=> b.attributes[:date]}.reverse.each do |pg| +dir = (pg.attributes[:type] == 'page') ? '' : '/articles' +%>* <span class="<%= pg.attributes[:type] %>_link"> <a href="<%= dir %>/<%= pg.attributes[:permalink] %>/"><%= pg.attributes[:title] %></a></span> +<% end %> +
A content/tags/ie.textile

@@ -0,0 +1,16 @@

+----- +:type: page +:permalink: ie +:title: "Tag: ie" +:filters_pre: +- erb +- redcloth +----- + +2 items are tagged with _ie_: + +<% @site.pages.select{|p| p.attributes[:tags] && p.attributes[:tags].include?('ie')}.sort{|a,b| a.attributes[:date] <=> b.attributes[:date]}.reverse.each do |pg| +dir = (pg.attributes[:type] == 'page') ? '' : '/articles' +%>* <span class="<%= pg.attributes[:type] %>_link"> <a href="<%= dir %>/<%= pg.attributes[:permalink] %>/"><%= pg.attributes[:title] %></a></span> +<% end %> +
A content/tags/internet.textile

@@ -0,0 +1,16 @@

+----- +:type: page +:permalink: internet +:title: "Tag: internet" +:filters_pre: +- erb +- redcloth +----- + +12 items are tagged with _internet_: + +<% @site.pages.select{|p| p.attributes[:tags] && p.attributes[:tags].include?('internet')}.sort{|a,b| a.attributes[:date] <=> b.attributes[:date]}.reverse.each do |pg| +dir = (pg.attributes[:type] == 'page') ? '' : '/articles' +%>* <span class="<%= pg.attributes[:type] %>_link"> <a href="<%= dir %>/<%= pg.attributes[:permalink] %>/"><%= pg.attributes[:title] %></a></span> +<% end %> +
A content/tags/italy.textile

@@ -0,0 +1,16 @@

+----- +:type: page +:permalink: italy +:title: "Tag: italy" +:filters_pre: +- erb +- redcloth +----- + +3 items are tagged with _italy_: + +<% @site.pages.select{|p| p.attributes[:tags] && p.attributes[:tags].include?('italy')}.sort{|a,b| a.attributes[:date] <=> b.attributes[:date]}.reverse.each do |pg| +dir = (pg.attributes[:type] == 'page') ? '' : '/articles' +%>* <span class="<%= pg.attributes[:type] %>_link"> <a href="<%= dir %>/<%= pg.attributes[:permalink] %>/"><%= pg.attributes[:title] %></a></span> +<% end %> +
A content/tags/microsoft.textile

@@ -0,0 +1,16 @@

+----- +:type: page +:permalink: microsoft +:title: "Tag: microsoft" +:filters_pre: +- erb +- redcloth +----- + +2 items are tagged with _microsoft_: + +<% @site.pages.select{|p| p.attributes[:tags] && p.attributes[:tags].include?('microsoft')}.sort{|a,b| a.attributes[:date] <=> b.attributes[:date]}.reverse.each do |pg| +dir = (pg.attributes[:type] == 'page') ? '' : '/articles' +%>* <span class="<%= pg.attributes[:type] %>_link"> <a href="<%= dir %>/<%= pg.attributes[:permalink] %>/"><%= pg.attributes[:title] %></a></span> +<% end %> +
A content/tags/opensource.textile

@@ -0,0 +1,16 @@

+----- +:type: page +:permalink: opensource +:title: "Tag: opensource" +:filters_pre: +- erb +- redcloth +----- + +10 items are tagged with _opensource_: + +<% @site.pages.select{|p| p.attributes[:tags] && p.attributes[:tags].include?('opensource')}.sort{|a,b| a.attributes[:date] <=> b.attributes[:date]}.reverse.each do |pg| +dir = (pg.attributes[:type] == 'page') ? '' : '/articles' +%>* <span class="<%= pg.attributes[:type] %>_link"> <a href="<%= dir %>/<%= pg.attributes[:permalink] %>/"><%= pg.attributes[:title] %></a></span> +<% end %> +
A content/tags/opera.textile

@@ -0,0 +1,16 @@

+----- +:type: page +:permalink: opera +:title: "Tag: opera" +:filters_pre: +- erb +- redcloth +----- + +2 items are tagged with _opera_: + +<% @site.pages.select{|p| p.attributes[:tags] && p.attributes[:tags].include?('opera')}.sort{|a,b| a.attributes[:date] <=> b.attributes[:date]}.reverse.each do |pg| +dir = (pg.attributes[:type] == 'page') ? '' : '/articles' +%>* <span class="<%= pg.attributes[:type] %>_link"> <a href="<%= dir %>/<%= pg.attributes[:permalink] %>/"><%= pg.attributes[:title] %></a></span> +<% end %> +
A content/tags/personal.textile

@@ -0,0 +1,16 @@

+----- +:type: page +:permalink: personal +:title: "Tag: personal" +:filters_pre: +- erb +- redcloth +----- + +6 items are tagged with _personal_: + +<% @site.pages.select{|p| p.attributes[:tags] && p.attributes[:tags].include?('personal')}.sort{|a,b| a.attributes[:date] <=> b.attributes[:date]}.reverse.each do |pg| +dir = (pg.attributes[:type] == 'page') ? '' : '/articles' +%>* <span class="<%= pg.attributes[:type] %>_link"> <a href="<%= dir %>/<%= pg.attributes[:permalink] %>/"><%= pg.attributes[:title] %></a></span> +<% end %> +
A content/tags/personal_log.textile

@@ -0,0 +1,16 @@

+----- +:type: page +:permalink: personal_log +:title: "Tag: personal_log" +:filters_pre: +- erb +- redcloth +----- + +6 items are tagged with _personal_log_: + +<% @site.pages.select{|p| p.attributes[:tags] && p.attributes[:tags].include?('personal_log')}.sort{|a,b| a.attributes[:date] <=> b.attributes[:date]}.reverse.each do |pg| +dir = (pg.attributes[:type] == 'page') ? '' : '/articles' +%>* <span class="<%= pg.attributes[:type] %>_link"> <a href="<%= dir %>/<%= pg.attributes[:permalink] %>/"><%= pg.attributes[:title] %></a></span> +<% end %> +
A content/tags/php.textile

@@ -0,0 +1,16 @@

+----- +:type: page +:permalink: php +:title: "Tag: php" +:filters_pre: +- erb +- redcloth +----- + +6 items are tagged with _php_: + +<% @site.pages.select{|p| p.attributes[:tags] && p.attributes[:tags].include?('php')}.sort{|a,b| a.attributes[:date] <=> b.attributes[:date]}.reverse.each do |pg| +dir = (pg.attributes[:type] == 'page') ? '' : '/articles' +%>* <span class="<%= pg.attributes[:type] %>_link"> <a href="<%= dir %>/<%= pg.attributes[:permalink] %>/"><%= pg.attributes[:title] %></a></span> +<% end %> +
A content/tags/politics.textile

@@ -0,0 +1,16 @@

+----- +:type: page +:permalink: politics +:title: "Tag: politics" +:filters_pre: +- erb +- redcloth +----- + +2 items are tagged with _politics_: + +<% @site.pages.select{|p| p.attributes[:tags] && p.attributes[:tags].include?('politics')}.sort{|a,b| a.attributes[:date] <=> b.attributes[:date]}.reverse.each do |pg| +dir = (pg.attributes[:type] == 'page') ? '' : '/articles' +%>* <span class="<%= pg.attributes[:type] %>_link"> <a href="<%= dir %>/<%= pg.attributes[:permalink] %>/"><%= pg.attributes[:title] %></a></span> +<% end %> +
A content/tags/productivity.textile

@@ -0,0 +1,16 @@

+----- +:type: page +:permalink: productivity +:title: "Tag: productivity" +:filters_pre: +- erb +- redcloth +----- + +7 items are tagged with _productivity_: + +<% @site.pages.select{|p| p.attributes[:tags] && p.attributes[:tags].include?('productivity')}.sort{|a,b| a.attributes[:date] <=> b.attributes[:date]}.reverse.each do |pg| +dir = (pg.attributes[:type] == 'page') ? '' : '/articles' +%>* <span class="<%= pg.attributes[:type] %>_link"> <a href="<%= dir %>/<%= pg.attributes[:permalink] %>/"><%= pg.attributes[:title] %></a></span> +<% end %> +
A content/tags/programming.textile

@@ -0,0 +1,16 @@

+----- +:type: page +:permalink: programming +:title: "Tag: programming" +:filters_pre: +- erb +- redcloth +----- + +11 items are tagged with _programming_: + +<% @site.pages.select{|p| p.attributes[:tags] && p.attributes[:tags].include?('programming')}.sort{|a,b| a.attributes[:date] <=> b.attributes[:date]}.reverse.each do |pg| +dir = (pg.attributes[:type] == 'page') ? '' : '/articles' +%>* <span class="<%= pg.attributes[:type] %>_link"> <a href="<%= dir %>/<%= pg.attributes[:permalink] %>/"><%= pg.attributes[:title] %></a></span> +<% end %> +
A content/tags/rails.textile

@@ -0,0 +1,16 @@

+----- +:type: page +:permalink: rails +:title: "Tag: rails" +:filters_pre: +- erb +- redcloth +----- + +19 items are tagged with _rails_: + +<% @site.pages.select{|p| p.attributes[:tags] && p.attributes[:tags].include?('rails')}.sort{|a,b| a.attributes[:date] <=> b.attributes[:date]}.reverse.each do |pg| +dir = (pg.attributes[:type] == 'page') ? '' : '/articles' +%>* <span class="<%= pg.attributes[:type] %>_link"> <a href="<%= dir %>/<%= pg.attributes[:permalink] %>/"><%= pg.attributes[:title] %></a></span> +<% end %> +
A content/tags/rant.textile

@@ -0,0 +1,16 @@

+----- +:type: page +:permalink: rant +:title: "Tag: rant" +:filters_pre: +- erb +- redcloth +----- + +4 items are tagged with _rant_: + +<% @site.pages.select{|p| p.attributes[:tags] && p.attributes[:tags].include?('rant')}.sort{|a,b| a.attributes[:date] <=> b.attributes[:date]}.reverse.each do |pg| +dir = (pg.attributes[:type] == 'page') ? '' : '/articles' +%>* <span class="<%= pg.attributes[:type] %>_link"> <a href="<%= dir %>/<%= pg.attributes[:permalink] %>/"><%= pg.attributes[:title] %></a></span> +<% end %> +
A content/tags/rawline.textile

@@ -0,0 +1,16 @@

+----- +:type: page +:permalink: rawline +:title: "Tag: rawline" +:filters_pre: +- erb +- redcloth +----- + +5 items are tagged with _rawline_: + +<% @site.pages.select{|p| p.attributes[:tags] && p.attributes[:tags].include?('rawline')}.sort{|a,b| a.attributes[:date] <=> b.attributes[:date]}.reverse.each do |pg| +dir = (pg.attributes[:type] == 'page') ? '' : '/articles' +%>* <span class="<%= pg.attributes[:type] %>_link"> <a href="<%= dir %>/<%= pg.attributes[:permalink] %>/"><%= pg.attributes[:title] %></a></span> +<% end %> +
A content/tags/redbook.textile

@@ -0,0 +1,16 @@

+----- +:type: page +:permalink: redbook +:title: "Tag: redbook" +:filters_pre: +- erb +- redcloth +----- + +6 items are tagged with _redbook_: + +<% @site.pages.select{|p| p.attributes[:tags] && p.attributes[:tags].include?('redbook')}.sort{|a,b| a.attributes[:date] <=> b.attributes[:date]}.reverse.each do |pg| +dir = (pg.attributes[:type] == 'page') ? '' : '/articles' +%>* <span class="<%= pg.attributes[:type] %>_link"> <a href="<%= dir %>/<%= pg.attributes[:permalink] %>/"><%= pg.attributes[:title] %></a></span> +<% end %> +
A content/tags/review.textile

@@ -0,0 +1,16 @@

+----- +:type: page +:permalink: review +:title: "Tag: review" +:filters_pre: +- erb +- redcloth +----- + +33 items are tagged with _review_: + +<% @site.pages.select{|p| p.attributes[:tags] && p.attributes[:tags].include?('review')}.sort{|a,b| a.attributes[:date] <=> b.attributes[:date]}.reverse.each do |pg| +dir = (pg.attributes[:type] == 'page') ? '' : '/articles' +%>* <span class="<%= pg.attributes[:type] %>_link"> <a href="<%= dir %>/<%= pg.attributes[:permalink] %>/"><%= pg.attributes[:title] %></a></span> +<% end %> +
A content/tags/ruby.textile

@@ -0,0 +1,16 @@

+----- +:type: page +:permalink: ruby +:title: "Tag: ruby" +:filters_pre: +- erb +- redcloth +----- + +27 items are tagged with _ruby_: + +<% @site.pages.select{|p| p.attributes[:tags] && p.attributes[:tags].include?('ruby')}.sort{|a,b| a.attributes[:date] <=> b.attributes[:date]}.reverse.each do |pg| +dir = (pg.attributes[:type] == 'page') ? '' : '/articles' +%>* <span class="<%= pg.attributes[:type] %>_link"> <a href="<%= dir %>/<%= pg.attributes[:permalink] %>/"><%= pg.attributes[:title] %></a></span> +<% end %> +
A content/tags/software.textile

@@ -0,0 +1,16 @@

+----- +:type: page +:permalink: software +:title: "Tag: software" +:filters_pre: +- erb +- redcloth +----- + +4 items are tagged with _software_: + +<% @site.pages.select{|p| p.attributes[:tags] && p.attributes[:tags].include?('software')}.sort{|a,b| a.attributes[:date] <=> b.attributes[:date]}.reverse.each do |pg| +dir = (pg.attributes[:type] == 'page') ? '' : '/articles' +%>* <span class="<%= pg.attributes[:type] %>_link"> <a href="<%= dir %>/<%= pg.attributes[:permalink] %>/"><%= pg.attributes[:title] %></a></span> +<% end %> +
A content/tags/tools.textile

@@ -0,0 +1,16 @@

+----- +:type: page +:permalink: tools +:title: "Tag: tools" +:filters_pre: +- erb +- redcloth +----- + +4 items are tagged with _tools_: + +<% @site.pages.select{|p| p.attributes[:tags] && p.attributes[:tags].include?('tools')}.sort{|a,b| a.attributes[:date] <=> b.attributes[:date]}.reverse.each do |pg| +dir = (pg.attributes[:type] == 'page') ? '' : '/articles' +%>* <span class="<%= pg.attributes[:type] %>_link"> <a href="<%= dir %>/<%= pg.attributes[:permalink] %>/"><%= pg.attributes[:title] %></a></span> +<% end %> +
A content/tags/travelling.textile

@@ -0,0 +1,16 @@

+----- +:type: page +:permalink: travelling +:title: "Tag: travelling" +:filters_pre: +- erb +- redcloth +----- + +2 items are tagged with _travelling_: + +<% @site.pages.select{|p| p.attributes[:tags] && p.attributes[:tags].include?('travelling')}.sort{|a,b| a.attributes[:date] <=> b.attributes[:date]}.reverse.each do |pg| +dir = (pg.attributes[:type] == 'page') ? '' : '/articles' +%>* <span class="<%= pg.attributes[:type] %>_link"> <a href="<%= dir %>/<%= pg.attributes[:permalink] %>/"><%= pg.attributes[:title] %></a></span> +<% end %> +
A content/tags/tutorial.textile

@@ -0,0 +1,16 @@

+----- +:type: page +:permalink: tutorial +:title: "Tag: tutorial" +:filters_pre: +- erb +- redcloth +----- + +4 items are tagged with _tutorial_: + +<% @site.pages.select{|p| p.attributes[:tags] && p.attributes[:tags].include?('tutorial')}.sort{|a,b| a.attributes[:date] <=> b.attributes[:date]}.reverse.each do |pg| +dir = (pg.attributes[:type] == 'page') ? '' : '/articles' +%>* <span class="<%= pg.attributes[:type] %>_link"> <a href="<%= dir %>/<%= pg.attributes[:permalink] %>/"><%= pg.attributes[:title] %></a></span> +<% end %> +
A content/tags/vim.textile

@@ -0,0 +1,16 @@

+----- +:type: page +:permalink: vim +:title: "Tag: vim" +:filters_pre: +- erb +- redcloth +----- + +2 items are tagged with _vim_: + +<% @site.pages.select{|p| p.attributes[:tags] && p.attributes[:tags].include?('vim')}.sort{|a,b| a.attributes[:date] <=> b.attributes[:date]}.reverse.each do |pg| +dir = (pg.attributes[:type] == 'page') ? '' : '/articles' +%>* <span class="<%= pg.attributes[:type] %>_link"> <a href="<%= dir %>/<%= pg.attributes[:permalink] %>/"><%= pg.attributes[:title] %></a></span> +<% end %> +
A content/tags/web-development.textile

@@ -0,0 +1,16 @@

+----- +:type: page +:permalink: web-development +:title: "Tag: web-development" +:filters_pre: +- erb +- redcloth +----- + +2 items are tagged with _web-development_: + +<% @site.pages.select{|p| p.attributes[:tags] && p.attributes[:tags].include?('web-development')}.sort{|a,b| a.attributes[:date] <=> b.attributes[:date]}.reverse.each do |pg| +dir = (pg.attributes[:type] == 'page') ? '' : '/articles' +%>* <span class="<%= pg.attributes[:type] %>_link"> <a href="<%= dir %>/<%= pg.attributes[:permalink] %>/"><%= pg.attributes[:title] %></a></span> +<% end %> +
A content/tags/web20.textile

@@ -0,0 +1,16 @@

+----- +:type: page +:permalink: web20 +:title: "Tag: web20" +:filters_pre: +- erb +- redcloth +----- + +8 items are tagged with _web20_: + +<% @site.pages.select{|p| p.attributes[:tags] && p.attributes[:tags].include?('web20')}.sort{|a,b| a.attributes[:date] <=> b.attributes[:date]}.reverse.each do |pg| +dir = (pg.attributes[:type] == 'page') ? '' : '/articles' +%>* <span class="<%= pg.attributes[:type] %>_link"> <a href="<%= dir %>/<%= pg.attributes[:permalink] %>/"><%= pg.attributes[:title] %></a></span> +<% end %> +
A content/tags/webdevelopment.textile

@@ -0,0 +1,16 @@

+----- +:type: page +:permalink: webdevelopment +:title: "Tag: webdevelopment" +:filters_pre: +- erb +- redcloth +----- + +12 items are tagged with _webdevelopment_: + +<% @site.pages.select{|p| p.attributes[:tags] && p.attributes[:tags].include?('webdevelopment')}.sort{|a,b| a.attributes[:date] <=> b.attributes[:date]}.reverse.each do |pg| +dir = (pg.attributes[:type] == 'page') ? '' : '/articles' +%>* <span class="<%= pg.attributes[:type] %>_link"> <a href="<%= dir %>/<%= pg.attributes[:permalink] %>/"><%= pg.attributes[:title] %></a></span> +<% end %> +
A content/tags/website.textile

@@ -0,0 +1,16 @@

+----- +:type: page +:permalink: website +:title: "Tag: website" +:filters_pre: +- erb +- redcloth +----- + +11 items are tagged with _website_: + +<% @site.pages.select{|p| p.attributes[:tags] && p.attributes[:tags].include?('website')}.sort{|a,b| a.attributes[:date] <=> b.attributes[:date]}.reverse.each do |pg| +dir = (pg.attributes[:type] == 'page') ? '' : '/articles' +%>* <span class="<%= pg.attributes[:type] %>_link"> <a href="<%= dir %>/<%= pg.attributes[:permalink] %>/"><%= pg.attributes[:title] %></a></span> +<% end %> +
A content/tags/wedding.textile

@@ -0,0 +1,16 @@

+----- +:type: page +:permalink: wedding +:title: "Tag: wedding" +:filters_pre: +- erb +- redcloth +----- + +6 items are tagged with _wedding_: + +<% @site.pages.select{|p| p.attributes[:tags] && p.attributes[:tags].include?('wedding')}.sort{|a,b| a.attributes[:date] <=> b.attributes[:date]}.reverse.each do |pg| +dir = (pg.attributes[:type] == 'page') ? '' : '/articles' +%>* <span class="<%= pg.attributes[:type] %>_link"> <a href="<%= dir %>/<%= pg.attributes[:permalink] %>/"><%= pg.attributes[:title] %></a></span> +<% end %> +
A content/tags/writing.textile

@@ -0,0 +1,16 @@

+----- +:type: page +:permalink: writing +:title: "Tag: writing" +:filters_pre: +- erb +- redcloth +----- + +15 items are tagged with _writing_: + +<% @site.pages.select{|p| p.attributes[:tags] && p.attributes[:tags].include?('writing')}.sort{|a,b| a.attributes[:date] <=> b.attributes[:date]}.reverse.each do |pg| +dir = (pg.attributes[:type] == 'page') ? '' : '/articles' +%>* <span class="<%= pg.attributes[:type] %>_link"> <a href="<%= dir %>/<%= pg.attributes[:permalink] %>/"><%= pg.attributes[:title] %></a></span> +<% end %> +