A Django site.
September 2, 2008
» I hate literature. I'd much prefer to read a good book.

Google Summer of Code is officially over, and the new school semester has started. Now I suddenly have to shift my focus to new things. For example, this semester we're supposed to design and build a CPU that runs Lisp code.

I am fairly satisfied with the end result of my project. I had envisioned a more feature rich application, but had to scale back my expectations in order to get all the core features running smoothly. In the end I got an image viewer with fewer feature but smoother performance. Perhaps not a bad deal.

I'm still impressed by how well it runs with the 109 megapixel image I use for testing - even on my test server which is a Pentium III laptop with 512 MB RAM. Obviously I point this fact out whenever I can, so even though I mentioned it in my previous blog post I'm bragging about it this time as well.

The annotation system is pretty slick too. You can add, view, delete, edit and move annotations, with nice graphics from Google Maps.

The Flying Tank

Wait, what?

Hm.. what's that old proverb again? "Genius has its limits, but stupidity knows no bounds."

In my last installment in my series on insane WWII hardware, I'll present one of the craziest of them all - the M1932 "Flying Tank."

The M1932 was the brain child of mad American inventor Walter Christie. He is most famous for his "Christie suspension," which vastly improved the cross-country performance of tanks.

Christie had a strained relationship with the U.S. Army. He did make several clever improvements to tank technology, but his areas of interest conflicted with those of the army. For example, he was obsessed with the idea of small and light tanks, with tracks that could be easily switched for normal wheels for faster speeds on paved roads. This did not interest the army at all.

During the 1920's he tried and failed to sell his unconventional ideas to the army. He finally achieved some success with the M1931 model. In a series of dubious transactions he managed to sell this tank to the United Kingdom, Poland and the Soviet Union. These countries later went on to design their own tanks based on the M1931: The British Cruiser tank, the Polish 10TP and the Soviet T-34.

Following this, he became obsessed with the idea of making tanks fly. The M1932 design was a turretless, extremely light and fast tank that he hoped to use for this purpose. It weighed 4.5 tons and was 7 meters long. The wooden biplane wings were mounted on a disposable airframe that would be dropped off after landing.

Incredibly, the M1932 was (on paper) capable of taking off and flying under its own power, the propeller was driven by the tank's internal engine. The engine had to be very powerful: 750 hp - capable of achieving speeds of 160 km/h when using rubber wheels on paved roads.

The idea is certainly appealing, but only until the inevitable disadvantages become apparent. Christie dreamt of a large wing of flying tanks, dropping in at or behind enemy lines without warning. They would then speed around killing everything in their sights, while receiving very few incoming hits because of their unmatched speed.

The reality would be a lot different though. When merging the two vastly different vehicles, a tank and an airplane, you obviously have to make compromises. In this case the result was a useless tank and an even worse airplane.

First, the tank lacked a moving turret - it would have to make right and left turns in order to aim its gun. Second, in order to achieve the low weight Christie had to drop armour down to the ridiculous - 10 millimeters. At this level, the tank really wasn't armoured at all, a normal heavy machine gun would have perforated it.

Too light to be useful as a tank, it still was too heavy to survive in the air. The M1932 would have been almost unmaneuverable, making it a ridiculously easy target for enemy fighters. It was rightfully rejected by the army. Had the M1932 ever been deployed, it would have been a miracle if any ever reached the battlefield intact. The few survivors would then have been prime targets for almost every weapon the enemy had.

If you enjoy crazy WWII weapons, check out My Tank is Fight! by Zack Parsons. Better military history has never been put on paper. Get it at Amazon or your local bookshop!

Most of the stuff I've written about is from this book, it also contains lots of other goodies, for example the German VTOL aircraft, the submarine cruiser, and the strap-on personal helicopter: Heliofly!

August 4, 2008
» Cake and grief counseling will be available at the conclusion of the test

Today there are exactly two weeks left of Summer of Code!

