19
Oct
15

The scarcity of water

http://www.theguardian.com/environment/2015/mar/08/how-water-shortages-lead-food-crises-conflicts

The link goes to one of an increasing number of articles about the scarcity of water, the conclusion of which was:

„The world faces a water crisis that will touch every part of the globe, a point that has been stressed by Jean Chrétien, former Canadian prime minister and co-chair of the InterAction Council. “The future political impact of water scarcity may be devastating,” he said. “Using water the way we have in the past simply will not sustain humanity in future.”

and, as is usual in The Guardian, it attracted a number of comments. One of the more interesting was:

DrPlokta:

„This is yet another article that assumes that the source of a resource that’s currently used because it’s cheapest is the only source, and that therefore if the cheapest source is fully utilised then no more is available. Actually, what happens is that a slightly more expensive source becomes economically viable to exploit, and life goes on with slightly higher prices. It happened with oil (shale oil became viable) and phosphorus (guano deposits were depleted so it’s now mostly mined), and it will happen with water (desalination is not actually very expensive, especially in areas with lots of sunshine for solar power, which fortunately happen to also be the most water-stressed areas — it’s around £1 per cubic metre of water, and I currently pay £1.80 per cubic metre anyway). Pipelines to move water inland from the coast are also pretty cheap.“

The author says the world is facing a water crisis and we cannot go on using water the way we have done in the past. The commenter says water is not scarce – there may be a scarcity of cheap drinkable water, but not a scarcity of water as such. And producing drinkable water through desalination is a viable solution to the problem of scarcity.

And this argument more or less pulls the carpet out from under the feet of the article’s argument.

In dealing with scarcity there are only really two approaches – increase the supply or reduce the demand. And reducing demand would mean severely curtailing our comfortable lifestyle, so we are naturally biased towards any suggestion of a way to increase the supply.

Consequently, it will be difficult to persuade us to take painful action unless we accept some fact or interpretation of reality as being intransigent. Only if we are convinced we are going to run into a brick wall, will we accept that we have a problem we must solve.

If, on the other hand, we question the intransigence of certain facts, like the scarcity of water, we are undermining our will to change our lifestyle.

So the fundamental question becomes – is there any such intransigent fact, some stubborn aspect of reality, some fundamental scarcity, that cannot be overcome?

Now we can take the next step in the argument, illustrated by the second poster.

Ttimgg:

„Some quick back of the envelope calculations – please correct me if I am wrong!

In the UK each person consumes 3.4 m3 per day including embedded water in food and products. We need 3kwh to desalinate one m3. So our water energy consumption of desalination would be 10kwh per day. For comparison, our total electricity use in the UK is around 14kwh per day, so we would need to nearly double our national electricity supply.

One m2 of solar panels can produce 0.5 kwh per day (high efficiency panels in a hot climate) So to desalinate our water we would need about 20 square metres of solar panels each. That is quite a lot. Not impossible – but quite a lot.

So I conclude that solar desalination is not impossible but not easy, given that we are going to find it very hard to match even our current electricity supply with renewables.“

What the poster is doing is to shift the argument to where it ought to have been anyway. The real debate has never been about scarcity, at least not of such things as water or air. The supply of drinkable water can, theoretically or conceivably, be increased significantly. The real question is whether a hypothetical solution can be turned into a practicable solution. And the second poster has his doubts – as he puts it, „not impossible but not easy“.

Now the first poster will not agree at all with the idea that his solution – desalination – is hypothetical. It works, it has been shown to work and it is working. Therefore what the second poster is arguing is that the solution will not scale up. In order to argue that this solution is not a practicable solution we must therefore argue that between the present scale and the necessary scale there is a barrier that cannot be overcome.

What then could this barrier be? Well, not being an expert on solar energy I can only speculate, but then that is exactly the point. We wanted a principled debate about the need of mankind to reduce its consumption of water down to sustainable levels given the explosive nature of water scarcity. We wanted everyone to agree that in certain areas water is scarce and this scarcity is a serious problem. A „we’ve got to do something about it“ problem.

And then up comes some bright spark and says „Water – scarce? No way“. And, of course, he is right. There’s water all over the place, just most drops are not for drinking. But well that’s not a problem. There is a happy collusion of water scarcity and sun abundance which leads us directly to the solution – desalination. Ah, says the second poster, not so quick – have you really thought this through – we’re talking about a big scale operation here. That’s an awful lot of solar panels you’re talking about.

