Variety

A bit of light observation. Different ways to do an else if with examples from languages I use or have used frequently.

Type 1: else if

Separated else and if, minimising the number of keywords required in the language. Personal favourite.

if (expr) {
    statements
} else if (expr) {
    statements
} else {
    statements
}

As in: C, Java

Type 2: elseif

Remove the space, for a bit more typing efficiency.

If expr Then
    statements
ElseIf expr Then
    statements
Else
    statements
End If

As in: Visual Basic

Type 3: elsif

Contracted by one more character, while still reading as “else if”.

IF expr THEN
    statements
ELSIF expr THEN
    statements
ELSE
    statements
END IF;

As in: Oracle PL/SQL, Perl

Type 4: elif

if expr:
    statements
elif expr:
    statements
else:
    statements

As in: Python and the Korn shell

Does anything use eif?

Tagged , , , , ,

Rue Montorgueil has a Space Invader

I am tracking-down the invasion, one Space Invader at a time…

Rue Montorgueil has a Space Invader
Tagged , ,

What would you attempt to do?

This quotation was sent to me the other day by a colleague, and has been sitting in my inbox awaiting my decision on where to ‘file’ it.

“What would you attempt to do if you knew you could not fail?” – Dr Robert H. Schuller.

Random motivational image

Random motivational image

I shall think about it, but it’s easier to ask it than to know the answer.

By the way, though I have no interest in the Church, Dr Robert H. Schuller’s life is worth reading about – even if it’s a quick peruse of his Wikipedia page, and a cursory glance at the first page of Google search results.

Email filed!

Tagged , ,

Amazon AWS Signatures

Last Thursday I presented an afternoon overview on Web Services to a group. We were using soapUI to demonstrate some SOAP Web Services written for a customer, and I wanted to demonstrate also that it is just as easy to call public services which are remote. For this I chose the Amazon Product Advertising API, partly due to the fact that it’s already an example on Eviware’s soapUI website, and partly because Amazon is such a well-known company. This post is a very short follow-up to explain how to do properly, something which I had to use a nasty workaround for during the afternoon.

The problem was the signature required in the header of the SOAP request, which I had to drop-to an executable I had written to generate. I would rather have used an off-the-shelf tool, but I couldn’t get openssl to work (completely due to user-error you understand).

I knew it was one of a few gotchas that was giving me the problem but I didn’t have the time to figure it out. Now I have, so what follows is, in as few a number of steps as I can manage, a 1-2-3 of how to send a request to the Amazon Product Advertising API.

Before we begin, sign-up to Amazon AWS. Amazon will send you an email – follow the link provided in the email and grab your AWS Access Key ID and Secret Access Key and paste them somewhere – we’ll need them in a moment.

To send a SOAP request (without WS-Security):

  1. Run soapUI
  2. Create a new project with the Product Advertising API’s WSDL by entering the URL:

http://webservices.amazon.com/AWSECommerceService/
AWSECommerceService.wsdl

  1. In the Navigator pane on the left of the soapUI main window, find the request for the ItemSearch action and paste in:

<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:ns="http://webservices.amazon.com/AWSECommerceService/2009-10-01">
   <soapenv:Header xmlns:aws="http://security.amazonaws.com/doc/2007-01-01/">
      <aws:AWSAccessKeyId>?</aws:AWSAccessKeyId>
      <aws:Timestamp>?</aws:Timestamp>
      <aws:Signature>?</aws:Signature>
   </soapenv:Header>
   <soapenv:Body>
      <ns:ItemSearch>
         <ns:AWSAccessKeyId>?</ns:AWSAccessKeyId>
         <ns:Shared>
            <ns:SearchIndex>DVD</ns:SearchIndex>
         </ns:Shared>
         <ns:Request>
            <ns:Title>Allo Allo</ns:Title>
         </ns:Request>
      </ns:ItemSearch>
   </soapenv:Body>
