Category: Technology


dbdesigner2cake : DBDesigner 4 Scaffold Tools for CakePHP - 1.0.6 - Minor Release

April 5th, 2008 — 1:26pm

Hello All,

A minor release of dbdesigner2cake is available. Those who are using the release 1.0.5 or previous are recommended to upgrade to 1.0.6.

These issues were addressed:
- Changed the website on the license text from cirello.org/dbdesigner2cake to dbdesigner2cake.cirello.org
- Now it forces the PrimaryKey according to the XML
- strtolower’d table’s names.
- avoid a special condition on which a hasMany/belongsTo table would be somehow linked to a HABTM table. (workaround)
- Corrected few typos.

Well, as I usually finish such release notes:

You are welcome to download the 1.0.6 version at
http://dbdesigner2cake.cirello.org/download.html

Bye

4 comments » | DBDesigner2CakePHP, Technology

Eric Raymond’s How to Become a Hacker.

February 27th, 2008 — 12:25am

This is an open letter to Raymond about his essay named “How to Become a Hacker”.

Hi Raymond,

I have read your howto about becoming a hacker. First off, according to your definitions of hacker, I am not a hacker - and also I do not consider myself as hacker. Therefore, as not being a hacker I do not know how great is my allowance to send this letter to you. I do not want to challenge your ideas, nor I have desire to enhance your thoughts.

However, I feel I should share a thought I had: “Rails-like framework considered harmful in early stages”.

RubyOnRails, CakePHP, DJango and many more. Are they wonderful tools that does a lot of auto-magic for us? Yes, they are indeed. They offer us DRY, MVC and force unto us OO thinking.

I think this auto-magic is a double-handed feature of them, because as it facilitates for us the day-by-day dirty work, they also hide from usrelevant knowledge on how things are done. Therefore, beginners tend trying fit their needs into the framework boundaries. “Well, I need ABC feature to use in this XYZ system I am developing - let me check if there is a component that does it for me. Alas! There is not, what am I going to do?”, perhaps a lazy beginner would say. Develop the ABC feature may not ever come across his mind. (”It is reinventing the wheel” some would say, but trying to reproduce things is a very good way to gain knowledge).

Understanding the laying logic beneath the whole magic is very significant - it is a very special kind of logic, because it enlighten us about the real limits of what things can or cannot be done and how they could or should be done.

Concluding, I would like to ask you to put in this essay of yours the following paragraph by the end of the second one in “1. Learn to Program” session:

“[...]you have to know what the components actually do. The same goes for the Rails-like framework (RubyOnRails, CakePHP, DJango &c), although they are magical on getting things done, they hide from you significant knowledge of how they perform their magic. Now I think it is probably best to learn C[...]“

I have written a web log post further developing this point of view of mine. I pray you read, if you will, at

http://blog.cirello.org/2007/09/24/imho-cakephp-made-php-bondage-and-discipline/

Yours sincerely,

Dérico Filho

Comment » | DBDesigner2CakePHP, Technology

William Kamkwamba

February 24th, 2008 — 10:25pm

Embedded Video

Blogged with Flock

Tags:

Comment » | Five Regions of The Future, Human Tech, Local Tech, Technology

Performance difference on fetching data from eZ Publish object with MyISAM and InnoDB.

December 19th, 2007 — 2:04pm

Hi,

eZ Publish is a Content Management System and Content Management Framework translated into 26 languagues and their variations coded in PHP and it stores its information on a Relational Database Management System, such MySQL and PostgreSQL.

I would like write a bit more on MySQL and eZ Publish integration about a very specific yet important point: tables storage engines.

Among many there are two that are broadly used: MyISAM and InnoDB. Both are great and each has its own advantages and disadvantages.

MyISAM engine is the MySQL version of the old IBM’s ISAM engine used in its early versions. It was designed to be fast and it is used as an engine of choice up to MySQL 5. InnoDB engine on the other hand was created by Innobase that was buyed by Oracle. It has been replacing MyISAM as engine of choice from MySQL 5 up to the latest.

It is possible to summarise the differences between them in these points:

- InnoDB has support for transaction queries. It means that eZ Publish may access the database, change its data and store (or discard) the modifications all at once in the end of process. MyISAM tables simply cannot operate like this. It is particulary importante in routines that consistency is pretty critical. All data changed is logged apart.

- When an InnoDB tables crashes, it recovers replaying the log. Therefore, the time to fix the table is always very short because it does not have to search for corrupted data. MyISAM on the other hand, has to scan the table each time it crashes, the larger ammount of data the longe it will take to check and recover it.

