Monday, October 12, 2009

Brady Harris

I downloaded North Hollywood Skyline from Jamendo and I love it - smooth!

He also has a page on Myspace.

Well worth a listen.

Tuesday, July 21, 2009

Shino

Not the glaze and not one of the anime characters or other people listed on Wikipedia - but the musician.

This is a great album. I love his voice.

I'm a fan.

Saturday, July 18, 2009

Perl's sitecustomize.pl

Perl has an option to run sitecustomize.pl very early and regardless of what program is running.

The Configure option to enable this is -Dusesitecustomize. See the INSTALL documentation that comes with the perl source for a brief description. It is not enabled by default.

See perlrun for a brief description of how to prevent execution of this script, if it has been enabled. This P5P thread describes how it works.

ActiveState perl may have this option enabled. It did, but I don't know if it does currently.

Another option is to create a configuration module and use this module when running perl. For example, if you create CONF.pm you can invoke your program as: perl -MCONF program.pl. Alternatively, you can set the environment variable PERL5OPT to include "-MCONF", but note that this option may be processed too late if you are using other -M options on the command line.

Friday, July 10, 2009

Of vim, view and swap files

The view command should run vim in read-only mode. In this mode, vim should not use a swap file. But sometimes, if I am editing a file and open the same file with view in another window, vim complains that the swap file already exists. What's going on?

It turns out that vim does not always run without a swap file when in read only mode. If the file is large enough that more memory than maxmem or maxmemtot is required then a swap file is used even in read-only mode.

On my system (CentOS 5.3 with 2GB RAM) both maxmem and maxmemtot default to 252KB. Many of the source files I edit are larger than this and, therefore, swap files are used even in read-only mode.

By setting maxmem and maxmemtot to something larger, swap files can be avoided for larger files. For example, in your .vimrc file you can add:

set maxmem=1024
set maxmemtot=1024

Tuesday, July 7, 2009

Standards, Open and Otherwise

I was reading the Wikipedia page on Open Standards. There certainly are a lot of definitions, and this is only one source. No doubt there are many other definitions. One might conclude that the phrase is only a vague suggestion.

What we need is a standard definition of what an open standard is, so we can all agree to it, and, since it would be too ironic otherwise, I guess that should be an open standard definition of what an open standard is.

Before worrying about what an open standard is, it might be good to determine what a standard is. This is no easier. Wikipedia has a long disambiguation page for "standard". The Free Dictionary has a page of definitions for "standard". There are all sorts of possibilities.

Perhaps we should begin with something basic like: "I think, therefore I am". If we can derive meanings for standard and open standard from this, maybe we can get everyone to agree. The problem with this approach is that, it seems, no one has gotten beyond thinking, which may or may not prove that they are, at least to themselves: but nothing else has yet been derived to general satisfaction.

This doesn't leave much alternative other than providing a definition of the phrase with each use. So, if you see the terms standard or open standard used, don't make any assumptions about what they mean, get a definition of them from the user: this is the only way to know what the user means.

"Open" is sexy. "Open" is good. "Open" is in. "Open" rocks. Lately, marketing types do their best to associate "open" with whatever they are marketing. An "open standard" may simply be a standard that the promoter wants you to believe is good, sexy and in. Just as there are too many lawyers, there are too many marketers who have dedicated their lives to abusing language to subvert your decision making. Don't be sucked in. Read the fine print.

My education and work experience are in engineering and IT. My interest in "standards" is in the context of qualifying things that will be used. Thus the definitions of "standard" that are most relevant to me, from those on the Free Dictionary page, are:
An acknowledged measure of comparison for quantitative or qualitative value; a criterion
and
An object that under specified conditions defines, represents, or records the magnitude of a unit.
and
Something, such as a practice or a product, that is widely recognized or employed, especially because of its excellence.
and
A degree or level of requirement, excellence, or attainment.
Actually, one of their most appealing (to me) definitions isn't in the definition section - it is in the description of the synonyms of "standard":
a point of reference against which individuals are compared and evaluated
And, similarly, in the thesaurus section:
a basis for comparison; a reference point against which other things can be evaluated

When I think of a "standard", this is what I am thinking of.

To be of any use, a standard must be available to the person who is doing the comparison and evaluation. It doesn't have to be available to anyone else, though it may be. When procuring computers, I might define my own standards against which I will compare and evaluate all the candidate systems. I might do this very privately, without letting anyone know what my standards are. Or I might publish my standards in an RFP which I might make available to prospective system vendors subject to a non-disclosure agreement. Or I might publish my standards so that they are available to prospective vendors or others without restrictions on reproduction or use.

Sometimes, two or more otherwise independent entities might agree to a common standard in order to achieve some consistency or compatibility. Many "standards" are published with the intent that others will use them. "Standards organizations" are organizations that specialize in producing such standards. Such organizations may do nothing else other than produce "standards".

Standards may be published to be available to some group of entities. Access to the standard may be very restricted (e.g. I assume Coca Cola has a standard recipe that is available only to its manufacturers around the world - a closely guarded secret never to be disclosed to Pepsi) or unrestricted. Access to a published standard may be subject to entering into an agreement which limits rights to access, use or refer to the standard. The lawyers of proprietors and the law makers have developed diverse means for extracting value from property.

So, what might an "open" standard be?

In contrast, consider what a "proprietary" standard might be. Perhaps the definition of an "open" standard should preclude the promotion or promulgation of any proprietary interest. Proprietary interests are protected and promoted by means which are generally restrictive and compulsive: not what I think of as "open", generally.

