Notebookshttp://www.pbw.id.au/blog
Much ado about some thingsTue, 26 Sep 2017 10:40:21 +0000en-AUhourly1https://wordpress.org/?v=4.8.2https://i1.wp.com/www.pbw.id.au/blog/wp-content/uploads/2016/09/cropped-cassowary_notxt_512x512.png?fit=32%2C32Notebookshttp://www.pbw.id.au/blog
3232131227423The base line: Alan Coleman, 1936 to 1945http://www.pbw.id.au/blog/2017/09/the-base-line/
http://www.pbw.id.au/blog/2017/09/the-base-line/#respondTue, 12 Sep 2017 11:43:27 +0000http://www.pbw.id.au/blog/?p=447Continue reading "The base line: Alan Coleman, 1936 to 1945"]]>In 1936, when he was four years old, Alan Coleman arrived at St. Joseph’s Home in Ballarat as a Ward of the State. He remained there until he was thirteen, and under the care of the Sisters of Nazareth in Geraldton until sixteen. When the Senate convened, from 2003 to 2005, an Inquiry into Children in Institutional Care, Alan made submission number 471. This story is taken from that submission.

Initially, Alan was in the nursery, but when he was six, he went “downstairs” to the school-age group of six to thirteen year olds. He realised that he was “in for a very hard time” because downstairs was “run like a prison.” Each child was assigned a number which was marked on his clothes. Alan was number 96.

The nuns delegated a great deal of authority to what Alan describes as “bully boys,” who were each in charge of from eight to ten younger boys. They had authority to administer some punishment and to refer offenders to the nuns to be given up to twelve strokes, or even more, of a long cane which had “pins in the end.”The peak physical punishment was being stripped naked, held down by four of the bully boys, and flogged from shoulder to calf with a thick strap. If you twisted over, the strap was applied to stomach and genitals.Sentences were up to a hundred lashes. Alan himself received this punishment at the hands of Sister Blandina, “the worst offender,” “sadistic and puritanical.”

In winter the boys were always cold and always hungry as, in Dickensian fashion, there were “never any seconds.” Any caught stealing food were punished either corporally or by being “made to stand in a dark passageway up to six or seven hours.” Saturday was weekly bath day. Three tubs and three towels served one hundred boys, youngest to oldest, in the same three tubfuls of water. Modesty was preserved by canvas towels worn round the waist. Only when it came to the bully boys turn were the tubs emptied and refilled with hot water.

In spite of the boys’ numbers, names were still important. Another Alan Coleman of the same age was sent up from Melbourne, so one had to change his name.The new boy became Joseph Coleman, and in spite of the fact that, in contrast to Alan, “Joseph” was not very good at school and did not play sport, Alan gradually assumed the role of his protector for as long as they were in care together.

In Year 7 of school, Alan injured his hand while working in the laundry. He was six weeks in Ballarat Base Hospital, and though he had no visitors, he basked in the compassionate attentiveness of the nurses. After this stay, and a longer one due to rheumatic fever, he started to have visits at the home from friends made at the hospital. It’s a comment on his likability.

Alan’s eighth grade class, the last year of his primary schooling, was taught by Sr Blandina. The class was being prepared for an exam to determine the two pupils who would be eligible to attend St. Pat’s College the next year. Alan, to Sr Blandina’s dismay, topped the class and the eligibility. However, he heard a rumour that the Brothers at St Pat’s “could do what they liked” with the orphans, so he withdrew.

It appears that, after the school years, the boys went into either the farm boys’ quarters or the smaller group of college boys. The first allusions to sexual behaviour in Alan’s submission involve the farm boys offering personal instruction in masturbation. Alan and Joseph went to the college boys, who let them stay. “[W]hile I was upstairs we had no idea this types [sic] of thing happened…we kept this from the nuns because we were taught never to put anyone in.” That’s the extent of sexual abuse experienced, or heard of, by Alan Coleman at St Joseph’s between 1936 and 1945.

It was 1945, and orphaned farm boys from St Joseph’s were being sent to Nazareth House in Geraldton (apparently an old people’s home) to work in the kitchen.In Geraldton, similar invitations to mutual masturbation were extended by the other farm boys and particularly the “manager,” a nineteen year old. The only more disturbing incident involved a visiting priest to whom Alan was sent on suspicion of “misbehaving.” The priest masturbated and asked Alan to “touch it,” but he refused. The refusal was accepted, “any way he was so excited he pilled [sic] out a large handkerchief and wiped it he told me not to say anything.”