Recent improvements: Completely rewritten servlets. I now interact correctly (I think) with the complex obs API, instead of using the getComplexDataFile shortcut. I've created a few new classes:

  • AnnotatedImageHandler, which overrides the normal ImageHandler
  • AnnotatedImage, which represents a Java BufferedImage with annotations and other metadata
  • ImageAnnotation, which represents one annotation for an AnnotatedImage.

I've also added a buffer that stores recently used complex obs including their complex data. The buffer is circular, so new content overwrites old content, and the buffer size is configurable through a global property. As a result I've solved the performance problem with big image files. Even my largest test image, at 109 RGB megapixels, (328 MB when decoded) now loads pretty fast.

German superweapons

In the fourth article in my series about WWII technology you never heard of in school, I'll discuss the German superweapons, the Vergeltungswaffen.

Germany originally intended to invade Great Britain in September 1940, as part of Operation Sealion. Before that could happen though, they needed to gain air superiority - i.e. to destroy the British air force, the RAF. Even though the German Luftwaffe had more and better aircraft, an unprecedented effort by the RAF managed to decide the Battle of Britain in favor of the British.

As the Germans gave up, Hitler instead turned to the Vergeltungswaffen (retaliatory weapons) in order to pummel the British into submission by an exceedingly expensive bombardment of London's civilian population. These weapons contained some of the most advanced technology of the war.

Three projects were developed in parallel, but only the V-1 and the V-2 were used successfully. While these two have become quite famous, the V-3 has been almost forgotten.

V-1 flying bomb

Nicknamed the buzz bomb for it characteristic noise, the V-1 was one of the first guided missiles. Essentially an unmanned aircraft, powered by one of the first jet engines ever devised, it was used relatively successfully. It was guided by a gyrocompass and reached speeds of 630 km/h. It was five meters long and was launched from a catapult.

The V-1 has perhaps been most accurately described by renowned military historian Zack Parsons as "a really crappy and inaccurate cruise missile that made a scary noise".

Approximately 10,000 were fired at England, but only 25% ever hit their targets, the rest being lost to countermeasures or due to failing guidance systems. Some of the fastest British fighters could just barely manage to catch up with a V-1 and topple it by slightly nudging its wing. This maneuver would tip the V-1's wing up and send the missile into an uncontrolled dive. The V-1 could also sometimes be destroyed by conventional anti-aircraft weapons.

V-2 rocket

The V-2 was was the first ballistic missile. It had a weight of 12.5 metric tons, achieved supersonic speeds and was powered by ethanol and liquid oxygen. The guidance system was a combination of accelerometer and gyroscopes. The V-2 project was decades ahead of any other country's rocket technology.

Although a much more devastating weapon than the V-1, because there were not yet any countermeasures that could be used against supersonic weapons, it was less effective because of its technical complexity and lower volume of production. Around 1400 rockets were fired at London.

The V-2 was the single most expensive German project during WWII, but had virtually no effect on the outcome of the war.

The scientists in charge of the V-2 program, led by Werner von Braun, were captured with their equipment by the Americans and the Soviets at the end of the war, and went on to design ICBMs and spacecraft. The V-2 is the grandfather of all modern rockets, including the Saturn V that sent the first men to the moon.

V-3 cannon

While the V-1 and V2 are very well known, the V-3 is not. Also known as Hochdruckpumpe (high-pressure pump) the V-3 was a revolutionary new artillery design. It consisted of a 140 meter long smooth-bored gun barrel, buried underground in France. Each installation had five of these guns, and all of the support facilities were in adjoining bunkers dug out by French slave laborers.

The most unique part of the V-3 design was the way that the projectile was propelled: The gun barrel had a series of chambers along the sides, filled with explosives. As the projectile moved upwards, each chamber fired in sequence providing additional acceleration. The projectile itself had stabilizing fins and was encased in a sabot when fired.

If successfully deployed the guns would have had a firing rate of one shot every five minute per gun, or one shot every minute for each five-gun battery. The maximum range would have been an impressive 165 km.

