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.
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.
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 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:
That’s it. Now stop Jetty with cntrl-c in the same terminal window as you started it.
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
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:
It works! You are now ready to:
Instantiate objects by class name
<?php $a = new Java("java.util.Date", 123); print $a->time;
<?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.
I’ve built large systems in dynamic and static languages. Neither is necessarily better or worse than the other in terms of maintainability, if you know what you are doing. Ted Neward said that at the end of the day, the whole static vs dynamic thing doesn’t matter. One should simply chose the languages that can:
1. Provide the ability to express the concept in your head, and
2. Provide the ability to evolve as the concepts in your head evolve
Programming Language Demand
With ITJobsWatch you can compare the frequency of job titles, companies, skills and industries in the UK employment market. The following charts provide the number of permanent jobs per language, based on job ads, across the UK over the last 3 months.
Timeline of Programming Languages
- 1983: C++
- 1987: Perl
- 1991: Python
- 1995: Java (highest demand)
- 1995: PHP
- 1995: Ruby (lowest demand)
- 2001: C#
Like most organizations the BBC has its own technical ecosystem, the BBC’s is pretty much restricted to Perl and static files. The good news is that they are planning to build a new infrastructure for bbc.co.uk and roll out a new Identity platform on it. This was announced on May during the XTech 2008 presentation that took place in Dublin, where BBC’s plans to reinvigorate its technical platform were revealed.
Why is the BBC doing this?
- Gradual evolution of the web.
- Antiquated web platform.
- Inflexible / proprietary architecture.
- Single Sign-On (SSO) was unable to adapt.
- Each project must have a clear customer and deliver a real benefit.
- Don’t Repeat Yourself (DRY). Life is too short to spend your time re-inventing things.
- Be as simple as possible. Just do what we need to do now.
- Be as open as possible. Assume that all services can be accessed from outside the BBC, by default.
- Start simple, then iterate. Build the smallest thing you could possibly need, deploy it, then build applications on top of it. Think building blocks, not monoliths.
- Don’t optimise prematurely. The service might not grow the way we think it will.
- Build to scale. Think stateless, think content delivery networks, think database resilience.
- Test often. So you know when you need to optimise. So you can maintain your code. So you can maintain your platform.
- Evolve. Teams, systems, support structures. The platform. These principles!
- Let it die. Be prepared to turn your system off, or change it unrecognisably.
- Service Oriented Architecture
- MySQL Repository
- OpenSSO Identity Management Core
- Java REST Services: Spring MVC
- PHP presentation layer: Zend Framework
Benefits of using the Zend Framework
- Zend Framework’s extensive unit tests, required for all contributed code, mean that exact situations can be recreated and problems diagnosed and pinpointed.
- The high-quality implementation of the MVC web application architecture provides a foundation for all Zend Framework applications.
- Internationalization (i18n) and Localization (l10n).
- Session management.
- Ajax support.
- Zend Framework tools (Wiki, Issue Tracker, VCS, Mailing List, etc).
- A vast community of talented developers.
XTech 2008 in Dublin
Presentation from XTech 2008 in Dublin, about the BBC’s plans to reinvigorate its technical platform and to create new user management service.