Alan’s strong moral code and his moral courage shine through in these events: his protection of his adopted “brother;” his sacrifice of further education; his lonely refusal of the culture of masturbation among the farm boys; and his “no” to a priest. Alan’s life subsequently was that of a man adrift. He only settled at the age of sixty, in the Philippines, with a Filipina wife who bore him a son, although he still accused himself of an incapacity to show affection.

This is a picture of life for an orphan in St Joseph’s orphanage between 1936 and 1945, and it serves as a baseline for another story, or set of stories, about the same orphanage between 1943 and 1959.

The bills I discuss below were withdrawn on the 27th of February, 2017, because they faced almost certain defeat. The issue of reform was referred to the Queensland Law Reform Commission.

Two related private member’s bills are currently before the Queensland Parliament. The Abortion Law Reform (Women’s Right To Choose Bill) 2016 removes abortion from the Queensland Criminal Code, lock stock and barrel. This is necessary, as the Explanatory Note makes clear, because “[t]he current law in Queensland is causing great hardship and personal suffering.” Further, according to Dr Carolyn De Costa, “This is the only health procedure that is dealt with like this in criminal legislation. It’s way, way out of date and belongs in the 19th century. We’re practising medicine in the 21st century.” The “Benefits of the Bill” include the following. “The Bill will repeal outdated laws that can criminalise women and doctors for a basic human right and a medical procedure…These archaic laws are dangerous and have no place in modern society where women should always have control over their own bodies. This Bill will protect vulnerable Queensland women and the doctors that are currently risking prosecution to assist them.”

In his speech introducing the bill, Mr Pyne (Cairns—Independent) made some trenchant comments.
“A Cairns District Court jury took less than an hour to find Tegan Simone Leach, 21, and her partner, Sergie Brennan, not guilty of charges of procuring an abortion…They admitted…that Ms Leach took the pills…because they were not ready to have a child. It is my position that when a young woman is not ready to have a child and chooses to terminate a pregnancy that should be a matter for her and her medical practitioner, not a matter for the state.”

He goes on, “Surely a young person should not have to ruin their young lives by proceeding with a pregnancy if they are not ready and their family and their doctor think it unadvisable.” Well, and perfectly correctly, said Mr Pyne.

However, there was one disturbing element to Mr Pyne’s speech. “Should this bill pass, the decision for the doctor would simply need to be that continuing the pregnancy poses a bigger risk to the woman than terminating it.” One has to ask, “What’s it got to do with the doctor?” Is women’s control over their own bodies now to be handed over to the medical profession?

Apparently Mr Pyne took this into consideration, for shortly before the Abortion Law Reform (Women’s Right To Choose Bill) came back from committee, Mr Pyne introduced the Health (Abortion Law Reform) Amendment Bill 2016 to clarify matters following the presumed removal of abortion from the Criminal Code. Mr Pyne’s speech in introduction showed the development of his thinking.

“Section 20 provides that only a qualified health practitioner may perform an abortion…It also says a woman does not commit an offence against this section for performing an abortion on herself.”

“Section 21 addresses abortion on a woman more than 24 weeks pregnant. It states that a doctor may perform an abortion…only if the doctor reasonably believes the continuation of the woman’s pregnancy would involve greater risk of injury to the physical or mental health of the woman than if the pregnancy were terminated; and has consulted with at least one other doctor [to the same effect.]”

This is an enormous step backwards. Not only does a distressed and vulnerable woman have to plead with one doctor to provide her “basic human right” (in Mr Pyne’s words) to the control of her own body, but she must now plead with two. This may not be as bad as it looks, though, because there does not seem to be any requirement for the second doctor to interview the patient, unless a judge decides that “reasonably believes” unreasonably requires such an interview.

The section does at least make it clear that there is no artificial and arbitrary upper limit on the period in which a woman in physical or mental danger can obtain (doctors willing) an abortion.

What happened to that talk in the earlier bill about removing abortion from the Criminal Code? Well, it does get a guernsey in a note to Section 21. “A failure by a doctor to comply with this section does not constitute an offence but may constitute behaviour for which action may be taken under the Health Practitioner Regulation National Law (Queensland), Part 8 or the Health Ombudsman Act 2013.” That is some relief.

“Section 22 concerns the duty to perform or assist in abortion. It says no-one is under a duty to perform or assist in performing an abortion…However, a doctor has a duty to perform, and a registered nurse has a duty to assist a doctor in the performance of, an abortion on a woman in an emergency if the abortion is necessary to save the life of, or to prevent a serious physical injury to, the woman.” The difference between the conditions applying in this situation and those of section 21 are quite clear. Section 21 only addresses “greater risk” of physical or mental injury by continuing the pregnancy than by terminating. Section 22 addresses an immediate threat. This provision will be worthwhile if it prevents the suicide of one desperate woman who finds herself at the mercy of the “consciences” of medical providers in, for example, a country hospital. It is important to note that this safeguard applies to all abortions, up to term.

