Available on iTunesU. I could not find a course website.

These podcasts detail the life of the Carthaginian general Hannibal, often considered one of the greatest commanders of the ancient world. During the Second Punic War against the Roman Republic in the 3rd century BC, Hannibal led his army over the Alps into Italy. He then used superior strategy and tactics to defeat the Roman army at a number of engagements, resulting in the battle of Cannae - a devastating loss for Rome. After this, the Romans adopted many of Hannibal's techniques. At the Battle of Zama, Hannibal was default and Carthage lost the war.

The lectures are given by Patrick Hunt as part of the Stanford Continuing Studies Program sometime during 2007. I couldn't find a course website, but there are a few articles relating to the course. There are 8 lectures (strangely numbered 1 through 10), all audio only and nearly two hours long (around 30MB in size). The first podcast is an interesting discussion on Carthaginian culture, in particular whether they really practiced child sacrifice. The second lecture introduces the First Punic War and Hannibal's father, Hamilcar Barca. The Second Punic War is covered over three lectures (along with an epilogue). The remaining three podcasts are dedicated to Hannibal's crossing of the Alps.

It seems Patrick Hunt organises regular expeditions to cross the Alps, trying to find archeological proof of where Hannibal crossed. Great attention is paid to how closely various mountain passes fit the ancient descriptions. Dr Hunt personally favours the Col de Clapier. If this historical event is of interest, then you will be well served. There is not one, not two, but three different first-person accounts of modern crossing of the Alps in attempts to follow Hannibal's footsteps: Hunt's; Ed Boenig, a student of Dr Hunt's; and John Hoyte, who crossed the Col de Clapier in 1959 with an elephant (called Jumbo).

Apart from close concentration on a narrow historical time period, the series has many intriguing digressions. For instance, there is occaisional mention of the meaning of Hannibal's name, "grace of Ba'al". Ba'al was the main Carthaginian deity, who supposedly lived on a mountain. Thus Dr Hunt suggests Hannibal would have no fear of mountains. A bit of a stretch, but still interesting. If you particularly want to find out about Hannibal's crossing of the Alps, then this is the podcast for you. However, there is still much to learn even if that is not your focus (and the second two alpine lectures can be safely skipped). On the downside, the first lecture (on the origins of Carthage) seems to be missing. Also, there is no sign of the lecture slides. Being able to see the maps and slides would have been particularly useful during discussions of which Alpine pass most closely matched ancient descriptions. Don't be put off by the long podcast length, this series is well worth a listen.

JButtons in a JTable

| | Comments (0) | TrackBacks (0)

Recently I wanted to have a clickable button in a table. Searching on Google for JButton in JTable I found a couple of suggestions, most notably this DevX article and this Esus article. There was also a StackOverflow question that just referenced other solutions. None really satisfied me. So borrowing their ideas I created my own solution.

Italy Photos

| | Comments (0) | TrackBacks (0)

A while ago I put up some photos from Pompeii, and it is about time I put up the best photos from the rest of that holiday in Italy. The set on Flickr is here.

History 110: Roman Republic

| | Comments (0) | TrackBacks (0)

Available on iTunesU. I could not find a course website.

Professor Isabelle Pafford from The Ancient Mediterranean World podcasts returns for another series of Ancient History podcasts. This time a course on the Roman Republic given during Fall 2008 at Santa Clara University. There are 19 podcasts - 1 is a slide show video, but the others are audio only. Each podcast is around 50 minutes in length and around 50MB. In the audio podcasts there are often references to slides that are not available online.

The course starts with the stories of Rome's foundation along with details of the surrounding area and people, which presumably influenced early Rome. The Roman Kingdom is quickly passed over (perhaps due to a lack of information on the era) for the Roman Republic. Most attention is focussed on the Late Republic, with over half the lectures on the period from the Gracchi to Caesar - around 133BC to 49BC.

These lectures are full of engrossing details. There is a bit of historical timeline talk (on this date this happened and on that date that happened), but the series is more about the life and times of ancient Rome. For instance, there is often discussion of the Cursus Honorum (a series of military and administrative positions that provided a semi-formal structure to a political career) and how it affected the way people sought or achieved power. There was also a strong patron-client system, where a person's power could, in part, be measured by the number of clients/followers they had. Thus, manumission was common as freed slaves were typically clients of their previous owner. There is also some interesting consideration of which events are definitely known to have occurred, the fixed-points of history, and those parts of the primary sources that may be apocryphal.