- MyISAM is quicker than InnoDB in many situations, because it does not have to store and keep log of changes while another command is processing reading. MyISAM either reads a table or writes to table, and these operations are not concurrent. However if you have a eZ Published site with a lot of changes, all of them happening together, you will problems with performance. Each time a MyISAM table is changed, the table cache is discarded - and it cannot be read until the write is done.

- MyISAM supports FULL TEXT index. When a Text field is created and indexed in MySQL, just a tiny part of it is stored in the index, and therefore it may return results lacking registers that should match a filter rule. FULL TEXT index prevents that, it creates a hash of all the words in the index so it returns consistently the expected result.

Thus what is it the best choice when developing with an eZ Publish object? The answer is quite easy and straightforward. The rule of thumb is: if your eZ Publish site reads much more than it needs to be updated, use MyISAM engine. Otherwise use InnoDB engine. Even if the proportion is 50% / 50% keep InnoDB as choice, on eventual crash it will recover quicker and very consistently.

This article is offered by WebDeal Hosting.

Comment » | Technology

My company and Brook’s Law - Why hiring a new programmer delays the whole company’s development schedule?

December 10th, 2007 — 1:56am

Hi!

I work in a real state agency. This company has its own management system which deals with customer database, customer relationship management, product database and product export to other external system of advertising.

It has been developed by 6 years now, and passed by the hands of 8 programmers (or interns) so far. And until the lastest one, adding more man power to its development always uncovered a sad feeling of Brook’s Law.

Brook’s Law dictates that “adding man power to a late software project makes it later”. Actually it really happened. After hiring a new programmer it took at least 3 months of intensive training, which approached quality (5s, Kaizen and PDCA) and some programming skills such OO, MVC and Design Patterns.

This thorough training should supposedly prepare the hired programmers to a supposed high-level of coding. Well, the code was not that high-leveled and the programmers always had to struggle with so many standards that they could not produce code.

There was never a roadmap or formal product release. Indeed in the beginning, the changes were made directly into the code and bugs fixed later. I guess when nothing is yet done, act quick-and-dirty or worse-is-better is a good atittude.

OK, it may have hurted some ears around. I am not defending them as a real alternatives for software development. What I am saying is: they are great choices to evolve from NOthing to SOMEthing. Let me explain it a bit further.

The company I work on was founded by a group of Internet investors. They had no previous experience on real state market. They had money and wanted to invest. One lunatic among them decided to burn his cash in a real state agency in the rotten brazilian market.

Alright. If you are producing a software to a company runned by an expert in the market, usually the biggest problem you could have would be how translate some business needs into technical specification.

However, If you are producing a software to a company runned by a lunatic that simply has no idea of what it is taken to do the business, then your greatest is problem is doing something almost completely off your mind - if the CEO has no idea and you have no idea - anything, even a bad thing, is better than nothing.

This lack of identity reflected the source code’s organisation, robustness and stability. Actually, a paleontologist could dig four differente eras of coding.

The first one made by four hands and it’s completely quick and dirty. The second one a bit more organised, but yet worse is better approach (the great change was moving from VI to Samba Shared file access). The third one with better structured code. And the last one developed with OO/MVC/All the letters that are G&W.

Thus, teaching the new-comers about the system had do cope with all these generations of coding and thoughts.

Why that last one has been different?

The last hiring was completely different on many aspects.

First, the hired programmer was a better professional. I am not talking about technical skills - I am mean a more matured and seasoned person. A young company with young employees behaves childishly - spending more than needed with wrong people.

Second, the company knows better its needs and what it expects from employees. It means that the business needs are more easily translated into technical specifications.

Third, the oldest codes are no longer changed. They work (sometimes badly) and they do not demand more maintenance. All the code produced is related to new needs, therefore I need to teach fewer things one to new employees.

Adding man power in these conditions is easy. Brook notice the projects delays when he realised that new programmers could not add production immediately because they needed to be taught. And that’s the whole issue.

The more one programmer need to learn in order to begin working - the longer it’ll take to make him productive.

When the teacher knows the things to be conveyed, it is easier. On the other, when there is no teacher (or no knowledge), it is the famous Research and Development - not funded, not supported and only demanded.

Does it ever happened to you?

Comment » | Chronicles, Technology

DBDesigner2Cake 1.2 Roadmap.

September 25th, 2007 — 12:11am

Hi all,

As many may have noticed, dbdesigner2cake was made stable and many of the fundamental features are already implemented.

Beside the basic homework (code organisation and documentation), I have few ideas for dbdesigner2cake 1.2 branch:

  • Reverse Engineering: It would analyse Model classes and create a DBDesigner XML file.
  • Automated Scaffolding: It would watch a XML file for changes, whenever it realised a file change it would automatically re-scaffold the application.
  • Non-destructive scaffolding: It would modify Model classes thus preserving the developer created methods.