The first bill is at least unambiguous and represents a great leap forward for Queensland. The second bill is something of a curate’s egg, but is overall a step in the right direction. There is, however, a glaring omission.

While this long-awaited clarification and rationalisation offers more security to women and the medical practitioners seeking to help them, including the important consideration that abortion is available until term, no-one seems to have considered the situation of women whose foetuses are delivered prematurely. Given that the justification for the great majority of abortions under current circumstances is concern about the mental, rather than the physical, health of the woman, this is a grievous oversight. Suppose a woman who, though in a desperate psychological condition over her pregnancy, holds off having an abortion through a certain reluctance and in the belief that she still has, say, eight weeks to decide. Suppose further that this woman has the misfortune to deliver the foetus at this time. If anything, this circumstance would render the woman’s psychological state more parlous. Yet at the very time of her greatest vulnerability and need, the state and the law turn their backs on her, denying her the undoubted benefits of an abortion in her troubled state, because of an accident of timing.

This anomaly and injustice could be addressed by defining a “nominal pregnancy.” While the details would have to be decided by extensive consultation, suppose that the minimum period of a nominal pregnancy were defined as 37 weeks. The mother of any foetus delivered before 37 weeks gestation could then seek to have her nominal pregnancy terminated on the same basis as a woman whose actual pregnancy was similarly advanced.

This is not a proposal for infanticide. Pregnancy properly lasts about 39 weeks; the foetus is not ready for the outside world until then, as the difficulties of the prematurely born attest. So such a pregnancy coming to term at the usual time reflects the proper transition from foetus to infant. A prematurely delivered foetus is physiologically, then, still a foetus, although one in more difficult circumstances than usual. Furthermore, any psychological and exacerbating financial stresses on the woman will be aggravated by the circumstances of premature delivery.

It goes without saying that the termination of what we might call an externalised foetus would be achieved in the most humane possible manner, involving no suffering to the foetus. This carefully controlled process would in fact be much more humane than the process of normal late-term abortion, with its necessarily confronting aesthetics.

Hopefully the opportunity presented by these bills will seized in full by amending the second bill to include the just principle of a “nominal pregnancy” and put Queensland at the forefront of progressive thinking on women’s issues.

The -prune action prevents a search from descending into the pruned directory, but I also want to strip out all directories, because the filenames are being fed into xargs grep. So the command feeding the xgrep looks something like—$ find . -type d -name .hg -prune -o -type f -print
This works well. All directory names are suppressed, along with the files contained in the .hg directory.

Because the default action on a find is -print, I often elide that action, so I end up with—$ find . -type d -name .hg -prune -o -type f
Lo and behold, the name of the pruned .hg directory appears in the list of files passed to xargs. All other directory names are suppressed.

What seems to be going on is this: the condition before the -o finds only directories named .hg. Those it prunes, but the condition returns the names of the pruned directories. The condition following the -o filters out all of the directories not named .hg. The combined list of files and .hg directories (but not their contents) is passed to xargs.

So how is it that the first version works as I want it to? How are the names of the .hg directories suppressed?

All I can surmise is that, in the absence of a specific -print action, the default -print applies to each of the conditions, but when it is specifically applied to the -o conditions, the default is suppressed for the initial conditions.

The man page says:If the whole expression contains no actions other than -prune or -print, -print is performed on all files for which the whole expression is true.
That is ambiguous; in fact, it seems to be false. Neither of the versions above contain any actions apart from -prune and -print, and one doesn’t even contain a -print. Yet they behave differently.

The command$ find . \( -type d -name .hg -prune -o -type f \) -print
which pops the -print out from within the sub-expression, behaves the same as$ find . -type d -name .hg -prune -o -type f
so that seems to be what is effectively happening in the absence of a specific -print on the or condition. (Incidentally, you seem to be able to use -or in place of just -o.)

Version Control Systems (VCSs)

VCSs like mercurial, git and bazaar (to mention only a few) are great for keeping track of changes to source files, but their utility doesn’t stop there. If you’re working on documents in applications like Word, OpenOffice or LibreOffice, especially when you are asking others to review those documents, a VCS program can save you a lot of anguish.

However, people who work not with source code, but with research papers, academic assignments and the like, are not inclined to make themselves familiar with the tools that geeks have grown used to. Considering how long it took for software developers to embrace those tools, it’s hardly surprising.

Limitations of VCSs

Unfortunately, VCSs aren’t set up well for managing such files. They depend for efficient version management on tracking line-by-line differences in file. This allows them to maintain the minimal set of changes from version to version, and to readily show what changes have occurred between any two versions. That works well for source files, which are written in plain text, but not for files which maintain their own complex internal formats, which generally only become readable when translated by the “mother” application.

