My blog has moved
10 April 2011

It is now at blog.sofer.com

11 January 2011

I have some tables that I am populating from a CSV file and it took me a little while to work out where to unpack the contents of the file. In the end, it was obvious that the place for it was in the model. In realising this I had the epiphany (again!) that controllers should really be kept very, very simple.

21 September 2010

“when looking at economic phenomena, be they the financial crisis or the vast increase in inequality of the past thirty years, it’s politics that matters, not just abstract economic forces. One of the singular victories of the rich has been convincing the rest of us that their disproportionate success has been due to abstract economic forces beyond anyone’s control (technology, globalization, etc.), not old-fashioned power politics. Hopefully the financial crisis and the recession that has ended only on paper (if that) will provide the opportunity to teach people that there is no such thing as abstract economic forces; instead, there are different groups using the political system to fight for larger shares of society’s wealth. And one group has been winning for over thirty years.”

22 July 2010

As David Kaneda explains in the jQTouch blog, he introduced a tap custom event to remove a 300ms delay when tapping on a link in Mobile Safari.

20 July 2010

In his recent post, The capital tsunami is a bigger threat than the nuclear option Michael Pettis argues persuasively that it is hard to imagine a scenario in which the Chinese would sell US government debt in significant quantities (the so-called nuclear option) and that the real danger is that they will continue to buy US debt to fund their trade surplus, which against all measures of sanity, is growing again.

08 July 2010

In his article, Demand shortfall casts doubt on early austerity Martin Wolf disagrees with the current enthusiasm for cutting current public expenditure.

01 July 2010

Rails application templates allow me to automate the setup of each new Rails application, so I don’t have to repeat all the steps required to get an application running the way I want it.

30 June 2010

I just spotted an interesting Buttonwood post from earlier in the month.

23 June 2010

When adding jQTouch files to a web a page, order matters.

02 June 2010

I have a Rails-driven website which changes infrequently and contains mostly static content. It is cheaper and almost as convenient to run it as a static site than to run it as a Rails app.

26 May 2010

In any block of code, execution is sequential. Each line of code will not execute until the previous line has executed. If a line contains a function call, then the next line will begin execution after that function returns a value. If the function continues to execute code even after it returns a value, then the code in the original block is no longer executing sequentially, in other words two different blocks of code are running concurrently. Concurrency is generally achieved in software by some implementation of threads.

18 May 2010

“I don’t think the fiscal squeeze of 16pc of GDP being imposed on Greece—without off-setting monetary or (internal EMU) exchange stimulus, and with a further accumulation of debt to 150pc of GDP—will lead to a stable Greece. It will destabilize Greek society. It is an evil policy. Greece is suffering the entire burden of adjustment: the banks are being entirely bailed out. Our sympathies should be with the Greek people. It is enough to turn me into a Communist.”

29 April 2010

A few notes to myself on developing on OS X 10.6 (snow leopard).

28 March 2010

Dylan Grice and Albert Edwards at SocGen, along with commentators like Peter Tasker, have for some time been drawing parallels between Japan in the 1980s and China now.

27 March 2010

Peter Tasker is unimpressed with the prospect of investing in emerging markets

21 March 2010

This week’s Economist mentioned that Companies are buying lots of their own shares again

14 March 2010

In my recent summary of George Cooper’s The origin of financial crises I mentioned his suggestion that we should create inflation, in order to reduce the real level of debt.

16 February 2010

Greek government debt is not really a problem for the Greek people so much as for overseas creditors, primarily banks and their shareholders. If there is a bailout it will largely benefit not the Greek people, but the greying populations of Northern Europe who, through their pension funds, own the banks that are most vulnerable to a Greek default.

26 January 2010

Bankers make money by borrowing short and lending long. In other words, most of their profits come from playing the yield curve. They can do this without fear of insolvency and bank runs because of explicit and implicit government guarantees. Banks are state-sponsored oligopolies that could not exist without tax-payer subsidy. They should not exist. Fractional reserve banking is not capitalism, it is theft. We should put an end to fractional reserve banking now.

24 January 2010

I recently finished reading The Origin of Financial Crises by George Cooper, according to which a careless disregard for the growth of credit, a mis-reading of Keynes, unfounded faith in the stability of capital markets and a misunderstanding of the role of the central bank are the causes of the current financial crisis.

22 January 2010

I have been tinkering with MongoDB and the MongoMapper gem for Rails and creating a MongoDB-based Rails project is pretty easy.

09 January 2010

30 November 2009

Some comparisons of ActiveRecord method calls and the equivalent SQL for associations, starting simple and progressing to joins and chained joins.

29 November 2009

Steve Keen is an Australian economist and a follower of Minsky. His long-held view, that neo-classical models of economics are inadequate because they do not take account of debt levels, led him to predict the current crisis long before it broke and makes him very sceptical of the likelihood of a quick recovery.

20 October 2009

