You are currently browsing the category archive for the ‘Uncategorized’ category.

lazy summer

Originally uploaded by pixietart

I wrote a tiny and very handy JMS drainer in JRuby with Spring at work, but I got fed up with running it from a command line because I am lazy.

So I wanted a web interface to run a drainer in background. Since I got JRuby on Rails in Tomcat running, I checked out BackgroundDRb only briefly, or not harder enough to get it working. To be honest, I could not figure out how I run a JRuby script as task.

Anyway, I came up with a better and simpler solution. I don’t need a fully featured background tasks management for this. I don’t need to persist tasks nor schedule tasks. I don’t care if tasks were terminated in the middle. The only things I need are:

  • Run a task from a web form
  • Show running tasks

I played with JSON and Jetty in JRuby before and found that combination very easy to develop. I have also learnt jQuery to work with JSON at client side recently. So I have used them to implement the above the followings.

  • Make a standalone JRuby task class runnable in a Java thread
  • A servlet in Jetty in JRuby with POST to execute a task in a thread and store the task instance in a global array and GET to return a list of running tasks of their status in JSON.
  • A default servlet in Jetty in JRuby to serve static content, i.e. one HTML page with css, javascripts and images
  • Use jQuery Ajax to load a JSON from the local servlet and populate the task list table dynamically.

That is simple and works well. It scales, too. 20-odd JMS drainers can run in one JVM. The execution is faster and save loads on the server.

I might post sample codes here if anyone is interested in.


ikea. carson, ca. 2007.
Originally uploaded by eyetwist.

Do you check online bank statements every month? I was surprised a few weeks ago that I was charged £25 for unpaid standing order that I was not aware. So I wrote them asking about it via secure email they provide. They replied,

In response to your enquiry, the charge applied to your account is for a transfer that was arranged which was unable to be completed due to insufficient funds in the account.”

Yes, they gave me a standard answer and it is not true. Useless. I asked them again.

Further to your email, there was not sufficient funds in your account to cover the payment as you made a withdrawal from the account on the same day.”

What? I didn’t make any withdrawal and the statement doesn’t show any. I made a transfer from my current account to my saving account. Then, they gave me more explanation via secure email.

“You transferred £** into your account on 29th December which gave you an availiable balance of £**. On the 2nd January you then transferred £** to your savings account ending ** which left you with insuffcient funds to cover the standing order for £**. “

I didn’t understand that at all. They said I made 2 transactions of the same amount on the same day, but I did not. However, on the same day, I received an another email to confirm that I got £25 refunded without any explanation (if I did something wrong) or apology (if they made a mistake). BTW, they need a spell checker in their system.

“Following your email concerning the standing order on your account, I am pleased to confirm I have arranged to get this refunded for you.”

I thought it was all right after all. I checked the account next few days to confirm the refund, 4 days later I ran out of patience. I wrote them again. No response from them. Another 4 days later, I wrote them again. You can’t believe what happened next.

“The message could not be delivered because the recipient’s mailbox is full.”

OMG! I couldn’t believe that. I really started worrying about their customer service. However, on the same day, the refund was finally made. They said,

“The fee you refer to has been refunded today. You will be able to view this in the recent transactions page of your personal homepage.”

Thanks, but still no explanation. I was surprised and impressed that they made the interest adjustment of £0.08. Not bad. I wrote them again thanking for the refund and asking about the further explanation. They responded,

“In response to your query I can confirm a charge was placed on your account as a result of the standing order reversing. This reversed due to insufficient funds in your account at the time. To avoid these charges you can transfer money to your
savings account as an internal transfer by logging into your account.

In addition I apologise if you were unable to send us a request yesterday as we were experiencing technical errors with our message inbox.”

One apology accepted. I am sorry, but I still don’t get it. That’s exactly what I did. I wrote them again. I hope they are patient with me. To be continued.


Blog Stats

  • 87,765 hits