Friday, December 16, 2016


I've been playing around a bit with SNOBOL.  I heard once that you should never bother learning a new programming unless it changes the way you think (oh here it is Perlis epigram 19):
  • 19: A language that doesn't affect the way you think about programming, is not worth knowing.

SNOBOL definitely changes the way you think.  It is based on pattern matching, and side effects that occur during matches, or attempted matches.  Blank space is not just significant (a la Python) it is an actual operator: concatenation.  SNOBOL has procedure definitions, and the procedures can be recursive, but it doesn't really have the notion of a procedure body.  You define the name, the arguments, local variables, and the entry point (all but the name are optional).

If you don't put a jump at the end of the definition then it will happily start executing the "body" of the code, and may give you an error, since of course the arguments will all be null, and you were maybe relying on something being there. 

There are no do or for or while loops, but every statement can have an unconditional or (up to two) conditional gotos appended.  Since there are no actual procedure bodies, you can have bits of code shared by multiple procedures (e.g. error returns).  There can be jumps from all over into that code, but of course RETURN will still return from the current procedure. Take that Dijkstra!

I/O is greatly simplified by the use of variables that can take their value from input, or which when set send their value to the output.  For example, Hello World looks like this:

 OUTPUT = 'Hello World'

I can't think of another language with that combination of very high level and very low level features, but when you realize that it dates from about 1969, it makes a a bit more sense.

What got me playing with it?  I recently picked up a copy of a book entitled "Programming Languages, A Grand Tour" (edited by Ellis Horowitz) at a Goodwill store in Albuquerque.  It is an anthology of articles on programming languages, from the early 80s.  Lots of great things in it, including the article by Backus in which introduced the phrase "Von Neumann bottleneck".

The first article in the book is by P. Wegner, titled "Programming Languages -- The First 25 Years" and contains a list of 30 milestones.  To give you some idea, M1 is the Von Neumann's EDVAC report, M5 is FORTRAN, M12 is LISP and M26 is Structured Programming.  SNOBOL is M13.  That reminded me I'd seen a book on SNOBOL at a friends house back in the 70s, and ....

Another point of interest in the book is an early paper on C. It mentions the disadvantages of having printf in a library rather than in the language.  Essentially the problem is that if you change the type of a variable you have to change the %d or what have you to match it, whereas if printf were in the language it could "know" the type, and adjust itself.  This was, I think, part of the motivation for adding cout to C++.  The (much newer) Go programming language fixes this by adding reflection, if I understand that correctly.  SNOBOL however had solved this long before: OUTPUT does something sensible with whatever value you provide it.

Wednesday, November 09, 2016

A #NeverTrump'er reacts to his election

Not that I tweet so often, but I did tweet against Trump several times, using the #NeverTrump hashtag.  Why?  I agreed with him that the country was going the wrong way.  Agreed that Obama had left large swathes of the country behind.  Agreed we need a change.  However, I wanted a Free Market Conservative.  Lower taxes, less regulation, less government intrusion in our daily lives.

Trump promised some of that, but mixed it with protectionism, cronyism, and a buffoonish manner.  When he promised something I don't like (Trade war) I believed him.  When he promised things I do like (Conservative Supreme Court appointments) I didn't believe him.

Like most people, as I watched the returns last night I was expecting to see a quick and painless victory for Hilary Clinton.  Well, maybe not painless ...

Instead, the map refused to turn blue.  Early on, a solid wall of red states went up the middle, symbolically dividing the country in two.  Then the red began to spread, first East, then West.  Ohio?  North Carolina?  Florida?  What was happening?

It seemed just and right that the red states all cohered, as if rebuking my interpretation of division. No, this is what the country is, they said.  Lonely Illinois and New York are the outliers, not us.  It got later and later, I repeatedly resolved to turn it off, but I could not.  Finally when Podesta told the Democrats in the Javits center to go home and get some sleep, I thought "good idea".