</soapenv:Envelope>

  1. Replace the search criteria if you don’t wish to search for Allo Allo DVDs (I do – it is hilarious)
  2. Insert your AWS Access Key ID in the two places provided.
  3. Choose a date and time for the timestamp. Right now will do.
  4. Concatenate the name of the action you are invoking and the timestamp in the format YYYY-MM-DDTHH:MM:SSZ, e.g. ItemSearch2009-10-11T16:11:30Z.
  5. Generate the signature using openssl as follows, inserting your Secret Access Key where indicated:

$ echo -n ItemSearch2009-10-11T16:11:30Z | openssl dgst -sha256 -hmac secret_access_key -binary | openssl enc -base64

  1. Paste the timestamp and the signature into the request where indicated and click the ‘Play’ button in soapUI to send the request. If all is well you’ll get a set of results from Amazon.

If you don’t have openssl you can download it from http://www.openssl.org/. There are links to binaries there, including for Windows.

The -n option to echo is very important, and was where my problem lay. On UNIX it suppresses the carriage return – important since we don’t want a carriage return as part of the text to be signed. On Windows however there is no equivalent (to my knowledge) and including the carriage return gives the wrong signature.

My best suggestion for a workaround for Windows is as follows. Open up notepad and write the text to be signed “ItemSearch2009-10-11T16:11:30Z” into it with no newline after. Save it, making sure to save with ANSI encoding (an option in the Save Dialog). Then at the prompt, execute the following command, again inserting your Secret Access Key where indicated, and the filename of the file that you just created.

$ openssl dgst -sha256 -hmac secret_access_key -binary filename | openssl enc -base64

If you’re not using openssl, or you just want verification, assuming the hypothetical Secret Access Key of 1234, I get the following:

$ echo -n ItemSearch2009-10-11T16:11:30Z | openssl dgst -sha256 -hmac 1234 -binary | openssl enc -base64

FRnAn5puzTwI47vJ33sQHYQ9SSSIBjChTKd8u8Mbfs4=

If you’re getting the same then you’re okay :-)

Full documentation of the Amazon Web Services security can be found here.

Tagged , , , , , , , , ,

Wood Smoke

It just happened again! I tweeted about this last winter, and I may be repeating myself but I *love* living in a city where I can open the window and get a good waft of wood smoke. It evokes memories for me of Mousehole in Cornwall as a child. Just as soon as le ramoneur has visited, I shall be lighting a fire in our chimney.

These days it may be un-green to light a fire when it’s cold (wood is better than coal, I know) and it’s really not good for city pollution. For me though it smells like magic, and that is what this city is. Round every corner and down every rue there is something new to be discovered every day. Some days I hate it, and I may have to leave it, but magic is what it is – a city which hasn’t lost touch yet with its past.

matthewneale.net

I’ve resisted buying a domain for many years. Around ten years ago all my peers were hurriedly snapping up their names, and I couldn’t really see the point. The whole business of choosing someone to buy the domain from, and choosing who to host it, and administering it, all seemed a bit much when all I really needed was an email address. In the end I signed up for HoTMaiL (as it was then) for free and never looked back. Perhaps it wasn’t cool, but it was simple.

After starting this blog I thought about it again, but the same thoughts came to mind, and anyway, this is not intended to be a pro-blog, it’s just for me to record my progress on.

In the end though I finally succumbed, and this blog is now matthewneale.net. You may have noticed, you may have not, in theory it shouldn’t make any difference and matthewneale.wordpress.com is still active and will remain so.

The reason for the change of heart is that recently I’ve put the URL for the blog all over the place – it’s on Twitter, LinkedIn, Seesmic and Plaxo, it’s on FriendFeed and Facebook, it’s even on my CV. I only realised just how many places when I tried to change them all to the new domain. My feeling is that if I am going to have my main internet presence somewhere, it really should be somewhere as permanent as possible, and somewhere I can control independently of where I host it.

It’s dead easy now anyway, I just paid a tenner via PayPal and WordPress did the rest. [This is not an advert for WordPress.]

The funny part is still to come though, the day before I made my final decision, I saw this little advert on my WordPress Dashboard:

WordPress tip: Be the master of your own domain – make this blog easymattnealeonline.com for just $15 per year.

For those who read my post 2 weeks ago, you’ll know why this made me gawp and then laugh. Strewth! This is one of those moments when you’re sure someone in power must be watching.