And now we reach an impasse in the debate, it has lost all its clarity and more importantly its power to convict.

Which brings us back to the opening argument. It would seem as if only incontrovertible evidence of hard limits to the availability of water will convince us to change our lifestyle. Only stark evidence that our liberal use of water will cause thirst in other less privileged parts of the world might persuade us to change our ways. Otherwise its business as usual.

So, apparently, there is no positive argument for moderation, no restraining ourselves to what we could reasonably need, no operative concept of enough.

For the moment I will leave it a that – even if it seems to be a rather disturbing picture of ourselves as practically incapable of restraint.

15
Oct
15

Fiscal Responsibility

The opponents of austerity are inclined to basically repeat just one argument – austerity doesn’t work, never has done and never will. They are not as willing to answer the obvious counter-argument – we can’t just keep on spending more than we have by taking on ever more debt.

Their answer is usually that there is some magic difference between the state and the individual such that where the individual simply has to „tighten his belt“, the state cannot and must not in order to avoid throttling the economy. But this leads to the charge, epitomised in the article, of financial irresponsibility.

The context of the article was the refusal of Labour’s shadow chancellor, John McDonnell, to agree to a charter to reduce debt in times of growth. Sadly, two weeks previously, he had actually agreed to such a charter and then did a turn-around. This led to the following statement by the chancellor George Osborne:

“A fortnight ago, Labour told voters they were ready to back our plans. But now, they have confirmed they want to go on borrowing forever – loading debts onto our children that they can never hope to repay. This is not socialist compassion – it’s economic cruelty. As Labour’s Great Recession showed, those who suffer most when government run unsustainable deficits are not the richest but the poorest.

“So today, with Labour’s economic policy in obvious chaos, I call on all moderate, progressive Labour MPs to defy their leadership and join with us to vote for economic sanity. Failing that, they should at least follow the advice of the former shadow chancellor and abstain.”

http://www.theguardian.com/politics/2015/oct/14/chancellor-labour-mps-vote-fiscal-responsibility-charter-george-osborne-john-mcdonnell-u-turn-budget-surplus

What is being argued?

  1. That Labour will go on borrowing forever.

  2. That increasing debt beyond what is repayable is economic cruelty.

  3. That running unsustainable debt will make the poor suffer more than the rich.

If there is a fourth argument it is the moral undertone. The headline speaks of „fiscal responsibility“ and Osborne of „economic sanity“. The clear implication is that only proponents of austerity are taking their fiscal responsibility seriously. Behaving in a responsible way means not spending more than we have. „Economic sanity“ implies naturally that the alternative is economic insanity. Not only is taking on unsustainable debt irresponsible it is madness.

We may note, by the way, how carefully Osborne avoids a fundamental criticism of debt per se. Not debt itself, but unsustainable debt is being condemned.

What will lead to unsustainable debt? Labour will go on borrowing forever. If Labour is not going to commit to reducing debt in times of growth, then they never will.

John McDonnell defended his volte-face with various explanations that  „… ranged from a meeting with redundant steelworkers in Redcar to a downturn in the world economy.“

So we are now getting closer to the real argument, that, in the eyes of the Conservatives, the Labour party, with its „socialist compassion“, is just too soft-hearted to run the economy. You have to be able to say no in order to be fiscally responsible, and Labour will always find a way to want to say yes, because of their „socialist compassion“.

But isn’t Osborne going just a bit too far here? As if all compassion is basically socialist compassion, and compassion is like a disease that softens our heart and weakens our resolve to do what is necessary, sane and responsible.

Consider another recent article in the Guardian in which Bernard Ingham, then press secretary, suggested that Margaret Thatcher needed “a recognition and understanding of the problems faced by the unfortunate in our society; this is not to say you should appear soft: rather the opposite, you should go out of your way in a deliberate but sympathetic manner to acknowledge their problems.” http://www.theguardian.com/politics/2015/oct/10/margaret-thatcher-bernard-ingham-private-papers

So, in the first article we have George Osborne accusing the Labour party of socialist compassion, which is, in his eyes, economic cruelty. And Bernard Ingham suggesting to Margaret Thatcher that she should be more compassionate, or at the very least, sympathetic to what are called the „unfortunate“.