VCSs provide for such files, but they mark them as binary, and make no attempt to track the differences between them. Instead, for each version, they simply keep a copy of the entire file. While this is still better by a long stretch than not being able to track, version by version, the history of a document, it makes it impossible for the native VCS to show what the differences between versions actually were.

Other solutions

This problem has been partially addressed before. For those who generate Open Document Text (ODT) files with, for example, OpenOffice, the program odt2txt will extract text from those documents. odt2txt, in turn, enabled oodiff, which is a script to generate a diff from the text of two ODT files, extracted with odt2txt. It’s not a complete solution, because there is still no merge facility, but it at least allows the textual differences between versions to be examined from within the VCS.

The combination of such a file comparison program with a VCS graphical interface presents a much lower barrier to adoption for users from outside the asylum. Because I᾽m on OS X, I’ve been using Atlassian’s free product, SourceTree, which has the advantage of working with both mercurial (hg) and git. If you’re working with mercurial only, or if you are on a linux distribution, you can use TortoiseHg as a graphical front end.

That wasn’t quite enough, because my wife, whose requirements got me thinking about this, works mainly with Word files. I needed an equivalent of odt2txt and oodiff for both .doc and .docx files — which have very different formats.

Thank you, Tika

Fortunately, the problem of extracting text from these formats has already been conveniently solved by the Apache Tika project. Tika can extract metadata, plain text, xml and html from a dazzlingly array of file types. For my purposes, plain text and metadata will suffice; metadata only for any file types, like images, from which text cannot be gleaned. Tika provides not merely a substitute for odt2txt, but an extension to virtually any commonly (an many not so commonly) used file formats. All that remained was to provide a substitute for oodiff.

tikadiff

That’s tikadiff. It takes either two filenames and generates a graphical diff of them, or two directories and, for each file in the first, generates a diff of the file of the same name (if it exists) in the second. tikadiff depends on Tika (obviously) and a graphical diff program; by default kdiff3, but it is currently written to look also for Perforce p4merge, and can be instructed to use a diff program of your choice, provided that it accepts the same two arguments.

tikadiff depends also on a number of scripts that are distributed with it.

tika

tika is a convenience script to run the CLI from the tika-app jar file. It passes all its arguments to tika-app. In addition to that basic function, it will preset certain arguments to tika-app depending on the name by which it is invoked.

tikatype —prints the mimetype of the file named in its argument

tikameta —prints the metadata of the file named in its argument

tikatext —prints the plain text extracted from the file named in its argument

tikaxml —prints the XML extracted from the file named in its argument

tikahtml —prints the HTML extracted from the file named in its argument

tikserve

tikserve, like tika, is a convenience script to run tika-app. Unlike tika, it is not invoked (except during setup) under its own name, but only through a series of links. It runs tika-app as a server, which performs some operation on any file which is written to its open TCP port.

tikstype —set up server to return mimetype of file

tiksmeta —set up a server to return the metadata of the file

tikstext —set up a server to return the plain text extracted from the file

tiksxml —set up a server to return the XML extracted from the file

tikshtml —set up a server to return the HTML extracted from the file

tikadiff only uses tikstype, tiksmeta and tikstext when comparing directories, on the theory that it will be faster to use a server when testing and comparing multiple files. I have not checked whether this theory is valid.

In order to run the server(s), tikserve needs a port on localhost. To support this habit, tikserve looks to two other scripts.

freeport

freeport hands back the next available port on localhost, starting at 1024. You may optionally give it a minimum port number and, sub-optionally, a maximum port number as constraints. In order to perform this task, freeport requires—

localhostports

localhostports prints the ports which, in the opinion of netstat, are currently associated with localhost.

It’s pretty important to check the digests of software you download. When a downloaded file is accompanied by a signature file, for example a gnupg .asc file, you can verify the signature with various tools. Often though, a download site will include the MD5 or SHA1 digest hash of the file, which allows a quick check on the file’s integrity. OS X has an /sbin/md5 command, and includes the openssl distribution. Within openssl, the digest subcommand allows for the generation of digests for an array of digest algorithms, including MD5 and SHA1. So it’s simple enough to generate the appropriate digest for that file you just downloaded.

Comparing them is a bit tedious, though. If you’re like me, you skim across the two digests – the one you generated and the one that the authors published – and look for eye-catching patterns near the beginning, middle and end. That works pretty well in practice, but its hardly rigorous.

