What's brewing
Saturday
Dec232006

Attention to details in iChat

Apple, apple.

A company famous in addressing issue in details. There are already a lot of examples shown before but I am amazed there is still something new being found today.

I am having an audio chat with my friend, turned up my speaker and started talking. But I've noticed that the left channel is muted. I am scared if it might be something went wrong, started to look around in System Preferences and such but noticed nothing wrong.

Then my friend reminded me that, the mic on the MBP is located on the left hand side, near the speaker. So it is muted on purpose to prevent the echo from happening.

I am simply amazed. :)
Sunday
Dec032006

A joy to do software development in OS X

I have been enjoying to do development in OS X for years, in JAVA most of the time. Eclipse, SVN, Apache ANT, Tomcat, Mysql .. all runs flawlessly and I can do deployment easily.

But I am enjoying even more lately with my first rails app. I do this with 3 apps most of the time, which I can "flow" nicely in between.


  1. Textmate
  2. CSSEdit 2
  3. DBVisualizer


Using the GUI of Textmate is like licking a tasty candy - Syntax highlighting, auto closing of tags, project navigation pane. It allows me to modify the different files in both tree mode and tabbed pages.

When I am doing the frontend, I start with the CSS. In this new version, the "X-ray" and "preview" are the 2 features that I like a lot. I can open the preview window and check out how my changes are like. When I am done, I switch back to Textmate for the logic. BTW, Textmate allows me to open CSSEdit from the project tree when I right click on any CSS file.

Upon execution, I will need to check if the backend operates as desired. Now the DBVisualizer comes into picture, I can do SQL query, browse through data easily. And not to mention, this is a FREE application.