Why is compassion regarded as so fundamental? The most obvious answer, and the one generally given, is guilt. The „unfortunate“ are recast as lazy scivers, living off other peoples hard earned money. Compassion can then be regarded as misplaced. Soft-hearted becomes another term for being naive about human nature.

The other side, generally quite well represented by the Guardian, regards compassion as another way of saying „there, but for the grace of God, go I“. Society’s responsibility to help those in need is a sort of reciprocal arrangement, I will help you in your time of need because a time may come when I need the very same help. I am now fortunate and you are unfortunate, but it doesn’t have to stay that way.

A less obvious, but equally important reason why compassion is regarded as so fundamental can be called „where to draw the line and why?“.

If we were to overcome the natural animosity between Labour and the Conservatives, or between the left and the right, then we could see some truth in both sides of the argument.

There are lazy people out there who prefer to live off other peoples money rather than earn their own. But there are unfortunate souls who have fallen into need through no fault of their own. And there are a large number of others where we could find fault, and guilt, if we wanted to, but who need a mixture of both, help in their need and perhaps some sort of pressure to get back on their feet. Although living on social security is generally pressure enough for most.

George Osborne’s, as a representative of the right, claims that „socialist compassion“ will never be able to draw the line and say no. But the left could equally well argue that the right, coming from the other direction, do not know where to draw the line and say yes.

And indeed, if we look at it this way, the questions posed are not easy to answer. We generally prefer not to draw the line at all rather than defend what somehow seem to be arbitrary decisions.

And, if we want the essence of the argument, it is this – most of life takes place in a grey area where there are no easy answers. There are answers but they are not easy. And they are, as a consequence, not easy to explain and to defend. Why be compassionate here and fiscally responsible over there?

My fear, at the present time, is that even if politicians were to overcome the rift between left and right, between the proponents of austerity and their detractors, then the voters, and their intermediates the media, would have neither the patience nor the appetite for the issues that would then be raised. We all prefer clear arguments, the virtuous and upright, the fiscally responsible over here and the irresponsible, weak-minded and profligate over there. If you are of another political persuasion, it is the compassionate, pursuing justice over here and the rich defending their privileges over there.

The debates are clear and the arguments simple – but they just won’t work.

07
Oct
15

The idea of eradicating drugs from the world by waging war on those who use them

 

„The idea of eradicating drugs from the world by waging a war on those who use them is fundamentally flawed for one simple reason: it doesn’t reduce drug taking. The Home Office’s own research, commissioned by Liberal Democrats in government and published a few months ago, found there is no apparent correlation between the ‘toughness’ of a country’s approach and the prevalence of adult drug use.“

http://www.theguardian.com/politics/2015/mar/03/uk-should-begin-decriminalising-drugs-richard-branson-nick-clegg

The fundamental argument of the article is expressed here – there is no correlation between the strictness of drug laws and the level of drug-taking. This led on to citing the example of Portugal, where drug-consumption was decriminalised. Decriminalisation is not the same as legalisation, which is an important point in the argument. Drug-trafficking is still a criminal offence and drug taking is also an offence. What has changed in Portugal is the nature of the punishment. Offenders are not punished but treated. And the important point about the Portugal example – compared with the rest of Europe the number of problematic drug-users is significantly lower. The Portugal example would appear to be a success.

The argument of Nick Clegg and Richard Branson in pleading for the UK to change its drugs policies runs as follows:

  1. It will be impossible to eradicate the use of drugs and there is no evidence that tough laws reduce drug use.

  2. Decriminalisation has been tried by Portugal and succeeds in comparison with other european countries.

  3. Therefore it must be worth trying out Portugal’s approach.

It is therefore surprising that at the end of the article we are presented with the following:

„But the Centre for Social Justice, a charity closely associated with the work and pensions secretary, Iain Duncan Smith, claimed charities on the front line in the struggle against drug addiction are opposed to decriminalisation.

In recent CSJ research, nearly three-quarters of charities surveyed were concerned about the effect cannabis use had on their clients and families. More than half (56%) felt the decriminalisation of cannabis would lead to an increase in its use. Less than a quarter (23%) thought it would not.“

