Random Music
I spent a little more time over the past two days on an algorithmic music project. As before, I used Nyquist/Lisp to to generate the sound files, but I used Ruby to prepare & manipulate the Lisp files.
Because doing it this way forces me to think about both composition and instrument-building at the same time, I use random numbers to generate the composition. To be more precise, I wrote an algorithm to introduce layered sounds at different times throughout the composition, and the random numbers are constrained to values I consider interesting… That is, I used non-uniform distributions: step functions, curves, lists of constants.
“Beacons (Version 1)”:
“Beacons (Version 2)”:
The result reminds me of when I used to run guitar sounds through long delay lines. Precisely because the “notes” all repeat some number of times in the code. I also see some affinity with the mobiles of Calder. I presented a loose set of rules and constraints on randomness, then chance did the rest.
I am finding out that Nyquist is not so easy to learn… I thought I understood the basic premise behind Lisp, and I probably still do, but there are so many dialects that the help you can find is mostly useless. The Nyquist manual is indispensable for explaining many of the signal processing functions, but so far all my attempts to to any meaningful list processing or closures (um… by wich I think I mean passing anonymous functions as arguments). That stuff is easy in Ruby, but I don't know how to even begin linking Ruby with the sound hardware. Apparently, the people who use Nyquist are not using the Lisp mode, because there is a non-lisp mode. I wanted a practical use for Lisp, and I wanted to do things my way, so I continue to build Lisp files in Ruby and feed the results to Nyquist.
Reality Is Broken...
I just picked up a copy of Jane McGonigal's Reality Is Broken. She reports that so many people spend so much of their time playing computer games that Reality has suffered.
My first impression was that I avoid computer games because it would scramble my brain… and then I realized that I also try to avoid Reality for the same reason. So I'm what?… Overwhelmed by inputs. Forty years in, and some of the pieces are starting to come together.
I realized right away that I think about Gamers and Potheads in roughly the same way. Escapist is a word often used. You can tar avid readers with that brush, too. Drinkers seem to be looking for an escape. Porn also looks like a means of escape. But, isn't this just a matter of how broadly you define your reality? I know plenty of heavy pot smokers and heavy drinkers who still live active, rewarding lives regardless. I couldn't do it.
One of the major ideas in McGonigal's book is that people who don't find work rewarding in their daily lives will put great effort into overcoming obstacles in a game, and this might indicate something wrong with the world outside. I find that I can't just brush it aside: A good puzzle can often be more rewarding to solve than anything I've ever been paid to do. And some of my jobs have, on rare occasion, been good places to be a creative problem solver. Legend has it that there are people who get to do that on a regular basis, but I was always skeptical, because my boss at the garbage company actually told me I should have a creative outlet so that I wasn't tempted to be creative in routing garbage trucks. They knew who I was. They saw me coming. They told me not to be so creative.
Is it wrong of me to think that the menial, repetitive, or boring jobs will be done by machines in the future, offering the possibility of creative work for all?
An Aside: I'm reading a hardback book from about a year ago. The author has written academic papers on the subject, which I could have read years ago. I have come to believe that book publushing is the wrong model and books are the wrong format. I'm also re-reading “Gulliver's Travels” on my Kindle. I'm a little worried about the timliness of “Reality Is Broken”, whereas I would never worry about Swift going out of style. Books are almost hopelessly out of date for discussion of fresh ideas, and I don't necessarily need an author to put all that time into a long-format work just so it can be printed and bound later. Not that I want publishing to stop entirely, it's just that nobody writes in manuscript these days—the texts begin their existence in electronic format, and sharing the idea is as easy as a mouse click. Why do we produce books just in case?? Volumes are printed “on spec”.
They Can't Find Any Workers
From Marketplace I see:
Double-digit unemployment? These firms can't find workers
Same old story: I run a business, and suddenly I need skilled workers that I didn't need for years. I don't know what those people were doing all those years, but now that I can't find them I am cranky.
But go ahead and read the article. When the jobs got shipped to China, those skilled workers went back to their countries in Latin America… So, these companies weren't employing Americans anyway – by which I mean resident American Citizens with a vested interest in the success of the company. I love the fact that somebody got some benefit at some point: Chinese factories who did some volume for a while, Latin immigrants who wired money home to families.
I feel like I just talked about this the other day… Because I was talking about how the garbage company I worked for (well, certainly the owner) wanted non-skilled helpers to be available whenever his machine broke down. But, I'll sympathize for a moment: It is unrealistic to expect such a small company to own and maintain extra capital equipment, or train workers and keep them on the payroll just in case. And we're talking skilled workers, here.
What I do expect these companies to do is form some kind of joint venture or industry association to train prospective workers. Share the cost of education – everybody involved kicks in a little something to get the ball rolling.
Farsical Numbers
I took five minutes this morning to invent a silly new number system: I asked myself if it was possible to represent every number when every digit had a different base. Start with base two on the least significant digit, use base three for the next digit, then base four, etc… Of course, as the numbers got big, you'd run out of symbols to use in the higher range — I said it was silly.
Ruby will convert a number to its representation in any base, up to 36 — for which it uses all the digits and the letters of the alphabet. So I wrote a quick loop to divide a number by progressively larger bases & tack on the remainder to the result. That gave me a bit of this:
| 0 | 110 | 220 | 1000 | 1110 | 1220 | 2000 | 2110 | 2220 | 3000 | 3110 | 3220 | 4000 |
| 1 | 111 | 221 | 1001 | 1111 | 1221 | 2001 | 2111 | 2221 | 3001 | 3111 | 3221 | 4001 |
| 10 | 120 | 300 | 1010 | 1120 | 1300 | 2010 | 2120 | 2300 | 3010 | 3120 | 3300 | 4010 |
| 11 | 121 | 301 | 1011 | 1121 | 1301 | 2011 | 2121 | 2301 | 3011 | 3121 | 3301 | 4011 |
| 20 | 200 | 310 | 1020 | 1200 | 1310 | 2020 | 2200 | 2310 | 3020 | 3200 | 3310 | |
| 21 | 201 | 311 | 1021 | 1201 | 1311 | 2021 | 2201 | 2311 | 3021 | 3201 | 3311 | |
| 100 | 210 | 320 | 1100 | 1210 | 1320 | 2100 | 2210 | 2320 | 3100 | 3210 | 3320 | |
| 101 | 211 | 321 | 1101 | 1211 | 1321 | 2101 | 2211 | 2321 | 3101 | 3211 | 3321 |
When I started working on this, I had a vague feeling that it would have something to do with the factorial numbers, and sure enough, it represents every factorial number as “1000…”, since those forms are the product of all the consecutive bases used below that digit from 2 on up.
1! = 1 (1) 2! = 10 (2) 3! = 100 (6) 4! = 1000 (24) 5! = 10000 (120) ...
With all 36 alphanumeric symbols at its disposal, you won't run into a problem with notation until you get up around 37!
Well, I can't think of any other good uses for such a thing. How about you?
Gremlins Abide
My Android phone's text messager has the nasty habit of sending messages to the wrong person. At first I was willing to believe user error, but yesterday I finally caught it red-handed: A text came in, I opened it up to read it, I typed my reply, & hit send. But today, I got a message (Sprint offering to keep me posted on NBA results), and when I opened the program to respond, the message I read yesterday was marked unread & the reply had gone to somebody else. Gotcha!
This is disturbing behavior for a fly-by-wire system like a cell phone. I have no way to force the computer program to get it right. I'm not allowed to run a debugger and alter the program's data structures directly…. So I have to have complete confidence in the hidden inner workings of my phone. This issue doesn't get much play in the marketing blitz to sell the devices. At least with Android I can download a free development kit and write a replacement, but that's still a lot of overhead: Re-learning Java, learning system idiosnycracies, etc. And I might arrive at the end of it all with renewed certainty that the original problem was in the kernel all along.
It's sneaky, So You Have to Watch It
If the premise of the technology was power & convenience, I've noticed that it has a mind of its own. Tech is great when it allows you to do what you want, but I see the designers these devices trying too hard to suggest while not trying hard enough to allow.
My text messager opens with a list of contacts in order by most recent message timestamp. It's perfect for extended exchange with one person, but if you carry on three or more slowly developing exchanges, the list is constantly getting shuffled. It won't be weird to click the wrong name from that list, so the first few times I sent a replyy to the wrong person, it just seemed like my fault. No doubt it often was. A few more times & I started to notice when things went wrong: I'd see the wrong name at the top of the screen. But, sometimes the touch screen isn't so easy to work with, so I must have missed the spot. It happened enough that I started to get suspicious.
Apache Rewrite Rules...
You probably never had to add lines to your Apache Config files. Then again, you're not me. I wrote a bunch of Ruby scripts with a .rhtml file extension, and the web server had to know that they were scripts — In server-speak, this involved associating a MIME-type and a Handler — That was fairly easy. When I wrote one for this blog named “index.rhtml”, I wanted to make it the default file for the directory, and I also wanted to make all the files look like they were in a directory called “blog”, even though it's only a symbolic link, not really a directory at all.
Apache is great because it checks every directory for a local config file. Otherwise, on shared hosting, like I use here, I wouldn't have permission to make changes. Put a file called “.htaccess” in the directory, and the server temporarily reconfigures itself for anything requested there. There is some processing overhead when this happens, so there is a kind of “Zen” to writing them. The .htaccess directives are powerful and potentially dangerous, and some people warn you about this. Rewrite rules can interfere with each other, not only because they use regular expressions. Two rules can apply to the same thing, and if you're not expecting it, the results can be bizzare.
Handlers & MIME Types aren't so complicated. I got it to work on the website, but when I tried writing a little server on my Windows Laptop with a Ruby script, the code copied from a textbook
failed to invoke the script and the server returned the plain text, not the output.
I looked at the rewrite rules for Typo, which is a Rails application I used “as-is” for an old version of this blog. It doesn't seem very complicated either. A big Rails app has a lot going on behind the scenes, and I always laugh when people say Rails is easy: It's integrating database, markup, stylesheets, Javascript & server modifications. Meanwhile, the this is composed of interlocking Gem libraries, some of which run independently to configure & rebuild the app itself. It's easy compared to doing all that from scratch. All I wanted was to default the directory to a cgi-script…
So there's The Manual
But I'm tempted to write my own guide — once I understand more of it — because the examples tend to be recipes for more complicated situations. That's nice if you need it, but I've got to walk before I can run. I may never need all the power and flexibility of a whole 'nother computer language for this purpose. I just want to substitute one file name for another. I think that would make a nice first example. When I tried adapting the “All my files are scripts” example, something went wrong, and I momentarily took out my sister's website in the process. One book details the precise order in which all the Apache modules process a request, in view of you eventually writing one more for the stack. I have my eye on one slightly more complicated goal, but it still pales in comparison: Typo really streamlined the look of the URLs by forcing everything to look like “site/category/action” instead of “site/script?action=one_thing&modifer=some_other_thing”.
Experiences
I always get the feeling that experience is useless… “Past Performance is no indication of Future Returns”. I usually find myself fighting the last battle, in any case, so relying on the past has a ring of the foolish in my ears.
The path you take is a squiggly line through multi-dimensional space. Covering distance in this manner is still not going to get you much experience of the space you travel through. I worked at a garbage company. It was intended to be a niche service for customers who would be “momentarily” forced or motivated to dispose of food waste in a responsible manner before established garbage companies offered the option. It rode a wave that only happens once — though I'm sure it happens unevenly enough that you could seek it out someplace for years to come. But, I didn't work there because I had experience collecting garbage, and a guy with that experience did not beat me out for the job.
I wasn't really hired to drive trucks. I was hired to manage the operation. I was aware enough of my flaws to throw a lot of effort in to the job, but with a general lack of talented drivers, I continued to spend most of my time in a truck. I cancelled my social life for long stretches. I wrecked my sleep schedule & ate on the run. My big indulgence was a regular Saturday or Sunday night meal at one of our customer's restaurants.
The trucks had a machine bolted on the back to raise the garbage cans and tip them over the edge. Electrical switches ran the hydraulic valves, which drove a piston to grab the container and a motor to pull a chain, which ran the grabber up and down a track. It broke all the time. Electrical, hydraulic, & mechanical failures were possible. I'm a pretty smart guy — After several months I could diagnose the problem. After a year, I had tools to fix some of the common failures. At the end I was patching chain & taping wires. I even replaced some hydraulic valves once.
When the machine was working, the truck would break down. When the truck was running the machine would break down. We had a few guys from the neighborhood who would ride along and help lift the cans into the truck. Some places had loading docks. Some places were at curb level. Some places had ramps or heavy equipment that would give us some mechanical advantage, or just a shelf half way up to rest on. Some places packed 300 pounds of wet rotting food in the cans, & yet other places only ever threw away bags full of paper. If the truck broke, nobody could work. If the machine broke, we scrambled around trying to staff teams of two or three guys. (I would have preferred teams of two on every shift, but I could see that paying two guys was not built into the business model.) In three weeks, when you could get a mechanic to look at it, and it came time to pay for the repairs, there was a cash crunch from having to pay all that extra labor. And when two guys are stranded somewhere waiting for a tow truck, or money to buy diesel fuel, it's a disaster.
The problem with these odd-job men was simple: We needed them only in emergencies, so they grew to resent us. We couldn't predict when we would need them, so they sometimes made other plans. Even a complete loser with too much time on his hands was going to make plans once in a while. Sometimes the guys had appointments with their parole officers. It was a decent, hardworking bunch — they worked harder than the drivers, but I started to resent them because of how often I would be driving an unplanned shift through the night, pulling my share of the weight, improvising the route & driving the truck when my helper would wake from his nap in the passenger seat and start complaining about how hard we were working. Then there was the petty snitching: A would tell me B didn't pull his weight, and then B would tell me the same thing about A.
I promoted a happy workplace. I tried to sell these guys on the value of their freedom. With their criminal records, it wasn't likely they were going to find another job, and a lot of people said I should be more of a hard-ass, but honestly, that does a lot of damage to me. The boss was pretty obsessed with metrics, but I didn't see how it was fair to expect great things from drivers when he didn't give me what I needed to keep the trucks running. Drivers were in a magical moment, whether they realized it or not: Nobody was hovering over them, micro-managing, but hard work would get results and get them noticed. Their performance was limited by the performance of the equipment. Some days that legitimately ruined their best efforts, but other days I know they took the excuse and didn't try. GPS records are great for those situations.
Speaking of GPS, you get drivers who start on the defensive, resisting the notion that someone is watching them. All I can say is: Drivers forget to record a pickup. Trucks get stolen. Drivers get injured. Both of these things actually happened. It was nice to have the GPS in those cases. Now, if you want to skip stops to park somewhere and take a nap, I like to know that too… But, you won't do that because you know I see the GPS. You won't win an argument with a satellite. And if you tamper with the GPS, I'll have to assume the worst. But, once again – results will get the job done and get you noticed, so I don't particularly enjoy holding you to latitude/longitude/atomic clock scrutiny. I'm not certified security expert, but you can thank my predecessor for mounting the GPS unit under the drivers seat where a muddy boot might really kick a plug out by mistake. And, the boss kept asking me to have the mechanic he hadn't paid mount it inside the dashboard.
I may have a story to tell, but it still covers a single viewpoint. If I were that interested in a career in the waste management industry, I would have done well to work at more than one company. For that matter, I would have worked at more than one bookstore. The benefits of loyalty versus the benefits of shopping around are open to argument. How much do I really care about an employer that goes out of business or tries to screw everybody over on payday? Quite a bit, as it turns out.
If I were guided by self-interest, I wouldn't want to work anywhere. You can find stories about states that have unemployment and a labor shortage because they passed tough anti-immigrant laws and can't find anybody in the job market to do the dirty jobs. ( Alabama , Colorado ) But, I've said it before — It can be more subtle than that: I was getting dirty and losing the ability to plan my life. I was getting blacklisted at equipment rental companies from day one. I was getting stranded by the roadside on a regular basis. Is it really too much to ask for better treatment than a 19th century railroad brakeman?
jQuery Shuffle
I was tweaking some things on the main page today, when I noticed it was loading with an excruciating slowness.
There have been some issues with Ruby and the Ruby Version Manager that caused a big problem. The shared version of Ruby gave me weird difficulties with Gem libraries – I couldn't get MySQL database access or RedCloth text markup to work – so, that drove me to RVM, but all it meant was new difficulties… I still have a lot more to learn about building Ruby in Linux. The YAML libraries, (the format I use to store lists of things like Photo Cat) refused to build. The easiest route would be to rebuild Photo Cat to use something other than YAML, but I'd rather have a working version of Ruby with all the normal libraries, and fewer problems installing Gem libraries. I discovered a lot of chatter about this problem on discussions about Rails, which is just far enough out of context to be usless as help.
I wanted to clean up a few cases of files laying around in higher level directories that should be filed in sensible locations. So, I moved a couple of stylesheets and Javascript files, then the Photo Cat stuff. I also intended to get rid of redundant versions of things, because they caused me to get disoriented for a while, not getting the results I expected because I had simply edited the wrong file.
Jumping around doing all this should have taken half an hour. In the midst of all that disorientation, I started noticing the main page just wouldn't load in reasonable time. At first, I just thought it was my connection, but after fussing over that and rebooting a few times, I decided the only common factor was loading the jQuery library remotely. It never used to take this long, so I'm thinking they might have stopped the practice of offering a link to the source. I've noticed the mention of this practice is conspicuously missing from a couple things I read recently. Seems to be some fuss lately over Google hosting it or something(?) The details are obscure to me, so it's a wonder I remembered it at all.
The thing about keeping a local copy is that you have to remember to update it on occasion. But, to be honest, I'm not sure that I'll ever rely on the bleeding edge in my website.

