The book has all the bases covered – history (much is set during World War II), science fiction (time travel) and action (crack troops storming the secret bases of their enemies). I think the plot was excellent, but something was lacking – I found the story telling stodgy in places (particularly at the beginning) and the characters were bland.

Book Review: The Proteus Operation, James P Hogan
Filed under Book Review
Book Review: Accused, Mark Gimenez
Really enjoyed this, it kept me guessing until the last page, with plenty of suspense and excitement. The author interspersed some funny passages too, particularly between the lawyer and his young daughters. This was the first book I’d read by Gimenez, but I will be back for more.

Filed under Book Review
WordPress App mangles my code!
I’ve noticed that whenever I use the WordPress App on my iPhone or iPad to edit a technical post that includes some code, the snippet I’ve carefully slaved over gets mangled. In particular, anything that uses templates in C++ (or generics in F#) will be affected, for example
vector<int> myData;
becomes
vector; myData;
The only answer at the moment is to be disciplined and restrict myself to editing code-based posts in the Web editor, which doesn’t destroy my content.
Filed under C++, Technology
How to recover a dead iPhone
I got out my my iPhone this evening and it was dead. No response from it, not even when I plugged it in to the mains (which has worked before when the battery ran out of charge). Attaching to a PC via USB did not revive it either. Very mysterious, given that it was working just fine on the way home from work.
Fortunately, this post had the answer – hold down the Power button and Home (square) button until the Apple logo appears. And you have to believe – no point counting to ten and giving up, really believe and the iPhone will come back to life. Worked for me (after 14 seconds). This article has even more tips in case the first doesn’t work.
Some might say that any hardware that relies on the user to google an obscure combination of buttons to turn on their phone has a screw loose – but I’m just happy to have my phone back.
Filed under Technology
Stephan Lavavej’s make_unique proposal
Stephan Lavavej has submitted a proposal to the C++ Standards committee for make_unique (the std::unique_ptr equivalent to std::make_shared for std::shared_ptr).
make_unique’s presence in the Standard Library will have several wonderful consequences. It will be possible to teach users “never saynew/delete /new[]/delete[]” without disclaimers. Additionally,make_uniqueshares two advantages withmake_shared(excluding the third advantage, increased efficiency). First,unique_ptr<LongTypeName> up(new LongTypeName(args))must mentionLongTypeNametwice, whileauto up = make_unique<LongTypeName>(args)mentions it once. Second,make_uniqueprevents the unspecified-evaluation-order leak triggered by expressions likefoo(unique_ptr<X>(new X), unique_ptr<Y>(new Y)). (Following the advice “never saynew” is simpler than “never saynew, unless you immediately give it to a namedunique_ptr”.)
It’s a really useful utility as demonstrated in this video.
Filed under C++
Primer on Credit Default Swaps
This is an excellent introduction to CDS’s, aimed at developers.
Now consider the case where we buy a General Motors bond. We then enter into a credit default swap to the maturity of the bond as well. This acts as insurance against General Motors defaulting on the bond. We receive interest from the General Motors bond, but pay some of it away in insurance on the credit default swap. Suppose the interest rate on a US Government bond is 5% and the interest rate on a General Motors bond of the same maturity is 8%. We’d expect the premium on a credit default swap on General Motors for the same period to be about 3%. Note that the 3% premium is also called the ‘spread’ on a credit default swap, since it is the spread between the government bond and the corporate bond interest rates.
In summary, a credit default swap is a contract where one party to the contract pays a small periodic premium to the other, in return for protection against a credit event (financial difficulty) of a known reference entity (company).
I wish there were more articles on financial products like this, written in plain English for non-Quants.
Filed under Finance
Equality and Comparisons in F#
This blog post from Don Syme is really useful when considering options for customising equality and comparisons in F#. Having said that, with F# 2.0, it looks like you don’t need to put attributes on your type, it’s enough to follow Don’s overrides of GetHashCode, Equals and CompareTo.
Filed under Programming
C++11 noexcept
Someone on ISOCpp re-awakened an old question on StackOverflow about noexcept, dynamic v static checking and differences between noexcept and the (now deprecated) throw specifiers.
Throw specifiers were the subject of Item 14 – Use Exception Specifications Judiciously in Scott Meyers’ More Effective C++. The drawbacks he mentions are: the standard prohibits compilers from rejecting calls to functions that might violate the exception specification (including if there is no specifier on the called function – this to allow integration with legacy code libraries that lack such specifications); you cannot know anything about the exceptions thrown by a template’s type parameters – so templates and exception specifications don’t mix; they’re easy to violate inadvertently (e.g. via callback functions); they lead to abrupt program termination when violated.
Stroustrup wrote this about noexcept in his C++11 FAQ:
If a function declared noexcept throws (so that the exception tries to escape the noexcept function) the program is terminated (by a call to terminate()). The call of terminate() cannot rely on objects being in well-defined states (i.e. there is no guarantees that destructors have been invoked, no guaranteed stack unwinding, and no possibility for resuming the program as if no problem had been encountered). This is deliberate and makes noexcept a simple, crude, and very efficient mechanism
This post gives a history of noexcept,
If the noexcept feature appears to you incomplete, prepared in a rush, or in need of improvement, note that all C++ Committee members agree with you. The situation they faced was that a safety problem with throwing move operations was discovered in the last minute and it required a fast solution
There are however important differences [between noexcept and throw()]. In case the no-throw guarantee is violated, noexcept will work faster: it does not need to unwind the stack, and it can stop the unwinding at any moment (e.g., when reaching a catch-all-and-rethrow handler). It will not call std::unexpected. Next, noexcept can be used to express conditional no-throw, like this: noexcept(some-condition)), which is very useful in templates, or to express a may-throw: noexcept(false).
One other non-negligible difference is that noexcept has the potential to become statically checked in the future revisions of C++ standard, whereas throw() is deprecated and may vanish in the future.
and this comment on SO from Jonathan Wakely also makes sense:
template code such as containers can behave differntly based on the presence or absence of noexcept (and equivalently throw()) so it’s not just about compiler optimizations, but also impacts library design and choice of algorithm. The key to doing that is the noexcept operator that allows code to query how throwy an expression is, that’s the new thing, and all that cares about is a yes/no answer, it doesn’t care what type of exception might be thrown, only whether one might be thrown or not
Filed under C++
How to monitor, inspect and break on COM calls
A colleague recommended API Monitor from rohitab.com for monitoring COM calls between components. I’ve installed it and have to agree that it looks really promising:

For the tool to be useful, you have to tell it about your custom COM interfaces by generating an XML file in a similar format to IDL – obviously room for improvement there by the authors (I wonder why they don’t read IDL files natively?). Having said that, once you have provided the interfaces, API Monitor will log all calls via those interfaces on any components that you specify. Better still, you can inspect the values in each call and even set breakpoints that will take you into the debugger of your choice (e.g. Visual Studio).
Filed under Programming