Professor Pafford can be an engaging speaker, and it is clear this is an area she knows well. Indeed the extra colour provided as cracks began to appear in the republic had me hooked. It was a classic fight between two political parties, the Optimates and Populares - modern analogies are too easy to make. Although the ability to raise private armies and the tendency of losers to be executed adds an epic scale to proceedings. The final result may be well-known, with Caesar the unlikely Populares triumphing - but I still raced through the last half-dozen lectures.

It was a good thing I did know what happened in the end, as the end of the lecture series is missing (hint Caesar is assassinated and his nephew eventually dissolved the republic, becoming the first emperor, Augustus). I would guess that around a half-dozen of the lectures are unavailable, mainly around the mid-republic. At one point Professor Pafford apologises for losing some lectures in a hard-drive crash. So I suppose their absence is forgiveable. However, like the earlier Ancient Mediterranean podcasts, there are numerous other production issues. The audio quality is usually good, apart from a few notable exceptions. The video lecture is almost impossible to hear, and the slides are small relative to the screen. Another lecture on the First Triumvirate is split across two lectures because it sounds like the microphone failed (and the second part is very quiet). There is also quite a bit of course administrative talk (assignments, books, etc) - in one 40 minute lecture, 8 minutes are spent on such course administration topics. At least the class seem interested and ask some good questions. The lectures are also presented out of order on iTunes. It helps to know a bit of history to reorganise them from the titles.

Interesting history podcasts, again let down a little by production.

New goals, again

| | Comments (0) | TrackBacks (0)

I don't like new year resolutions detailing plans to make yourself better - I'm already great! However, I do like the idea of setting a few goals. This year's goals are fairly similar to last years, but a little less ambitious:

  • Blog at an average rate of at least 4 times a month. Fairly sure I can do this with the Blender and History Podcast posts I'm planning.
  • Only have 2 programming projects going at the same time. Reassess projects every 3 months. The first two are: learning how to load and animate blender models in a 3D graphics engine; and a secret project.
  • Complete 3 Blender models and write tutorials on them - the models are a robot (to learn animation), a Thermopolium, and a Broch.
  • Maintain Queuesaurus and general ruby skills. Try to use Scala.
  • Run 5km in 25 minutes. This is a bit ambitious.
  • Decrease net ownership of physical goods

Recap

| | Comments (0) | TrackBacks (0)

Almost a year ago I wrote some goals for the new year. Now it is time for an assessment.

  • Goal: Improve Ruby skills. Result: Partial success. I'm not at what I would consider a professional standard, but not far off it. I gemify'ed my BBC weather library, but have since abandoned it as keeping up with the BBC's constant API changes was frustrating. I use Queusaurus even if no one else does. I started another project, but it didn't get far enough to publicise.
  • Goal: Learn Scala. Result: Have done some, but not much.
  • Goal: Learn Blender. Result: Near Success. I feel confident enough about this one. I haven't completed an ancient scene, but I'm sure I could.
  • Goal: Decrease net ownership of physical goods. Result: Success. Doing this slowly but surely - I own fewer things now than when I wrote that goal, but not by much.
  • Goal: 48 blog posts in a year. Result: 44 posts. I'm fairly happy with that. Holidays and looking for a new work contract slowed me down a bit.
  • Goal: Run 5km in 25 minutes. Result: Not even close. The less said the better.
  • On the stretch goals, all are still a long distance away.

I think the main problem with achieving those goals was my tendency to try doing too much. At one point (and continuing for a couple of months) I had 6 programming projects on the go at once. Nothing progressed at any pace over the last half of the year and that is what caused the most slippage. Something to be aware of for the coming year.

Starting a UK Company

| | Comments (0) | TrackBacks (0)

Having just completed the process of forming a new limited company under UK law, I found myself frustrated by the number of steps required. In case I ever need to do it again, or a reader does, I thought it might be useful to set out the steps I took - hopefully I haven't missed any! If it seems overwhelming, various accountancy or specialist firms can do most of it for a fee. Note, I am not an expert in this area, just someone who has done it once and recorded the steps - there is no guarantee this is completely correct.

  • First get the company formed. This will require a unique company name, a business address, and directors' details. Forming the company can be done through Companies House, but I used Companies Made Simple to get things moving quickly. I recommend getting a Printed Certificate of Incorporation - it is needed in later steps.
  • In my business, clients require invoices to have a VAT number so registering for VAT was my next step. If you don't need a VAT number straight away, you may wish to get a bank account first. Also, if the firm's turnover is less than £68,000, registration is not required. There are a few other exemptions too, see more at the Business Link VAT guide. I applied for registration online through the HMRC Online website (click register) - the details required should be the same as for company formation. HMRC also runs a Flat Rate VAT scheme that is worth investigating. If it turns out to be useful then applying to join the scheme can be done at the same time as registering for VAT.
  • Get a bank account. This is quite important as many of the other steps need either bank details or a good reason why there are none (eg VAT registration). Most banks will require a Printed Certificate of Incorporation. I can't recommend any good banks, and you should be aware that it can take longer than you think to open a business account.
  • Sign up to file company documents online at Companies House (click on File documents online). Even if the information given during formation never change, the company will still need to submit at least two forms a year to Companies House to stay registered (annual return and annual accounts). This is easy to do online. At the same time you can sign up for the PROOF system to make it harder for fraudsters to take control of the company by filing paper forms. However, be aware that once you have applied for online access, Companies House will (physically) mail some activation forms before you can file online.
  • If the company will be paying anyone a salary or expenses (directors' expenses count) then you will need to sign up to PAYE. This can be done up to a month before payment. Again this can be done through the HMRC website (click register). From the employer's perspective, I find PAYE a bit complicated. You should learn about it yourself - HMRC and Business Link are good places to start.
  • In the weeks after forming the company, HMRC should send you some forms to register for Corporate Tax. These need to be filled in and returned within 3 months of business activity starting. Filling in the forms will require the firm's PAYE, VAT details, and the Memorandum of Incorporation (this should have been included as part of the formation process).
  • Insurance may be required and is probably a good idea anyway. My business area requires Professional Indemnity Insurance, so I organised this before beginning trading. There are many other forms of insurance which may be useful - my firm also has Employers' Insurance and Public Liability Insurance. Business Link have a guide to help determine which forms of insurance may be required. I used an industry specialist insurer, which wouldn't be useful to most readers, but I have learnt to shop around as different firms can quote vastly different rates (often the most expensive is multiples of the cheapest).
  • I recommend signing up to submit VAT, PAYE and Corporate Tax forms through the HMRC website. It is quite good and normally guides you through the process of completing a form; facing a long paper form fills me with fear. Also, if VAT is paid by direct debit (which can be set up online) HMRC will give you an extra week to pay (this can be done for PAYE too). After initially applying online HMRC will send activation codes through the mail to complete the process.
  • Profit!

After that I advise you quickly sort out your accounts and construct a calendar of regulatory/tax events. Remember, every 3 months a VAT form will need to be submitted. Depending on payroll size, PAYE will need to be paid monthly or once a year in addition to an annual PAYE form (P35) and expenses form (P11D). Corporate Tax forms need to be submitted annually, as do Companies House returns and accounts. Staying organised and being able to quickly determine the financial position of the firm is very useful. Since my business is fairly simple and having completed a course on accounting at uni, I created a double entry book-keeping system in Excel. If you don't feel you have the knowledge to do this (or the firm's accounts are too complicated) there are various software packages and accountants that can help - I can't recommend any.

In general, the HMRC and Business Link websites are very useful and well worth a look.

Good luck!

Singularly Lazy

| | Comments (0) | TrackBacks (0)

Ah, the Singleton pattern. It is used to create a single, globally accessible instance of a class, preventing any further instantiations (so only one object of the class can ever exist). When I first learnt about Singletons soon after leaving university, I thought they were wonderful and used them often. Now I think that they are often a very bad idea. Not because of security concerns, as one person once suggested to me, but because I don't want static methods/classes hanging round (increasing global state) or I later realise more than one is needed!

