Software Development in Brisbane

Archive for the ‘Development’ Category

Configuring Windows 2003 as a Development Server

Thursday, October 16th, 2008

Like many developers I spend a decent amount of time stopping and starting VMWare servers. Many of these are running Windows Server 2003. Win 2K3 has been designed as a server, and therefore has things like automatic tracking of reasons why the server was shutdown, which requires you to enter reasons into the dialog. As a server it also has pretty tight security around the Internet Explorer,making it even less usable than usual.

Fortunately (like always) the internet has the answers to these problems. The Microsoft Software Forum Network has a good series of articles titled “How to convert your Windows Server 2003… to a Workstation!“.  These talk about a whole heap of different options on what to do, the most useful for making W2k3 run as a development server are:

  1. Disabling Internet Explorer Enhanced Security, and
  2. Disabling the Shutdown Event Tracker.

Following the simple steps in these articles will help save time when working with a Development Win 2k3 server.

Reducing the Startup time for IBM WebSphere Portal

Wednesday, September 10th, 2008

After spending too much time today waiting for WebSphere Portal to restart (due to a nasty bug causing Portal to crash when I was working with it) I've been revisiting how to improve the startup time.

The key step in doing this is to uninstall portlets that aren't needed. (see http://www-01.ibm.com/support/docview.wss?rs=899&uid=swg21213982&ca=lsall for a list). For the lazy developers (read me) there are a series of scripts that have been developed that do this. The article Installing and configuring WebSphere Portal V6.0 Servers for development with Rational Application Developer V7.0 and Rational Software Architect V7.0 includes these scripts in a zip file (search for StartupPerformanceConfig.zip in the article). The article also has some good suggestions for memory and jvm settings for your server.

I have known about the existence of this process for a little while, but it took me a little to find them just now (when tuning a development server). Google was have troubles pointing me to the right article, so I thought for my sake I'd try and help google find this in the future. (Even if google did find the right spots, the title of the developerworks article wouldn't have made me think that it had the nugget of information about IBM WebSphere Portal Startup performance).

SSH Tunnelling is your Friend

Tuesday, September 9th, 2008

I've been using ssh tunnels for a while now. I first encountered the technique when setting up my e-mail client when doing research at the ISI. The ISI are understandably quite security conscious, so a ssh tunnel was required to access my mail on my mac. I'll admit that I set this up initially withot really having a clue, simply following the directions of the guys at the ISI that knew what they were doing. I had a couple of ssh commands sitting in an e-mail (and more often than not in my history), which I would simply refer to and reuse.

More recently at Ephox I've been doing a fair bit of ssh tunneling. I've been doing this to access the UK demo server for E2, exposing the Websphere admin and wcm portal urls via the tunnels. This process has worked relatively well for a couple of weeks for me, but in my current stage I'm going through some pain as the transfer of my ear file from the local build to the remote server is taking between 15 and 20 minutes currently. To get around this for some rapid bug fixing work, I've entered the next stage of my ssh tunneling jujitsu

  • ssh to remote server
  • ssh back to local Brisbane office, setting up a tunnel into subversion server
  • then use subversion to check out the codebase.

After having performed this setup work, I can easily do my changes on my local box, update the remote server via svn, then build and deploy from the remote server. The build and deploy are currently too manual, and could use some automation, but I'm currently happy to wear the pain, and drop my deploy process from 20 minutes to under five.  

My current next step is to automate the rest of the process.  Assuming my recent foray into sysadmin land didn't completely kill the server, this should be done very soon.

Web Character Encoding

Friday, July 11th, 2008

Making character encoding work well on the web can be a bit of a tricky task. There are many different layers to get right, and many different places in which things can go wrong.

At Ephox we have seen many of our clients experience problems with character encoding, and different fonts. We've actually created a variety of different articles to help people make there content editing environment work better:

http://liveworks.ephox.com/2007/05/15/why-international-characters-display-as-boxes/
http://liveworks.ephox.com/2007/05/08/solving-character-set-issues-with-legacy-systems/
http://liveworks.ephox.com/2007/09/03/character-encoding-and-special-characters/
http://liveworks.ephox.com/2008/03/11/url-encoding-and-character-sets/
http://liveworks.ephox.com/2008/02/05/controlling-entity-encoding

More recently I have been seeing some issues with encoding without EditLive! included. Sun proved to have a decent article talking about Character Conversions: http://java.sun.com/developer/technicalArticles/Intl/HTTPCharset/.  This articles includes good details on how to setup your JSP/Servlet layers to support encodings well.

This proved to be the answer to my problems, and well worth viewing if you are having encoding related problems in a Java Web application.

Can the Government be Agile? – discussion with a PMP PM

Sunday, June 22nd, 2008

I’ve enjoyed my relationship with my brother-in-law for a long time. We’ve often talked about business and career, sharing where we are at, and the directions we are taking.

Over the past few years Paul has been doing a great job as a project manager in Canberra, in particular his involvement with the Department of Defence in the successful and ambitious e-voting project (Remote Electronic Voting Federal Election 2007). It has been great hearing about his work, and some of the stories around it. He has also been sharing his growing understanding of project management, and some of the courses and information he has been collecting, and applying. I have been listening with interest, and a degree of skepticism, thinking that much of what he has been learning would not apply directly to me, as it seems to be focused on heavyweight/rigorous methods, and I very much prefer working in Agile environments, where good smart people are encouraged to do great work.

So it was with great interest that I was recently listening to him discussing and presenting some of his recent thinking and work around scrum. Paul has been looking at how to apply scrum to government projects, and has some great ideas about this. I was particularly interested to hear what he saw as the strengths that scrum would bring, and the advantages he saw in outcome based results (delivery of working software that meets outcomes) versus delivery based results (traditional waterfall delivery of documentation is part of the results).

I look forward to seeing Paul’s work going forward, and to seeing how he continues to apply agile techniques to his work. If you are in Canberra, and are looking for a great contract or consultant project management, it is well worth talking to Paul and the team at Barton Institute of Management.

Howto Learn an API

Friday, June 20th, 2008

I recently have been learning a number of different APIs. After reflecting on my process for learning I have ended up with the following strategy for working with APIs.

  1. Find someone who has used the API in the past and get a brief introduction.
  2. Read documentation about the product (starting at the central documentation site for the product, include any tutorials and getting started guides). The goal from this first step is to get a general background understanding of what the product is about, the core concepts and jargon and principles of the product.
  3. Use the product without the APIs. If there is a gui to access to product that is available, ensure that you know this, and the jargon around the product. Try and ensure that the information you have from step 1 is grounded in reality.
  4. Read more documentation around the APIs. Make the top goal for this round to get enough of an understanding of what you can do.
  5. Explore the APIs to see what they expose of the feature. The set of features exposed by APIs often do not match up with what is exposed through the GUI. The most important spot to aim for is the subset of features that are supported by both the API and the GUI.
  6. Google (as usual it’s your friend). Sometimes there are some useful results in google that are missed elsewhere. Start with searching for the product name, try adding in API/howto/tutorial/getting started keywords to filter down content if you get too many results.
  7. Write some exploratory code to see how the APIs work, and what they do. This should enable you to know enough to actually write the code that you need.

All steps are required, as there are often features which are not easily discovered by just taking one of the above paths. One of the most important steps is ensure that you do understand the subset of what is supported by the API and the front-end. This helps to ensure that you are actually hitting the right part of the API.

From time to time there are options which are not well documented at all, and are only alluded to in technical documents. It can be worth contacting authors of documents if the feature is not clear. The coding and exploration of the system will need to continue after this. It should be expected to continue learning the APIs. At every stage there is value in talking to whatever experts/more experienced people you have available. Being able to quickly pickup a technology and move from no knowledge to confidence in using the API is a valuable tool for developers. Learning new technologies has been an important part of my job as a software engineer, and I expect that it will continue to be for many years to come.