The Portugal argument is simply ignored, or perhaps even flatly contradicted. Decriminalisation will lead to an increase in use, say more than half. Even allowing for this being only a quote from a perhaps larger argument, it is not unusual in public debate for one side to present an argument and for the other side to ignore it or contradict it without any argument.

One reason could be that both sides view the law in a fundamentally different way such that their arguments are in different categories. Branson and Clegg regard the law as being subordinate to and meant to serve an end – the reduction of drug use. If the present law does not serve that end – it should be reviewed and if necessary changed.

If the „other side“ are not amenable to the Portugal argument, then perhaps because they view the law as a moral statement on the part of society. A tough law on drugs represents a strong stand of disapproval, whereas decriminalisation represents a weakening of this stance. Decriminalisation sends out the wrong signal.

This raises the interesting question as to why what seems to be a very strong argument would be dismissed. After all, it is no longer a speculative discussion about what would happen – Portugal tried decriminalisation and it worked. The only apparent way to counter this argument would be to point out relevant differences between the UK and Portugal such that the policy may have worked there but not here.

But we see no such thing being argued.

02
Dec
11

How to create a python extension with Mingw

This effort is based on this article by Eli Bendersky, this article at boodedebr.org and backed up by an explanation on the MinGW FAQ.

The first step is, of course, to download MinGW and install it. You will be asked to select what you want to install. I chose the lot because I wasn’t sure what I would need, but you can probably get by with just the compiler and no MSYS.

While you’re on the sourceforge download page you should navigate to Extensions/pexports/pexports-0.44-1 (at the time of writing) and download pexports-0.44.1-mingw32-bin.tar.lzma. You will need pexports later to manipulate the python-dll.

After you have installed MinGW it will be necessary to put MinGW\bin in your Windows PATH.

As a next step you will need to extract pexports.exe from your previous download of pexports-0.44.1-mingw32-bin.tar.lzma. 7-Zip can be used to extract the file to MinGW\bin.

My python installation is at c:\Python27. Based on that you must go to Lib\distutils and create a file distutils.cfg with the humble content:

[build]
compiler = mingw32

Whilst you’re here you might as well edit cygwincompiler.py and remove every occurrence of “–mno-cygwin”. This occurs in my version at line 322 ff. where the compiler options are set.

self.set_executables(compiler='gcc -O -Wall',
                             compiler_so='gcc  -mdll -O -Wall',
                             compiler_cxx='g++  -O -Wall',
                             linker_exe='gcc ',
                             linker_so='%s %s %s'
                                        % (self.linker_dll, shared_option,
                                           entry_point))

The newest version of MinGW no longer accepts this option and gcc.exe will exit with an error.

There seems to be some uncertainty as to whether the following steps are necessary. I did it because I didn’t want to experiment and it worked. You’re welcome to try the shorter method of copying python27.dll directly to MinGW\lib, in which case you won’t need pexports.

The problem is that your extension will need the python library, which is a DLL under Windows. pexports creates a def-file that can then be used with the dlltool to create a libpython27.a or whatever your version is. Go into a directory of your choice and do the following:

pexports c:\WINDOWS\system32\python27.dll > py27.def   
dlltool -D python27.dll –d py27.def -l libpython27.a
 
Now you have libpython27.a you should copy it to c:\MinGW\lib (assuming you installed MinGW in this directory).
 
You are actually not far away from a working extension.
 
My practical problem was that I am using Cheetah as a templating system, which uses a C-program to speed up parsing. The program is called _namemapper.c and uses an include file cheetah.h. Assuming these two files live in a directory C:\Cheetah-2.4.4\cheetah\c then I added the following file setup.py to this directory:
 
# setup.py
import distutils
from distutils.core import setup, Extension

setup(name = "Simple example from the SWIG website",
      version = "1.0",
      ext_modules = [Extension("_namemapper",
      include_dirs = ['.\\'],
      sources = ["_namemapper.c"])])

It is really pretty simple, the only refinement, over against other examples, is to demonstrate the use of include_dirs, without which I cannot compile _namewrapper.c. The other thing is that the extension name, at least in my case, had to be the same as the program – _namewrapper.

Now, all that remains is to do:

python setup.py build – c mingw32

Python should do something useful like call gcc.exe to compile the file and then once again to link it and produce a subdirectory build with a directory lib.win32-2.7 which is where I found my _namewrapper.pyd.