Once when creating a consumer website for a bank I needed access to various pieces of bank information at numerous points in the code. "There is only one bank", I reasoned and made the class containing this information a singleton. Then the bank acquired another two banks so my design was broken and refactoring had to take place right before launch. However, despite learning repeatedly from experience, I still find myself creating more. I think this is due to laziness on my part. If I'm short of time or feel that it is not particularly important, I fall back on habit. Later, while refactoring I realise a better result could have been achieved with some thought. For instance, if the global access of singletons is a problem, perhaps using an IoC container (like Spring) to wire everything up could help.

I hereby resolve not to use Singletons without thinking very hard first about whether there is a better way.

Available on iTunesU or at its website.

This is a recording of a University of California at Berkeley history course on the ancient Mediterranean given by Professor Isabelle Pafford during Fall 2007. There are 25 podcasts (each around one hour, and 15 MB) starting with a couple on Ancient Egypt and then passing through Ancient Greece, the Hellenistic Period, the Roman Republic before ending with the Roman Empire's collapse in the west around the 5th century AD. Most attention is paid to Greek and Roman history. A following course on Byzantine history is mentioned, but I couldn't find it online.

As should be expected for a series covering so much, the lectures often quickly pass over topics. Some parts of lectures were lists of important events. Despite this, there were more than enough digressions onto engaging side-topics to maintain interest (for instance, there was a passage on the nude in Greek sculpture and another on the formal political structure/progression in the Roman Republic). Thus the podcasts serve as a good introduction to the breadth of ancient Mediterranean civilisations and highlights areas you may want to explore further (after this I was looking forward to learning more on the mid and late Roman republic). I can't find much fault with the content of the course considering its scope.

I can find fault with the production standards, which overall are frustratingly poor. The sound quality is often annoyingly bad. For one lecture I had the volume turned up to max and pushed the earplugs deeper into my ears and I still could barely hear the lecturer, who sounded like she was mumbling next to a static noise generator. Course administration comments are sometimes made during a lecture - including asking unintentionally rhetorical questions to what seem to be largely apathetic students. Considering these are lecture recordings I can understand this, but usually the first few minutes of each lecture are taken up with course administration too (these could have easily been cut). Also, Professor Pafford regularly refers to visual aides that are no longer available online (the bspace website mentioned in the podcasts has been shutdown). Also the first two lectures are missing.

A good introduction to classical history, made slightly less pleasurable by poor production.

Testing generated code

| | Comments (0) | TrackBacks (0)

What is the accepted way to test generated source code? A recent work project required me to generate some Java source code from small definition files as part of a larger framework. The plan was for other project teams to take the framework and use the generator to create source which would become part of their project. I wanted to write unit tests for the source code. The problem was how to write a test for code that didn't exist at the time the test was written because it hadn't been generated yet! I came up with a few options:

  • Do a text comparison between generated code and the previously created known text output of the generation process. If they are exactly the same, the test passes. This tests the generation process if correct but doesn't test the logic of the generated code. If the generated code has syntactic errors, compilers or IDEs will pick this up quite fast and the developers in the other project will complain quickly, but subtle logic could go unchecked for ages.
  • Write a test that generates a class file from known inputs then compiles it programmactically with the Java Compiler API then loads the class into the JVM and runs tests against it. This would be better than the previous idea, as it tests the functionality of the result. This was my first choice solution. However, getting the Java Compiler API to work can be a bit hard. There was a paucity of documentation on this and in the end I couldn't get it to work within time constraints.
  • Generate the test at the same time as the generated code and pass them both to the other project. The other project would then test the generated code as if it was their code. This felt wrong to me. No other generations systems do this - it is like passing the buck. If there is an error in the generated code then the generator needs to be fixed not the generated class!
  • A 2-step process - test the functionality and generation process separately. First, create a class that should be the same as a generated class given known inputs (probably by generating it!) and write tests that work against that class. Thus the problem of testing not yet existing code is solved by using some code generated earlier. This tests the generated code's functionality as long as the generating process doesn't change. So the second part is to test the generation process hasn't changed using the first test in this list. Add another test to generate the code and check that it is exactly the same text as the class the rest of the test is written against. If the generation output changes then you have to modify the pre-generated class, and thus change the functionality test if required. Easy.