Tagged

Times Fly*

My six months are up! I’m done! Pencils are down! The project has been put to bed!

Time does seem to have flown, and even though I promised to write a lot on this blog, I haven’t. You’ll have to believe that this is because I’ve been far too busy to have had time.

Goodnight!

Goodnight!

From the sofa of a flat on Upper Richmond Road, Putney, through the fantastic Le Bureau in Battersea, to the dining table of an apartment on Rue Montorgueil, Paris, it has been a grand adventure. Though there were a few gaps during the move times, I’ve worked at least 15 hours a day and have written 24,700 lines of code. I’ve learned a lot – one category of things I’m glad I now know, and another category of things I really wish I hadn’t had to go through!

The most important thing is that I do feel I’ve executed on what I said I’d do. My plan was to spend six months prototyping my idea, to achieve three goals:

  • Have a working prototype of the thornier technical areas to demonstrate they can work.
  • Gain some clarity into the major technical hurdles and clarify the purpose.
  • Get a better idea what the rough time and cost investment would be to produce a first release version of the product.

The prototype is quite nice, it does an awful lot with a very simple user interface, which is exactly what I intended. With not much more than a few clicks you can select a number of filesystems, and databases, suck them from their current locations, record them, version them, and spew them (technical jargon for sure!) onto a whole host of other servers that you choose. Everything is transactional and filesystems and databases can be rolled back, and rolled forward as you please.

The ability to do this is one corner of the functionality that is required to be able to build the software I want, though actually in itself, the above could be quite useful.

So what now? I’ve taken a week off, I’ve brushed up my CV, and I’m going to look around for something interesting to do. A contract would be best, as I’m still dedicated to finding a way forward for my idea.

On the project front there are a few things that I want to clean-up in the prototype that didn’t quite get finished by the deadline, but most importantly I’m going to start putting the business plan on paper – starting right after this post.

Finally, there are a few parts of the prototype that may be useful in their own right. The XA Filesystem post was the first example of this and two other areas that are immediately obvious are:

  • To facilitate the ability to read a database and re-construct it elsewhere, I needed an RDBMS-neutral schema format. I looked around but couldn’t find exactly what I wanted, so I wrote one from scratch. I can analyse a database and produce an XML-based, vendor-neutral schema which then can be loaded up anywhere else you like. This could potentially be useful to others so I’ll put something together about it on this blog sometime in the next month.
  • The other is the WS-Coordination and WS-AtomicTransaction support I wrote for Apache CXF. This is slightly more rough, and probably serves more as a proof-of-concept rather than anything that could be used straight away. Also, I imagine we’ll see this in CXF at some point, but I’ll post something on it soon if Apache doesn’t get to it first.

* Title from an Orbital EP Times Fly, 1995.

Product-Naming Mistakes

A Friday morning post in the general amusement category!

After an entire morning working through a mind-numbing list of software packages thrown up by a Google search, I feel I have to make a few observations.

The names have been changed to protect the ‘innocent’.

1. If your product name shortens to an acronym that’s a little dubious, please don’t use the acronym on your website

For example, if your software is a system to help a circus owner seat important VIPs, and say you decided to call this product Seating Of Dignitaries, then that’s fine with me, there is only a limited namespace available. However, don’t use the acronym! Don’t put on your website:

Click here to download Seating Of Dignitaries (SOD)

Saw it this morning!

2. Be careful about what you really mean when you call your product * Manager

Sticking with the circus, if your software is to help lion-tamers manage their lions then calling your product Lion Tamer Manager is not at all correct. That would be a piece of software for the circus owner to manage lion-tamers. See?

3. And finally, putting the word ‘online’ in your url isn’t going to fool me (for long)

There is nothing wrong with PC-based software. The world may be moving towards hosted software like a, erm, leaping circus lion, but this doesn’t make your product obsolete overnight. It’s probably still the best in it’s class. Don’t worry about it. Putting the word ‘online’ in your url to cover-up for the fact isn’t going to fool me.

To go back to Lion Tamer Manager, calling your site www.liontamermanageronline.com and then giving me a link to order the cd is just desperate.

