Today I spent far more time than I'd intended trying to figure out if I can rely on Dart source files being stored as UTF-8. The spec doesn't say anything about file encodings at all, and just says that "source text is represented as a sequence of Unicode code points" (section 20.1)
It's hard to find anything definitive, but the strongest practical factor seems to be that the Dart Common Front End Scanner has two scanner classes: StringScanner and Utf8BytesScanner. The StringScanner expects a String, and Dart's native String representation is UTF-16, like Chrome. When reading bytes, like from a file, it always uses the Utf8BytesScanner. And trying to run a Dart program in UTF-16, either with or without a BOM, does not work well.
So I conclude that UTF-8 is the only accepted encoding. And since it's hard to find this out, I'm making this blog post so that future me, or someone else searching, can find this out more easily. Or someone can tell me I'm wrong.
Alan Knight's blog
Wednesday, August 21, 2019
Tuesday, April 15, 2014
Dubious Panegyric
Another one of Rixford Knight's articles from the Atlantic, and a couple more photographs. My father was particularly fond of the line "I'd walk a mile to kick a goat."
Dubious Panegyric
by Rixford Knight
The poor man's cow is a sensitive index to business conditions because, when things get tough, lots of people begin to think about getting a goat. Correlation is inverse, of course – the more goats the less business.
Possession of a goat may also be an indication of intellectuality. Even in dire circumstances, only a person of considerable originality would think of getting a goat. Several of my friends have goats and they are all originals.
We may have something here, and I hope so because I have been rationalizing for years trying to justify my keeping a goat. I have hitched her to a wagon, taught her tricks, eaten her progeny, and milked her, and have not yet found a reasonable basis on which to excuse my ownership of her.
Whatever it indicates, the goat population in Vermont is on the increase. People are becoming "goat conscious." I have this from the lady who sold me my goat and who wished me to understand that the expression meant that the demand for goats was increasing, and that her price was not unreasonable.
Another goat dealer whom I interviewed assured me that once I had kept a goat I would never be without one. I can appreciate this too, because once you have a goat it is very hard to get rid of her. There are sound economic reasons why it is hard to dispose of a goat, but there are other reasons also. It is hard to love a cow, who has no personality and does nothing but give milk, but a goat abounds in personality and becomes as much a part of the family as a mischievous dog – even more than a dog, because a goat's capacity for mischief far exceeds a dog's.
Legend has it that goats will eat tin cans, but this is not so. They will eat only the labels from tin cans, and even here they are fastidious and will not eat the labels from corned-beef cans. This is not out of sympathy for a sister ruminant, because they will eat dried beef scraps if the scraps are salted.
A goat likes apples but will not accept one from which you have first taken a bite. She will accept it, however, after the offending portion has been cut off with a knife, provided the knife has not previously been used to slice plug tobacco. A goat does not dislike tobacco, because she will eat cigarettes. I know one poor woman who denied herself a package of cigarettes a day in order to feed them to her goat who loved them so. The goat is dead and the poor woman is still alive – but this does not mean that cigarettes were bad for the goat that her deprivation of them was good for the woman because the woman is in better health now than when the goat was alive.
It is said that goat meat tastes like mutton, but this has not been our experience. We could not eat it, and neither would the dog or the cat. On the other hand, some mutton that we bought tasted just like goat and yet we ate it, and so did the cat, but not the dog. Once we were given meat which was said to be goat and tasted like beef. We ate it gratefully and said nothing to anyone about the bullet we found in it. The dog and cat watched reproachfully while we ate.
People who keep goats are even more interesting than the goats themselves. Not all peculiar people keep goats, but all people who keep goats are peculiar. This does not apply to foreigners, but it applies without fail to Americans not brought up in the goat tradition.
People keep goats believing them to be a cheap source of milk. They need a cheap source of milk because they do not fit into the present established American way of life, and they do not fit this life because they are peculiar. Yet they are peculiar only if the American way of life is unpeculiar, which is not established.
This makes a hard problem. If a person does not like singing commercials, baker's bread, working for a boss, or keeping up with the Joneses, he can avoid these things by moving to the country and keeping a goat. But keeping a goat involves many hardships. The person must decide whether he is inherently antipathetic to singing commercials and the like, or merely allergic to them from environmental causes. If the latter, it might be easier for him to train himself to like them – say in ten years – than to keep a goat and avoid them.
Of course it is possible to graduate from a goat to a cow. I have a cow but still retain the goat. A friend was more fortunate. He didn't like his goat and got rid of her. "You can't keep one behind a fence," he said. "So you have to tether her out – by a chain, not a rope. A goat is not like a pole bean that always runs anti-clockwise. And whichever way she runs she will stick to it and will immediately wind herself up on the stake and then tie a knot in the chain. She will stand still until you have got a knot nearly untied, and then will give you a jump and catch your thumb in the loop. I'd walk a mile to kick a goat."
But a cow is not the solution either. A cow gives lots of milk but she also eats lots. There is a saying that you should keep a number of cows or none at all.
The man with one or two cows can't afford expensive haying equipment and will have to work by hand. A cow lives on pasture for six months and on hay for six months. While on pasture, she operates by wrapping her tongue around a tuft of grass, pulling it into her mouth, seizing it between her lower teeth and upper lip, and tearing it off. She does this steadily and stows away grass at about the rate at which a subsistence farmer, armed with a scythe, can cut hay, turn it, and lug it into the barn.
Now get the mathematics of this: six months pasture, six months barn. Farmer cuts hay at same rate as cow in pasture eats grass. Of course the cow must rest at times, and when she does, the farmer may feel free to drop his scythe and relax with his wife. But he must watch out. The minute the cow gets up from her nap he must go back to his scythe or he will be short of hay next winter and will have to buy some – which is fatal to the man who has been hoping to get away from Wall Street and the American way of life.
My goat has kidded three times, the first time giving us one buck which, by a shrewd business maneuver, I succeeded in giving away. The next time she gave us two bucks, and the third time three bucks which didn't live for the christening. I am now holding my breath and wondering how the goat population manages to maintain itself, to say nothing of increasing.
Two lusty kids will take about all the milk an average doe can provide, and before being weaned may need more. It seems illogical to keep a goat in order to save the expense of a cow and then have to get a cow to feed the goats, but that is what one goat raiser had to do. He had two goats he wanted to sell. One, for $20, gave three quarts of milk a day. The other, for $40, gave three and one-half quarts a day. I detected an interesting, possibly formidable, mathematical progression here and, after several moments' thought, asked if a four-quart goat would cost $60 or $80. My efforts to discover the combination of his pricing system finally irritated the man and I left him and bought my goat from a woman who had only one for sale and whose pricing system therefore, as I have explained, was based on the immutable law of supply and goat consciousness.
My doe gives a little under three quarts a day when she freshens, but keeps this up for only a couple of months. For a family with children it is necessary to have two goats and stagger their breeding dates six months.
Five or six goats will eat as much as one cow but will not give as much milk unless they cost more than the cow. Supply catching up with demand is unlikely to alter this cost ration in a way favorable to the goats, because it is not too hard to raise one calf, but raising five or six kids will drive a person crazy.
Looked at in another way, it is not economical for me to keep a cow that gives fifteen to twenty quarts a day when all I need is four or five. Of course there is butter, but by the time the utensils are washed we have spent two hours making it, and even at a dollar a pound we could do better with our time by buying butter. As for cottage cheese – don't mention the word to me.
Here is an odd fact about dairy products. A given quantity of milk sells for a higher price than the cream taken from that milk. Butter made from that cream will bring less than the cream. In other words, the more work you put into it the less you get out of it. This is actually true if you can get retail milk customer who will pay up.
The same is true of goats as opposed to cows. In respect of time and the work involved, keeping a goat is an expensive way of getting one's milk. Yet the people who get their milk in this way seem healthier and happier than those who court efficiency and get their milk in a bottle. As I've said – people who keep goats are peculiar.
Saturday, March 1, 2014
Idyl of the P.S. Corp.
On the general theme of family history, I thought I'd post one of my grandfather's articles from the Atlantic Monthly in the 1950's, when he was living on a farm in Vermont. This is a favourite story, and one that nicely captures the Knight family ethos.
Idyl of the P.S. Corp
by Rixford Knight
When pressure from the family decided me to have electricity brought up to the farm, I was told by the Public Service Corporation that since I was not on a power line I would have to put five poles. I could do this myself, or they would do it for me at a cost of $18 a pole. I did it myself, using spruce trees from the wood lot. My only cash outlay was the $5 deposit required by the company before they would wire the poles and install the meter.
I found it pleasant to have electric lights on the farm, and it was convenient when a cow got sick or anything, but I was irked about the company's having the use of my $5 deposit, which might have been drawing interest for me at the savings bank at the rate of 1½ percent or seven and one-half cents a year. So when the first month's electric light bill came I tucked it back of the kitchen clock. I did the same with the bills for the two following months.
So long as the total of these bills did not exceed the amount of my deposit the Public Service Corporation did not worry much; but five days after receiving the third month's bill I got a notice from the company, printed in blue ink, noting the amount of my arrears, and warning that if my account was not settled within ten days they would have to remove my meter. "The cost of re-installation will be $2" was their supercilious postscript. I paid this notice on the eighth day.
By doing this I saved a three-cent stamp and a half-cent envelope on each of first two bills.Three and one-half cents time two is seven cents. The other half cent I was willing to forgo on account of the extra three and one-half cents it cost the company to mail me the blue-ink notice and the annoyance it undoubtedly caused them. We carried on on this basis for five years till the spruce poles I had set up rotted at the base.
But three years and seven months before this a neighbor, three poles farther up the road, had had electricity installed. He used my poles, of course. Also a second neighbor, five poles past the first, was using my five and the first neighbor's three.
I now represented to the light company that since my first neighbor was using eight poles, five of which were mine, he ought to stand five eighths of the expense of my five new poles. And my second neighbor, who was using a total of thirteen poles, ought to pay five thirteenths of the cost. This would make their combined contributions 105/104ths of the total cost of my new poles.
I told the electric light company that this time I might wish to have them set up the poles themselves, at so much a pole, and asked them to submit an estimate, at their earliest convenience, of the probable amount of their remittance to me per pole upon completion of the transaction. They replied that the simplest way would be for them to consider me as now being on a power line and to erect the poles at their own expense.
I agreed to the company's proposition, but at the same time I could not ignore the implication that if I was a power line now, I had also been a power line three years and seven months earlier when my neighbor had started using my poles. In effect the power company had been using my poles to their profit for that length of time and should have reimbursed me for a proportionate amount of the original labor cost of my five poles. I estimated that at the rate of seven cents every three months it would take a lifetime to liquidate the indebtedness and I felt justified in putting my Fabian tactics in connection with the bills on a year-round basis.
My next extra-routine dealings with the Public Service Corporation came three years later, at a time when the matter of rates was up before the state utilities commission. I received a form letter from the company saying that because of our long and mutually profitable relationship and my consistently prompt payment of my bills they were pleased to refund me my original deposit of $5.
I felt more amicably inclined toward the light company after this, but since they still owed me for their share of the original poles after I became a power line, I saw no reason to change my habit with regard to the bills. However, something must have gone wrong in the mails, because two months and fifteen days later the Service Corporation drove up and removed my meter. I offered to pay the two bills, but they insisted on the $2 re-installation fee in addition. This I refused to pay and they drove off with my meter.
They thought, of course, that pretty soon I would come hurrying to them with $2 in my outstretched hand, begging for re-installation of my meter. But I'm not one to be pushed around by these big monopolies and I determined to teach them a lesson.
I had always felt -- and had explained to my family many times -- that these electric gadgets the monopolies press you to buy, and then sell you current for, are not really necessary anyhow, and that in the end we lose by having them. The electric washing machine is a case in point.
Before the advent of the electric washing machine the women washed what needed to be washed and that ended it. But now that the P.S. Corp. does the work for them, everything in the house needs washing. Once a week regularly the house is thrown into a turmoil of frantic search for anything with a woof or a warp. Sheets are yanked from beds, and cases from pillows. Curtains are pulled down, exposing finger marks on windows which augur poorly for peace the following day. Closets are ransacked; bags of garments are dumped and sorted into whites and non-whites. Socks are held up between thumb and fastidious forefinger for an inspection they never pass.
If a wind is blowing and the sun is warm, blankets, portieres, rugs, couch covers, and mattress covers are all deemed in need of cleansing and add their quota to the profits of the P.S. Corp. Children are run after and their pockets searched for the last handkerchief that is not neatly folded into a square and devoid of all wrinkles. Gentlemen stealing into pantries for a glass of milk and a cracker, as substitute for their midday meal, are harried with such questions as "When did you last change your underwear?" Everywhere is a melee of lather, suds, splashings, arguments, and soggy clothes hanging face-high on sagging lines.
All this, to the loss of the P.S. Corp., would be over with. We would return to the days of sanity. I mapped out our household regimen. We would rise with the sun and would toast our bread as it ought to be toasted -- on the back of the good wood stove. During the day we would do such chores as needed to be done, and in the evenings, instead of enduring the blaring radio and glaring light bulbs, I would entertain by reading aloud pertinent chapters from Thoreau by the soft light of the kerosene lamp. Then we would retire for a long and peaceful rest.
Now began for my family and myself a series of idyllic days and nights free from the domination of the machine age and the exactions of the P.S. Corp.
Because the electric pump was no longer operating, the flush toilets could not function, so I began immediately the construction of an outdoor privy. I enjoyed every minute of designing and working on this structure. I believe, from my experience on it, that an entirely new economy could be built up around the individual incentives derived from frustrating the P.S. Corp., and that it would work far better than one based on the profit motive.
Because water had to be fetched in pails from the well, washday lost all of its fearsome character. Washing became a matter of boiling an occasional handkerchief or the lower end of a pair of socks in a cup of water.
With the radio out of commission it became possible to get the children to do a little work in the garden and a little studying in the evening. Studying made them sleepy, so it was possible to get them to bed and out of the way for that quiet hour that is the delight and support of parents.
With the refrigerator no longer in use, odd saucers and bowls that had been missing for months began to re-appear. Butter became spreadable. Frozen junkets flavored with vanilla, lemon extract, or even almond, were replaced by honest pies and cakes.
Also the whine of the vacuum cleaner was no longer heard in the land.
It is in this connection that I have to report a certain measure of non-cooperation on the part of members of the family. An inordinate amount of rug-beating seemed to be required, and it always seemed to happen that I was the only one around at the time it had to be done. However, I was supported in this work by knowing that the board of directors of the P.S. Corp. were sitting around their mahogany table worrying about the decline in profits I was causing them and wondering what to do about it. One hundred and twenty-five good thwacks for each of the twelve directors and the rug-beating job was done.
No small part of the satisfaction I got from defeating the P.S. Corp. came from estimating the amount of their loss and of my own savings. At the end of every month I spent a happy hour figuring these amounts in detail. Then I placed that amount of money in an envelope marked "for flashlight batteries" and tucked it back of the kitchen clock.
This happy situation might have continued indefinitely if I had not been called away for a few days on business. When I returned I was met by the blare of the radio, the whine of the cleaner, the slopping of suds, and the smiles of the members of my family. I was not unconsolable. During my absence the P.S. Corp. had acknowledged defeat and re-installed my meter.
Thursday, December 26, 2013
In memoriam, John Knight, May 3 1936 - Dec 22, 2013
I'm sad to say that my father, John Knight, passed away on Sunday evening. There will be a service Monday the 30th and I'm appending the text of and a link to the obituary. He was a wonderful father and a much-loved professor, and will be very much missed by all of us.
-----------------------
John Knight passed away peacefully at home in Ottawa on December 22, 2013. He is survived by his wife Norma (nee Evans); brother Bill (Eileen); three sons, Alan of Seattle (Kirsten Carlson), Douglas of New Westminster (Ruth Silverman), and Scott of Toronto (Natalie Fong-Yee); two grandchildren, Marisa and Charlotte; and several nieces and nephews. Predeceased by his mother Mary, father Rixford, and sister Margaret (the late Robert Diehl).
John was a Professor of Electrical Engineering at Carleton University since 1967 and remained there until well after retirement. Thousands of engineering students will remember him fondly as an inspiring and entertaining lecturer who was always willing to help.
A memorial celebrating John's life will be held Dec. 30 at 2:00 p.m. at Riverside United Church (3191 Riverside Dr, Ottawa). In lieu of flowers, donations to Stride Wheelchairs Plus or the charity of your choice.
-----------------------
John Knight passed away peacefully at home in Ottawa on December 22, 2013. He is survived by his wife Norma (nee Evans); brother Bill (Eileen); three sons, Alan of Seattle (Kirsten Carlson), Douglas of New Westminster (Ruth Silverman), and Scott of Toronto (Natalie Fong-Yee); two grandchildren, Marisa and Charlotte; and several nieces and nephews. Predeceased by his mother Mary, father Rixford, and sister Margaret (the late Robert Diehl).
John was a Professor of Electrical Engineering at Carleton University since 1967 and remained there until well after retirement. Thousands of engineering students will remember him fondly as an inspiring and entertaining lecturer who was always willing to help.
A memorial celebrating John's life will be held Dec. 30 at 2:00 p.m. at Riverside United Church (3191 Riverside Dr, Ottawa). In lieu of flowers, donations to Stride Wheelchairs Plus or the charity of your choice.
Tuesday, June 18, 2013
STIC 2013 - video and slides for my talk
I've recovered a bit now from the STIC 2013 conference. The video for my talk "Modern Web Programming with Dart" is now available. I give a very quick overview of Dart and Web Components as approaches to improving web programming. You can also download the slides, which are a bit hard to read in the video.
Other presentations are being added at Jim's site. The most recent is Dan Ingall's keynote talk. On the loose theme of "My Favorite Things" Dan talked a selection of things he's been involved in over the years, starting with some quite interesting history about very early Smalltalk versions and how much they differed from Smalltalk-80, and ranging up through various Squeak projects and a short bit on the Lively Kernel. It includes running versions of some remarkably old software doing some remarkable things. This was part of the historical theme of the conference on the 30th anniversary of Smalltalk-80 being released to the world.
Other presentations are being added at Jim's site. The most recent is Dan Ingall's keynote talk. On the loose theme of "My Favorite Things" Dan talked a selection of things he's been involved in over the years, starting with some quite interesting history about very early Smalltalk versions and how much they differed from Smalltalk-80, and ranging up through various Squeak projects and a short bit on the Lively Kernel. It includes running versions of some remarkably old software doing some remarkable things. This was part of the historical theme of the conference on the 30th anniversary of Smalltalk-80 being released to the world.
Thursday, June 13, 2013
Sunday, March 17, 2013
Words of wisdom from Joachim Tuchel. Glorp expects your model to be internally consistent. I've had a number of questions from people who expect, when working with databases that it's enough to modify one side and then the database refreshing will take care of the other side. If you have a bi-directional relationship, and the two sides don't match, Glorp will complain when you try and write. Unfortunately, it complains when it gets down to the level of writing rows and sees that there are two different sources trying to write different values to the same field, which isn't always the most helpful in figuring out the original problem.
Subscribe to:
Posts (Atom)