To complete the package, I relies on "Transmit" for ftp transmission (btw, it's nice to be able to right click on any file and open with Textmate for editing) and "Color Schemer Studio" in preparing the color scheme. It's always good to get inspiration from others.

As a side note, the environment switching in Ruby is welcoming. Since the DB setting on my local machine differs from my server, I only need to setup accordingly in the "Test" and "Development" environment in the file database.yam. Startup my webbrick with additional attribute, and I am set.


ruby script/server -e test



I treasure these little thing since I work on my mbp many hours in a day.
Friday
Dec012006

The “Partnership” in Hermes

Let's talk about "Partnership", one of the term you should know well in using Hermes.

After finishing this episode, you will know on how to create a partnership and can deliver messages to my testing server.

A large Hawaii pizza with extra cheese, please!


So, what is partnership?

Take an analogy, when you go to order a pizza, the waiter will ask you a couple of questions. What is your favorite topping? What size do you want? Do you want extra cheese?

Right, partnership is your decision on how the messages should be transmitted.

Partnership is an "agreement", in between you and the people who gonna receive your message (let's call them a "partner"). This "agreement" defines on how the message will be sent, e.g. should the partner reply with a note upon receiving a message.

Ok, how could I place my order?


In the Hermes 2 packages, you can find execution script called "partnership.sh" (or partnership.bat), the script will invoke a java class that helps to create the partnership. The program gather the partnership values from the xml file, which can be found from the "data" directory.

The XML file contains all the major configuration that you can find from the message specification, and the default value are configured to create partnership for loopback test. You should be able to spot the meaning of each of them by the name of each element and configure the partnership as desired.

Thus, to create the partnership, all you need to do is,


  1. Modify the xml file, e.g. if you want to create a partnership to send ebms message, you should edit the file "ebms.xml"
  2. Execute the batch script "sh partnership.sh ebms -a data/ebms.xml"


One thing to note is, the script will assume the username and password for the database to be those defined in the installation guide. If not, you will need to change the value in the file "conf/partnership.module.core.xml"

Who else can take my order?


So, you might want to talk to someone else other than yourself. Don't worry, I have setup a testing server. But PLEASE be gentle, don't try to stress test my server. :D


  1. Open "data/ebms.xml"
  2. Modify the following line from


    <transportEndpoint>
      http://127.0.0.1:8080/corvus/httpd/ebms/inbound
    </transportEndpoint>



    to


    <transportEndpoint>
      http://images.vsmile.com:8080/corvus/httpd/ebms/inbound
    </transportEndpoint>

  3. Execute the shell script,



    sh loopback.sh ebms



  4. All should goes well like in the loopback test, mark down the message id for the next step.


How would I know if my order has been placed?


Visit this page and look for the message id you get in the previous step.

Found it? Congratulation, you have sent your first ebms message over the internet.

What you can do next is to play around with the rest of the setting, like enabling the receive of acknowledgement, setup your own pair of server and try to exchange messages (make sure the partnership setting aligns between the server).

Once you are familiar with this, you can go live to exchange electronic messages with your business partner. Have fun!
Friday
Nov172006

Setting up of the Hermes2 Messaging Gateway

Introduction



Hermes 2 (or Corvus, the codename we used to call in the office) is a messaging gateway that enables the handling of electronic messages in the format of AS2 or ebMS. For details, you can refer to our product web page.

I have noticed different questions in the mailing list, and as one of the developer behind the product, I hope my contribution can help those people who is interested in using it.

First off, let's start our installation.

The procedures are basically the same as indicated in the installation guide but I will include a small section in answering some commonly asked question. Also, I want to bring up some interesting finding as I am going to deploy Hermes in a little bit different environment.

Prerequisite


Apart from the binary of Hermes 2, you will need to prepare some other supporting applications, note that I have replaced Postgres with Mysql cause my web host only provides the later one. :D

NOTE : I don't have time to test out everything on this platform so if you want full compliance, stick with Postgres. ;)



Configuration - Mysql


I will highlight the steps nvolved in using Mysql in place of Postgres, but for the rest of the installation, please check out the details from the installation guide.


  1. Create two databases, named as "as2" and "ebms" respectively
  2. Create an user "corvus", grant the right to "CREATE", "DELETE", "DROP", "SELECT", "INSERT", "UPDATE". Or you can simply grant ALL if you are as lazy as me.
  3. Modify the table schemas, replace "VARCHAR" with "VARCHAR(255)" and "BYTEA" with "BLOB". Or you can download my copy from here.
  4. Create the tables accordingly.


Configuration - Hermes


The configuration files in the binary is having Postgres configured as the database of choice. You will need to change the setting in using Mysql instead.



  1. Get yourself a nice editor, search for the string

    "org.postgresql.Driver"


    and replace it with

    "com.mysql.jdbc.Driver"



    Also, locate this as well,

    "jdbc:postgresql://localhost:5432/ebms"


    and replace it with,

    "jdbc:mysql://127.0.0.1:3306/ebms"



    Repeat the procedure for AS2.

  2. Put the jdbc driver of Mysql into the "lib" folder of the Corvus webapps

You can now startup the tomcat and check the various log files (catalina.out, corvus.log, ebms.log and as2.log) that no errors are thrown.

Configuration - Loopback test


Congratulation! Now you are just one step away from completion.

It doesn't mean all is set even if no error is thrown during startup, let's try out our installation with the loopback test. BUT since the program is developed with Postgres in mind so some changes has to be made.


  1. Copy the JDBC driver of Mysql into the lib folder and modify the execution batch files to include it in the classpath.
  2. Modify the file "partnership.module.corel.xml" in the "conf" folder. Do the same thing as in Step 1 in Hermes 2 configuration.

Ta-da, now you are all set and done. Run the loopback test as usual and you should get the following results,



- Module 'Corvus Partnership' initialized successfully.
Start sending AS2 loopback test case.
Sent AS2 loopback test case with returned message ID 20061117-170806-45901@210.245.164.9.
Start checking the received list.
Download the message from the list with ID 20061117-170806-45901@210.245.164.9.
Downloaded successfully.
End checking the received list.
============================
AS2 loop back test finished.
============================



Note



There's something funny upon executing the loopback test ...

I have encountered several DAO issues and turns out it is the case sensitivity in the SQL query. The DB tables are all created with a big cap for the first letter and somehow, in the SQL query, some of the statement is using lower cap and the mismatch leads to the DAO issue. I have changed the table name accordingly in all the DAO XML files and everything is working fine.

What if ...


You are lucky if everything can go in one pass. I will put up pointer to questions which I have seen many times in the google group.


  1. When I boot up Hermes 2, I saw this message in the corvus.log,

    Unsupported keysize or algorithm parameters



    This error will raise if you forgot to deploy the JCE patch. Make sure you are copying to the right location. Also, I found that I have to set the "JAVA_HOME" in my user profile in order to have the patch loaded properly.

  2. Why is the JDK version so specific? Can I use some other version like JDK 1.5?
    Trust me, you will save yourself a lot of time in using the version we request. We find that a method we rely on, has somehow been changed to a private method since 1.4.2_04, so you might experience issues like

    java.lang.IllegalAccessError: tried to access field
    org.apache.xpath.compiler.FunctionTable.m_functions from class org.apache.xml.security.Init



    For JDK 1.5, we have identified some code changes that need to be done before it can operate properly.
  3. Is the "wildcard" feature that was introduced in Hermes 1 still valid in Hermes 2?
    No, this feature has been taken away from Hermes 2, due to the change in principle from push mode to polling mode. You need to specify precisely on what are the messages you want to send or receive.
  4. OK, now everything is working, what if I want to write a client?
    To keep things simple, let's focus on ebms message delivery first. First of all, you need to create a "partnership" for sending out messages. You can do so by using the program in the loopback test, the program will read a "data" file which define the details of the partnership (think partnership to CPA in ebMS).
    After that, you develop your program and make a web service call to Corvus for message delivery. The web service call will include some of the key information you defined in the partnership, so that Corvus can pick up the rest (like where to send it to) from the database.
    The "end point" on Corvus that responsible for picking up the request is
    "http://127.0.0.1:8080/corvus/httpd/ebms/sender" and you need to supply the following information in the web service call,

    • cpaId
    • service
    • action
    • conversation id
    • from party id
    • from party id type
    • to party id
    • to party id type
    • ref to message id

    Also, you will want to create an "AttachmentPart" which carries the "payload" you want to send over to the recipient.
    Upon making the request, you should get a soap response. The body inside should contain an element called "message_id" and the value of this is a string. This is the "token" that Corvus generated for you. You can use this "token" to perform query.


I hope this episode can help you a bit in kicking start the installation. When you are busying in setting up the environment, I will prepare my next episode, focusing on the partnership thing and hope to bring you something more interesting. Stay tuned.
Wednesday
Nov082006

Using WordPress as the project information repository

As illustrated in my previous post, I have selected WordPress as the tool in building up my project tracking page.

Below is a recap on what I am aiming to do,

  1. Categorize the entry
  2. Allow visitor to leave comment
  3. Searchable!
  4. Can ease my documentation effort
  5. Time tracking or something like completion
  6. Can integrate with the other resources, e.g. version control, file server, etc.


Turns out I can achieve all but the 5th requirement, which I have decided in doing it separately.

 



Categorize the entry


Setting up category is a breeze but what I want to share with you is the structure I use.

Each category of functions that I need to implement will have their own category, e.g. one of the feature we will implement is called "Document Processor", I declared it as one of the primary category and for any related smaller function will become it's child.

Apart from that, I have created task related primary category, e.g. Coding, Architecture.

So when we create a new blog entry, we firstly select the related function and then the task.

 



Allow visitor to leave comment


Searchable!


These 2 are standard features from WordPress, the only thing that once bothers me is the problem in sending out email to author when new comment is posted. But I have it resolved finally.

 



Ease my documentation effort


Originally, my ultimate goal to achieve is allowing me to run a script, gather what have been put up on the repository and have a document generated. It is good but I don't know how I could do so, have thought about using DocBook but no time to look into it yet.

So, I step back and thing, if I could generate PDF for related post and have them join togehter could be something good enough. I started looking for plugin that generates PDF file and I have found Contutto.

The installation is a snap and one could even modify the CSS file used for PDF generation. I am too lazy to have it touched up and used the default for now. Maybe I will change the layout to match how the project web site is like.

 



Integrate with the other resources, e.g. version control, file server, etc.


What I have done is to integrate the RSS feeds and provide links to the web interface of the external resources from the project page. Thus, the user can use this as the entry point in looking for anything.

I have found the Sidebar plugin a very welcoming feature, especially in integrating RSS feeds. You can get a bunch of widgets from the WordPress website and manipulating them is just some drag and drop. The use of AJAX is clever.

I used SVN for version control and WevSVN provides both the RSS feeds and a web interface for user to browse around the repository.

For files browsing, I am using a little PHP script called e-Directory Index that allows user to browse around the file server and download any of them as desired.

To fulfill my last desire, i.e. time tracking, I have once thought about developing a client that integrates with Basecamp. It's doable as the API are all nicely presented but I just don't have the time. And I am now doing this in the old fashioned way - whiteboard. On each week, I will list out the tasks that has to be completed and give a tick on the item finished.

This solution is serving well and see if there are anything that I can refine.