Except, I couldn't sleep.  It was clear Trump had won.  Was I happy?  I was happy that Clinton had lost.  I thought it would have been a terrible precedent for her to influence peddle her way into the White House.  The Clinton Global Initiative may have been entirely legal (though we will see) but it was ugly.  It stank.  To use a charity to launder millions of dollars of bribery is disgusting.  To get away with it? Worse.  To become President on the back of it?  Intolerable.

And the emails.  People say it like, you know, everyone has emails, sometimes you delete them, no biggie.  I disagreed.  Had lunch yesterday with a friend who served in the Navy.  Told me he'd spoken to other servicemen about her server, and the way she handled email.  They were disgusted.  Would have been crucified if they'd been as careless as that.

Have you seen “The Imitation Game”?  I've been reading the book it is based on.  “Alan Turing: The Enigma”, by Andrew Hodges.  No spoiler, this is not in the movie: the Germans were reading our codes.  In Bletchley Park, they were working like crazy to break the Naval Enigma to find out where the U-boats were.  The convoys would then be re-routed to avoid them.

Bletchley started seeing that messages were being sent to the subs redirecting them to the convoy’s new position.  Fortunately the allies were not as blind to the possibility of codes being broken as the Germans were, so we changed the weak convoy codes.  However, in the months before we did, the convoy losses were horrific.  Thousands died because of the laxity, the unwillingness to take information security seriously.

Now it is true, that while our nation is currently “at war” in a sense, this is hardly WWII.  On the other hand, the lost convoys sailed more than seventy years ago; these are lessons we should have learned then and never forgotten.  To neglect them is criminal.

So I was not sad she lost.

As for President Trump?  I am praying that he does a good job. What else can I do?

Tuesday, March 08, 2016

Skylake Hackintosh

My "Early 2008" Mac Pro was getting a bit long in the tooth.  Given that it was seven years old, it was actually running pretty well, it had been upgraded to 10Gig of Ram, a 480G PCI based SSD boot drive, and an NVIDIA 750 ti graphics card.  I'd even taken out the 2.8 Ghz Xeons it came with, and put in 3.2 GHz ones.  When it was new, that was a $1600 option, but you can get the correct parts on Ebay now for about $90.00.

The SSD kept it going for a bunch of years, that is the key upgrade on an old machine.  The RAM helped of course, and the Video Card makes a difference, especially with Lightroom 6 now being GPU optimized.  However, the upgrade to the 3.2 Ghz processors was a definite mixed blessing.  The 15% speed improvement is actually noticeable, but the TDP on the processors went from 80 watts to 150 watts, meaning an additional 140 watt draw when they were going full bore.  It was enough that I could tell when a Lightroom slider was not one of the ones that used the GPU, because if I started tweaking one, the fans would start to roar.  Pretty ridiculous.

So I thought about getting a newer machine, but the latest Mac Pro came out two years ago, and doesn't have room for the hard drives in the 2008, or the Video Card I got for it.  Arguably the machines, expensive as they are, are a good deal.  If you look at the going rate for the video cards in the NMP, especially the high end ones, it looks like you are getting over $1000 off by buying them in the NMP, and they throw in the rest of the computer for free.

However, it was not clear to me that I really needed $6000 worth of Video Card, even at the $4000 bargain price.  Also, they came out two years ago, and the best deal you can get from Apple is 15% off on a refurbished model.  That didn't sit well with me.

 I spent a while trying to figure out if there would be a new new Mac Pro (nNMP?) any time soon, but Apple is notoriously tight lipped.  The scuttlebutt seems to be based on when the correct Broadwell Xeon parts will be available, which should be later this year, since Apple is likely to skip Haswell altogether.  Unfortunately, the usual tick-tock Intel schedule was badly disrupted when they shifted to 14nm, and Broadwell is really late.  In fact, Broadwell was followed very quickly by the 'tock', Skylake, which also comes with a new chipset, the 170.  The 170 has a number of cool features, including support for DDR4 RAM.