Allied intelligence was tipped off about the V-3 weapons by French resistance fighters while the guns were still under construction, in 1944. Frightened by a new weapon potentially more deadly than the V-1 and V-2, they began air raids using the bunker-busting Tallboy and Grand Slam bombs, which I discussed in a previous article in this series.

The raids proved ineffective though, and construction proceeded almost uninterrupted. While hugely powerful, the anti-bunker bombs were unguided and often missed. Even when they didn't, the bunker was thick enough to withstand the damage. The RAF turned to increasingly desperate methods, such as Project Aphrodite. In this maneuver, a two-manned crew flew a B-17 bomber crammed full of explosives towards the target. They were then supposed to bail out just in time, and a second bomber would then guide the first one in the rest of the way, using a crude TV-remote control system. This failed miserably, and Joseph Kennedy, president John F. Kennedy's brother, was killed in one of these raids.

As the allied invasion of France progressed though, it became clear that the guns would not be completed in time. They were abandoned and captured by the British, who in turn dynamited the facility in order to prevent the French from having a ready-made London gun. The British and French were allies of course, but you want to be on the safe side with stuff like the V-3.

July 22, 2008
» Build a man a fire, and he'll be warm for a day. Set a man on fire, and he'll be warm for the rest of his life.

As I'm writing this I'm sitting outside trying to survive the blistering heat of the Norwegian summer. (20°C) Global warming indeed! The sun is scorching my poor untanned flesh... I'll probably be lobster red by the time I'm finished typing.

During last week's conference call, several interesting points came up:
  • I should create an AnnotatedImageHandler, which will handle storage and retrieval of both images and their annotations.
  • Look into more standard XML formats for storing image metadata and annotations, if they exist.
  • Complete the module to the point where other developers can easily try it out on their own, and post that to the openmrs module repository. Sooner rather than later.
  • Collect input from other developers and prioritize changes/features based on that.

In addition to this, the annotation system needs some more work before it can be considered complete. I also need to update the wiki page again, but I don't feel like doing that right now. Haha, what a rascal I am!

Right now I'm focusing on the new AnnotatedImageHandler. I'll store annotations the same way as before for now. If I decide to change this later, I'll only need to update the handler, the rest of the code will be unaffected.

Panzer madness!

In my third installment of war stories you'd want to tell your mates down at he pub, I'll discuss some interesting German tank designs.

During the second world war, the Germans made a shift in tank design from light, mobile vehicles to heavier models with greater firepower. They had several very successful designs, culminating in the Tiger and especially the Panther. Several countries modeled their post-war tank designs on the Panther.

After the German invasion of Russia got underway, German intelligence uncovered roumors of a new Russian super-heavy tank being built. Predictably, Adolf Hitler ordered the development of a German super-heavy in order to counter the Russian one.

The first proposal came in 1942 from industry giant Krupp: The Panzerkampfwagen VII Löwe (Lion) came in two versions, the Leichter Löwe (Light Lion) at 76 tonnes, and the Schwerer Löwe (Heavy Lion) at 90 tonnes. Hitler immediately scrapped the light version and ordered the heavy model to be super-sized with a bigger gun, thicker armor and higher speed. For comparison, the Panther weighed 45 tonnes and the M1 Abrams, the current main battle tank of the US army, weighs 65 tonnes. (Tonne = metric ton, 1000 kg)

Before Krupp could figure out how to achieve both greater speed and heavier armor at the same time, Ferdinand Porsche (yes, the founder of the automobile company) countered with the Panzerkampfwagen VIII Mammut (Mammoth). This monstrous design weighed in at 188 tonnes, was 10 meters long and 3.5 meters wide, had a crew of five and had a top speed of 20 km/h. It was to be armed with a new 150 mm anti-tank gun, which was also under development. As you may imagine, Hitler ordered an initial delivery of 150 tanks, and shut down development of the Löwe. Masters of understatement, the Germans renamed the Mammut to Maus (Mouse) in 1943.