Empty Tags in Internet Explorer

Monday, June 16th, 2008

In Case you were wondering…. <span class="replaceMe"></span> does not behave the same as <span class="replaceMe"/>  in ie, even though they are semantically equivalent. The second option will cause sites to crash, and not render if using ajax calls to update them (in particular with Prototype, with the use of Element.replace, or event innerHTML).

So, even though <span class="replaceMe"></span> should be equivalent to <span class="replaceMe"/>. Don't use the later if you want dom manipulation to work (which is pretty much the main reason to use an empty span tag in the first place.  The real moral to the story is Don't use empty span tags if you want to support the most popular browser on the planet.

Automating Deployment to IBM WebSphere Portal

Thursday, May 22nd, 2008

Having an automated deployment procedure is an important goal for any project. This post talks about the the steps taken in making E2 autodeploy to WebSphere Portal in Development.  The below process assumes that the application has been deployed once through other means.

After a friendly pointer from AJ to an article about automating websphere deployment, I decided that the time had come to revisit trying to automate the deployment of our EAR file for E2. I had done bits and pieces of thi in the past using a combination of the WebSphere scripting client, and the WebSphere ant tool (like ant but built with WebSphere bits and pieces). The killer constraint for me is that my client machine didn’t have access to any of the WebSphere binaries (perhaps unsuprisingly Apple and IBM have don’t perfectly interoperate).

In order to work around thi sproblem I ended up leveraging one of the classic protocols (telnet), the websphere scripting client, samba (to mount the application server drives), and a bit of ant to glue it all together. The process outlined below is focused around the deployment of the application E2Application to WebSphere portal.

Step 1: Enable telnet

In Windows Server 2003 this is relatively straightforward. Simply go to your control panel -> services -> Telnet go to the properties, make it automatic and start it.

Step 2: Write scripts to start and stop the app server

I did this using tcl and ended up with the following scripts (the pythonistas may like to use jython to do the same):

stopApplication.jacl

1
&#160;

1
set cell [$AdminControl getCell]<br />       set node [$AdminControl getNode]<br />       set appManager

   

1
[$AdminControl queryNames

   

1
cell=$cell,node=$node,type=ApplicationManager,process=WebSphere_Portal,*]<br />       $AdminControl invoke $appManager stopApplication E2Application<br />

startApplication.jacl

1
&#160;

1
set cell [$AdminControl getCell]<br />       set node [$AdminControl getNode]<br />       set appManager

    

1
[$AdminControl queryNames

   

1
cell=$cell,node=$node,type=ApplicationManager,process=WebSphere_Portal,*]<br />       $AdminControl invoke $appManager startApplication E2Application<br />

Step 3: Write the ant code to compile and copy the application

After the series of standard building tasks, we used a simple copy task to copy the files to the exploded WAR directory on the server. (something like: ${portal.home}/WebSphere/profiles/wp_profile/installedApps/{cell}/{application}.ear/{app_war}.war). Since I develop on a laptop I added in a combination of available and fail task to stop me from accidently creating directories if I hadn’t mounted m

Step 4: use ant to telnet to the server

Make use of the telnet ant task1 to telnet into the server, and run the stop and start server jacl scripts. My Ant targets (passwords scrubbed) are below (excuse the duplication):

1
&#60;target name=&quot;startApplication&quot;&#62;

   

1
&#60;telnet userid=&quot;Administrator&quot; password=&quot;${portal_admin_password}&quot; server=&quot;${portal_server}&quot;&#62;<br />       &#160;&#160;&#160;&#60;read&#62;Administrator&#60;/read&#62;<br />

        <!– change to the IBM AppServer directory –>
        

1
&#60;write&#62;cd \ibm\AppServer\bin&#60;/write&#62;<br />

        

1
&#60;read&#62;AppServer\bin&#60;/read&#62;

        <!– Execute the jacl –>
        

