Thursday, July 9, 2009

GWT and MVP (Model View Presenter) Pattern

After watching the google wave presentation at Google I/O, I changed my mind about the GWT (Google Web Toolkit) and I've been studying it hard. From the technical view, GWT is amazing and it's getting better on each new release. I was searching for best practices using GWT and I found this presentation: "GWT App Architecture Best Practices - Ray Ryan". Ray Ryan gives a lot of tips on how to create a well-structured and testable application using GWT. On the first thought I found it a little bit complex: when you deal with a simple screen it's easy to understand, but when you have to deal with a more complex screen, things get way more complex.

Ray Ryan presents the MVP (Passive View) pattern as a good solution, and it is. I spent many hours trying to figure out a way to implement the communication between the presenters. After this hard work I found - in my opinion - a good way to implement it, and I decided to share it with the world. I decided to share this knowledge as a sample application. You can find this application on http://gwt-mvp-sample.googlecode.com.

I'm not very experienced in this pattern so you might find some bugs or wrong concepts. The idea is to talk about it, to share knowledge. Feel free to change the source code, send me e-mails, add issues, etc.

I'm looking forward to your replies.

Tuesday, April 21, 2009

JavaScript Inheritance Implementation

I'm not used to develop in Javascript but, as a fan of programming languages and object-oriented paradigm, my friend Otavio Avila and I decided to develop a kind of inheritance in JavaScript. He is a very experienced javascript developer and html coder, with helped me a lot with my lack of knowledge in these areas. You can check more about it in http://jsii.googlecode.com. The project is licensed in LGPL that enables you to use it in your commercial, or not, applications.

Saturday, September 6, 2008

How to add an Apache directory alias in Mac OS X 10.5 (Leopard)

Another point that I spent a lot of time trying to do was to make an Apache directory alias. The first thing that you have to know is that all directories in the path for the target directory must be with at least permission to read. This was the point that I spent more time. I was trying to make an alias to the directory ~/Desktop/quickstart and the Desktop directory had no read permission for group and others, so that was the problem.
  • You have to edit /etc/apache2/users/{username}.conf and add the following lines:
<IfModule alias_Module>
Alias /your_project /Users/{username}/Desktop/your_project
</IfModule>

<Directory "/Users/{username}/Desktop/your_project">
    Options Indexes MultiViews FollowSymLinks
    AllowOverride All
    Order allow,deny
    Allow from all
<Directory>

  • Save the file and restart apache server.

Thursday, September 4, 2008

How to enable .htaccess in Mac OS X 10.5 (Leopard)

Yesterday I lost a lot of time trying to enable the apache .htaccess file in my macbook. So, I decided to create this post with all information necessary to do it.

  •  You have to edit /etc/apache2/httpd.conf and in the root directory - usually /Library/WebServer/Documents - you have to change the attribute AllowOverride from None to All. Save and close the file.
If you want to enable the .htaccess in your ~/Sites directory, you have to follow the below tips.
  • You have to edit /etc/apache2/users/{username}.conf and modify the attributes Options and AllowOverride as below:
Options Indexes Multiviews FollowSymLinks
AllowOverride All
  • Save the file and restart Apache server.
So, every time that you want to use .htaccess file, you have to modify the Options and the AllowOverride of the directory definition of your application.