Pinch of salt ;-)

Tagged , ,

Positive Reinforcement

I’m keen for my application to keep the employee interested and involved in their job, perhaps even in the gaming sense I’m keen for my application to reward the employee for their positive behaviour. Now while this could sound rather sinister, as does the creepy behavioural title of this post, that’s not my intention, so I’ll try to explain.

In my previous job we used an ageing piece of software called ClearDDTS to track defects and change requests. This had a very simple feature whereby it emailed you when the status of the defect or change-request you were working-on changed. So if the defect went through test successfully, you’d get a mail, or if the defect was finally closed once the customer had approved it, you’d get a mail. The email was useful for example if your defect had been re-opened so you knew to look at it again, but other than that I feel the potential was under-utilised.

I’d like to use similar techniques in my application, but not only to keep people informed of the status of their previous (or upcoming) work, but also to keep people interested. Ideas from modern social media crop-up here too – these days, staff are often spread around the globe and I know only too well how annoying it can be receiving an email or a call from someone you’ve never even heard of, asking you why something you’ve done works the way it does.

Before I go any further, I’m not building a social networking tool, nor am I building a defect tracking system. The software I’m focused-on is designed in part (it has many facets) to aid communication and collaboration within large enterprises, and part of the purpose is to track work done on (and changes made to) software.

As some examples of the kinds of things I’m thinking of: I’d like to see the user informed when work they’ve done goes into test, I’d like them to know who is doing that testing, what that person’s bio is and what they look like. I’d like to see the user informed when the work they’ve done is delivered to the customer, I’d like them to see any customer feedback, a log of what occurred during the installation and who performed it. I’d like to see the user informed when someone else in their team takes their changes to incorporate into their own work. I’d like the user to be able to see the work of those around them, so they can understand at a glance how it impacts them. Most of all I want this visualised in a gui. Part of this is a news feed (how very Facebook), but I’d also like a visual representation of it.

I’ve been thinking about this on and off for a while and it led to a 4:30 or so wake-up one morning with my brain buzzing randomly about the standard Organisation Chart. That led to these thoughts. The video may be slightly jokey, but my point is serious. The Org Chart tells management how many people they manage, but it doesn’t describe to the individual their daily communication, or their responsibilities, or their worth. Let’s face it, if you’re at the bottom of an Org Chart, where most are, you’d be forgiven sometimes for thinking that the work you’re doing is just a drop in the ocean.

If the Org Chart demonstrates to you how insignificant you are, how much benefit would there be to providing an employee with an ever-changing, constantly up-to-date diagram of where they sit in their organisation? What impact does what they do have? Lots, generally. When you fix a defect in a piece of software, how many other people work with what you do? How many people are impacted before it goes out the door? The fact that you introduced a bug, or forgot to document something clearly, how many people did this negatively impact? What were their names? What do they look like? Where did they go on holiday? (You can mention this when you contact them to apologise.) How much better would I feel if I could see visually the good that came of what I did today, and when it’s negative, perhaps it would improve me as an employee to know.

Some of this wasn’t a problem in the ‘old days’ when people generally only worked with others in the same room, but large companies now are run across many countries, and many of us work daily with two or three other countries. I think this is genuinely great for the individual, it’s one of the most wonderful things about my previous job, all the people from so many different countries that I worked with, it’s just that companies haven’t yet evolved to take any other advantage of this other than the reduced cost.

The Org Chart has no place in my application, but I feel a visual representation is important. I’m imagining a diagram that shows you, and your work, and your links to your peers (whether local or remote). I’d like this to be active and clickable so the user can drill down, or scroll around and find out a little more about their peers – who they are and what they are working on.

To my mind this will give an employee not only an idea of what is upcoming for them and what has happened to the work they’ve done previously, but it will also give them an understanding of what is going on around them, and a sense of worth and position in their organisation. So while the title of the post could be seen as creepy, I’d rather the emphasis was on the word positive rather than the word reinforcement, and the ideas thought of as a benefit to the everyday enjoyment of the employee, as well as, as a benefit to the organisation they work for.

Tagged , ,
Follow

Get every new post delivered to your Inbox.