So I wrote myself a little script that generates a hash, and checks it against a hash value given as an argument. Here’s the help output. $ sha1 --help
Usage: sha1 &lt;filename&gt; [test-value]
where &lt;filename&gt; is required and test-value is
an optional hex digest value to test against.
Exits with
1 if the number of arguments is wrong;
2 if the digest comparison fails;
3 if an unsupported algorithm is requested.

or: sha1 --digests
which will echo the supported algorithms.

or: sha1 --setup
which tries to ensure that hard links are set up for all digest algorithms.
Exits with 4 if NOT all links are available after execution.

Note that the user running this option must have write permission in the
directory containing the invoked program. Soft links are followed
to determine the actual directory containing the program.
Alternatively, you may manually set up your own softlinks in any directory.

or: sha1 -&lt;anything&gt;
Print this help text.

Some of the executables may already exist on your system. On OS X, for example,
the executable /sbin/md5 is present. Which one is found depends on your PATH.
$

Installing the script

Download the script from here. The SHA1 digest of the script is59254e751d0ce827770a73aae573f5294a1e1ac9
This assumes that your downloader is happy with UTF-8 or ASCII and the existing Unix line endings (LF). If it changes them, all bets are off.

Select a location on your PATH. I installed in ~/bin, but you may want to put it in /usr/local/bin or some such system directory. To do that you will have to use sudo or some equivalent. Make sure the file is executable. In my case, I would do this:$ mv ~/Downloads/sha1 ~/bin/sha1
$ chmod +x ~/bin/sha1

Set up links

The –setup option will try to set up hard links for each of the supported digest algorithms (a subset of the algorithms supported in openssl digest). If you required sudo to install the script initially, you will also have to run the –setup as sudo. Your output will look something like this.$ sha1 --setup
Executable /Users/pbw/bin/sha1 already exists.
Executable /Users/pbw/bin/md5 created.
Executable /Users/pbw/bin/sha256 created.
Executable /Users/pbw/bin/sha384 created.
Executable /Users/pbw/bin/sha512 created.
Executable /Users/pbw/bin/dss1 created.
$
Now that it’s installed you can check a digest like so. I’ll go to the Downloads folder and check (too late now, of course) the initial download.$ sha1 sha1 59254e751d0ce827770a73aae573f5294a1e1ac9
sha1 OK
59254e751d0ce827770a73aae573f5294a1e1ac9 EQUALS
59254e751d0ce827770a73aae573f5294a1e1ac9
$
Let’s see what happens if you change the comparison text.$ sha1 sha1 59254e751d0ce827770a73aae573f5294a1e1acA
sha1 FAIL
59254e751d0ce827770a73aae573f5294a1e1ac9 NOT EQUAL TO
59254e751d0ce827770a73aae573f5294a1e1aca
$

The script returns true (0) for a successful comparison and false (in this case, 2) for a failure.

That’s it folks!

]]>http://www.pbw.id.au/blog/2015/03/help-for-digest-checking/feed/031Monad; that’s a wrap!http://www.pbw.id.au/blog/2015/02/monad-thats-a-wrap/
http://www.pbw.id.au/blog/2015/02/monad-thats-a-wrap/#respondSun, 15 Feb 2015 22:25:00 +0000Continue reading "Monad; that’s a wrap!"]]>Just like everybody else who starts to look at monads, I found it was like coming to the face of a sheer cliff. Let me qualify that: just like every other programmer who is not a mathematician (and that’s most of us). I am looking at monads in the context of clojure, so code snippets will generally be written in clojure-like syntax.

Adam’s talk eschews category theory, and mathematics in general, concentrating on how to define and use monads in code. This is an essential approach for the rest of us. Unfortunately, all of the terms used in discussing monads hark back to the mathematics, and that, I believe, makes the practical use of monads more confusing than it need be. This point was brought home to me strongly when, after observing what some of the others were saying, I watched the first part of a lecture by this extraordinary woman.

Warning: take everything I say with a large grain of salt. I am writing this to help me to sort it out in my own mind, and there are no guarantees that any of it is correct.

In all of the discussions I have seen, it is stressed that monads are defined in terms of the behaviour of two functions.

wrap

Although it is not usually mentioned first, I will start with the function that I will call wrap. Nobody else calls it that, but that’s what it does. It goes by a number of aliases:

result, m_result, mResult, etc.

return, m_return, etc.

lift, m_lift, etc.

the monadic function (? Sometimes. However, the 2nd argument to rewrap —see below— is generally called monadic function, so it may be more accurate to describe wrap as the base function on which all other monadic functions of a given monad are built.)

When he discusses the Array Monad for Javascript, Santosh Rajan gives the following signature for the monadic function, i.e. wrap.

f: T -> [T]