Another idea I had was a modified version of app_model.php that would parse DBDesigner XML file on fly, simplifying the Model Classes files. An example, instead of this:

<?php

class Post extends AppModel {

        var $name = “Post”; 

        var $hasMany = array(’Tag’ => array(’className’ => ‘Tag’));

        var $belongsTo = array(’Subject’ => array(’className’ => ‘Subjects’)); 

        function yetAnotherMagicalMethod(){

                …

        }

}

?>

It would be:

<?

class Post extends DBDesignerModel {

        var $name = “Post”; 

        //Relationships would be automagically loaded - and cached.

        function yetAnotherMagicalMethod(){

                …

        }

}

?>

Bye!

Comment » | DBDesigner2CakePHP, Technology

IMHO, CakePHP made PHP bondage-and-discipline.

September 24th, 2007 — 11:56pm

Hi everyone,

In My Humble Opinion, I think CakePHP made PHP bondage-and-discipline.

The first time I heard about RubyOnRails, CakePHP, PHPonTrax, JavaOnSails &c… I thought: “Hey! it’s no novelty, actually there’s a book named ‘Design Patterns’ that deals with all that stuff of Active Records and so on… What’s the need of such things?”

I never paid too much attetion to them, in fact I related them to the dreaded COBOL - but Ruby and PHP are not as verbose as COBOL-fingers.

As everybody knows, a well respected hacker will never admit to have learned COBOL - but unfortunately I have learned it in College, so I am not a hacker (yet :-) ). Hey! Hold on! It was just a semester in that bloody Mackenzie’s (yes, we have a Mackenzie in Brazil) and I’ve abandoned it in the middle of the discipline.

You know, COBOL has a very strict structure on how programmes should be engineered and written. There are only two level of tabs, and those DIVISIONs on each you define variables, file descriptors, io masks - this sort of pedantic way of programming.

But COBOL enabled brain-dead people to develope all types of commercial softwares. COBOL was written in english and supposedly an english-speaking person should be able to create, read, understand and modify any routines made by someone else. COBOL even had paragraphes.

This characteristic could only be achieved if everyone did everything in a single and common way - I should be guided, through the language syntax, to write the same solutions in the same way as you would do. Gosh, was COBOL the computer’s NewSpeak?

Well… Time has passed, those dinosaurs mainframe were gradually replaced by new servers, and the languages evolved into a more structured and more free syntax, like C.

The issue with C, Perl, PHP, Java and all-alike, is that you can always do the very same thing in a different way, opposed to COBOL which is bondage-and-discipline.

The phisolophy of “Convention over Configuration”, or whatever you call it, is just a modern way to enforce bondage-and-discipline on programmers. Convention itself is harmless, Kernighan and Ritchie have the blessed ident style and so Java people, GNU people.

The problem rises when Convention replaces Freedom - a forced standardisation of programming which affects almost every aspect of coding: naming style, code organisation and even the “best practices”.

Someone thought to consolidate all those Design Patters in a single project and give a name to it. CakePHP was inspired by RubyOnRails, both share some features - and both turned vanilla languages into bondage-and-discipline.

RubyOnRails and CakePHP are not only tools which would help the developer to be more productive - oh no… they’re schools of thoughts. They have a way on doing things which are considered “best practices” and should be followed closely.

Bondage-and-discipline is not Bad And Wrong. It is a leverage for those who are more pragmatic in solving problems or creating fast-food solutions - to problems which the kernels are the same among near 80% of them.

I like CakePHP… But I like PHP better. Sometimes I want to have freedom to model a solution according to a very special line of thoughts that oftenly is not the same of CakePHP. Now I have arrived to the point I wanted.

As CakePHP makes PHP into bondage-and-discipline language, programmers - specially the begginners - tend to adapt their solutions into CakePHP frame… Sometimes the best step is something quicker and more direct, but CakePHP, RubyOnRails or [your language of choice]on[transportation of choice] forces flowing or spliting the solution into meaningless parts.

In an exaggerated representation: “Hey, I just want to print out a formatted number! Why create a helper_to_format_number method in the PrintHelper class?” or “Why am I iterating all the result set in Model class into an array to iterate again in the View?” Or even, “I must structure this data into that framework-structure to output using the MagicalOutputHelper class…” (which likely would take longer to do).

I don’t if I am being clear here. These frameworks are wonderful tools - actually I develope a tool for CakePHP named dbdesigner2cake - but I don’t twist my solutions logic to fit the CakePHP’s mold. Don’t you even bother to talk about that vendor directory on CakePHP, because few things just won’t work; some third-party modules count on the fact that’s being run standalone or isolated - not within a framework.