The Maus would have been highly resistant to enemy fire, an would have been able to deal out a huge amount of damage. The project was plagued with technical difficulties, though. For one, no enginge could be found that was up to the task, and the prototypes couldn't go faster than 13 km/h under ideal conditions. Second, the tank was too heavy to cross most bridges, so it had to be redesigned to ford or run submerged using a snorkel across rivers. Thirdly, the new gun was delayed and a smaller one had to be used instead.

Only two prototypes were ever built. By the time they were almost ready for use, the Soviets overran Kummersdorf where they were located at the time. The first prototype had been fitted with a dummy turret, and was captured by the Soviets. The second one had a working turret and was shipped off to Berlin to be used in defense of the city. It broke down before it got there and was blown up by its crew to prevent it from falling into enemy hands. As the Soviets found the second prototype they discovered the turret still almost intact, and combined the #2 turrent with the #1 hull. The combination vehicle was shipped back to Russia for testing, and can now be found at the Kubinka Tank Museum.

Make eet bigger!

The Maus wasn't the only super-heavy design, though. Krupp had another ace up his sleeve, the Landkreuzer P. 1000 Ratte. (Rat) This tank was so ginourmous that it wasn't even designated a tank. A new designation had to be invented: Landkreuzer literally means Land cruiser.

The design called for a crew of 20, a length of 35 meters and a width if 14 meters. It had a gun for every purpose. Living up to the land cruiser designation, it was armed with a modified cruiser turret, sporting two 280 mm naval artillery guns. These had a range of 5 km in direct-fire mode, (aimed directly) or up to 40 km when tilted upwards for a curved trajectory. These guns were too big to be used against something as frivolous as enemy tanks, so a third, smaller gun (128 mm) was to be used for that purpose. In any way, this was not a critical part of the design, as no tank could possibly penetrate the armor of the Ratte. In addition to the three guns, the land cruiser would have sported eight anti-air flak guns on top, and probably a few machine guns to clean up the rest... like people, or elephants.

The power plant might have consisted of up to eight Daimler-Benz diesel submarine engines. The design specified a weight of an un-freaking-believable 1000 tonnes, though this was probably too optimistic. Post-war analysis of all the specifications led to an estimate of closer to 2000 tonnes.

No bridge in the whole of Europe existed that could carry the Ratte, so the design counted on the height of the vehicle allowing it to ford most rivers. Had it been successful, the Ratte would have been an awesome sight to behold. The Maus destroyed all roads it drove across. The Ratte would have plowed a new field. Buildings would have been torn down just by the vibrations in the ground. Being able to stop an enemy offensive single-handedly is quite impressive too...

This kind of super weapon design was just the thing Hitler loved, and he ordered Krupp to begin immediately. It was not to be, though. The design was fundamentally flawed in that it could not possible have been worth the enormous resources required. The technical difficulties were significant, of course, and the Ratte had a major weakness: The huge size, slow speed and inability to disguise itself would have made the land cruiser a prime target for enemy dive bombers, which would have quickly knocked out the Ratte's engines through the weaker topside armor.

Does it end there?

You know it doesn't! If you have any interest in military history at all, you'll probably have seen about a dozen documentaries about Schwerer Gustav, the largest rifled weapon ever made. Schwerer Gustav was an 800 mm artillery cannon mounted on a railway car. It was designed to destroy large, heavily fortified targets, and was in actual use during the German invasion of Russia.

Back in 1942 when the Ratte project was initially approved, Hitler gave orders to make his beloved railway gun self-propelled. I pity the designers at Krupp.

Enter the Landkreuzer P. 1500 Monster. Too big for the irony of a name like "mouse" or "rat" to work. The Monster was simply a version of the Ratte scaled up by 50%, and using the Schwerer Gustav for a main gun. The designed called for a weight of 1500 tonnes, but like the Ratte, this was too optimistic. A more recent estimate has put it at 2500 tonnes.

Obviously the Monster had the same design problems as the Ratte. The combined resources required for these two projects might have devastated the German war industry, if not for the dangerously clever Albert Speer.