That is, for the Array Monad, wrap takes a value of some type T, and wraps it in an array. Both the type of value and the mode of wrapping are specific to each defined monad, but once defined, they are fixed for that monad.

The resulting, wrapped, value returned from wrap is known as a monadic value, and is often represented in code as mv. In this discussion, I’ll call it wrapt, for obvious reasons. I’ll call the argument to wrap the basic value, or bv.

(unwrap)

unwrap is under wraps, so to speak, because it is not part of the public face of monads. It is NOT one of the two functions which define the behaviour of a monad. It is, however, essential to the functioning of monads, and some kind of unwrap functionality must be available to the other function in the definition of monad: rewrap.

unwrap is the inverse of wrap, not surprisingly. In terms of Santosh’s Array monad, it’s signature might look like this.

f: T <- [T]

That is, unwrap takes a wrapt (monadic value), which is a wrapped basic value and returns the basic value.

rewrap

This the function that is generally called bind, m_bind, etc., although in Santosh’s examples, this function takes the name of the monad; for example, arrayMonad. The signature that Santosh gives for this function in the Array Monad is

M: [T] -> [T]

That is, it transforms a wrapt value to another wrapt value. In the case of the Array monad, the basic value is wrapped in an array.

The monadic function argument, mf, deserves a closer look. mf operates on a basic value to produce a new wrapt value. It is, in fact, a composition of functions. It composes wrap and some operation that modifies the basic value. So,

mf ⇒ (f′ ⋅ wrap)

where f′ is a function that modifies the basic value. In that scheme, wrap itself can be described as

wrap′ ⇒ (identity ⋅ wrap)

That given, we can now describe rewrap as

(defn rewrap [wrapt, (f′ ⋅ wrap)]

(let [bv (unwrap wrapt) new-wrapt (wrap (f′ bv))] new-wrapt))

or, equivalently,

(defn rewrap [wrapt, (f′ ⋅ wrap)]

(wrap (f′ (unwrap wrapt))))

The 3 R’s

Monads must obey three rules. These rules I have taken from Jim Duey’s post, with the appropriate translation to the “wrap” terminology I’m using here.

Rule 1

(rewrap (wrap x) f) ≡ (f x)

Alternatively, given our rewriting of rewrap, above, but using f rather than (f′ ⋅ wrap);

Her pregnancy confirmed, she experienced joy or resignation; and she cursed the inconvenience or shrugged her shoulders. She sought advice from her friends about obstetricians; and she sought advice about clinics and prescription drugs. She has expectations of new life; and she has expectations of her old life. She is immersed in a whirlpool of change and growth, of ultrasound images and another heartbeat, of wonder and retching sickness, of anxiety about the future; and she has recovered the status and statis of the recent past.

Her state is an impartial differential function. What will collapse this function, so that we may discover whether Ms Schrödinger’s baby is alive or dead? Does Ms Schrödinger choose?

I call heaven and earth to witness against you this day, that I have set before you life and death, blessing and curse; therefore choose life, that you and your descendants may live…

No, she cannot “choose life,” for no choice is required to bring this new life to parturition. Ms Schrödinger chose life before her baby was conceived. From that point on, the “default course” is life, and the new life drives on relentlessly to growth and birth and growth again. In this respect, there is only one action to decide upon, one thing to choose: death. So a strange “choice” resolves this function. Ms Schrödinger either walks the path she has already set herself upon, or tries to rewrite her own history by killing the witness.

To kill or not to kill: what will it be this time, Ms Schrödinger? She is life-bearer and she is Kali. She is the god-mother. She cannot create life, but she can destroy it.

Unbeknownst to them, the children in the womb must pass quietly by the sleeping Kali, lest she wake and consume them.

In this way, every woman in this society has been given a licence to kill; but only her own children. The law is not written in that way, but that is its effect, and was its intention. The letter of the law is flouted systematically, and so the principle of law itself has been subjected to the will of the god-mother. Ethics has been democratised, and the law which once reflected millenial ethical traditions of its culture in respect of the murder of the unborn, has come under the sovereignty of Kali.

Ave Kali! Hail Ms Schrödinger!

For Christmastide, and for the feast of the Holy Innocents, 28th of December.

]]>http://www.pbw.id.au/blog/2014/12/schrodingers-baby/feed/056zargrep: grep files in a zip archivehttp://www.pbw.id.au/blog/2014/06/zargrep-grep-files-in-a-zip-archive/
http://www.pbw.id.au/blog/2014/06/zargrep-grep-files-in-a-zip-archive/#respondSat, 21 Jun 2014 00:22:00 +0000Continue reading "zargrep: grep files in a zip archive"]]>How do you search for strings within a zip archive?

