Archive for January 2009
Get groovy for better shell scripts
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.
Essential Java Resources
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.
Building desktop Linux applications with JavaScript
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.
Snake Wrangling for Kids
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.
Top Posts 2008
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:
- 30 Useful PHP Classes and Components
- Where is the include coming from?
- Open-source PHP applications that changed the world
- 10 great articles for optimizing MySQL queries
- 20 MediaWiki Extensions You Should Be Using
- Zend Framework Architecture
- Loading models within modules in the Zend Framework
- Scalable and Flexible Directory Structure for Web Applications
- BBC’s New Infrastructure: Java and PHP
- 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.
The Importance of Branching Models
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
Running Quercus in Jetty Web Server
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.
NautilusSVN: Linux TortoiseSVN Equivalent
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
Zend Framework: Free Online Book
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.