Albert Speer was the minister of armaments, and he had a special knack for spotting Hitler's most wasteful and demented projects. He canceled both land cruiser projects in 1943.

Oh, and the rumours of Soviet supertanks were of course false. The Soviets had kick-started their tank manufacturing, that was true... but when they finally were ready they completely overran the Germans with tens of thousands of small, light and fast T-34 tanks.

July 14, 2008
» You! What planet is this?

Yesterday I completed the basic functionality of the annotation system for my image viewer, using the Google Maps' marker feature. Each marker is shown as a red icon overlaid on the image. If the marker is clicked, an info window (looks like a comic book speech balloon) will open, displaying the annotation text.


So far it is possible to create new markers and view the existing ones, but they can not yet be moved, edited or deleted. This will obviously have to be implemented. Also, I would like to change the default marker icons used by the Google Maps API. Finally, the shadows that the API uses behind the markers and info windows seem unnecessary and potentially confusing, so I may remove them.

The image viewer saves and loads annotations using AJAX, so reloading the page is not necessary. The current implementation stores annotations as an XML file in the complex obs directory, but this can be changed fairly easily.


HMS Habakkuk

Though reading about my summer of code project must be quite captivating, let's move on to something even more interesting.

Project Habakkuk was a British plan to construct the world's largest aircraft carrier during WWII. This project was the brainchild of English journalist/spy/inventor/mad scientist Geoffrey Pyke, and was based on his most famous invention: Pykrete.

Pykrete is a composite material made by mixing sawdust or wood pulp with water, and then freezing it. The optimal mix is supposedly 14% sawdust and 86% ice (by weight). The properties of this material are quite impressive: It is easy and cheap to make, incredibly tough (comparable to concrete) and has a very slow melting rate.

Project Habakkuk, if successful, would have involved creating a huge, unsinkable floating island out of pykrete, probably in the Canadian winter. The top side would have been leveled to make room for one or more airstrips, and the center hollowed out for storage of 150 twin-engined bombers or fighters. Several anti-air installations would have been added, and the ship may have been reinforced with steel.

The final design called for a displacement of 2.2 million tons (the American Nimitz-class supercarriers have a displacement of 80,000-100,000 tons) and a length of more than 600 meters (twice that of the Nimitz-class, and enough for an airstrip suitable for the heavy bombers of the time). Steam turbogenerators would have supplied 26 electric motors mounted on external nacelles, similar to the way propellers are mounted on an airship.

A possible design for the HMS Habakkuk, shown next to an Iowa-class battleship and a Nimitz-class supercarrier.

HMS Habakkuk would probably have been impervious to submarine attack, and highly resistant to enemy bombing raids. Refrigeration plants would probably have been added to prevent melting, although the slow melting rate of pykrete may have enabled the ship to last for a year even without these.

Geoffrey Pyke presented his idea to British Admiral Lord Mountbatten, a favorite of Winston Churchill, and the uncle of Prince Philip. Mountbatten in turn presented the project to Churchill in 1942. Several tests were made to optimize the properties of pykrete, and a scale model was constructed in Canada.

At the Quebec Conference of 1943, Lord Mountbatten made a demonstration for a group of admirals and generals along with Winston Churchill and Franklin D. Roosevelt. Mountbatten brought a block of normal ice and a block of pykrete, to demonstrate the strength of the new material. He placed the blocks on the floor, drew his service pistol and fired at the ice block, which shattered. He then fired at the pykrete. The bullet ricocheted off the block, grazed the leg of US Admiral Ernest King, and ended up in the wall. The Admiral was highly impressed by Mountbatten's unorthodox demonstration.

Project Habakkuk began to lose priority later that year, and it quickly became apparent that the technical difficulties and the enormous resources required were too high.

It took three hot summers to completely melt the Canadan prototype.

July 3, 2008
» Gentlemen, you can't fight in here! This is the War Room!

