The demise of the U.S. dollar
The USD has dropped pretty well back to parity with the Swiss Franc.
Based on the forex rates since 1970:

Source: Pacific Exchange Rates
This extrapolation suggests that the USD will be worthless:
- against JPY in 2018
- against CHF in 2020
- against EUR in 2042 (DEM in graph, fixed rate 1.95583 since 31/12/1998)
As the graph also suggests, the GBP, which more or less matches the USD, will become worthless in the mid 2020’s.
Of course, as any investor knows, past performance doesn’t predict anything in the future. Nonetheless it would seem that the trend will not only continue, but is likely to sharpen. The reason for this is simple; the U.S. government is borrowing and printing money at a heretofore unseen rate:
Source www.whitehouse.gov
and as every investor also knows, borrowed money has to be re-paid sooner or later.
In my opinion it will be sooner rather than later. Nearly 50% of U.S. debt is held by the Chinese and Japanese:

Source www.treas.gov
At some point the pain of holding securities whose value is continuously decreasing will exceed the perceived benefits. When that happens, U.S. creditors will start selling and the result can only be further devaluation of the dollar.
Nay-sayers will argue that the Chinese will soon have to devalue the Yuan. Maybe, but once the Yuan were to be floated, there’s no good reason for it’s value to lower, quite the opposite given their balance of payments.
The other argument is that the U.S. could raise the interest rate on the USD. In the short-term, this would certainly produce a buy signal, but in the long run this will fail, simply because the dollar will devalue more or less in step with the increasing interest rate. Let’s face it, a bond that pays, say, 15% p/a has been and always will be a junk bond, even if it’s printed by the U.S. Treasury.
As the Chinese proverb says “We are going to live in interesting times”
Quip of the year
Very occasionally, one reads something on a forum that is truly excruciatingly funny.
I found this on

|
Quote by: Vee
How old were you when you first masturbated?
About 42… What method did you use? |
The Heinrich Manouver, I think it was called. Didn’t work, though…
Displaying images using the RES: protocol from a IE BHO
Problem: You’re using Visual Studio to write a Browser Helper Object for Internet
Explorer and you want to add some images to the web page being displayed.
Here is an example, taken from my Affine addin. The two images I insert are shown by the arrow:

Finding out how to do this is trickier than expected, so here’s the recipe:
- Import the images into the project and create a .RC file which identifies them:
affinehide.bmp bitmap "affinehide.bmp"
affinefade.bmp bitmap "affinefade.bmp"I called this file images.rc in the images directory in my project.
- You’ll need RC.EXE, the resource compiler, which is in the Windows SDK. The
2008 version for .NET 3.5 is here - In your setup project’s, set the prebuild event to
"D:\Affine\rc.exe" /r "d:\affine\images\images.rc"
I copied RC.exe into my project directory because I sometimes work on a 64-bit box, where Program Files becomes Program Files (X86). Adjust the paths to suit your installation.
- Open your project’s .VBPROJ file and insert the three red lines shown:
<?xml version=”1.0″ encoding="utf-8"?>
<Project DefaultTargets="Build"
xmlns="http://schemas.microsoft.com/developer/msbuild/2003"
ToolsVersion="3.5">
<PropertyGroup>
<Win32Resource>images\images.res</Win32Resource>
</PropertyGroup>
<PropertyGroup>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>Thanks to Wouter van Vugt for this!
- The HTML to insert the images is straightforward:
<img src="res://affine.dll/#2/affinehide.bmp"
where #2 means that the embedded object is an image
Assuming this string is stored in the variable "buttonhtml" then the code to insert the button on the page isa.insertAdjacentHTML("afterEnd", buttonhtml)
- Now for the events. You need an event handler for the DHTML event itself:
Imports mshtml
Public Delegate Sub DHTMLEvent(ByVal e As IHTMLEventObj)
_
Public Class DHTMLEventHandler
Public Handler As DHTMLEvent
Private Document As mshtml.IHTMLDocument
Public Sub New(ByVal doc As mshtml.IHTMLDocument)
Me.Document = doc
End Sub
_
Public Sub [Call]()
Handler(CType(Document.parentWindow.event, mshtml.IHTMLEventObj))
End Sub
End ClassThanks to Rick Strahl
- A handler which the above will call, to actually deal with the event:
Imports mshtml
Module BrowserEventHandler_
Public Sub BrowserEventHandler(ByVal e As mshtml.IHTMLEventObj)
Try
If e.type = "click"” AndAlso e.srcElement.tagName = "IMG" Then
… - and finally tghe code to add in in your DocumentComplete event:
Dim Handler As DHTMLEventHandler = New DHTMLEventHandler(doc)
Handler.Handler = AddressOf BrowserEventHandler
doc.onclick = Handler
Happy coding!
MS SQL Server ISNUMERIC bug – the joys of separators
From an early age I have practised defensive programming. On a recent project, I was loading data entered on an intranet site to an SQL Server table. Wary, I used SQL’s ISNUMERIC function to validate the numbers users had entered. It worked fine for a few weeks, until somone entered a comma as a decimal separator. It turns out that ISNUMERIC accepts this, whereas casting doesn’t. Here’s the proof:

Doubtless, MS will try and wriggle out by saying that it depends on how your international settings are made. My contention is that if ISNUMERIC says it is then you should be able to CAST it to a number.
Period.
(sorry for the weak pun)
UBS wins again with fake-looking 3D-Secure site
I elected to pay my dues to SWITCH.CH by credit card and got redirected to this:

Now I have a credit card from UBS, I’m paying SWITCH and I end up at CARCENTER.CH on what looks like a teenage-hacker effort?
Believe it or not, this is indeed UBS’s implementation of 3D-Secure, which as you can read in that Wikipedia article, seems to be less than perfect. Amusingly, returning to the same URL I get this:

which pretty well says it all. With all the other snafus the bank has been accumulating, one wonders how long it can go on…
3DS Max – How to resize / rescale a skinned, weighted biped
A recurrent problem occurs when you’ve spent hours/days/months rigging and skinning a biped and discover that your initial scale or size was wrong, either because you need to merge the biped into an existing scene with a different scale or you need to change your system units. I spent an inordinate amount of time trying to resolve this and found this solution:
In this example, I’m converting a model that’s 130 centimetres high with system units in inches to 130 centimetres in system units in centimetres – in other words making the model 2.54 times bigger, but it should work for any other type of scaling.
Input A scene X containing a skinned, weighted mesh on a biped. The biped is called BIP, the mesh is called BODY with a skin modifier.
Desired output A scene Y containing the same biped, with the mesh, bones and weights correctly scaled to a different size and/or units.
Prepare to convert
- Open X. Select the biped. Motion->Biped->Figure mode. Save File button to create BIP.FIG
- Select BODY. Select Skin modifier->Envelope. Open Advanced Parameters. Click save and create BIP.ENV
- Select BODY. Delete all modifiers (symmetry, skin etc). Save the scene as X1.MAX
You now have X1.MAX which contains the base mesh without modifiers, a FIG file with the biped definition and an ENV file with the envelope weights.
Create the new scene
- Reset
- If you need to change the system units for the new scene : Customise->Units Setup->System Units and change them
- File->Merge X1.MAX and select BODY. If you’re prompted, choose convert units (and not “adapt to file’s scale”). Check that your scene now contains only the mesh with no modifiers.
- Use Tools->Measure distance in front view to confirm that the mesh is indeed 130 cm high – not the 51 cm that you might have expected when changing from inches to centimetres
- Create->Systems->Biped. Drag in the front viewport to create a tiny biped next to your mesh (make it knee-high to your mesh)
- Select the COM of the tiny BIP01 you just created. Motion->Figure mode. Click load file and select the BIP.FIG you created above. The biped should centre to your mesh but it’ll be 2.54 times smaller, standing between your biped’s ankles. Check in top view.
- With BIP01 still selected, open motion->Structure and note the BIP’s height (just under ankle attach). Multiply this value by 2.54 and replace the height with this new value. This seems to be the trick to scaling a biped correctly. BIP01 should now match the size of the mesh closely. Make BIP01 see-through (object properties) and orbit in perspective to check that the bones and mesh are correctly aligned.
- If your mesh was only one half, select BODY and add symmetry (and any other pre-skin modifiers).
- Add a Skin modifier onto BODY.
- Select BODY->Skin->Envelope. Open Advanced and load BIP.ENV.
- Save scene as Y.
You should now have a new mesh and biped, correctly scaled. You’ll need to check and maybe fix by hand:
- Vertex weights. Select each bone and look carefully for misplaced red vertices. Similarly, exercise the bones (not in figure mode) to isolate vertices that should be red but no longer are. The most efficient way to do this is to move the bone and select skin->envelope to adjust the buggered vertices by opening the toolbox and copy/pasting the weight of an adjacent vertex.
- Polygons. Depending on the scaling you migh see some narrow holes in the mesh, visible as pairs of parallel edges which have “moved apart”. Fix by welding with a low threshold.
- Bones. I have experienced an unexpectedly shortened neck making the head a little low; go into figure mode and scale as needed, this doesn’t usually mess up the vertex weights.
- Saved postures and poses. Don’t seem to translate so well for me, often making the biped look like a fatal trauma case. I found it quicker to redo them from scratch.
Good luck!
Cambodia is beautiful
Two week’s holidays in Cambodia, a delightful country which reminds me strongly and perhaps not surprisingly of Myanmar (Burma). Getting there is easy but protracted: Geneva – Paris – Ho Chi Minh – Siem Riep. The second leg is 12 hours going and 13.5 returning, not exactly pleasant when you’re travelling cattle-class.
This is quickly forgotten on arrival. The people are gentle, friendly, always ready to help and wear a permanent and engaging smile. Siem Riep is home to hundreds of temples dating back as far as the 7th century, many in remarkable condition. Angkor Wat is the most famous satelite view of Angkor but not my favourite. Despite the astonishing monuments around Siem Riep, home to Angkor Wat, the country has not been tainted by excessive tourism. The food is superb, perhaps my only gripe is the state of the roads, riddled with potholes. Pictures
Titeuf – now for some animation

Creating a cartoon certainly isn’t easy. For me, the hardest part was skinning the model. I don’t dare to admit how many hours I’ve spent on this, but it’s an interesting challenge.
Here’s the video in AVI format or in MOV (Quicktime) format
Calabi Yau manifolds
Stumbled upon Calabi Yau manifolds quite by chance, they attempt to represent 10-dimensional space in string theory. I don’t understand a word of the article but they struck me as rather pretty geometry:

Here are some high-resolution images that I made with the excellent POVRay renderer.
Enjoy.
Modelling Titeuf – tricky fun
Set myself the task of learning how to make a cartoon. Lacking artistic skills, I decided to use a local character, Zep’s Titeuf as a model. I bought a figurine at the local toy shop and used photos of it to build the mesh. Skinning the legs was the hardest part, they’re so short and fat that the creasing has to be adjusted a pixel at a time.
The first results are encouraging:

Video:
