Archive for the ‘Programming’ Category

JRuby 1.1.4 & getPlatformMBeanServer error on linux

Saturday, September 13th, 2008

I was getting an error on a new install of JRuby on a Linux

jruby 1.1.4 (ruby 1.8.6 patchlevel 114) (2008-08-28 rev 7570) [i386-java]
Created MBeanServer with ID: -vsnele:fl2bg1bd.0:mandlebrot:1
java.lang.management.ManagementFactory:-1:in `getPlatformMBeanServer’: java.lang.InternalError: One of the management beans is not compliant.
from org.jruby.management.BeanManager:59:in `register’
from org.jruby.management.BeanManager:29:in `register’
from org.jruby.compiler.JITCompiler:68:in `<init>’
from org.jruby.Ruby:207:in `<init>’
from org.jruby.Ruby:160:in `newInstance’
from org.jruby.Main:184:in `run’
from org.jruby.Main:100:in `run’
from org.jruby.Main:84:in `main’

It turned out that remove the following packages solved that problemRemoved the following packages:
java-gcj-compat
java-gcj-compat-headless

Adding Semantics to business websites; what tools do we need?

Monday, October 24th, 2005

RSS and ping (and trackback) are what made the blog explosion happen. Content was routed, manipulated, aggregated, tagged and tracked.

What enabled this were the blogging tools and software, that allowed users to simply create content and RSS-ify it.

So what would the tools for a business need to do? Well you tell me!! comments please!
Here are a few ideas to get going..

  • News + content (manuals etc)
  • I think RSS takes care of most of this.

  • Describe the business
  • e.g. We are a furniture shop, retail.

  • Describe your business outlet locations, opening times and contact info
  • … add services available at each outlet? E.g . wifi available, handicap accessibility.

  • Describe products in a standard way
  • This would simplify comparison for prices etc. across vendors. Both Yahoo! and Google (Froogle) have their own standards for this.

  • A way to describe discounts and special offers
  • Sale on 14th – 15th December, 20% off everything.

Once these pieces exist, you should be able to ask questions like,

Show me furniture shops near me holding a sale in the next week.

or

Show me furniture shops with items described as couches, with prices less than 600 Euros , that are open after 6pm

…. and we all know that would be good.

Determine the Character Encoding of a file.

Monday, June 13th, 2005

I came across a mail on a ColdFusion forum by Brett Suwyn:

I am trying to read the contents of a file and then output it verbatim.

The problem is that if I use cffile to read the file into a variable and
then output it (or readBinary into a variable and then ToString to output
it), I have to specify an encoding. But I don’t necessarily know the
encoding (and if I specify the wrong one, the file contents are altered on
output) so I just want to output it exactly as it came in.

I thought this was an interesting question because Character encodings are something I haven’t a DEEP understanding of. Here was an excuse to find out more!

Usually when I want to have a deep understanding of a subject I start with first principles.

So what is character encoding? There are several good resources on the web, but I found
Jukka “Yucca” Korpela’s site (http://www.cs.tut.fi/~jkorpela/chars.html) on the issue to be very comprehensive, with many links for further explaination.

So basically the only why to determine the correct encoding of a file is if the original program that created the file specifies it in the contents of the file (in Ms Word for example or in the encoding attribute of a XML file)

< ?xml version="1.0" encoding="UTF-8"?>

An example of encoding specifed in XML

or if the information is passed along with the file when it was recieved, with a charset specified in an email for example.


Content-Type: text/plain; charset=ISO-8859-1; format=flowed
Content-Transfer-Encoding: 7bit

An example of encoding specifed in Mime Header in an email

So back to Brett. In his email he didn’t specify the origin of the files that he was including. But since he is talking about a ColdFusion application I’m going to make an assumation. The files are uploaded via the browser.

RFC 1867 is the RFC that deals with Form-based File Upload in HTML
(http://www.faqs.org/rfcs/rfc1867.html)

Section 3.3 deals with encoding

The value supplied for a part may need to be
encoded and the “content-transfer-encoding” header supplied if the
value does not conform to the default encoding.

The default encoding here refers to 7BIT encoding.

Of course rfc’s are not alway conformed to, so some testing will needed to be done.

A note on the Byte Order Mark:

One other piece of information I came across in the field of Encoding determination, was the Byte-Order-Mark. Basically the Byte-Order-Mark may be used to indicate the encoding of unlabeled text in many Unicode encodings. However it is of limited use to determine encoding, in general, as the program creating the file must insert it. If there is a BOM however you know the file is unicode and you also can tell the Endianness of the text.

Googles web accelerator and the RESTful web

Saturday, May 7th, 2005

Googles new web accelerator is making waves, and not in a good way.

The problem is that webaccelerator prefetchs URL in the context of your browser, so if your are logged in to your favorite web application, it goes and “clicks” all the links on the page, for example, links that might DELETE things!!

Now there are lots of smart folks out there in the Blogosphere saying I told you so and “you were warned” . Robert Sayre even suggests to google they should work around things people are doing to keep their applications from breaking!!

Well I think the last word should go to Leslie Michael Orchard (another blog for my reader I think )

So, like… uh… Did Google build their accelerator that way just to provide a dramatic example of why REST evangelists focus repeatedly on the fact that the HTTP GET method is specified as and should be implemented as idempotent?

Dramatic indeed.

Code.Google.com

Friday, March 18th, 2005

Google has launched Google Code, a website for external developers interested in Google related development, and where they will publish free source code and their APIs to their various services..

Check it out code.google.com

What I want from Com Reg.

Sunday, March 13th, 2005

There are 3 little things that Com Reg could insist phone companies do to improve transparency and competition.

  1. Give me access to my bills in electronic format via a web service in a common fixed format.
  2. Let me change my account options via a webservice
  3. Give me access to tariffs in the electronic format via a web service.

Using these 3 things, 3rd parties, like me, could really do some interesting things.
For example, I could write a web page where you put in your mobile number, and password, and then it would display how much your last months bill would have cost across all the mobile providers, with all the various options.

It could recommend which number you should set as your “phone a friend for free” number. And if they let you change account options via a webservice, you could change to the suggested number there and then.

It could sample your bills for the last 6 months and suggest which carrier would give you the best options.

Once you have the data and power over your account, the options are endless.

IrishBlogs

Getting started with PHP

Monday, January 17th, 2005

Well believe it or not, I’ve never had the time or requirement to get into PHP for a medium/large project.
Recently I’ve had both the time and the requirement.

Firststop was to install PHP on my OSX Powerbook.
Marc Liyanage’s excellent Mac OS packages website made that extremely easy
Just follow the instructions here

http://www.entropy.ch/software/macosx/php/

Next thing I needed was a PHP friendly editor. Since I already use Eclipse as an editor for Java, I decided on the PHP plugin.
Download it here, www.phpeclipse.de . Hasn’t got Debugging yet, but good otherwise.

Given my experience in Java web applications, I was keen to find two bits of functionality for my new PHP web application.

First I needed a templating engine, so I can do some presentation/logic separation.

I’ve decided to try smarty,
http://smarty.php.net/

Second I needed some DB abstraction, and the consensess seems to be to use PEAR, http://pear.php.net

Any other suggestions welcome

We will see how we get on!