The image tile servlet is more or less complete, and I can now create tiles from images of any size (or so I believe) without using lots of memory. As I mentioned in my previous post, the largest image I'm currently testing with is 8192*9976*8 bits. I'll dig up some even larger ones soon and do some further testing.

The servlet now works as follows: The Google Maps image viewer figures out which tiles it needs based on the state of the view window, and makes HTTP GET-requests, like so: imageTileServlet?obsId=6&x=0&y=2&z=5

For each request, the image tile servlet should return a 256x256 pixel JPEG image. It looks up the obs with the given id, and opens the file given by its "complex" value. The servlet then reads metadata from the file (dimensions and bit depth). Based on this and the GET parameters, the servlet can calculate the relevant part of the image and set the correct image read parameters, like so:

ImageReadParam param = reader.getDefaultReadParam();
param.setSourceRegion(new Rectangle(xpos, ypos, tileSize, tileSize);
param.setSourceSubsampling(subsampleLevel, subsampleLevel, 0, 0);

SourceRegion is the part of the image we are interested in decoding. SourceSubsampling allows the reader to skip pixels while reading, if set to 2 the reader will read every other row and column.

The servlet will then resize the image using a Graphics2D object, encode to JPEG and write the resulting stream to the HttpServletResponse object. The user's web browser will in most cases cache the images, so each tile shouldn't need to be requested more than once.

So far the source image must be a JPEG file, but adding PNG, GIF and BMP is a simple matter, as Java's Image I/O API has built-in support for these formats. I also plan to add DICOM image decoding at a later time.

Right now the tile servlet is a little sluggish. I have my test deployment of OpenMRS running on a Pentium III laptop with Ubuntu server. Loading an image tile from my largest JPEG takes several hundred milliseconds. Smaller images are read significantly faster.

I have created a portlet that contains the Google Maps-based image viewer. I'm currently ironing out a couple of JavaScript and CSS issues, which I expect to resolve soon. As the svn server is supposedly up and running, I'll probably make my first svn commit when this is completed, though I may do a little cleaning up and refactoring first.

I also believe it is time to update the wiki page for my project, I'll probably get that done within a couple of days. Next up is support for annotations.

 

Now, with all that out of the way, let's talk about something really interesting: Amusing facts from WWII.

During the war, the British developed a new class of bomb to use against bunkers and submarine pens, the so-called earthquake bomb. The design was built in two sizes: The 5400 kg 'Tallboy' and the 10000 kg 'Grand Slam'. The Grand Slam was the world's largest bomb at the time. These weapons were dropped from specially modified Lancaster bombers and reached supersonic speeds before hitting the ground. The bomb casings allowed the weapons to penetrate several meters of soil and concrete before detonating their massive load of torpex high explosive.

At RAF Scampton, a Royal Air Force base north of the English town of Lincoln, a Lancaster bomber and a Grand Slam bomb were set up as "gate guards" after the war. In 1958, the road going past was going to be extended and the gate guards had to be moved. They rolled out a crane and tried to lift the bomb, which for some reason wouldn't budge.

The RAF crew initially suspected that the bomb casing was filled with concrete, or had filled up with water over the years, but then someone got a horrible suspicion. "No... It couldn't be... could it?" This area had been open to the public, and a lot of people had climbed up on the bomb and taken pictures sitting astride.

So, they called up a technician who carefully scraped off the paint and opened a service hatch. Right enough, the Grand Slam bomb was still filled with explosives from 1944!

A bigger crane was called in and the bomb was carefully moved under police escort to the coastal experimental range at Shoeburyness. There it was rigged for demolition, and the resulting explosion proved without a doubt to anyone within a 16 km radius that the bomb was still very much alive.

Carefully does it!

The subsequent investigations failed to determine how a live earthquake bomb could have been set up as a gate guard. They crunched some numbers, and estimated the damage the bomb could have done if detonated at its location outside the RAF base. Besides taking out the base itself, the bomb might have flattened most of the northern part of Lincoln, including the cathedral dating back to 1250.