Wall Street banks like JPMorgan and Goldman Sachs have been making money from trading in the last quarter. There has been some uncertainty in the press about what this “trading” actually consists of. Some have suggested it refers to stock and commodity trades, others to bets against the dollar, and still others to increased commissions on their clients’ trades. Philip Greenspun has a simpler explanation: they are borrowing money from the U.S. government at 0% to buy short-term government debt at 2-3%. They are being subsidised by the taxpayer for recycling government money.

10 October 2009

You can use the .irbrc file to make changes to the Rails console. My .irbrc file currenlty looks like this:

02 October 2009

A few reminders to myself of how to keep Rails applications simple.

01 October 2009

I came across a situation where I thought I wanted to access the current_user from within a model, but it was just a case of mistaken thinking. Making session variables like current_user accessible to a model is a break with convention, and breaking with conventions is usually a bad idea. So, the rule is: don’t do it unless you have exhausted all other options. There is a probably an easier way of doing what you are trying to do.

25 September 2009

I have a tendency to multiply layouts in Rails, so that after I have defined the main application layout in /app/views/layouts.application.html.erb, I create different layouts for different controllers as needed. That’s all OK, except that I find myself cutting and pasting from the application layout which is just wrong, wrong, wrong.

24 September 2009

When talking about debt levels, it is important to distinguish between private and public debt. While the ratio of public debt to GDP has in the past been higher than it is now, the ratio of private debt to GDP is at levels far higher than at any time in history. It is private sector debt more than public debt that is weighing down the global economy and which is going to make a return to normality so difficult.

23 September 2009

REST is now the standard way of doing things in Rails and I am a convert. I have always spent far too long worrying about the best way to write my applications, but now REST has come into my life and taken a whole universe of procrastination and indecision away from me.

22 September 2009

Let’s remind ourselves, that at the root of the current financial crisis are imbalances of international payments that have created currency surpluses which have in turn fed back into the financial system in the form of cheap and plentiful credit. The only possible resolution to the crisis that will not create yet another crisis in the near future is an end to significant and persistent imbalances of global payments.

07 September 2009

A paper published in June by Dirk Bezemer describes why most economists didn’t see the current crisis coming and—more importantly—why some of them did. The key missing ingredient: financial flows. The growth of the financial sector relative to the rest of the economy should have been an early warning sign of trouble ahead.

06 September 2009

Cheng Siwei, former vice-chairman of the Standing Committee and now head of China’s green energy drive: “Gold is definitely an alternative, but when we buy, the price goes up. We have to do it carefully so as not to stimulate the markets”.

07 July 2009

Rails offers the html_escape method (usually shortened to h), which prevents simple attempts at code injection. However, when users are entering content onto a site, there is a very good case for sanitizing the input. After all, if a rogue user is injecting unwanted code into my HTML forms, why would I want to store it in my database? It makes sense to neutralize it before it gets stored.

06 July 2009

Selected quotes from Warren Buffett’s most recent letter to shareholders

13 June 2009

Named scopes in rails make for tidier code.

09 June 2009

When I save data in Rails, I continually misuse the different methods available, so that my code is sprinkled with save, save!, save(false), update_attribute, update_attributes and so on. I also often introduce bugs by assigning a new value to an attribute and then forgetting to update it.

01 May 2009

I have just put RepeatCode into “pre-beta”. there is very little material up so far, but I have now removed the login barrier, so if anyone happens to wander onto the site, they can actually try out some A-level maths or a bit of French.

29 April 2009

This may seem trivial to some people, but I got a bit confused finding a path through the Restful Authentication plugin for Rails.

25 April 2009

This week The Economist has used their front cover to make it clear what they think of any glimmers of hope there might be in the world economy. “The worst thing for the world economy”, they say, “would be to assume the worst is over”.

24 April 2009

“It would be difficult to discover any (peacetime) nation during the industrial age that had strayed further away from any kind of sustainable economic equilibrium than China has over the last 15 years…the economy has become dependent on double-digit loan growth to keep loss-making state-owned enterprises in business and China’s huge workforce employed. However, now that the country faces excess capacity and deflation at home, most new investments (undertaken to expand industrial capacity still further) can only be loss making if targeted at the domestic market. In such an environment, the majority of new loans that are extended within China are destined to become non-performing. If the banks continue to extend credit aggressively, the cost that the government will have to bear to bail out China’s depositors may quickly exceed fiscal resources.”

22 April 2009

Richard Duncan published his revised edition of The Dollar Crisis in 2005. It is a remarkably prescient analysis of the the problems now facing the global economy. I reproduce the short and somewhat chilling final chapter from the book below.

21 April 2009

John Authors in yesterday’s FT gave a simple and entirely plausible explanation for the recent rally in stocks: an increase in the significance of mutual funds at the expense of hedge funds.

13 March 2009

The US Flow of Funds Accounts figures for the fourth quarter were released yesterday and Tobin’s Q is at 0.62. In other words, at the end of last year the ratio between the market value of US corporations and the net worth of their assets was below its historical average for the first time since 1988 and the stock market was therefore fairly valued in historical terms.