In conclusion, my definition of an "open standard" is:

a standard which is not constrained by and does not incorporate, promote or promulgate any proprietary interest.

There is a problem with this definition: in most countries any published standard will be subject to copyright which establishes an unavoidable proprietary interest in the publication and unavoidable proprietary constraints on use of the publication. Therefore there is no such thing as a published standard which is not constrained by proprietary interest, at least not until years later when the copyright expires. So, maybe this definition should be amended to:

a published standard: which is not subject to copyright, or in which the copyright owner explicitly grants permission for anyone to reproduce and use the published standard without fee, royalty or other compensation, and which does not otherwise incorporate, promote or promulgate any proprietary interest.

Friday, July 3, 2009

Little Programming Advice

I didn't, at first, understand the point of Urlich Drepper's article Little Programming Advice, because I didn't see where the conflict was between the variable length array and the alloca allocation. But then, I got it...

The conflict arrises because both variable length arrays and alloca allocations are stack based: the stack is extended to make the required space, but variable length arrays are supposed to be limited to the block they are defined in which alloca allocations are supposed to persist until the subroutine they are made in is exited.

The sample code is:

{
char arr[strlen(s)];
fill_in(arr, s);
s = strdupa(arr);
}


When the block containing the variable length array definition is entered the stack is extended to make space for the array. Presumably (the article doesn't say) this allocation is removed from the stack when the block is exited (it could also be that it is removed when the block is re-entered and when the subroutine is exited). The conflict arises when alloca is used to allocate another block on the stack because the alloca allocation must persist to the end of the subroutine. As the alloca allocation is above the variable length array allocation on the stack, the variable length array allocation can't be freed until after the alloca allocation is freed and this can't happen before the subroutine is exited. A new allocation could be made for the variable length array on every entry to the block, but then these would accumulate, which isn't supposed to happen.

Friday, June 26, 2009

Philips MCD708 Micro Theatre demo mode

If you have a Philips MCD708 Micro Theatre stuck in demo mode, you can turn off demo mode by setting the unit to standby mode (pressing STANDBY-ON on the unit or remote) then pressing "PRESET -" in the unit. While the unit is in standby, pressing "PRESET -" toggles it between DEMO ON and DEMO OFF.

You can turn demo mode off from the remote also, but only if TUNER is selected, not if DVD or AUX are selected. Turn the system on, select TUNER then turn the unit to STANDBY, then press the "CH -" button on the remote.

Because Philips left this information out of the manual and has nothing about this issue on-line where Google can find it, I wasted several hours pressing buttons until I happened upon the magic combination. If I could, I would return this poorly documented product and get my money back to buy something else. I will be reluctant to buy anything else from Philips.

Wednesday, June 24, 2009

Linux Compatible Firmware

Many hardware vendors produce excellent hardware but do not make sufficient technical information about them available to allow their hardware to be used with Linux systems. This includes BIOS and other firmware on main boards and core chip sets.

Until 2007 a consortium of vendors was working to improve this situation by producing a Linux-ready Firmware Developer Kit, according to an INTEL employee (see the comment by arjan).

What has happened since 2007?

There is a bit of an update from 2008 here.

And there is this comparing LinuxBIOS with EFI.


The UEFI standard defines a GUID Partition Table. This is proposed and somewhat used as a replacement for the traditional partition table.

The traditional partition table is not well defined, it seems. There is some consistency between systems but also much inconsistency. Software interacting with partition tables includes BIOS and operating systems. Andries Brouwer has written a description of it. And here's another from ata-atapi.com.

Trusted Computing

I read this article on Trusted Computing over the past few days. It is from 2003 - six years ago.

What has happened since then?

It is hard to imagine that Trusted Computing will actually work. The worst case is that it does not work and it is bolstered by legal requirements to use it and prohibitions against anything that reduces its effectiveness. This would include prohibitions against investigations into how it works, its strengths and weaknesses and any alternatives such as already exist in the DMCA legislation in the US. This would also include prohibition of anything that could be used to investigate how Trusted Computing works and any communication of information about how it works. Such legislation has been proposed in other cases.

The emperor may have no clothes, but that will be OK because it will be illegal to look at his clothes or communicate anything other than the official statements about his clothes.

Sunday, June 21, 2009

Linux commands I read about today

The losetup command is for managing loop devices. The loop device driver accesses regular files instead of physical devices. But, while they are block devices, you can't partition them like real block devices (i.e. disks). You can run fdisk but will have to tell it the number of cylinders, after which it will create a partition table for you, but there will be no devices created to access those partitions and attempt to reload the partition table (as fdisk does after writing it or with blockdev --rereadpt) fails with Invalid argument. This email may be relevant and this post has some further examples.

The blockdev command is for calling select ioctl commands on block devices from the command line.

The tc command can be used to add latency to loop devices (and lots else):

tc qdisc add dev lo root handle 1:0 netem delay 20msec

tc qdisc del dev lo root

the loop device can be used to access partitions in disk images.

Note that the NASA enhanced loop device is still available from ftp://ftp.hq.nasa.gov/pub/ig/ccd/enhanced_loopback/ but it is patches against a 2.4 kernel and has not been updated since 2004.

Thursday, June 11, 2009

Telecom/Xtra blocks port 25

This isn't news - they have been blocking port 25 for a long time now. What's new for me is that, since switching from dial-up to broadband, the traffic is blocked despite my subscription to opt out of port 25 filtering. The opt out worked when I was on dial-up, even with a dynamic IP address.

Now that I am on Telecom/Xtra broadband, they tell me the only way I will be able to connect to port 25 on any other than the Telecom/Xtra smtp servers is to subscribe for a static IP address, at an additional cost of $20/month - that's 40% of my connection fee.

To make a long story short, I spent over an hour on the phone, mostly on hold, insisting that it should work. Eventually the support person gave up telling me there was nothing more he could do and escalated the call. A few hours later I had an email from technical support - they had reset their authentication cache for my account and asked me to reset my router.

So, I reset my router and I can once again connect to remote SMTP servers.

It shouldn't have taken so long, and if I didn't know IP and SMTP well enough to build their network for them I wouldn't have had the confidence to know they were wrong when they told me it couldn't be done. But I suppose those who don't know enough are very unlikely to need to connect to remote SMTP servers, so not much harm done from Telecom's perspective.

In summary, it is still possible to connect to remote SMTP servers, even with Telecom/Xtra broadband service - as long as you have hours and patience to work through their helpdesk.

Shared mailbox

I got x11vnc working but so I can connect from my laptop running vista to my workstation running CentOS5. It works OK except that I can't cut and paste between applications on Vista and Thunderbird running on CentOS5. Cut and paste works for some other applications, but something is different with Thunderbird.

I got vncserver (which is, I think, just an interface to control Xvnc - the vnc server built in to the X server) working also. Cut and paste works fine with this configuration, even with Thunderbird, but this only works with an X server on a virtual terminal - I can't use it to access and control the physical console. This is a nuisance because I often enough leave Thunderbird running on the workstation, then I can't start another copy of the second login.

So, now I have set up fetchmail and dovecot. These seem quite popular and I got them working with very little difficulty. I don't know much about them yet - I have a lot to learn before I will be comfortable that I have set them up well. Like I don't even know if my communications are secure. But it's only on my local network, so no great worries yet.

After a brief Google, I found the fetchmail configuration required to download messages from hotmail, where I have a test account. No problems here. The messages are delivered by SMTP to my local sendmail MTA and from there to my inbox.

Another brief Google and I had the required configuration for dovecot: I added
mail_location = mbox:~/Mail:INBOX=/var/mail/%u
to /etc/dovecot.conf. With this, dovecot finds incoming email in my incoming mailbox (where sendmail deposits it) and stores folders in ~/Mail, with each folder being one mbox format file. I don't see how to get it to find messages in ~/mbox, where my local mail client stores them after reading them from my inbox. No doubt there is a way but...

Anyway, with these set up I tried connecting from Thunderbird: this was easy. I just created a new IMAP account, selected SSL and told it to connect to localhost. Bingo-bango I had access to my messages.

Then I installed Thunderbird on my laptop and set up an equivalent account, but specifying my workstation as the server rather than localhost. I opened up inbound connection to TCP/143, from the local network only. And I now have access to my messages from my laptop.

So now I can receive messages on either my laptop or workstation.

Next, outbound...

Wednesday, June 10, 2009

CentOS5 display management

From the top...

When the Linux kernel boots, the last thing it does is start the init process. This process is the parent of all processes on the system. It creates processes according to the contents of its configuration file: /etc/inittab. You can read all about it in the manual pages for init and inittab.

On a CentOS5 system with X Windows installed, /etc/inittab will include the following:
# Run xdm in runlevel 5
x:5:respawn:/etc/X11/prefdm -nodaemon
The first line is just a comment. The second causes init to run /etc/X11/prefdm whenever the system is running in runlevel 5 and to restart it if it terminates.

The /etc/X11/prefdm script (it's just a shell script) reads the /etc/sysconfig/desktop file to determine which display manager is preferred: by reading the DISPLAYMANAGER variable set in that configuration file. If the variable is set and prefdm is able to, the specified display manager is run. Otherwise, first gdm, then kdm then xdm are tried.

The /etc/X11/prefdm script runs display managers by exec'ing them. Thus the display manager replaces the shell process running the script. If no display manager can run, then the script exits with exit status 1. Otherwise the display manager exits with whatever status it likes.

When the script or the display manager it executed terminates, the init process runs the script again.

rhgb

The rhgb program (Red Hat Graphical Boot) displays messages from the boot scripts on an X Server display. There is no man page or other documentation installed with this program but it seems to be a standard part of Red Hat installations.

The rhgb program is run if the boot parameters include rhgb. If you don't like rhgb remove this parameter from your boot parameter list (grub, lilo or whatever you use). You should then get all your boot messages appearing on a simple text display.

There is no option to provide a detailed display by default. You can edit the boot scripts to force a detailed display, but rhgb will sometime make up its own mind and switch the display anyway - like when some script takes longer than 10 seconds to complete. So, unless you pepper your init scripts with "rhgb-client --details=yes", you won't necessarily see the details.

Starting the X Server just takes more time when all you really want to do is boot.

Displaying the text from the boot scripts in a graphical display really doesn't add any value to the boot process. Maybe some people find it more "friendly" because it hides "intimidating" messages. My advice is to turn it off.

x11vnc on CentOS5 with GDM

Setting up x11vnc to allow remote login and control of the physical console on a CentOS5 system is easy.

Install x11vnc (e.g. yum install x11vnc)


Create a GDM init script for display :0 (or whatever display you want to connect to). The default init script is /etc/gdm/Init/Default. You can copy this to a file named for the display you are using. On my system this is ':0'.
cp /etc/gdm/Init/Default /etc/gdm/Init/:0
Edit the new init script, adding the following down at the bottom, just before the exit:

x11vnc -bg -o /tmp/x11vnc.log -reopen -forever

Note: I had "-auth /var/gdm/:0.Xauth" option until Karl (see comments) suggested it wasn't necessary - it works fine without it. The -auth option isn't required in this case because the XAUTHORITY environment variable is already set when x11vnc is executed. If running x11vnc in some other context, it would be necessary to either set the XAUTHORITY environment variable or use the -auth option.

The -bg option causes x11vnc to go to background instead of staying in the foreground until terminated. This allows GDM to carry on to do its thing.

The -0 option specifies the path of a logfile.

The -reopen option tells x11vnc to reconnect to the X server if the connection is broken, which it is after GDM completes login because the initial X server is terminated after login and a new X server is started as the logged in user.

The -forever option tells x11vnc to continue running after termination of a VNC session. With this option it is possible to disconnect and then reconnect.



For details of GDM see http://library.gnome.org/admin/gdm/2.16/configuration.html.en.

Tuesday, June 9, 2009

Windows Vista Sidebar Gadgets

I have a new laptop with Windows Vista pre-installed. I have avoided Vista for as long as possible but my old laptop died and it seems to be impossible to buy a new one with XP these days. Before I install Linux, I thought I would try out Vista for a while.

One of the new features is the sidebar gadgets. I haven't seen them before, so I went to the Microsoft site to learn more about them. First I found marketing hype about how great they are, then I found http://vista.gallery.microsoft.com/vista/SideBar.aspx?mkt=en-nz. This page has downloads and links to information but all the links are to a "live.com" website. That site looks like some sort of social network / shareware distribution site.

So I called Microsoft to find out where the documentation is and after a long conversation with the support analyst the best they could refer me to was end-user documentation. I explained that I am an IT professional and I need to know how to manage them in a corporate environment, to which they responded that I should search for some third party websites that have more information and suggestions how to tinker with the gadgets. So I explained again that I am an IT professional and I don't want to tinker with gadgets, I want to manage corporate desktops professionally. The analyst went away to search again and finally came back to say that the end user help pages is all the documentation that Microsoft has to offer and if I wanted more I would have to go to a third party.

So, after all these years, the best desktop Microsoft has to offer is, from a corporate management perspective, undocumented. It gives me a sinking feeling.

But wait... After much searching about the Microsoft link and following links here there and everywhere, I finally found a page that has some reasonably technical information:

Sunday, May 17, 2009

HTML name and id tokens

The HTML 4.01 spec says:

ID and NAME tokens must begin with a letter ([A-Za-z]) and may be followed by any number of letters, digits ([0-9]), hyphens ("-"), underscores ("_"), colons (":"), and periods (".").

But it also says:

Use id or name? Authors should consider the following issues when deciding whether to use id or name for an anchor name:

  • The id attribute can act as more than just an anchor name (e.g., style sheet selector, processing identifier, etc.).
  • Some older user agents don't support anchors created with the id attribute.
  • The name attribute allows richer anchor names (with entities).

It is strange that name attributes are supposed to allow richer anchor names (with entities) when the none of the characters necessary for specifying entities, other than digits, are allowed in name tokens - the ampersand (&), without which one cannot specify an entity, is not allowed in a name token, nor a semicolon (;) nor a hash/pound (#).

Some browsers allow many characters other than those specified, including non-letter initial character, but not all. No doubt some browsers are attempting to conform strictly to the specification when they ignore anchors with disallowed characters in their name tokens.

Thursday, May 14, 2009

Demographics, Corporatization and Democracy

Here is an interesting presentation on trends in demographics, with some discussion of their implications to prosperity and stability of countries around the world.

The world has never been a static place and the future is certain to be different from what we know today. Having grown up in a long period of peace and propsperity in "western" countries, it is easy to forget the preponderance of conflict and hardship in the overall human experience. It seems unlikely that the pervasive ease of life that I have known will continue much longer.

We are still in the early stages of global integration and corporatization. As global integration progresses, the significance of geographically based organizations declines. For example, in Europe, after many centuries of violent conflict, there is no longer enough concern in the geographically based nation states to continue the conflicts - European union better serves the corporations. The corporations already transcend nations. Their conflicts are in other realms than the geographic extents of nations.

National governments are of progressively less significance. Consider, for example, how many countries remain free to pass legislation independently on issues that affect the corporations. They are bound by economic necessity and international treaties and have progressively less independence as they become more integrated economically.

Corporations, on the other hand, are becoming ever more powerful. They are revising the laws of all nations to facilitate their objectives. They are powerful enough now to be able to subvert the democracy in even the most powerful and most dogmatically democratic countries. And they have long since disposed of democracy and independent local governments in less powerful countries in which they have an interest.

In the past 250 years, the struggle for democracy in national governments was won to a significant extent in several of the more powerful countries in the world. But the new powers, the corporations, are in no way democratic.

If you want to know how it will be, re-read Machiavelli's The Prince and remember that the shareholders are the new princes. The nature of the conflict has changed, from military to economic, but the desire for power and the consequences of the struggles for power, for the general population, remain the same.

Very broad markets in consumer goods and services may be the last bastions of democracy in the new world. Unless democratic nations reverse the handover of power to international corporations, they will soon cease to yeild any significant power, after which their democratic nature will be irrelevant.

The rise of third world nations and cultures will not save the democracies - they are already un-democratic and easy prey for the corporations.

Religious fervor may be the only force that the corporations find difficult to overcome. But the concentration of power that is often associated with religious organizations makes them vulnerable to corruption, so even this is uncertain.

The corporations will continue to consolidate and amass power and wealth, until even the wealthiest nation states are unable to compete with them.

Tuesday, May 12, 2009

Connections

Please read Bill Joy's article in Wired: Why the future doesn't need us. It is insightful, thought provoking and worthy of careful consideration. The issues he discusses should be of concern to everyone.

How I came to read the article today seems not unrelated to the concerns raised in it and increases rather than relieves my anxiety. In what follows, I will try to explain why.

Progress in understanding often comes from associating previously disjoint information. Combining facts or ideas that previously had never been considered together can lead to new insights, understanding and abilities - new knowledge that is more significant than might be expected.

When I was in university, I worked for a professor with several degrees in the biological and physical sciences. He told me, in effect, that the most interesting, capable and impressive people he had ever met or expected to meet all had multi-disciplinary backgrounds and it was this diversity of their knowledge and experience which allowed them to bring together what had previously been separate, producing new knowledge and insight.

Today, I read a humorous posting regarding a question from a somewhat naieve user of computers that, among other things, included a link to a picture of Bill Joy. Somewhat embarassingly, but as is increasingly frequent as I get older, I was certain that I knew who Bill Joy was, but couldn't recall anything specific, so I googled him. Of course, Wikipedia has an article on him, which I read and which jogged my memory.

That article had an intriguing link: "Why the future doesn't need us". - another Wikipedia page with a link to the Wired article of the same name. So, having some time to spare today, I followed the link and read the article.

Please read the article, but to paraphrase and condense extremely, I will say that the essence of the article is that there are risks associated with the advancement of our knowledge and technology; that the risks are growing as the power of our technology increases; and that, with the speed at which knowledge and technology are advancing, these risks are now or will very soon be so great that we need to be more cautious in our further development and use of knowledge and technology.

My reading the article today is related to all this, and compunds my concerns arroused by the article, because I began reading about a problem in programming and ended up, only a few minutes later, reading an article that I think is of quite profound importance. Had it not been for the Internet and Google and Wikipedia, I never would have come across these very different bits of information in the same day and almost certainly wouldn't have associated them with each other in any way, yet now, they are associated for me, and the gap between them is as easily bridged by others as it was by me. I am no one special.

In this case, the combination of ideas does not result in anything that will change the world, but the linking and association of information that is inherent in the Internet, Google, Wikipedia, PerlMonks, Wired (the sites I browsed in this case), and many other similar resources, is staggering and profoundly significant. While many of the links created are trivial, no doubt there are many nascent links of profound importance, easily but not yet followed or anticipated, and without precedent in anyones consideration.

The Internet exposes a vast resource of information and the bits of information made accessible by it are more significant as a part of the whole than they would be separately because they can be so easily related and combined, even by people like me without particularly significant education or connections or experience.

There was a time when individuals made discoveries of great import. Then, for a while, it seemed, only relatively large and well funded teams of people could make much progress in extending our collective knowledge and ability. But the Internet empowers everyone to learn and access a vast diversity of information. It seems again that individuals have at their disposal the means to learn and significantly advance our understanding.

Why is this troubling? A basic principle of security that I have been taught and learned to appreciate through the years is that security can be improved if systems can be created such that several people would have to collude over a period of time in order to successfully subvert the system to their own ends. The risk of several "bad apples" successfully working together in secrecy is lower than the risk of one "bad apple" working in secrecy. The need for large teams and substantial financial resources in order to significantly advance knowledge and technology provided some assurance that the effort would not long remain secret. And exposure would allow a broader consideration and control of the activity.

Maybe I was just naieve to think that there was much impedement to individuals making breakthroughs in isolation, but certianly doing so is made easier by the Internet.

Thus, the Internet and the information and tools it provides access to, increase the risk that someone will accidentally or thoughtlessly or maliciously develop something of great harm to us all, as individuals and as a society.

I am concerned most of all because of my experience of the profound inability of people, on average and in general, to successfully manage even very simple things successfully for long and with reasonable consideration and accommodation of the needs and interests of the broader community. Just think of your own experience of errors and accidents. How many of them, in hindsight, seem like they could have and should have been avoided. Yet we continue, collectivley, to make them.

It is somewhat amazing, given all the "accidents" and ignorantly self-interested and intentionally malicious or destructive acts that are committed so frequently, that we have survived as long as we have with the technology we already have. As our power, and in particular the power of individuals and small groups, continues to increase, how long can it be before something harmful on a grand scale occurs?

Compounding my worries, I came across John Perkins' "Confessions of an Economic Hitman" yesterday. I was pessimistic at best that there were sufficient feelings of fellowship in the world, and this confirms and compounds my worries.

I think I will read the Dalai Lama's "Ethics for the New Millennium", mentioned in Bill Joy's article. Maybe that will cheer me up. In the mean time, maybe I'll read the study guide.

In the mean time, the sun shone today and the grass is green and it is quiet and peaceful here were I am. There is much to be happy about.

Monday, May 11, 2009

Can't locate package XXX for @XXX::ISA

You may see this error and think that package XXX can't be found in @INC and then be stumped when you find that module XXX.pm is in @INC.

The problem here is that "Can't locate package XXX" is not refering to the module XXX.pm and is not indicating that this module can't be found. It is referring to the package XXX and it is indicating that the stash of the package XXX isn't defined. This usually results from the module that defines the package not having been loaded (by use, require or do).

While there is often a one-to-one correspondence between them, packages and modules are not the same thing. A module is a file containing Perl code. A package is a namespace with its own stash containing the names in the namespace.

When @ISA is being processed, each package in the @ISA list must already be loaded (by use or require or do or whatever). If the stash for the package namespace isn't defined, then this error is produced.

The solution is to load the module that provides the package before including the package in @INC.

Testing with Module::Build

Module::Build is a system for building, testing, and installing Perl modules.

Much of what you need to know is documented in the POD of Module::Build. In particular see the entry for the test function.

You may wonder how the as-yet-uninstalled module is tested when the test files do not explicity reference the build directories. This isn't covered in the POD.

Before running the tests, Module::Build prepends the blib/lib and blib/arch directories of the build directory to @INC. In this way, when modules are loaded the local copies are found and loaded rather than those already installed.

Monday, May 4, 2009

A Few Thoughts on Copyright

A friend sent me a link to a YouTube video that is a tutorial and advertisement for a website that provides "unlimited free games" for xbox 360. This was in the context of an ongoing discussion regarding copyright stimulated by recently enacted changes to the copyright act here in New Zealand. He sent the link with the comment that he understands why the industry wants new rules. He suggested I post my reply, so here it is...

It appears that the xbox360 site is copying games in breach of the copyright holders' copyrights. I understand why those copyright holders would want to enforce their copyrights but it is less clear whether any fundamental change in copyright law is necessary, appropriate or beneficial for society as a whole.

The current law, as it is in most countries (164 signatories to the
Berne convention and others indirectly controlled via membership in the WTO) allows those copyright holders who's copyrights are being breached to prosecute the owners of the xbox360 site. No change in the law is required. All they have to do is prove the copyright violation in a court and sue for damages, including their legal costs.

There is a potential problem that copyright holders might prove breach of copyright in court but then find that the guilty party does not have sufficient wealth to cover the legal costs of proving their guilt. This same potential exists in any other civil litigation. In general, it is easy for people to cause harm to others that would be monetized to values far exceeding their net worth. Consider, for example, all the people worth less than a few hundred million dollars and without third party liability insurance for a similar amount who continue to engage in activities which create the risk of fires on a large scale (e.g. owning accommodations, driving to work, camping, etc.). There are many other risks that people take that might result in harm to others.

If breach of copyright were deemed to be criminal activity, the copyright holder would be relieved of a large part of the cost of litigation, which would be shifted to the tax payer. This would greatly reduce the downside risk for the copyright holder. If this were done, it may be necessary to ensure public resources were not wasted on frivolous cases as there would be little to inhibit the copyright holder after the cost of litigation were removed. It would also be necessary to ensure reasonable protection of the accused from the harm of false or frivolous accusation.

Some copyright holders are frustrated by the assumption inherent in the current law that people are innocent until proven guilty in a court of law. This requires them to prove who is violating copyright in order to obtain compensation for damages. Some would prefer to be able to obtain the compensation without the burden of proving who is guilty of breaching their copyright or even that their copyright has been breached. They might also appreciate the restoration of the Greek practice of debt slavery, for dealing with those who are unable to promptly pay their presumed damages.

There are two conflicting trends: one is progressively more legal rights being granted to corporate interests, seemingly on the premise that all corporate profit is inherently good for society, and the other is a growing number of people who are willing to disregard those legal rights. The widespread disregard for the legal rights of copyright holders (the evidence presented by some of the more vocal copyright holders suggests that in the case of copyright this disregard is extremely widespread - for example, to the extent that a universally applied tax and payment to the copyright holders has been proposed) combined with the ongoing trends in legislation makes one wonder if in fact we live in a democratic society. The answer may be that there is a growing discrepancy with individuals between their public personae (in which they support strong property rights) and their private personals (in which they disregard property rights). If this is the case, then this moral disintegration of individuals will lead to disintegration of society and widespread strife.

There was a day when one held land at the pleasure of the king and only land holders had rights. Those days were only slightly removed from the days when those most effective in battle had rights at the expense of all others. We have come a long way, in many countries, to current society based largely in the rule of law applied, in principal at least, equally to all. There is a broad consensus with regard to physical property rights, gained through many centuries of experience with various laws.

Modern technology combined with a very rapid pace of change has created a transient situation in which "intellectual property" can have a very high value. Under current regimes, all copyrights and all patents eventually expire, after which the affected information comes to the public domain. At the moment, an unusually high percentage of information relevant to modern life is recently obtained and subject to copyright or patent.

At the same time, modern technology has reduced the barriers to replicating information to levels that are almost completely negligible. For example, the cost of replicating a movie is now less than the cost of the popcorn that one might eat while watching it.

These conflicting trends have been identified for some time. One of the earliest and most profound expressions of the conflict that I know is that of Stewart Brand of the Whole Earth Catalog and other endeavors.

This is layered on top of the more fundamental and persistent conflict between individual and common interests, well defined in Garrett Hardin's Tragedy of the Commons and elsewhere.

There were many revolutions in the course of resolving land rights and other physical property rights to their current state and, I expect, there will be more in the course of resolving a reasonable state or management for intellectual "property" rights. These are not insignificant issues.

My personal inclination is that neither the interests of society as a whole nor the interests of individuals on average are best served by granting long term monopolies on "intellectual property" as a default. Current timeframes for copyright were established at a time when little new arose in the span of 100 years. Patentable inventions are now arising so rapidly that the pace of change is disruptive to society and exceeds the capacity of many to cope. Further extension of monopolies seems to be of dubious benefit and may be harmful. 

To the extent that monopolies are granted and enforced for "intellectual property" (i.e. copyrights and patents) the holders of those rights should be subject to property tax on the value of those properties on the same basis that land owners are taxed on the value of the land they own. This would not resolve all the conflicts but it would redress some of them in a way that is easy to manage. One would, of course, always have the option of turning one's "intellectual property" over to the public domain, after which no further taxes would be due.


Sunday, May 3, 2009

Information Wants to be Free and Expensive

Note: it seems that blogger.com or blogspot considers the following to be blog SPAM. My appologies if it offends anyone. I have requested a review and will remove the content and/or the blog, subject to the result of the review.

This isn't my idea. Roger Clarke has provided a nice writeup. And while you are there, his page Freedom of Information? The Internet as Harbinger of the New Dark Ages is also worth a read.

There are many others. If you have a few spare minutes a quick search will yield much interesting reading.

Intellectual Property Tax

Intellectual property should be taxed on the same basis as land and other real estate.

The legislation regulating intellectual property is changing. As well as increasing the scope of what is intellectual property and the time during which property rights are assigned to individuals, the rights themselves are being changed to make the property more rivalrous and excludable - to make intellectual property more like land and real estate.

In agrarian society, land is the essential asset of value. There are other assets of value, but ownership or at least the right to use land is essential to survival and the ability to produce wealth. Everything else is secondary.

In the modern "Information Age" the importance of information is recognized. It is not that information was not important in earlier ages, but the ability to gather, produce, manipulate, control and extract value from information is greater now than ever before.

The importance of intellectual property is increased both by the increasing ability to produce and use it and by changes to legislation which increase the proprietary rights to intellectual property which are granted to the deemed owners of the property.

An increasing portion of society's wealth and resources is now invested in the creation, acquisition and control of information and intellectual property. While it was, historically, somewhat incidental to the key elements of the economy, wealth and power, it is increasingly central and essential to them. Information and intellectual property are becoming more important than land, real-estate and other physical property.

The burden of government is distributed by the means of taxes and fees on income, consumption and properties. How this burden is distributed is rife with tension, conflict and contradiction. On the one hand, the burden is expected to be on those who benefit. On the other hand, the burden is expected to be on those able to bear it. While everyone might agree that the distribution should be fair, it is difficult to find two or more people who agree as what is fair or even what the basis of fair is.

As well as distributing the burden of government, taxes and fees are also used to influence behavior. Relative decreases or increases of taxes and fees can encourage or discourage particular behaviors.

Intellectual property should be taxed now as land and real estate have long been taxed, for the same reasons that land and real estate have been taxed. Just as land and real estate were the principle assets in agrarian society, intellectual property is the key asset in our modern information based society. Along with the privileges and benefits of owning these key assets come the responsibility of assuming a greater portion of the burden of government.

Yet there is an important difference between intellectual property and real estate. Real estate cannot be reproduced and distributed like information can. Intellectual property is rivalrous and exclusive only because of regulations, not because of its essential nature. Thus while granting intellectual property rights increases the value to the property owner it significantly decreases the total value of that intellectual property to society as a whole by excluding many from benefiting from it. Compare this with the value of a field - it can be used to grow only one crop at a time and it cannot grow more or less depending on which farmer owns it.

Given that the value of intellectual property can be maximized by allowing it to be reproduced and used freely, why are intellectual property right granted in the first place? A common argument for intellectual property rights is that they produce a market for intellectual property and this market provides incentive for the production of intellectual property and a means for allocating scarce resources to produce intellectual property and that these benefits outweigh the loss of utility of the intellectual property produced.

But excessive prolongation of intellectual property rights does little or noting to increase incentive to produce intellectual property while it continues to decrease utility and utilization.

Intellectual property tax can provide a reasonable disincentive to excessive prolongation of intellectual property rights that responds to market conditions. If the owners of intellectual property were required to pay property tax but could avoid the tax by turning the property over to the public domain, then there would be an incentive to put intellectual property into the public domain. The benefit is that information in the public domain can have higher utility and utilization that proprietary intellectual property.

Intellectual property tax would also put an end to the copyright black hole, whereby many copyrighted works are no longer available because the copyright owner is unknown or unavailable to approve and be paid for the right to produce and sell copies of the work. If tax was due, the works could be seized and put into the public domain if the taxes are not paid.

Thursday, April 30, 2009

What's wrong with HTML and CSS??

W3C says:

Tables should not be used purely as a means to layout document content as this may present problems when rendering to non-visual media. Additionally, when used with graphics, these tables may force users to scroll horizontally to view a table designed on a system with a larger display. To minimize these problems, authors should use style sheets to control layout rather than tables.

But style sheets are not capable of reasonable layout. Not only is the design of CSS layout overly complex and obtuse, but the specification is so poorly designed and written that no two browsers are consistent in their implementation of it - not even two subsequent versions from the same vendor!!

What makes this even more bizzare is that before designing CSS there was a working model: HTML tables. It would have been easy, and sufficient for most purposes, to provide in CSS the layout capabilities already present in tables. This need not have precluded other layout options, but at least there would then have been one reasonably sane and reasonably well understood (i.e. amenable to consistent implementation) means of laying out pages with CSS.

As it is, I will continue using tables for the foreseeable future.

Wednesday, April 29, 2009

It's hard to be helpful

It struck me again this morning how difficult it is to be helpful.

Comments and suggestions may be taken as criticism, particularly if they relate to someones core beliefs, values, passions or achievements. And criticism, perceived or actual, often elicits defensive reactions that inhibit further communication and learning.

As a result, it can be difficult to get someone to think about and understand a new or different idea and more so to get them to accept that it is valid or has merit.

I quite like the quote in this post. on PerlMonks. If I understand correctly, this is a quote from Tagakure. I will have to read this to see if it is the true source and if it is generally of the same quality as the quoted passage.

There are recent translations of Tagakure available from Amazon and elsewhere. There is also this version, which purports to be a copy in the public domain. I Don't see it on Guttenburg or Internet Archive, which makes me wonder if it is actually in the public domain. The Wikipedia article also has a link to an on-line copy, though I don't see any statement about copyright there.

Wednesday, April 22, 2009

Perl Objects

Perl Objects

What is an object in Perl?

An object is a reference to an item (anything that can be referenced by a reference) that has been blessed.

An object is created by first creating a reference and then using the bless function to bless the referenced item with a package name.

For example:

$reference = {};  # here a reference to a hash but it could be to anything

bless $reference, "Some::Package::name";

The bless function requires a reference as an argument but it modifies the referenced item rather than the reference itself. It sets a flag in the referenced item that indicates that the item is an object and it records the package name as an attribute of the item. With this done, any reference to the item can be used with the arrow operator (a.k.a. dereference operator) for method invocation.

It is the facility of method invocation that makes objects different from other variables.

Method invocation is a means of calling a subroutine. It differs from regular subroutine invocation in two respects:

  1. the package name with which the referenced item was blessed is passed as the first argument to the subroutine, followed by any explicit arguments; and
  2. a runtime lookup of the method name is performed to determine the subroutine to be called.

For example:

$ref->method($arg1, $arg2);

$ref->Package::method($arg1,$arg2);

The method name may be unqualified or qualified with a package name. If it is unqualified, lookup of the subroutine begins in the package with which the referenced item was blessed. If the method name is fully qualified, lookup begins in the specified package, regardless of the package with which the referenced item was blessed.

If the package has a subroutine with the same name as the method name then this subroutine is called.

If the package does not have a subroutine with the same name as the method name then lookup is repeated in each package in the list (@ISA, 'UNIVERSAL'). The @ISA array is a package global and 'UNIVERSAL' is a package that is part of the Perl core distribution which defines several basic methods. As each package may have its own @ISA array, a depth first search of these arrays is performed.

If no matching subroutine is found after this search then the search is repeated but searching for AUTOLOAD rather than the named method and if an AUTOLOAD subroutine is found then it is invoked for the method.

These mechanisms are simple, but the ramifications and possibilities are not.

Because methods are resolved to subroutines at runtime (a.k.a. dynamically), interesting things can be done. Sometimes these are interesting in the sense of wonderful, amazing, powerful and good, but sometimes they are interesting in the sense of the curse: may you live in interesting times. 

Wednesday, April 15, 2009

perl system on windows

On Windows systems, if the first argument to "system" is a number or integer and not a string it is taken to be the mode of the spawn call that creates the process to run the command which, in this case, is specified by the second argument to system. Allowed values are P_WAIT or P_NOWAIT as defined in process.h. These are usually 0 (synchronous execution - calling process waits until the spawned process terminates) and 1 (asynchronous execution - calling process continues to execute concurrently with the spawned process) respectively. Other values are not supported by perl and will result in system returning an error (-1) without running the command. The default is synchronous execution (P_WAIT).

Friday, February 27, 2009

Devel::Peek

Consider:

$ perl -MDevel::Peek -e 'my $x; Dump($x);'
SV = NULL(0x0) at 0x9c90cdc
  REFCNT = 1
  FLAGS = (PADBUSY,PADMY)
$ perl -MDevel::Peek -e 'my $x = 10; Dump($x);'
SV = IV(0x8a5a9b0) at 0x8a3ecdc
  REFCNT = 1
  FLAGS = (PADBUSY,PADMY,IOK,pIOK)
  IV = 10
[ian@alula ~]$ perl -MDevel::Peek -e 'my $x = 10; Dump(\$x);'
SV = RV(0x809d158) at 0x8074c28
  REFCNT = 1
  FLAGS = (TEMP,ROK)
  RV = 0x8074cdc
  SV = IV(0x80909b0) at 0x8074cdc
  REFCNT = 2
  FLAGS = (PADBUSY,PADMY,IOK,pIOK)
  IV = 10

What are all the addresses?

perldoc Devel::Peek doesn't say.

Every value has data stored in a structure 'struct sv'. Dump reports the address where this structure is located in memory as "at 0xXXXXXXXX". For example, in

SV = IV(0x8a5a9b0) at 0x8a3ecdc

The 'struct sv' for this SV is located at 0x8a3ecdc.

Most values (all but NULL values) also have data stored in a second, type specific structure. The 'struct sv' includes a pointer to this secondary structure. Dump reports the address where this secondary structure is located in memory in parentheses after the type of the value. For example, in

SV = IV(0x8a5a9b0) at 0x8a3ecdc

The type of the value is IV (which determines the type of the secondary structure) and the secondary structure is located at 0x8a5a9b0.

Labels