What is the moral of this story? Cheetah is a quite competent templating system and I have been using it for a number of years. After using Python 2.4 for some time I want to go for 2.7. It looks as if Cheetah runs under 2.7, but the latest version of _namewrapper.pyd on the Cheetah site is 2.5. Considering that even someone like me (who programs in Python in order to avoid C) can get the thing up and running in an hour, why don’t the Cheetah guys do it? Probably because they consider Windows to be a negligible development platform – “If you’re that stupid you’re out on your own”.

Well I don’t have a choice – and Windows isn’t all that bad.

24
Oct
11

Sticking to the rules

Since my last post was about games and rules, let me present a passage from an interview from the Sueddeutsche Zeitung, one of the better German newspapers:

"Die Regierungschefs der Euro-Zone und die EZB haben alle geltenden Stabilitätsregeln gebrochen, seien es Schuldenobergrenzen, das Schuldenankaufsverbot oder das Beistandsverbot. Hier gelten keine rechtsstaatlichen Regeln, sondern es herrscht Faustrecht. Warum sollten neue Regeln einen Fortschritt bewirken? Regeln zudem, die einstimmig beschlossen werden müssten, also auch von den Problemstaaten? Eine solche Entwicklung halte ich für extrem unwahrscheinlich."

"The heads of government in the Euro-Zone and the ECB have broken all of the present stability rules, whether it was the upper debt limit, the prohibition of buying debt or the no-bailout clause. Here we do not have the rule of law but the rule of force. Why should new rules bring progress? Rules, moreover, that have to be agreed to by all parties, including those countries with a debt problem? I see that as being highly unlikely" (my translation)

http://www.sueddeutsche.de/geld/2.220/streit-um-die-gemeinschaftswaehrung-der-euro-wird-zusammenbrechen-1.1151907

This gives us no ground whatsoever for optimism, and indeed that was the intention of the person being interviewed, Stefan Homburg, Professor at the University of Hannover. Sadly it is very difficult to fault his argument, which is two-fold.

Firstly, he is doubtful that anyone who has broken rules in the past can be trusted to keep them in the future. And secondly, that countries with severe problems are not going to agree to new rules that will only make their situation more difficult.

And if that wasn’t enough he presents a third argument not quoted here, that we are seeing a fight between those financing the debt in Greece (and other countries) and the tax-payer. And what is the fight about? It’s not difficult to guess. The banks are trying to make the tax-payer bear the burden. This is what the Germans call privatising profits and socialising losses. So that when he speaks of the rule of force it seems to be a thinly veiled claim that it is not governments who make the rules, and break them if need be, but the financial sector.

In other words, he seems to be arguing that governments are not only unwilling to make rules but unable to enforce them, although that is what I thought they were there for.

23
Oct
11

The economic system

Economists regard the economy as a system. This could have something to do with the fact that economics is regarded as a science, at least by its practitioners.

Let us take an argument that caused something of a stir:

"But maybe this is an opportunity to reiterate a point I try to make now and then: economics is not a morality play. It’s not a happy story in which virtue is rewarded and vice punished. The market economy is a system for organizing activity — a pretty good system most of the time, though not always — with no special moral significance. The rich don’t necessarily deserve their wealth, and the poor certainly don’t deserve their poverty; nonetheless, we accept a system with considerable inequality because systems without any inequality don’t work. And before the trolls jump in to say aha, Krugman concedes the truth of supply-side economics, that’s not an argument against progressive taxation and the welfare state; it’s just an argument that says that there are limits. Cuba doesn’t work; Sweden works pretty well." http://krugman.blogs.nytimes.com/2010/09/28/economics-is-not-a-morality-play

If we do Paul Krugman the favour, which many of his detractors do not, of being intelligent enough not to be advocating war if it is good for the economy, then it is more probable he is firstly arguing that a system is just that – a system. It has no innate sense of justice, no regard for doing right or wrong. Going beyond that he might defend his position by saying that it would impair our ability to see the facts if we closed our eyes to what we find morally repulsive. In the economists eyes this would be bad science in much the same way that an anthropologist must not prejudice his view of mankind by taking a moral stance.

Somehow or other, this sort of argument always seem to imply that taking a moral view of how the system should work is generally futile and quite possibly harmful. Not that we should be neutral as to how the system works. Krugman prefers the Swedish system to the Cuban – because it works.