23 February 2009

When I read over the weekend that Gordon Brown is proposing to put an end to 100% mortgages, it put me in mind of horses bolting through stable doors. Exactly who in command of their senses would now be either requesting or granting a 100% mortgage?

22 February 2009

Text-to-voice software and synthesised voices are getting to the point where they are really quite impressive and certainly usable. I recently discovered Acapela’s range of multilingual voices and I want to use them. However, accessing a computer’s voices from within a web page is not entirely trivial.

19 February 2009

With oil prices in a state of collapse and investment grinding to a halt, maybe global warming is no longer a priority. With the survival of the global economy at stake, is the search for alternative sources of energy really so urgent? Actually, yes it is. The argument for increasing investment in energy research is undiminished and the possible dangers of global warming are irrelevant to the argument.

16 February 2009

In their book “Valuing Wall Street”, Andrew Smithers and Stephen Wright use James Tobin’s Q ratio (the value of a stock market divided by corporate net worth), to recommend (in 2000) disinvesting from equities. They also give an excellent account of the dynamics of the economic cycle.

29 January 2009

Today’s FT published extracts from an analysis of the crisis by George Soros. It is an excellent read and goes into some detail about the dangers of short selling and credit default swaps, but one thing that caught my eye is his explanation of the rise of the dollar.

28 January 2009

Working on my predictions for 2009, got me thinking about how we could negotiate a way out of the mess we have got ourselves into. The only way I can see of doing this is through an unprecedented degree of co-operation between central banks and with a reordering of the global system for settling international exchange.

27 January 2009

It’s a little bit late for New Year predictions, but here are mine and very pessimistic they are, too. I have bottled it on the big one (No.6), but—really—I don’t feel brave enough to predict the end of the world as we know it—at least not yet. Anyway, working on this list has made things a lot clearer for me. Here goes.

26 January 2009

1) The primary cause of this crisis has been the recycling into international markets of the huge quantities of credit built up by the major exporting nations far in excess of what could sensibly be used in productive investments. In other words, trade imbalances are the source of our misery. subprime mortgages, credit derivatives, excessive credit card debts, insufficient regulation, greed and fraud are just the channels through which the consequences of these unsustainable imbalances flowed.

25 January 2009

There is a worrying divergence of opinions on the subject of toxic bank assets.

24 January 2009

“What are we to conclude about the efficacy of credit creation [between 1933 and 1936] as a means of attaining recovery? All conclusions must necessarily be tentative, but it seems to be clear that the effects have been smaller and slower in appearing than was claimed by the advocates of the theory [that the central bank can stimulate recovery by creating credit]. It seems to require a very great expansion of the base of the structure, continued for a considerable time, before the appearance of an adequate rise in the stream of money, which alone can affect the size of individual incomes.”

18 January 2009

The banking system is to all intents and purposes broke. Liabilities almost certainly exceed assets by a significant margin and, but for the recent interventions of central banks, the equity of our major banks would be worthless. There is probably not a single one of them either in London or New York that is solvent.

14 January 2009

In my ongoing attempt to resurrect Keynes to his rightful place as the first person to call this current crisis, I have contributed a new section to the entry on the balance of trade on Wikipedia.

13 January 2009

Brad Setser wrote a piece yesterday on the funding of the US budget deficit in which he points out that central banks are not responsible for most of the recent growth in the holdings of US Treasuries—the US private sector is. Meanwhile, Constantin Gurdgiev thinks that Treasuries are likely to go belly up later this year, when the risk of deflation subsides.

12 January 2009

From the Manchester Guardian Commercial, 29 March 1923.

10 January 2009

Storing a commodity costs money. This cost of carry tends to exert a gentle upward pressure on the current prices for future delivery of that commodity. This can produce what is described as a normal or upward sloping yield curve. A futures market in this state is said to be in contango.

09 January 2009

The futures market for oil is currently in contango. In other words, the price of oil for delivery in several months’ time is higher than the cost of oil for delivery now. There is currently such a wide gap that traders with deep enough pockets can lease a tanker, fill it with oil bought on the spot market, sell a contract to deliver it later in the year, and realise a pretty significant and moderately risk-free return (assuming that their tanker doesn’t get boarded by pirates).

21 December 2008

London Banker wrote a piece recently on the inevitability of deflation and I just wanted to say that deflation is not inevitable at all. Inflation seems more likely.

15 December 2008

I have been re-reading David Hackett Fischer’s book, “The Great Wave”, which puts our current difficulties in the context of an 800-year history of repeated periods of stability, growth, crisis and collapse.

13 December 2008

One outcome of the last few weeks has been that politicians around the world have been taking the opportunity to feel smug about the ongoing crisis.

08 December 2008

Geoffrey Crowther wrote about the Great Depression in the final chapter of his book An Outline of Money . Despite being written in the 1940’s, what he had to say has more relevance to the current economic crisis than anything else I have read on the subject.*