1
&#60;write&#62;wsadmin -conntype SOAP -port 10033

                

1
-username wasadmin -password **** -f startApplication.jacl<br />

        

1
&#60;/write&#62;<br />

        <!– wait for the connected to process message, which will occur on the successful completion of the script –>

1
<br />

        

1
&#60;read&#62;Connected to process&#60;/read&#62;<br />

        

1
&#60;read&#62;AppServer\bin&#60;/read&#62;<br />

    

1
&#60;/telnet&#62;<br />       &#60;/target&#62;

1
<br />       &#60;target name=&quot;stopApplication&quot;&#62;

    

1
&#60;telnet userid=&quot;Administrator&quot; password=&quot;${portal_admin_password}&quot; server=&quot;${portal_server}&quot;&#62;<br />

        

1
&#60;read&#62;Administrator&#60;/read&#62;<br />

        <!– change to the IBM AppServer directory –>
        

1
&#60;write&#62;cd \ibm\AppServer\bin&#60;/write&#62;<br />

        

1
&#60;read&#62;AppServer\bin&#60;/read&#62;

        <!– Execute the jacl –>
        

1
&#60;write&#62;wsadmin -conntype SOAP -port 10033

                

1
-username wasadmin -password **** -f stopApplication.jacl<br />

        

1
&#60;/write&#62;

        <!– wait for the connected to process message, which will occur on the successful completion of the script –>

1
<br />

        

1
&#60;read&#62;Connected to process&#60;/read&#62;<br />

        

1
&#60;read&#62;AppServer\bin&#60;/read&#62;<br />

    

1
&#60;/telnet&#62;<br />       &#60;/target&#62;

Step 5

mix ingredients and enjoying being able to have a one click deploy to WebSphere Portal.

Appendix

For security paranoid people with time on their hands, it is possible to do this using ssh and scp. The key parts will be step 3 and step 4. In step 3 we are using folder share and the ant copy task currently. It could be done with scp. In step 4 the use of telnet could be replaced with ssh.

1 – The telnet task depends on the availability of the commons-net jar on the classpath. (click here to download commons-net).

HTTP Authentication in a URL

Monday, May 19th, 2008

When reading through the Selenium FAQ, I noticed a piece of coolness that I didn't know existed in HTTP Authentication (Selenium FAQ – authentication).  RFC 1738 specifies the following scheme for specifying authentication information in a url //<user>:<password>@<host>:<port>/<url-path>.  I have been familiar with this for commanline based protocols (ftp/telnet and their secure equivalents) but didn't realise that it would work in a browser. In a browser you can specify http://user:password@server:80/path to do basic http authentication. While this ia a bad idea for usernames and passwords in real applications, it is a great tool for development purposes.  My firefox speeddial plugin now has development pages specified in this way.

Of course this approach is not a silver bullet, and other tools are needed. I have used this technique to access websphere portal and webapps hosted on a WebSphere Portal server, as well as applications using HTTP Authentication on Tomcat Servers. Unforutnately it doesn't work with the WebSphere administration console, but thankfully you can simulate the form based login using the following type of url: https://serverName:10039/ibm/console/secure/securelogon.do? action=secure&j_username=username&j_password=password 

The combination of //<user>:<password>@<host>:<port>/<url-path> tye urls, and faking login forms, makes it possible to access most web urls very quickly in a browser environment. 1

1 -Internet explorer doesn't support this for recent browsers (see: http://support.microsoft.com/kb/834489)

Real Programmers

Thursday, May 15th, 2008

There is always a bit of a culture in IT (is that an oxymoron?) around macho programmers.  Real programmers use VI/EMACs etc.   It is always fun to read some of the interesting stories, and urban legends around real programmers, basically all taking variations of the Monty Python "We were poor" sketch

The Story of Mel is one of my favourites, only upstaged by the tooltip on this XKCD Comic on Real programmers.

What's your favourite story (real or made up) of real programmers?