At any rate, I decided to build the following machine:
ASUS ROG Maximus VIII Hero Motherboard
Intel i5-6600 CPU
Cooler Master Hyper 212 EVO
EVGA 750W Gold PSU
G.SKILL Ripsaws V 16GB RAM
Samsung SM951 SSD (512Gb)
Syba Firewire card
realtek chipset Ethernet card
Fractal Design R5 Case

I already had:
2x Sandisk Extreme Pro 960 GB SSD  (for Lightroom library)
EVGA Geforce 750ti
LG Bluray/DVD burner

I got the i5-6600 Skylake instead of the i7-6700k because at the time I built it, the overclockable 6700k was selling at about $440, instead of the MSRP of $350.  The 6600 was available at list, and since it has a TDP of only 65W, as compared to the 95W of the 6700, it seemed the better choice for a "cool" and "quiet" build.  Overclocking is definitely not compatible with cool or quiet.  However, even with the lesser processor,  performance is more than adequate, the system benchmarks better than a 4 core Mac Pro 2013 (the low end of the new round ones).

The Fractal case, and the Hyper 212 EVO were also specced for quiet.  Both are very well reviewed, and my experience matches that.  I did have a problem with case, but Fractal design sent me a replacement side panel that fits perfectly.  The 6600 comes with an Intel cooler, but some of the reviews complained it was noisy, so it was replaced by the 212 EVO.  The Z170 motherboard is arguably overkill, but it supports the high speed RAM, and should be reliable, as it is overbuilt.  The PSU is also overkill, but it seems cheap insurance for longer system life, and since it doesn't run the builtin fan until it reaches 45C (which it never has) it is another contributor to quiet operation.  You do have to be sure to set it for ECO mode, or it will run the fan all the time.

It also seemed a good idea to get a modular PSU, this was my first build, and modular PSUs are supposed to be easier.  This one certainly was not a problem, even with the several disks (not listed) that I also put in.  If I do get a higher powered GPU (when Pascal arrives later this year?) I will easily be a able to power it as well.

Putting it together was pretty easy.  Getting it to boot up as a Mac was a bit harder, but the good people at tonymacx86.com helped a lot.  They still are not recommending Skylake builds, only Haswell or Broadwell, but it really was not that bad.  It took me a while to get iMessage working, I had to follow this recipe from Reddit. Until I did, it kept telling me that such-and-such number was not registered with iMessage, when I knew perfectly well that they were.  I still have problems with sleep, but since some of the software I use doesn't like sleep (looking at you Kyma!), that is not such a problem.

P.S. If you have read all this, you might wonder why I put it up.  I was encouraged to do so by a scientist friend at LANL, I guess computer builds have to be interesting to somebody, right?  He, by the way, is very happy with his NMP.  The only thing I envy him is that the case on this thing is really big ...

Tuesday, November 03, 2015

Midi Patchbay 64 bit version

I decided to rebuild Midi Patchbay as a 64 bit app, and for good measure, put it in the Mac App store.  The rebuild wasn't too difficult, just a few changes to some old code.  Then a bit of messing about in Xcode, and with the icons, and it passes validation.

One difference is that it doesn't seem to be able to talk to the Jack server anymore.  This may be an oddity of my system, or perhaps it is because of the sandboxing.  I don't know!

It seems to take a long time to come up the first time you run it, after that it is quicker.

In any case, I was having some strange Midi issues on my system, and thought that perhaps it might be because this app was only 32 bit.  It seems unlikely that it really was a problem though, the Dropbox mac app is only 32 bit, and they don't seem too concerned about it.

If you find it useful, let me know.

Thursday, January 01, 2015

A Federalist Settlement for Nebraska and Oklahoma v Colorado

It seems to me that there is a simple and fair settlement to be made in this case, one that will preserve Colorado's right to determine for its citizens what they should be allowed to consume, while not treading on the rights of Nebraska and Oklahoma to make different rules.