Once again we suspect that what Krugman means by "works" is "does not break down". This is subtle but inherent in a systems view of things. The economic system is complex and difficult to keep in a stable state. That is the way complex systems are, whether we are talking about software systems or family systems or nation systems. If they are functioning in any acceptable way we should probably be satisfied and leave them alone. Tinkering with them is unlikely to make things better and could lead to disaster.

As a means of stimulating our thinking let me propose an alternative – the economy is a game. Many will find it seemingly frivolous to use such a term, but there is, after all, such a thing as game theory and the Stanford Encyclopedia of Philosophy has a whole article on it.

Now, if someone wants to they can also keep morality out of game theory, but surely one of the fundamental complaints about our present financial system is that too few people are "winning" and far too many are "losing". And one of the advantages of looking at the economic system from a game theory perspective is that it gives us ground for dissatisfaction with the system and at least a possibility of change.

If you want to change the game change the rules. And at present one has to suspect that nothing else will help. At the moment the game is stacked in favour of the banks and big companies, and they are winning. In order to turn the tide, there seem to be some aspects of the present system that must be forbidden.

At this juncture it becomes interesting to see how people react to such a suggestion, and I’m not the only one making it. The systems thinker will be considering what happens when we interfere with the interaction of free agents in the system by implementing some sort of legislation. He will find this a very difficult question to answer, after all it is a very complex system, and most probably he would prefer it if the legislator would keep his sticky fingers out of it. It is not that he advocates an untrammeled free-for-all, it is just that he is finding it difficult calculating the effects of any legislative action.

And this gives us another ground for being dissatisfied with the present state of affairs. It is a game too complicated by far, and a dangerous one too. Thus, even if we feel that morality clouds our judgement, which I don’t, then there is still a great deal to be said for simplifying the game. This would allow us to make mistakes whithout thereby being brought to the brink of disaster. Which is what the present system is doing.

17
Oct
11

There’s no good time for reducing debt

Well, what have we learnt so far from the Euro crisis? There is a song that has been sung so often over the years by German employers – this is not the time for wage increases. Whatever the time, it is not the time. The same can be said for cutting government spending, and Paul Krugman has been saying it:

What, Krugman asked, do these events have in common? “They’re all evidence that slashing spending in the face of high unemployment is a mistake. Austerity advocates predicted that spending cuts would bring quick dividends in the form of rising confidence, and that there would be few, if any, adverse effects on growth and jobs; but they were wrong.” http://biztech.caledonianmercury.com/2011/03/29/nobel-laureate-krugman-questions-uks-policy-of-unforced-austerity/
What he means, and has also said, is that when the economy is not going well we will only make it worse by cutting spending. And he is probably right. At least this is what we are seeing in Greece. And he proposes a two phase approach, stimulate the economy now and reduce debt later. But later never comes. It never has in Germany and I suspect it never will. 
But surely we reach a point in time where we have no other option but to reduce debt. That’s what you’d think. But I fear we have gone beyond that point and are now in an almighty mess .
To illustrate my point from an area that I know more about, there was a software system written for the inland revenue in Germany. It cost somewhere between  250 and 900 million Euros and was then abandoned. It is only one example, There are, sadly, others. Now, don’t you think there was a debate at the time as to how much more money would be necessary to bring the project to a successful conclusion. I’m sure there was. And I’m equally sure that nobody could offer a reasonable assurance that a reasonable sum would in fact lead to a usable system.
This is what I mean by saying that we are in an almighty mess. Nobody seems able to offer a course of action that offers any reasonable assurance that, at the end of the day, all will be well.
In the end, the German authorites simply wrote off the system. They probably had no alternative. But its not that easy to “write off” the Euro. We are in a situation where there is no pain-free exit strategy. Letting Greece go bankrupt will cause a great deal of pain. But trying to keep Greece in the Euro is also going to cause a great deal of pain. And what we precisely mean by a “great deal of pain” is something I prefer not to think about. But that won’t help me either.
So what have we learnt so far. The way the Salami Tactic works is by presenting us with a small choice and then repeating that choice. If the Russians invade Germany and simply take 20 Kilometers – is it really worth starting a third world war for 20 Kilometers? So then they advance and take another 20 Kilometers, and we are faced with the same decision. We then have no rational reason for changing the choice we made. And thus the Russians continue, slice for slice, until they have taken all of Germany. This was the the so-called Fulda Gap scenario.
The frog in a pot of water faces the same dilemma. As the water gets hotter and hotter he never finds the time to jump out and gets boiled. Which was, quite obviously, a mistake.
Much the same has been happening with european debt. It just keeps rising slowly and we keep saying that this is not the appropriate moment to cut spending. Which, in my humble opinion, is also a mistake.

 
14
Jan
11

