## Wednesday, April 22, 2015

### 2015 Atlanta Pen Show

Tl;dr: I went to the Atlanta Pen Show. It was fun.

I had originally planned on going to Atlanta on Friday, spending the night, and taking Saturday at the pen show, going to seminars and having a wonderful time. Then, I remembered that I'm an antisocial misanthrope with shyness issues from Texas, would be unlikely to actually speak to anyone, and that this is apparently a send-the-IRS-much-money year, so I waited until Saturday morning. I arose somewhat early, patted the Dianne, Penelope Doglington, and Zach on the head and prepared to leave. Zack glared at me and started waving his claws around; I cut the preparations short and just took off.

I hopped into the ol' 'vette and went through Section like the Four Ponies of the 'Pocalypse, leaving devastation and wreckage in my wake although I don't think anyone noticed; I whipped through Fort Payne like the North Wind, except that I was actually coming from the west; and took Rome, GA, and points Atlanta-ward like an invading army of crazed yankees driving Corvettes. However, as I didn't leave any parts behind, I assume my territorial claims have since been nullified.

Anyway, I arrived at the Wyndham about 11:45 because I'm not a morning person. That meant that I missed Susan Wirth's seminar on "How some pens can make anyone’s handwriting look good. How to find them at a Pen show," which I wanted to attend. Sigh. I did manage to avoid being dragged into the calligraphy class---that would have been like teaching a pig to talk; it wastes your time and annoys the pig. I did a quick lap of the show, which was two conference rooms and the halls between. It was packed, both with vendors and attendees. Then, I got to business.

Brian Anderson did have a Sailor King of Pen (just say it, "King of Pen"), which felt lovely and has an impressive nib. One of the things I was looking for at the show was lightweight, oversized pens, and that is one. Unfortunately, Mr. Anderson sold it to the guy standing next to me right after I finished playing with it, so I didn't spend several hundred dollars on one pen. (The rat bastard.)

On the other hand, I discovered that I don't particularly like the way Pilot Vanishing Points feel. It's a nice pen, but I no longer feel the need to look closer at one. For me, this show is the first time I've seen many of the pens I have looked at in person, and there is nothing like touching a pen and feeling its heft to judge how I would like it.

The Nock tables were occupied by a man with a terrifying beard.

Another thing that I was looking for was a reference to Parker Vacumatics. Given that they are beautiful and just feel right, and that they represent everything that is good, true, and just in the world, and that I love them, I decided I needed to get serious about collecting them, which meant learning much more about them. I was talking to Mike and Memi Turkington of M&M Pens and learned that Mike has some sort of weird fascination with Duofolds, but he suggested Geoffrey Parker, David Shepherd, and Dan Zazove's Parker Vacumatic book. Unfortunately, said book is apparently printed on unobtanium. Fortunately, they pointed me to the Pendemonium folks, who had a copy of said book for sale and it came home with me. The book is as attractive as the pens.

Overall, the show was very nice. Although vintage pens did seem to be much of the focus (something I enjoyed), there was a good mix of vintage and modern. The Franklin-Christoph booth, I believe, was doing a great business offering a wide selection of testers and custom-ground Masuyama nibs. (And Franklin-Christoph has some nice pens.) Anderson Pens also had a wide variety of different manufacturers (including the TWISBI 700 vac that followed me home). Every vendor I talked to had testers or was happy to let potential customers get their grubby mitts on their pens, including letting them dip and write. The customers, not the pens. Pens don't have fingers; they can't dip or write.

I spent a lot of time near Martin Ferguson's booth, and the other tables doing pen repair. Am I weird to think that's fun?

After the show, I stopped by Rockler Woodworking, which has some good options for pen stands, gift boxes, and zippered pen cases in their pen-turning supplies, in addition to their, you know, woodworking stuff. I had dinner at Nori Nori, eating very good sushi until I ruptured, and came home, flying like a great raven through the Georgia countryside. Except that the 'vette is red, not black, and doesn't fly.

Here endeth the saga.

## Friday, April 17, 2015