Upon application from the Attorney General of another State to the Attorney General of Colorado making such a request, the Attorney General of Colorado will issue regulations prohibiting sale of Marijuana to citizens of the requesting state.

It is already a requirement to present ID to purchase Marijuana in Colorado, so the added burden of checking which state issued the ID (or the address on the ID) is not a great one.  While this doesn't do everything possible to ameliorate the effects of legal pot on neighboring states, it addresses what must be the largest problem, that citizens of other states will simply show up, legally buy it, then bring it home.

Commercial smuggling is another matter, but the quantities involved are (my experience with enforcing Marijuana laws is basically limited to a single case I presented to a Brooklyn Grand Jury, but that is another story) generally much larger than what is permitted to be sold in Colorado, so one hopes that in the interest of reaching a settlement, Nebraska and Oklahoma will not demand an end to all legal sales in Colorado.

If we take seriously the "laboratories of Democracy" theory of Federalism, it isn't too much of a stretch to ask that states limit themselves to experimenting on their own citizens, to the extent practicable.

Suits between states were much more common before the Federalization of pollution laws. In a system of increased Federalism, there will unfortunately be increased conflicts between states, as they naturally chose differently in various areas.  I don't claim to have a universally applicable framework for resolving such disputes, but I hope this is a good initial sketch.

(In case you have no idea what any of this is about, see: the Supreme Court filing.)

Monday, September 15, 2014

Ed support page

Ed is an iPhone port of the famous unix editor ed.

It was originally written many years ago for use on printing terminals.  It is not WYSIWYG or anything remotely resembling that.

Ed is modal.  To enter text, type a, and hit return.

Then enter your text.  When you done, put a period on a line all by itself.

To see what you have, type:

To save type:

w myfilename

There is a way to see what files you have:

The bas version of the iPhone port is not the latest version of Ed, which (believe it or not!) is a posix standard.  It is based on a much earlier version which you can read more about here.  Believe it or not, it was used to write most of Unix.  If that surprises you, look at this document, which reveals some of the hidden power of ed.

Obviously there are certain differences between the iPhone version and a full Unix version, most particularly in the ! shell escape command.  The only useful command implemented in the iPhone version of ed is !ls, which will list your files.  To do serious file management, I suggest using iTunes.

If you have any questions feel free to email me, or leave a comment here.

Thank you for looking, and for your five star reviews!

Thursday, July 31, 2014

Open letter to Elon Musk: Why Tesla should build the Gigafactory in New Mexico


I am going to give you one more reason to build the plant here.  Mayor Berry and Governor Martinez and their hardworking staff have already given your people a great breakdown on the economic reasons to come here.  We have the land, we have the workforce, we'd love to have your factory.

I can't add anything to that aspect of it.

The one thing I will add is this:  if you build it here it will make a real difference to the State of New Mexico.  For too long we have been dependent of the Federal Government for our economic sustenance.  Not that we don't love having Sandia and LANL here, of course we do; and Tesla might like having access to the Boffins there also.  But we don't have private industry here the way the other states in the running do.

There was a chart published recently of the largest (by revenue) business in every state.  New Mexico was one of only two states (the only other was South Dakota, if I read it correctly) where the largest local business is a non-profit.  Of course we also love Presbyterian Healthcare, but let's face it, our private sector could use some help.

I love my Roadster, love driving it, love telling people that electric motors have full torque at zero RPM  (I heard that, then I sent in my down payment all those years ago), love that I have a "full tank" every morning and never have to stop at a gas station.

I also love this State, the open spaces, the big sky, the smell of the air after a summer storm.

Tesla is in the business of changing the world for the better.  You could also change New Mexico for the better.  News of the ground breaking in Nevada has us all in a bit of a nervous tizzy.  A ground breaking here in would be a real breath of fresh air for the business community, and all the people of the state.

From one Tesla guy* to another,


* I was the first Tesla owner in the state, which is a source of pride, and a matter of some small notoriety -- it's why some people here call me "the Tesla guy".   Of course we both know who the real one is.