2010 May 27 - Thu
Oil Farming
It is only on rare occasions where one can obtain an elegant solution having positive ramifications for
two differing economic sectors simultaneously.
These two guys are offering up an eco-friendly solution for
squeezing oil out of water.
2010 May 26 - Wed
Germany / Russia Working Together
I wanted to record this little snippet for something to check back on during some point in the
future.
One writer is indicating that Germany is the real economic power in the European Union. Should the
European Union break apart or evolve/devolve into something else, Germany can't go it alone. I have to
take that assertion with a certain grain of salt, but perhaps the next idea fits in.
It is said that Germany's strength is it's manufacturing and export ability. Germany also has a
decreasing population. A logical partner might be France, but they are typically highly competitive
with each other, rather than cooperative with each other.
On the other hand, Russia has a large population with nothing much to do. Rather than being an
exporter of raw materials, Germany could partner with Russia for manufacturing. Rather than
increasing immigration towards Germany, which is something Germany does not want, they would
send manufacturing to Russia.
In summary, it would be of interest to see how the European Union reorganizes around a
possible Germany - Russion alliance.
2010 May 25 - Tue
C++ Curiously Recurring Template Pattern
Through the years of maturing in software development, I have migrated through a
series of technologies to solve various programming problems.
During the initial stages of my C++ usage, I used the tried and true run-time dynamic
polymorphism, mostly known as virtual methods through class inheritance. To answer the question of
when to use virtual destructors, Herb Sutter has an excellent article called
Virtuality.
For more virtual destructor information, Item 33 in Scott Meyer's More Effective C++ is helpful.
Inheritance - virtual Functions FAQ has more useful information.
Class inheritance and virtual functions closely couple classes. I wanted start some
decoupling, and do some event based coupling through C#-like events/delegates.
C++ doesn't have a similar concept built-in, but there are various libraries available
while supply a similar concept: Boost's slot/signal system, or the one I ended up using:
FastDelegates.
FastDelegates are supposed to be fast. And they do work well.
As I do some work on the Windows platform, I had been using the MFC classes for some GUI work.
As I got more into multi-threaded designs, MFC started to show it's significant short-comings
related to modular and mult-threaded designs. I came across the Windows Template Library (WTL)
as a nice, fast, light-weight windowing library.
The WTL introduced to me the concept of the Curiously Recurring Template Pattern (CRTP). WTL and
ATL make significant use of the CRTP pattern. A good introduction can be found at Wikipedia's entry for
Curiously Recurring Template Pattern.
CRTP has brought me back tight-coupling of classes, but as a consequence, it offers up the ability to
integrate a number of concepts together: slot/signals aka delegates, maintenance of strong typing,
simulated dynamic binding aka static polymorphism, and fast execution.
The close-at-hand references don't mention one other refinement (I wish I could find the
original source of this trick), and that is one of conditional static polymorphism. There is a way
to conditionally make the polymorphism call: if the derived class doesn't over-ride a method,
the calling code doesn't get compiled, it gets optimized away.
For example:
template <typename T>
class base {
void implementation( void ) {};
void interface( void ) {
if ( &base<T>::implementation != &T::implementation ) {
static_cast<T*>( this )->implementation();
}
}
};
class derived1: public base<derived> {
};
class derived2: public base<derived> {
void implementation( void ) {};
};
In this example of the CRTP, the base class has a default implementation of the interface.
In class derived1, as there is no implementation defined, no implementation gets called. In
class derived2, where there is an implementation defined, it is called.
2010 Apr 23 - Fri
Common Representation of IPv6 Address Text Representation
Most everyone knows how to write an IPv4 ip address, and is easy and simple to understand.
As the world migrates to a new internet addressing system, which is known as IPv6, writing
out the address becomes difficult. The difficulty is that there are multiple ways of
writing an IPv6 address. As a consequence, when people need to perform text searches,
no matches may result because the way in which it was searched doesn't match the way in
which it was written.
A new document has been authored entitled
A Recommendation for IPv6 Address Text Representation which helps to standardize the process of writing
an IPv6 address.
In a nutshell, the recommendation is:
- Leading zeros MUST be suppressed. For example 2001:0db8::0001 is not
acceptable and must be represented as 2001:db8::1. A single 16 bit
0000 field MUST be represented as 0.
- The use of symbol "::" MUST be used to its maximum capability. For
example, 2001:db8::0:1 is not acceptable, because the symbol "::"
could have been used to produce a shorter representation 2001:db8::1.
- The symbol "::" MUST NOT be used to shorten just one 16 bit 0 field.
For example, the representation 2001:db8:0:1:1:1:1:1 is correct, but
2001:db8::1:1:1:1:1 is not correct.
- When there is an alternative choice in the placement of a "::", the
longest run of consecutive 16 bit 0 fields MUST be shortened (i.e.
the sequence with three consecutive zero fields is shortened in 2001:
0:0:1:0:0:0:1). When the length of the consecutive 16 bit 0 fields
are equal (i.e. 2001:db8:0:0:1:0:0:1), the first sequence of zero
bits MUST be shortened. For example 2001:db8::1:0:0:1 is correct
representation.
- The characters "a", "b", "c", "d", "e", "f" in an IPv6 address MUST
be represented in lower case.
- When writing port numbers with an IPv6 address, the [] style as expressed in [RFC3986] SHOULD be employed, and is the
default unless otherwise specified -- [2001:db8::1]:80
Borrowing Money to make Money, Taxpayer Pays the Interest
Eric Fry, in teh Daily Reckoning, provides an interesting insight into the profitability of today's banking sector:
When it converted into a bank holding company back in 2008, Goldman became eligible to borrow
cheap money from the Fed's discount window. Morgan Stanley did the same thing. As a result, Goldman,
Morgan Stanley et al. may borrow billions of dollars from the Federal Reserve and use the
proceeds to purchase higher-yielding government securities of longer duration.
In other words, Goldman may borrow from the government at 0.75%, then loan the money back to the
government at 3% or 4%. All in a day's "trading." Not surprisingly, all the major financial
firms have been reporting blockbuster profits. Yesterday, for example, Morgan Stanley
wowed the Street by nearly doubling its expected earnings result. Bond trading provided most of t
he juice, as Morgan's fixed-income revenue more than doubled from the prior year's first quarter.
Prior to Morgan Stanley's results, Bank of America, JP Morgan Chase and, yes, Goldman Sachs, h
ad all reported record quarterly revenue from fixed-income trading. On the surface,
these monster profits would seem like good news. But this silver cloud contains a very dark
lining: without the Fed's low-cost financing, fixed-income profits will be much harder to come by.
World Events and the Iceland Volcano
Byron King at Whiskey and Gunpowder wrote about how natural relate to human events through
history. Any history buffs able to confirm the following?
We need to keep an eye on Iceland and its grumpy volcanoes. The historic record is
filled with Icelandic volcano blasts that wrecked European civilization. It goes back at
least to the days of the Roman Empire. There's evidence that an Icelandic eruption in A.D. 405
led to a harsh winter the next year, in which the Rhine River froze. This allowed the
barbarians cross in numbers sufficient to defeat the Roman Legions.
In A.D. 934, there was a massive lava flow from Iceland's Eldgja fissure system.
It unleashed the largest basalt flood in recorded history. An ash cloud blanketed
Northern Europe and weakened many political structures. This eruption helped keep
the Dark Ages dark, and in particular harmed the English political system. It's
no coincidence that William, Duke of Normandy, conquered England a century or so later, in 1066.
Then there was the Laki eruption in 1783, with another immense outpouring of lava in Ice
land. This eruption emitted large volumes of poisonous gas, including fluoride and
sulfur dioxide chemicals that poisoned half of Iceland's livestock. The gas cloud blew
over Scandinavia as well, causing many deaths and hardships that included a long famine.
There were many deaths further south in Western Europe, as well, in 1783. Then came
several years of extreme weather. Among other problems was a shortfall in farm output.
This led to a drop in tax receipts for governments across the continent. In France,
King Louis XVI eventually had to summon the Estates General to ask for new taxes.
Instead, he wound up with the French Revolution.
The San Francisco earthquake of 1906, for example, caused many banks and insurance
companies in the U.S. and Britain to fail. This led to the Panic of 1907. The Panic of
1907 led directly to the creation of the U.S. Federal Reserve in 1913.
He goes on to provide some modern day statistics regarding the volcano:
According to Eurocontrol, which operates the airspace in Europe, about 20,000 flights
per day are canceled. By my back-of-the envelope calculation, that translates into about
1.5 million barrels of jet fuel per day that's not being burned to power airliners. That's
just shy of 2% of total daily world oil demand. So with this fast hit to demand, it's
no wonder that the price of oil has dropped about $4 per barrel in the past week.
Meanwhile world trade is indeed suffering. Perishable items, from flowers to exotic fish
and fruits, are rotting on the loading docks. High-value items like computer chips and
diamonds are sitting in secure warehouses. Much other airfreight is just stacking up on the
pallets. FedEx and UPS together carry about $1.3 billion of goods per day between
North America and Europe. Right now, it's almost all shut down.
The ripples are global. For example, Chinese auto assembly lines are slowing down
due to lack of electronic components from Germany. There are reports of mass layoffs in
nations as far apart as Kenya and Colombia, due to the inability to export goods via
airfreight to Europe. Then consider all the personal and business disruptions and
expenses from casual and business travelers unable to fly.
2010 Apr 03 - Sat
Welcome to Planet NIT WIT
NIT WITs (Nationalize, Inflate, and Tax . Whatever It Takes) in Washington
Taken from a Casey Daily Dispatch:
Key among the tools used by governments around the globe to fund their steady expansion are the rights they take unto themselves to Nationalize, Tax, and Inflate, or NIT for short.
And they don't stop there. If a problem arises that threatens the status quo in any way, governments these days are quick to do "Whatever It Takes" (WIT). And we.re not just talking about snuffing out Arab bogeymen in Dubai hotels or handing over $180 billion to failing insurance companies - these days, if a problem is considered serious enough, no obvious limits need apply.
2010 Apr 02 - Fri
Checked Iterators in Microsoft Visual C++
I've wondered why some of my C++ programs seem to run slower than I think they should be
running. Then I came across an article regarding Checked Iterators, and it become clearer
to me where some of my execution speed issues could be. By default, in debug mode,
all standard iterators are bounds checked. This checking can cause a slow down in
execution speed when using standard iterators extensively.
The solution is to set certain macros to selectively enable and disable the checking
on proven code. A
Microsoft MSDN article on Checked Iterators
describes the two symbols used for controlling the checked iterators feature:
- _SECURE_SCL: If defined as 1, unsafe iterator use causes a runtime error. If defined as 0, checked iterators are disabled. The exact behavior of the runtime error depends on the value of _SECURE_SCL_THROWS. The default value for _SECURE_SCL is 1, meaning checked iterators are enabled by default.
- _SECURE_SCL_THROWS: If defined as 1, an out of range iterator use causes an exception at runtime. If defined as 0, the program is terminated by calling invalid_parameter. The default value for _SECURE_SCL_THROWS is 0, meaning the program will be terminated by default. Requires _SECURE_SCL to also be defined.
2010 Mar 28 - Sun
A Collection of Quotes
Seduction is part of my stock in trade in the diplomatic service. Public lies are shouted in councils and courts, but secret truths are whispered in beds. -- The Miocene Arrow
"Everything will be okay in the end. If it's not okay, it's not the end. -- an email footer
"You see, wire telegraph is a kind of a very, very long cat. You pull his tail in New York and his head is meowing in Los Angeles. Do you understand this? And radio operates exactly the same way: you send signals here, they receive them there. The only difference is that there is no cat." -- Albert Einstein
<< One of the really cool things about the camera is its cooling system. >> -- One would hope so. -- email foot from Dan Drasin
Holmes opined "It is a capital mistake to theorize before one has data. Insensibly one begins to twist facts to suit theories, instead of theories to suit facts".
"Undecidable by reduction to the halting problem in general, though apparently possible for straight-line code (no loops/recursion) through the brute-force method of generate all paths and send them to a theorem prover to prove equivalence." -- email foot from Scott McMurray
"The American dream is not owning a house; it.s every individual having the opportunity to achieve their full, God-given ability, and each generation having the responsibility to leave the country better off and better-positioned than the next so that our children and grandchildren can have a better way of life than we have" -- former U.S. Comptroller General David Walker
"It's is not, it isn't ain't, and it's it's, not its, if you mean it
is. If you don't, it's its. Then too, it's hers. It isn't her's. It isn't our's either. It's ours, and likewise yours and theirs." -- Oxford University Press, Edpress News
"If you don't do it right the first time, you'll just have to do it again." -- Jack T. Hankins,
"The more sophisticated the technology, the more vulnerable it is to primitive attack. People often overlook the obvious." -- Dr. Who,
"Everything should be as simple as possible, and no simpler" -- Einstein
"Common sense is not so common" -- Voltaire
"Stability leads to instability. The more stable things become and the longer things are stable, the more unstable they will be when the crisis hits." -- Hyman Minsky
"Never appeal to a man's 'better nature,' he may not have one. Invoking his self-interest gives you more leverage."
"Unfortunately, inefficiency scales really well." -- Kevin Lawton
"Davenport answered with a lift of his own glass, sniffed, then sipped. Tantalizingly delicious, deliciously tantalizing. He saw that it could be dangerous--a taste too easily acquired for something not so easily acquired." -- Foundations Friends.
"Let me state the obvious and posit the known--nothing is so overlooked as the obvious and nothing is so mysterious as the known" -- Foundations Friends
"It is what you do in life, not what torments you in your soul, that matters. And who you are in life, not who you fear you might become." Bast to Herzer in There Will Be Dragons
2010 Mar 18 - Thu
2009 Christmas Panto, 2010 Dad's Army
I havn't been writing much in the last while. I should have been. The least I could have done
is keep a diary of what I've been doing. Coulda, shoulda, woulda.
My excuse has been that I've spent quite a bit of time doing two things: designing, tuning, and running lighting for
two recent shows at Bermuda Musical and Dramatic Society (BMDS), and then when not lighting, doing videos of the shows.
November and December were taken up with designing the lighting for BMDS' annual Panto at City Hall. This
year we had a visiting director put on his work called Robin Hood.
For January and February, we had a local-up and-coming director put on a terrific production of Dad's Army.
Dad's Army was a regular series on BBC TV,
and was popular with the local crowd. We really didn't need to do any advertising, the show sold itself. After
pre-sale tickets to patrons, cast and crew, there were only 9% of the tickets remaining for the general public.
I'm not sure if this is a first for the theatre, but we ended up running an extra three nights. Tickets for those
nights were sold out within 90 minutes.
I ended up shooting some video over several nights of Dad's Army as a keep sake with my new Panasonic HVX-200A. With that
footage, plus a bunch of pre-production footage, I have a bunch of editing to do. Lots of editing.
Our next show is called 'A String of Pearls', with lighting design by one of my mentors. I get to take some time
off and catch up on stuff I havn't been doing. Hopefully the updates here will now be more frequent as I catch
up on my reading and projects.
I need to take a break when I can as I've been requested to design lights for this year's Panto. The script has been
written by the local actress, writer, director Carol Birch. It is loosely based upon the story of Firebird and promises to
be challenging from a lighting perspective... I guess me complaining that lighting for recent shows has been too
easy, so she going to let me try out some new concepts. Our lighting inventory has been expanded with additional
colour changers and moving fixtures, so we should be able to try out a more technically oriented show.
2010 Jan 14 - Thu
Definition of a Banana Republic
In a missive from Contrarian Profits newsletter today, they drew nice intimated
an interesting parallel between a Banana Republic and a certain relatively large,
very well known country. The recipe for a Banana Republic, as described by
Justice Litle, Editorial Director, Taipan Publishing Group.
Wikipedia defines "Banana Republic" as a pejorative term for a country that is
politically unstable, dependent on limited agriculture (e.g. bananas), and
ruled by a small, self-elected, wealthy, and corrupt clique.
Ingredients:
- out-of-control printing presses
- currency restrictions and controls
- strangling regulation and red tape
- aggressive nationalization of private assets
- extravagant social programs (bribing the poor)
- deeply corrupt financial structures (bribing the connected)
- crushing pressures on small business (extorting the middle class)
Directions:
- Combine fervent promises of "hope," "change" and "revolution" in demagogue crockpot. Bring mixture to a slow rolling boil.
- As mixture firms, stir in aggressive spending plans and "revolutionary" public adjustments. Sprinkle liberally with insider connections and oligarchic financial loopholes to maintain smooth consistency. Let simmer for a full election cycle on low-heat propaganda flame.
- Pour filling into flaky self-righteous crust. Top with blatant corruption, repressed scandal and outright nationalization. Bake in fiscal suicide oven until inflation thermometer registers 30%+ and insider cronies are sufficiently enriched.*
*As with a delicate souffle, the middle class must not experience complete collapse during this phase. If this happens, you have inadvertently followed the recipe for a coup.
2009 Dec 22 - Tue
Global Warming: Should I Be Concerned?
For years, I've heard reports that the Earth is warming up, and as a consequence, something should be done about it.
Primary symptoms of warming have been through reports of that Antartica's Ice Cap is reducing in size.
A primary contributing factor which has been suggested as a primary contributor has been the combustion of various
fossil fuels which added carbon dioxide to the atmosphere, which in turns traps reflected sunlight, which in
turn warms the Earth/Atmosphere. Among other things.
I've been lead to believe that that global warming is a bad thing, and should be stopped, or even possibly reversed.
A fellow by the name of Mann recently presented a chart, now known as the 'hockey stick' chart, which shows a significant increase in
average global temperatures. Popular media has become enamoured with this chart, particularily recently, what with all
the latest brouhaha during the Copenhagen Climate talks.
From what I hear, developing nations want developed nations to give them billions of dollars in either cash or technology
cut emissions. If developed nations can't even commit to cutting their own emissions, what is the point in giving some one
else money in the illusion that they might also cut emissions.
Would it not be better to just put the hundreds of billions of dollars directly into alternate energy research? Obviously,
there will be expensive gaffs along the way, but at least something direct may come of it to assist the developed as well
as developing countries.
But then comes along some data that indicates that this may all be a moot point. A number of different scientific
observers have put together data from many different sources, with the data indicating that we are by no means currently
at a historically high global temperature. The middle ages (around 1000AD) saw higher temperatures than what we are
currently experiencing. The time around 0 AD saw even higher temperatures. And 1000 years before that were even higher temperatures.
And over the course of history, substantial temperature swings have been noted.
Mann's 'Hockey Stick' may be significant in recent history, but is it significant in the grand scheme of things? Is global warming an
event which would have arrived regardless of human meddling?
One way or another, the climate is going to give us some interesting action over the next little while, for some value of little.
It looks like I should be concerned, but due to completely different reasons.
For more climate oriented pointers, visit
Watts Up With That?.
|