A couple of years ago, back in 0.6 days, I wrote a post on operator overloading in Rust. I've now updated it for Rust 1.0.0-beta, which simplified the code greatly.

As a bonus, it now includes some discussion of Rust macros!

## Sunday, April 12, 2015

### Update on rust-toys

With the release of rust 1.0.0-beta, I've received a ping about updating my code from 0.11. Unfortunately, I hit the following:

        let line : String = line.unwrap();
let line : &str = line.as_str().trim();


The variable line coming in is a io::Result (Is it me or are there two Result types in the standard library, std::result::Result and std::io::Result?); unwrap() returns a String (or blows up), which I then need to convert to a string slice (&str) in order to trim whitespace, using something like String::as_str or Str::as_slice.

Unfortunately, that code fails to compile with:

src/bin/mk_anadict.rs:18:32: 18:40 error: use of unstable library feature 'convert': waiting on RFC revision
src/bin/mk_anadict.rs:18         let line : &str = line.as_str().trim();
^~~~~~~~


And the convert feature is not allowed in the beta release channel. (There was a fix for the error message suggestion, to prevent the compiler from showing "add #![feature..." when that won't work, but it didn't make it into the beta release.

I'm going to bail on this for the moment, until the standard library settles down a bit.

## PS. Wait, what?

I realized I hadn't tried one thing: calling trim() on the String itself.

        let line : String = line.unwrap();
let line : &str = line.trim();


It works. I don't know how.

Later. Hah. Because there is a Str implementation for String. I think. As I recall, there wasn't previously, which was why I needed to get the str explicitly.

## Saturday, April 11, 2015

### One stupid shell scripting trick everyone should know

Let's say that I am installing Rust 1.0.0.beta, which comes as a pre-compiled binary package with an install script. Now, this is probably a good thing, because building rustc from source was slow and the rustc source doesn't include cargo, and thus probably other nifty things, but it does have a downside: if you use the --prefix argument to set a local installation directory, say in your home directory, you get an error message running rustc.

error while loading shared libraries: librustc_driver-4e7c5e5c.so: cannot open shared object file: No such file or directory


The rustc executable cannot find the shared libraries that it needs because their custom location is not built into the executable. Nor, if you didn't run install.sh as root, has their location been added to the system's search path; that is the point of the error message at the end of the installation.

install: running ldconfig
/sbin/ldconfig.real: Can't create temporary cache file /etc/ld.so.cache~: Permission denied
install: WARNING: failed to run ldconfig. this may happen when not installing as root. run with --verbose to see the error


So, what to do?

You could fix the ldconfig situation, but fooling with the system configuration irritates my lazy bump.

The obvious solution would be to set the LD_LIBRARY_PATH variable to include the Rust lib directory, but LD_LIBRARY_PATH has been the source of weird problems and frequently complicates debugging, so setting it globally or in your shell initialization script is an enterprise fraught with peril. But there is a simple trick that is handy for these sorts of situations.

First, in the Rust bin directory, move all of the executables to a new name, say rustc to rustc.bin, rustdoc to rustdoc.bin, etc. The cargo program doesn't have any links to the Rust libraries and the rust-gdb program is already a script, but doing this to all of them won't hurt anything.

Second, in the bin directory or any other location of your choice, create another short shell script.

#!/bin/sh

RUST_HOME=/home/mcguire/soft/rust

export LD_RUN_PATH=$RUST_HOME/lib LD_LIBRARY_PATH=$RUST_HOME/lib exec $0.bin "$@"


I named it environment-script. Make sure it is marked as executable.

This script does a little more than necessary, but the basic idea should be clear: it sets the LD_LIBRARY_PATH environment variable in the last line to the location of the Rust libraries, then uses exec (a small optimization) to call another program ("$0.bin"), passing along all of the command line arguments ('"$@"'). I will explain the details here after the final step.

Third, in the rust bin directory next to the newly-named rustc.bin, create a symbolic link to the environment-script named with the original name of the Rust program. Do this for all of the Rust programs.

ln -s environment-script rustc
ln -s environment-script cargo
...


After doing this, you should be able to run rustc --version and get the version string without an error message.

$rustc --version rustc 1.0.0-beta (9854143cb 2015-04-02) (built 2015-04-02)  What is happening here? Running rustc invokes the environment-script, which uses the shell's syntax for setting the LD_LIBRARY_PATH variable for the execution of the exec command. The exec command takes the rest of its arguments and calls them, as a normal shell command. However, with exec, the process running the environment-script becomes the next command rather than running it in a sub-process. (Like I said, a small optimization.) The program that gets run is given by$0.bin. $0 evaluates to the name the script was called as; in this case that will be "rustc". As a result, it invokes rustc.bin, the renamed executable. The script uses the shell syntax "$@" (the quotation marks are important) to pass any command line arguments along unchanged. In the end, rustc.bin is executed with an argument of --version and an environment setting necessary for it to find its shared libraries.

The LD_RUN_PATH environment variable is similar to LD_LIBRARY_PATH, except that its value should be added to the library search path compiled into any programs that rustc produces, allowing them to find the Rust libraries if they need them.

Tl;dr: Wrapper scripts! Learn them! Love them! Live them! Is there nothing they cannot do?

## Monday, March 30, 2015

### Defending Darwin?

Regarding Defending Darwin, a recent article by James Krupa in Orion magazine: Keep in mind that there are several confounding factors in teaching evolution in a religiously conservative (in the American sense) area.

1. If you're not from around here (or even if you are), you may not realize that the United States are not especially unified, culturally. Essentially everyone lives in a bubble, scientists, Swedes, Baptist ministers. No one is really evil ('cept me; but I'm always rooting for the underdog); very few people are actually stupid and the term "ignorant" is one to use with care (it applies some people much of the time but everyone some of the time). Unless you've had this fact rammed down your throat, the fact that some people say different things than you do often seems like prima facie reason to believe that there is something seriously wrong with them.

2. The conflict between religion and science is at a much deeper level than evolution or any other specific question about facts. Religion is based on belief in the absence of (or even in conflict with) evidence. Science is (or should be) based on doubt even in the presence of evidence. (Quick quiz: Did Albert Einstein waste the last half of his life opposing quantum mechanics?)

I enjoyed Stephen J. Gould's book on the conflict between religion and science, but he rather missed the actual point. ("I make it clear that one can accept evolution and maintain their religious beliefs. They are not mutually exclusive": yes, at the risk of having to compartmentalize the activities of science and religion; but everyone does that anyway. I like to fancy myself a scientist, but my understanding of most of science is at the level of religion; I don't have enough physics to really evaluate evidence, so I'm just going along based on results. Likewise, I don't have the chemistry or the biology. I suspect the vast majority of any scientists or engineers are in a similar boat, although I know too many of both to expect not to be set on fire for this statement. In any case, I'm mostly going along because I like the results.)

3. Evolution, on the student side in this article at least, is essentially irrelevant to the lives of the students. (Modulo, of course, the evolutionary medicine points; many of those are as compatible with creationism, though.) This is a course on biology for non-biologists; the facts of biology have no practical, visible effects on their lives. That might change if they go full-crazy and assert something like the immutability of species, but that isn't the mainstream of creationist thought. Whether whales descended from a strange, wolfy sort of critter is as irrelevant to non-biologically inclined students as whether whales' tails are oriented vertically or horizontally to students in Kansas. Or, whether nitrogen compounds are exciting.

Teaching evolution in these classes is valuable solely because it teaches an understanding of how science works, which (a) most practising scientists don't really have but which (b) is kind of important if one is going to be dealing with modern policy decisions. Which one is. On the one hand, that makes this class one of the most important that the students could take, but on the other it makes this class one of the least important: personally, I don't care if you believe in evolution or not if you can make reasonable, reasoned decisions. (Unless you believe the world was created 4000 years ago, all of the evidence otherwise was planted as a trick, and that the god who did so is benevolent. I'm staying away from that guy. There's something seriously wrong with him.)