Federico Cargnelutti

Simple is better than complex. Complex is better than complicated. | @fedecarg

Archive for January 2009

Get groovy for better shell scripts

leave a comment »

Eric Wendelin wrote:

I often use shell scripts to automate mundane, repeatable tasks on my computer. Since I’ve found Groovy, though, I have discovered a great way to make writing those scripts easier and more enjoyable. This is especially true if I have anything complex to do, and it saves me a LOT of time.

I couldn’t agree more. Also, I’m quite impressed how easy is to operate on an XML document with Groovy.

Get groovy for better shell scripts

Written by Federico

January 30, 2009 at 12:35 am

Posted in Java, Linux, Programming

Essential Java Resources

leave a comment »

The Java platform will be celebrating its 14th birthday soon and one side-effect when a successful and ubiquitous language reaches this kind of milestone is the widespread proliferation of libraries, tools and ideas. In this article, Ted Neward tacks through the vast tides and presents a list of the key resources any up-and-coming Java developer should have.

Essential Java Resources

Written by Federico

January 24, 2009 at 1:35 pm

Posted in Java, Programming

Building desktop Linux applications with JavaScript

leave a comment »

During his keynote presentation at OSCON last year, Ubuntu founder Mark Shuttleworth described application extensibility as an important enabler of innovation and user empowerment. Citing the Firefox web browser and its rich ecosystem of add-ons as an example, Shuttleworth suggested that the Linux community could deliver a lot of extra value by making scriptable automation and plugin capabilities available pervasively across the entire desktop stack.

Mark Shuttleworth also described his strategy for accelerating the adoption of Linux. He discussed the importance of extensibility in open platforms, contemplated the challenges of adapting conventional software methodologies so that they can be used for community-driven development, and contended that the open source software community has the potential to deliver a user experience which exceeds that of Apple’s Mac OS X platform.

Ryan Paul: Building desktop Linux apps with JavaScript

Written by Federico

January 22, 2009 at 8:39 pm

Using Ant as a library

leave a comment »

Ant has an extensive collection of predefined tasks that can be used directly from your Java/PHP code. In this post, Hung Huynh shows how to use Ant to download a file, unzip a package and execute shell commands.

Written by Federico

January 22, 2009 at 8:32 pm

Posted in Deployment, Java, Tools

Snake Wrangling for Kids

leave a comment »

There’s a wide misconception that today’s technology and software have grown so complex that it’s impossible to teach children how to program them. Nonsense. “Snake Wrangling for Kids” is a printable electronic book, for children 8 years and older, who would like to learn computer programming. Written by Jason Briggs, the book covers the very basics of programming, and uses the Python 3 programming language to teach the concepts. There are 3 different versions of the book, one for Mac, one for Linux and one for Windows.

Jason Briggs is a writer with over 15 years experience in the IT industry. He has written for ONJava, ONLamp, Java Developers Journal, JavaWorld and Linux Devices, and worked on projects for clients such as HSBC Investment Bank UK.

Snake Wrangling for Kids

Written by Federico

January 10, 2009 at 4:12 pm

Posted in Programming, Python

Top Posts 2008

with 3 comments

I looked through this blog’s statistics to find out which posts got the most page views in 2008. Here are the top 10 posts:

  1. 30 Useful PHP Classes and Components
  2. Where is the include coming from?
  3. Open-source PHP applications that changed the world
  4. 10 great articles for optimizing MySQL queries
  5. 20 MediaWiki Extensions You Should Be Using
  6. Zend Framework Architecture
  7. Loading models within modules in the Zend Framework
  8. Scalable and Flexible Directory Structure for Web Applications
  9. BBC’s New Infrastructure: Java and PHP
  10. Code Refactoring Guidelines

Each post was written for a reason. “Open-source applications that changed the world” is my favourite one. It not only brings back good memories, but also shows our commitment to the open-source community and our passion for developing and supporting open-source software. Zend Framework was the most popular Web application in 2008. Yes, Dow Jones, HSBC and even the BBC is using it. In case you haven’t notice, I spent the last 12 months promoting the Zend Framework, reason why it gets mentioned in 6 of the posts. I’m also glad that “Code Refactoring Guidelines” made it to the top 10. It shows that the PHP community cares.

Written by Federico

January 10, 2009 at 2:28 pm

Posted in Open-source, PHP

The Importance of Branching Models

with 2 comments

Among the branching models used in software configuration management, the branch-by-purpose model offers better support for parallel development efforts and improved control of both planned and emergency software releases. If you want to improve software quality, you must first understand your software. What are its pieces? How are they organized and related to one another? If you do not understand your code base, your odds of updating it without breaking something are poor.

The Importance of Branching Models (PDF)

Links

High-level Best Practices in Software Configuration Management

Written by Federico

January 7, 2009 at 4:03 pm

Running Quercus in Jetty Web Server

with 18 comments

Jetty Web server can be invoked and installed as a stand alone application server. It has a flexible component based architecture that allows it to be easily deployed and integrated in a diverse range of instances. The project is supported by a growing community and a team with a history of being responsive to innovations and changing requirements. More info here.

Installing Jetty

First you need to download Jetty. It’s distributed as a platform independent zip file containing source, javadocs and binaries. The most recent distro can be downloaded from Codehaus:

$ wget http://dist.codehaus.org/jetty/jetty-6.1.14/jetty-6.1.14.zip
$ unzip jetty-6.1.14.zip
$ cp -R jetty-6.1.14 /opt/
$ cd /opt
$ ln -s /opt/jetty-6.1.14 jetty

Problems installing Jetty? More info here.

Running Jetty

Running jetty is as simple as going to your jetty installation directory and typing:

$ cd /opt/jetty
$ java -jar start.jar etc/jetty.xml

This will start jetty and deploy a demo application available at:

http://localhost:8080/test

That’s it. Now stop Jetty with cntrl-c in the same terminal window as you started it.

Installing Quercus

Quercus is a complete implementation of the PHP language and libraries in Java. It gives both Java and PHP developers a fast, safe, and powerful alternative to the standard PHP interpreter. Quercus is available for download as a WAR file which can be easily deployed on Jetty:

$ wget -P ~/quercus http://quercus.caucho.com/download/quercus-3.2.1.war
$ jar xf ~/quercus/quercus-3.2.1.war

Unpack the WAR file and copy all the jars to Jetty’s global library directory:

$ cp ~/quercus/WEB-INF/lib/* /opt/jetty/lib

Configuring Jetty

Edit the web.xml file:

$ vi /opt/jetty/webapps/test/WEB-INF/web.xml

Add the following between the web-app tags:

<servlet>
    <servlet-name>Quercus Servlet</servlet-name>
    <servlet-class>com.caucho.quercus.servlet.QuercusServlet</servlet-class>
</servlet>
<servlet-mapping>
    <servlet-name>Quercus Servlet</servlet-name>
    <url-pattern>*.php</url-pattern>
</servlet-mapping>
<welcome-file-list>
    <welcome-file>index.html</welcome-file>
    <welcome-file>index.php</welcome-file>
    <welcome-file>index.jsp</welcome-file>
</welcome-file-list>

Create a PHP file inside the test application:

$ cat /opt/jetty/webapps/test/index.php
<?php phpinfo(); ?>

This file will be available at:

http://localhost:8080/index.php

It works! You are now ready to:

Instantiate objects by class name

<?php
$a = new Java("java.util.Date", 123);
print $a->time;

Import classes

<?php
import java.util.Date;

$a = new Date(123);
print $a->time;

Call Java methods

<?php
import java.util.Date;

$a = new Date(123);
print $a->getTime();
print $a->setTime(456);

print $a->time;
$a->time = 456;

And much, much more.

Written by Federico

January 4, 2009 at 6:39 pm

Posted in Java, Linux, PHP

NautilusSVN: Linux TortoiseSVN Equivalent

with 3 comments

Based on Stuart Langridge’s original script, Jason Field and Bruce van der Kooij created a set of Python scripts which integrate a load of Subversion functionality into the Gnome Nautilus browser. It’s basically a clone of the TortoiseSVN project on Windows.

NautilusSVN currently supports the following functionality:

  • Checkout
  • Commit
  • Revert
  • Diff (using Meld or gvimdiff)
  • Log Viewer
  • Revision and SVN User as columns in Nautilus views
  • Emblems to show file status (though buggy)
  • SSL authentication (buggy)
  • Username and password entry dialog
  • Editing Properties

NautilusSVN Project

Written by Federico

January 4, 2009 at 3:04 pm

Posted in Linux, Open-source, Python, Tools

Zend Framework: Free Online Book

with one comment

Pádraic Brady announced the release of his online book: “Zend Framework: Surviving The Deep End”. Chapter 1, the Introduction, is first on the menu to open the new year. According to Pádraic, the next chapter should turn up within a few days. The book is still a work in progress. What’s cool about this site is that it allows you to comment on each paragraph.

The book is available online without charge. Of course, you are more than welcome to make a donation.

Zend Framework: Surviving The Deep End

Written by Federico

January 3, 2009 at 7:06 pm

Posted in Frameworks, PHP

Follow

Get every new post delivered to your Inbox.

Join 610 other followers