Python xmlrpc and Windows 7 (or Vista)

Thanks to caxelrud, whoever he may be, I solved a difficult problem using xmlrpc on Windows 7. I communicate with a server over xmlrpc and the performance on Windows XP is fine, but deadly slow on Windows 7.

I was using:

xmlrpclib.ServerProxy(‘http://localhost:7080/’,encoding=’UTF-8′,use_datetime=False)

Changing it to:

xmlrpclib.ServerProxy(‘http://127.0.0.1:7080/’,encoding=’UTF-8′,use_datetime=False)

resolved the problem.

localhost is commented out in hosts, with the comment that it will be resolved in DNS. As others have remarked that seems to be the problem.

The performance disadvantage is enormous, things slow down to a crawl.

13
Jan
10

Getting a network printer to work in Ubuntu 9.10

Just for anybody who might run into the same problem. If you configure a network printer and you get this far:

I am working with a Kyocera 1700+, with a built in print server. I pressed the button marked here with ‘Erkennen’ (I work in Germany, could be ‘Detect’ in English). I got a list that didn’t help me and my printer did not print after that.

This took me a while to discover. Luckily I have a virtual machine and another windows machine next to the printer. After a while I decided to check if any other machine could print and the answer was – no.

So if your getting timeout messages in /var/log/cups/error_log that you don’t understand, try switching the printer off and then on. It might work wonders.

11
Feb
09

Python – testing inproc com objects

 

import System
from System import Random

class test_resize:
  def __init__(self):
    self.usep = unichr(0xE032)

  def _list2string(self,pList):
    return self.usep.join(pList)
   
  def test1(self):
    otype = System.Type.GetTypeFromProgID('Python.PBInlineCom')
    oConn = System.Activator.CreateInstance(otype)
    oConn.InitApp('mupstamm',r'D:\pb8\mup4g\Version 2.8\MupStamm','mupstamm.ini')
    slist = [u'dw_excel',
      u'tab_meldungen'
      u'tab_meldungen.tabpage_messages;Meldungen',
...
      ]

    scols = ['sz_message_date_t:column:9:571',
     'sz_message_time_t:bitmap:590:645',
...     ]
   
    orand = Random()   
    for i in range(0,10):
      s_str = self._list2string(slist)
      oConn.InitWindow('w_mupstamm_meldung',s_str)
      print "I=",i
      w = orand.Next()/1000000
      h = orand.Next()/1000000
      s_str = self._list2string(slist)
      print "w",w," h",h
      oConn.ResizeCtrls("w_mupstamm_meldung", w, h, s_str)
      s_str = self._list2string(scols)
      sres = oConn.ResizeDW(s_str, 4762, 3646, 1, 1)
     
if __name__ == '__main__':
  lobj = test_resize()
  lobj.test1()         

 

Having written a com object in python, and wanting to test it running ‘inproc’, I found no way to do it using win32com.client. What I did find were hints that I would have no success because two programs were using just one interpreter.

IronPython is your friend here. It is not really all that difficult. I borrowed the tip with System.Activator and it worked.

This program I am testing is used in a Powerbuilder application to resize controls properly. The first problem was that several routines take lists as parameters, and this doesn’t work from IronPython to com. So I converted lists to strings and reconverted them back in the com object.

A neat trick that I learnt from someone else is what Unicode calls ‘private use characters’ starting at 0xE000. So I define a seperator 0xE032 and join the list to a string and can be sure the character won’t be used anywhere.

Just to complete the example, I wanted to test the resizing using random height and width, but random is not available in IronPython. But it is not hard to use System.Random to achieve the same thing.




August 2026
M T W T F S S
 12
3456789
10111213141516
17181920212223
24252627282930
31  

Design a site like this with WordPress.com
Get started