I’m tinkering with EPUB3 files, and I wanted to be able to find certain strings within .epub files, so I had a look around, and I immediately found zgrep and family. The trouble was that zgrep assumes a single zipped file, not an archive.

So, without further ado, I wrote the following script, which I called, naturally, zipgrep. It uses grep and unzip, which it assumes to be available on the PATH. Not wanting to have to pick through the argument list, I decided to mark the end of arguments to grep with the traditional ‘—‘, after which I could stack up as many zip file names as I liked.

It was a case of not enough time in the library; or Google, in this case. As soon as I had it working, I discovered the original zipgrep.

All was not lost. The original zipgrep handles a single archive using egrep and unzip, with the nice wrinkle of optional sets of filenames to include in, or exclude from, the search. However, I liked the ability to search multiple zip archives, and grep can be converted to any of its relatives with an appropriate flag, so I decided to hang on to son of zipgrep. All I needed was a new name: hence zargrep.

You can retrieve it here. It has been tested on OS X against multiple EPUB3 files.

Because they are zip files, this should also work for jar files, but I haven’t yet tried it.

Brendan O’Neill raises a point which I have never heard in the discussion before, but which I have always felt is critical. This unprecedented redefinition of the basic building block of human society rewrites the contract that the State entered into with every currently married person. How’s that for retrospective legislation? I will return to this point below.

Speculate for a moment that the purpose of this push is the destruction of the the institution of marriage. How does that fit with the observations that the original dynamic of homosexual activism was, loudly and proudly, the destruction of the bourgeois institution of marriage? Perfectly well. That same motive was expressed equally fervently by what was known radical feminism in the 70s, and which has become the taken-for-granted feminism of the teenies. If that is the major motivation it has worked very well.

Still, though, something about the appeal of marriage has not been eradicated. Couples who have lived together for years will marry when they decide to have children. How about that? That has happened in my own family. Why would they do such a thing if marriage is merely a recognition of the commitment and loving relationship between two people? So marriage is a tougher nut to crack than was first imagined, and all those young feminists are still going off and getting married before having their children. “Gay marriage” is the next move in the campaign to break the nexus between marriage, family and society.

Returning to the issue of retrospective legislation, I note that there is no provision being made for those who have grave objections to the State’s redefining marriage, and in particular their marriage, to leave the redefined state. If these legislators are to pretend to have any concern for their constituents, they must surely include a provision for those who are currently married to be awarded a divorce on the single ground that the state has violated their original contract of marriage. Such a provision would provide for the automatic transfer of the state-sanctioned marriage to a state-sanctioned civil union of the kind that was offered to homosexual couples.

Those whose marriages are, first and foremost, a sacramental union, would still be sacramentally married. The Catholic Church, for example, does not recognise the State’s divorces. George Weigel, after the re-election of Obama, wrote, “Thus it seems important to accelerate a serious debate within American Catholicism on whether the Church ought not pre-emptively withdraw from the civil marriage business, its clergy declining to act as agents of government in witnessing marriages for purposes of state law.” Amen. That’s not going to happen, in the US or Australia, because it takes a Church with courage, commitment and a vibrant faith to stand in open opposition to the surrounding culture and many who are nominally within its own ranks.

Nonetheless, it should be the subject of a vigorous debate now. The various churches which currently act as agents of the State in marriage ceremonies could demand that their recognition as marriage agents be withdrawn as part of any “gay marriage” enabling legislation. They would advise couples to enter into civil unions immediately before coming to the church to marry, so that their legal rights would not be threatened. Failing the cooperation of the State, the churches could engage in their own campaign of civil diobedience, refusing to sign State marriage contracts or allow them to be introduced into the church.

I’m not holding my breath. The prospect of “gay marriage” has receded in Australia with the election of a conservative government, even as the law has recently been changed in the UK. In the United States, the fight is bitter, unequal and undemocratic, as the fate of both Proposition 8 and Brendan Eich attests. It is understandable, then, that a debate such as George Weigel proposed is being conducted in some nooks and crannies of the American Catholic Church, and perhaps in other congregations. It is also understandable that Weigel’s view has been rejected in such comments as I have read.

The changes between Mavericks and Yosemite, noted below, still apply in Sierra. At least, I have not had to change anything since Yosemite for either El Capitan or Sierra.

UPDATE for Yosemite.

Apple and Tim Cook have shown their commitment to the wider developer community, once again, by starting to pull the plug on the launchctl facilities for setting and modifying environment variables. Here’s the rub: with the last lot of changes, Apple got the system working very, very well.

You can get a feel for the impact of the changes by reading the launchctlman page. See, in particular, the section LEGACY SUBCOMMANDS. It’s not entirely accurate, but that’s not unusual. The critical subcommands are getenv, setenv, and unsetenv. The man page indicates that the export subcommand is available; it is not. (See update in the text, below.)