There are situations that RubyOnRails (that’s gonna ache on the Ruby Envy guys) and CakePHP just won’t do, they’re closures with programmers stuck inside.

Design Patterns should be used a la carte. “Oh God! My code is messed up, let me organise it using MVC”, “Ahan, I am just doing CRUD here, I guess Active Record will fit just fine”, and so on.

Perhaps there’s something to learn with DJango guys, they actually stated they’re against auto-magic. As they don’t hide the magic behind the stage of an all-mighty framework, the programmer DOES HAVE the option to use or not one of the magics available without being considered too unelegant. Or extend it to make it able to do the desired functionality. When the framework is too magical simply there is not sockets to connect an extension…

These frameworks do the dirty work for the programmer charging a price: less flexibility and freedom of choice of how to do things. Is this good? I don’t think so…

I love CakePHP productivity, but I dread that it will make all programmers to code all the same code. Oh you don’t agree… If you want to make a blog with the too-obvious table Posts on it, unless we’re talking about different frameworks, on CakePHP the model class would be exactly like this:

<?php

class Post extends AppModel {

var $name = “Post”;

}

?>

See? There are thousand of ways on naming, invoking and accessing a database table in PHP. But in CakePHP this is the only way.

The same applies to [Your Rail Framework Of Choice]. Or even [Your language-of-choice] made bondage-and-discipline.

UPDATE: I found in Technorati two blogs supporting my point of view:

http://www.jonlee.ca/switching-from-rails-back-to-php/

http://www.oreillynet.com/ruby/blog/2007/09/7_reasons_i_switched_back_to_p_1.html

2 comments » | Technology

dbdesigner2cake supports CakePHP 1.1 and 1.2

September 21st, 2007 — 7:28pm

Hello All,

Dbdesigner2cake now officially supports CakePHP 1.1 and 1.2. Actually, when you use it on CakePHP 1.2 it offers a new parameter, which is shown below:

  -wb, –with-bake             generate controller and view code using bake shell.

This options scaffold your application creating the controller and view files instead of activating the $scaffold variable. I think it’ll be even more handy for those who want to save time.

Well, as I usually finish such release notes:

You are welcome to download the 1.0.3 version at
http://www.cirello.org/dbdesigner2cake/download.html 
or
http://cakeforge.org/frs/?group_id=162 .

Any doubts please submit to
http://groups.google.com/group/dbdesigner2cake.

Bye

Comment » | DBDesigner2CakePHP, Technology

Preliminary Tutorial for DBDesigner2Cake

September 12th, 2007 — 11:44am

Hi!

 I am preparing yet a more complete tutorial, but as appeared some demands on how to use dbdesigner2cake I decided to release a preliminary tutorial.

 Well, I assume you know how to use DBDesigner, your database of choice and some shell operation. I assume also that you have unpacked CakePHP’s files into a directory and had it configured, and the tables drawn in DBDesigner are stored in database too.

Let us take an ER diagram like this:

ER Modelling by DBDesigner

 Please note that the relationships created fields on the tables, for instance, users relates to posts through “user_id” field. You will also notice that DBDesigner create fields in plural instead of singular (tags_id versus tag_id), thus you should rename then to singular flexion. Also we have both a hasMany relationship and a hasAndBelongToMany relationship.

  Unpack CakePHP’s zip file, put dbdesigner2cake.php and save DBDesigner’s XML file in the same root directory like this:

# find -maxdepth 1
.
./sql
./app
./cake
./docs
./index.php
./vendors
./.htaccess
./dbdesigner2cake.php
./modelling.xml <– the ER diagram saved as XML by DBDesigner.

 Now you should generate the scripts using dbdesigner2cake.php

# php dbdesigner2cake.php modelling.xml
Scaffolding Post — done
Scaffolding User — done
Scaffolding Tag — done
Skipping PostsTag - HABTM table.
Done

Well, point your browser either to
http://yourhost/application/post/ or
http://yourhost/application/user/ or
http://yourhost/application/tag/

And you’ll see that your application is working (at least in theory).

14 comments » | DBDesigner2CakePHP, Technology

dbdesigner2cake : DBDesigner 4 Scaffold Tools for CakePHP - 1.0.0 FINAL

September 8th, 2007 — 1:08am

Hello,

The final version is released. Just a tiny bug found regarding the –app parameter.

I hope you guys enjoy it as much as I did.

Currently I am working on the tutorial and perhaps a screencast, afterwards I will look for CakePHP 1.2 support.

You are welcome to download the final version at
http://www.cirello.org/dbdesigner2cake/download.html 
or
http://cakeforge.org/frs/?group_id=162 .

Any doubts please submit to
http://groups.google.com/group/dbdesigner2cake.

Bye

Comment » | DBDesigner2CakePHP, Technology

Back to top