As far as I know, the procedure outlined below is still valid for Yosemite, but the question is still open. I would not be surprised to learn that the behaviour of launchctl has changed in ways which invalidate some of this discussion. If you find any problems, please let me know in comments.

In a previous post I explained how to integrate your .profile settings with the desktop’s background environment on Lion, using ~/.MacOSX/environment.plist and code in .profile.

Then, of course, Apple changed all that when they released Mountain Lion. To achieve the same objective now required launchctl, and environment.plist was orphaned. Not wanting to abandon the integration path from .profile settings to the desktop environment, I built a method for using launchctl on top of my existing environment.plist code. That got pretty arcane, but it did the job for me.

There was always the problem with the first method, that in order for environment.plist to “take,” you had to go through a login cycle. launchctl overcame that problem. In fact, launchctl was a great advance, because it enabled immediate update of the desktop environment. I’ve now rewritten the .profile code and the launchctl setup to completely remove all reference to the plist. In the process, launchctl provides immediate updates of the desktop environment variables, and they persist across login and reboot cycles.

As explained in a previous post, the now-recommended method of system variable setting is to use the setenv subcommand of launchctl, like so:

launchctl setenv M2 /usr/share/maven/bin

The strings defined in setenv statements like the above, must be string literals. There is no means of resolving variable content based on other variables. For example, you cannot definesetenv TMPDIR $HOME/tmpYou can check the state of the launchd environment with the subcommand export:launchctl export

Here’s the modified code in .profile to set both launchctl and the bash environment variables.
Create the following functions in .profile.export LAUNCHCTL_ENV_VARS="$HOME/.launchctl_env_vars"
if [ -f $LAUNCHCTL_ENV_VARS ] ; then rm $LAUNCHCTL_ENV_VARS; fi

You may then use the function set_env_var to set both bash and launchctl entries. For example,set_env_var M2_HOME "/usr/share/maven"
set_env_var M2 "$M2_HOME/bin"
set_env_var HTML_TIDY "$HOME/.tidy"

Note that the environment variables will immediately be available to any shell scripts or Terminal invocations, and to any applications launched from the desktop.

To get the environment re-established across a login, the launchctl startup features have to be invoked. This is where the file ~/.launchctl_env_vars comes in. Notice that in the .profile code above, we have been executing a launchctl setenv command, and immediately echoing that same command to ~/.launchctl_env_vars.

When the system starts, the launchd process finds system daemon processes to launch from /System/Library/LaunchDaemons &/Library/LaunchDaemons. When a user logs in, launchd looks for user agents to start up in /System/Library/LaunchAgents, /Library/LaunchAgents & ~user/Library/LaunchAgents. While the first two are system-owned directories, the third is owned by the individual user.

We need two files: 1) a shell script which will actually issue the launchctl setenv commands, and 2) a LaunchAgent file that will tell launchd where to find the executable, and how to run it. The shell script is available here; the LaunchAgent file is available here.

The executable: profile2launchctl

#!/bin/sh
#
cmd_list="$HOME/.launchctl_env_vars"
SLEEP_TIME=10# Uncomment following to echo launchctl commands to stdout# Key StandardOutPath will have to be set in the plist file# (au.id.pbw.plist2launchctl) for output to be captured.#ECHO_TO_STDOUT=true
#
one_cmd () {
eval "$@"
}
#
[[ -n "$ECHO_TO_STDOUT" ]] && cat "$cmd_list"
cat "$cmd_list" | while read line; do one_cmd $line; done
[[ -n "$ECHO_TO_STDOUT" ]] && echo Sleeping in profile2launchctl
#
# Sleep for a while so launchd doesn't get upset
[[ -n "$SLEEP_TIME" ]] && sleep "$SLEEP_TIME"Notes:
The required sequence of launchctl setenv is in the cmd_list file. The commands are simply read one line at a time, and each line is handed to eval for execution.Permissions & Location:
To stay on the safe side, give the file -rwxr-xr-x permissions. It should be placed in /usr/libexec, which is root owned. You will have to use sudo to copy it.

Notes:
The UserName field will, of course, be set to your own login name. Likewise, the au.id.pbw can be replaced with any suitable identifier, and the log file directed to a suitable location.
If you need to debug the plist file, add the following lines.

These lines are used in conjunction with the ECHO_TO_STDOUT variable in the executable file. If used, the StandardOutPath will point to a writable file on your system. In this case, it points to a file in my home directory; you will have to change that.

Permissions & Location:

Again, give the file -rwxr-xr-x permissions. Place it in your $HOME/Library/LaunchAgents directory.