Tag Archives: k line

Can you mix Lionel and Marx track? Yes, pretty much.

Here’s a question from the search engines: Can you mix Lionel and Marx track?

Generally speaking, yes you can. Just stick with O27 track, and you can mix Lionel, Marx, and K-Line as needed. Dad had a mixture of Lionel and Marx track in the 1950s–my theory is that someone tipped my grandfather off that you could buy a Lionel O27 starter set, expand it with cheaper Marx track, and once you had the track assembled, no one would know the difference. When we set his layout back up in the mid 1980s, we added some K-Line O27 track, because it was what we could find. I have a mixture of all three brands to this day. Continue reading Can you mix Lionel and Marx track? Yes, pretty much.

Installing trucks on junker train cars

Sometimes a train car breaks, and sometimes you get a good deal on a train car that’s missing its running gear. Whatever the reason, sooner or later most hobbyists find themselves needing to attach trucks to the underside of their train cars, and if they’re like me, they soon find that using a regular nut and bolt doesn’t cut it–the nut works itself loose after a few times around the track, which leads to wobbly running, which leads to derailments.

There’s a solution other than expensive riveting tools, if you’re just interested in making cars run well, rather than restorations that are as historically accurate as possible. For about 15 bucks, you can get enough parts to do 50 cars.

Continue reading Installing trucks on junker train cars

Playing around with LyX

In what little free time I’ve had the past few days (we have a project that has us in the midst of a death march at work), I’ve been messing around with LyX, a typesetting program for Windows, Unix, and most other operating sytems. I remember messing with it about six years ago, when there wasn’t much else resembling a word processor available for Linux, but this time, I’m more impressed with what I see.LyX is a front-end for a typesetting system called TeX. TeX was developed by the legendary computer scientist Don Knuth when he was dissatisfied with the appearance of his galley proofs for the second edition of The Art of Computer Programming. Knuth had an eye for fine typography, and because hand-set type was increasingly being replaced by machines, he looked for a way to make a computer play by the same set of rules that experienced typesetters have used for the past 500 years.

I had my first exposure to TeX when I was working on a business analysis project with Charlie Sebold. There was a department Charlie and I both did a lot of work for, and supporting these 8 users had ballooned into a full-time job in itself. We had an expensive contractor billing an average of 45 hours a week to the department alone over the course of a year, and when I replaced him, I wasn’t able to knock that down much below 40. We believed there was something wrong with a department of 8 users spending $200,000 a year in computer support. Come to think of it, that may have something to do with why I don’t work there anymore, but I digress. Charlie and I embarked on a project to figure out what we could do to cut those costs. I don’t remember anymore how the writing duties got split up, but Charlie typeset the report in TeX. I remember him being surprised to hear that I didn’t know much about TeX, especially since I had written a book for O’Reilly at that point, and if you look at the early O’Reilly books, they look like they were produced by TeX on the default settings.

Well, intentionally or unintentionally, using TeX for the report was a stroke of brilliance, because the most influential people in the department were design snobs, and TeX produces better-looking output than anything PageMaker could ever do. The text is beautifully justified, with no rivers through it, and the kerning is always set just right, and it will even use ligatures when appropriate. Basically, it does all of the hallmarks of elegant design that they taught me in journalism school–stuff that takes hours to do by hand–and it does it in minutes.

So when Charlie handed that report out at the first meeting, he got us a whole bunch of instant credibility.

What I like about LyX is that it removes the markup stage from TeX. You apply an appropriate document style–book, letter, article, report, or whatever–and you mark lines as whatever they happen to be–standard paragraphs, headings, chapter titles, document titles, author, or whatever–and it handles all of the layout and everything else for you. It’ll even generate the table of contents for you. And if you want an index, just flag words as you write or edit, and it can generate an index.

It also handles the most frustrating aspect of writing that I faced when I was writing my book back in 1999. A good book shouldn’t spent a lot of time repeating itself, so there’ll be times when you’ll refer the reader to a specific chapter, or even a specific page. The problem is, these things change. I not only re-ordered the chapters about halfway through the writing process, I actually took a couple of chapters, combined the like topics, and turned them into two completely differently titled chapters. Finding my cross-references and keeping them straight was such a pain that I really didn’t do it all that much. With LyX, cross-references are easy. You just label a section, and insert a cross-reference to the label, and it inserts the page number and the name of the section for you. You can put a cross-reference on every page and not slow down a bit.

Now that I’ve spent a few hours with it, I heartily recommend LyX. In college I found I got better grades when I turned in papers using fonts other than Times and Arial, and the output from LyX adds a whole new degree of elegance to it. Succeeding in college is as much about playing the game as it is anything else, and LyX gives you that slight edge.

And, as you might suspect, I’ve been playing with LyX for a reason. I’m writing again. Over the course of the past year, I’ve prepared a 133-page manuscript (that’s single-spaced Times with no pretty pictures or formatting, so it’s more than it sounds). I’m in the process of editing and typesetting it now. It’s highly specialized, so I’ll be self-publishing it, rather than using a publisher. I’ll be happy if it sells 1,000 copies and thrilled if it sells 10,000, and no publisher is willing to touch a book anymore if they think a book will only sell 10,000 copies. If it sells 1,000 copies, it will have been worth my while to write. Modern print-on-demand technology makes that a much safer risk than it was in 1999, when I wrote and published my first book.

And while there are times when the help of a traditional publisher definitely makes a better book, I think this is a case where I can create a better product working on my own.

I’ll keep you posted.

Keeping a Lionel 1122 switch from buzzing

The other day I helped someone troubleshoot a Lionel 1122 switch that was buzzing and not operating. I don’t have time to take pictures or anything but hopefully this brief rundown will be helpful for someone.First, some background information: The Lionel 1122 and later switches are designed to switch automatically for an incoming train, because a train approaching the curved section of the switch when the switch is set straight will derail.

The buzzing generally is caused by a short circuit making the switch think a train is approaching when it isn’t.

This same procedure will aid in the troubleshooting of Lionel O22 switches as well as later non-derailing switches made by Lionel and K-Line.

First, remove the troublesome switch from the track. Connect two wires directly to the transformer, and touch one of the wires to any center rail. Touch the other wire to one of the outer rails of the curved leg. If the switch doesn’t snap, touch the wire to the other outer rail. The switch should operate. Whichever rail causes the switch to operate when touched with a wire needs an insulating track pin, rather than a standard metal track pin. These pins, which used to be made of fiber but are now made of plastic, are available online and possibly from your local hobby shop.

Now that you’ve confirmed the curved leg works, repeat for the straight leg, and insert an insulating pin into that rail if one isn’t already present. If the switch operates on both legs in this fashion, the switch is operable and you just have a short circuit somewhere.

If the activating rails already had insulating pins and the switch still buzzes, you have a short circuit somewhere and you probably need to add more insulating pins. The center rail should never be insulated. But you may need to add insulating pins to several of the other rails. The easiest way to do this is to set up a simple loop on the floor with two switches, connect a transformer, put a locomotive on the track, and apply a little bit of power. If one or more switches still buzz, add insulating pins until the buzz goes away. This solution worked for us and got a layout that had two buzzing 1122s (out of three total) working again.

A remote administration Unix trick

OK, here’s the situation. I had a Linux box running Squid, chugging away, saving us lots of bandwidth and speeding things up and making everything wonderful, but we wanted numbers to prove it, and we liked being able to just check up on it periodically. Minimalist that I am, though, I never installed Telnet or SSH on it. And besides, I haven’t found an SSH client for Windows I really like, and Telnet is horribly insecure.
Sure, I could just walk up to it and log in and look around. But the server was several city blocks away from my base of operations. For a while it was a good excuse to go for a walk and talk to girls, but there weren’t always girls around to talk to, and, well, sometimes I needed to check up on the server while I was in the middle of something else.

So here’s what I did. I used CGI scripts for the commands I wanted. Take this, for example:

#!/bin/sh
echo ‘Content-type: text/html’
echo ”
echo ‘‹pre›’
ps waux
echo ”
cat /proc/meminfo
echo ‘‹/pre›’

Then I dropped those files into my cgi-bin directory and chmodded them to 755. From then on, I could check on my server by typing http://192.168.1.50/cgi-bin/ps.cgi into a Web browser. Boom, the server would tell me what processes were running, how much memory was in use, and even more cool, how much memory was used by programs and how much was used for caching.

Here’s how it works. The first two lines fake out Apache and your Web browser, essentially just giving them a header so they’ll process the output of these commands. The next line tells it it’s pre-formatted text, so don’t mess with it. This isn’t necessary for all commands, but for commands like ps that output multicolumn stuff, it’s essential. Next, you can type whatever Unix commands you want. Their output will be directed to the Web browser. I echoed a blank line just so the memory usage wouldn’t butt up against the process info. The last line just cleans up.

I wrote up scripts for all the commands I frequently used, so that way when my boss wanted to know how Squiddy was doing, I could tell him. For that matter, he could check it himself.

But if I knew there were going to be girls around, I went ahead and made an excuse to walk that direction anyway. Some things are more important than remote administration, right?

How I set up Greymatter for Weblogging

How I set up Greymatter for Weblogging. First things first: I’m sure everyone’s asking how much hardware you need. I’m using a Pentium-120 with 64 megs of RAM, and it’s plenty fast most of the time. It takes a little while to regenerate all the templates, but other than that it’s mostly sitting idle. Any Pentium-class machine should be plenty. I’d be hesitant about using a 486 because the templates will take an awfully long time to rebuild. Remember, Greymatter’s written in Perl, and Perl’s an interpreted language. Interpreters are slow for the same reason emulators are slow–the translation is real-time.
But Greymatter offers advantages. You can control your destiny. You have total control over your site–it’s running on your Linux box. And you’re free from FrontPage’s tyrrany. Did I hear cheers? Most importantly for me, I set the clock. I can set the clock ahead a couple of hours, make my post at 10 p.m., and it’ll be dated the next day. That can only mean… The return of the infamous Farquhar Time Machine. I can start sleeping in again! Or go to work earlier… Hey, I can start sleeping in again!

Anyway, I had the Pentium-120 already configured with Mandrake 7.2, but I discovered Mandrake 7.2 in high security mode doesn’t seem to allow Web traffic from the outside world. So I installed Mandrake 7.2 again in low-security mode. I used a server installation. The only things I really cared about were Apache and Perl, but I didn’t feel like de-selecting everything. Both will be in there by default. I think Perl’s part of the Development group during installation. I’m not sure what group Apache is in. I don’t recommend running XFree86 on your server. Those memory resources are better used for server purposes. Oh, and one last thing: Don’t use DHCP. Give your Web server a local, static IP address.

Once I was up and running, Apache wasn’t running by default, so I dinked around with a cp /etc/rc.d/init.d/httpd /etc/rc.d/rc3.d/S45httpd so that Apache would start on boot. Then I started Apache by executing /etc/rc.d/rc3.d/S45httpd start. Of course there are plenty of other ways to accomplish the same thing. It was close to midnight and I just wanted the thing open to the world at that point.

Then I pointed my Web browser at the server’s address, and my embryonic Weblog came up.

It won’t happen that way for you, because I already had Greymatter installed and configured before I did all that. In other words, I did things bass-ackwards. You should do it differently. Get Apache working right first. It’s less frustrating that way.

With Apache installed and running, point a Web browser at it. You should see some kind of Apache welcome screen–it’ll vary based on your Linux distro, but it’ll basically be some kind of show-off screen. You see it? Great. You don’t? Get Apache working. How? I dunno. Make sure it’s running, first of all. Type the command pidof httpd. You should get a couple of numbers. Maybe a lot of numbers. If all you get is a blank line, then Apache’s not running. If it’s running but not responding, you’ve probably got a problem with the configuration file. The default configuration file for Apache, unlike the default configuration of a lot of programs, does work reasonably well. The defaults will certainly do for a Weblog. Start with the default config, get it working, then get fancy later.

Working? Great. Open up port 80 on your DSL router and point it to your server’s address. Don’t expose any other ports. This improves security immensely. Now go to www.grc.com and run Shields Up!, then Probe My Ports. Port 80 should be open. If it’s not, either your Linux box is too secure (I wish I could offer some advice there but I don’t know much about un-securing a Linux box) or your router’s not forwarding the port right.

By default, in Mandrake at least, Apache puts its HTML files in /var/www. So, first, clear out /var/www/html. Next, I put all of the Greymatter files in /var/www/cgi-bin. Then I created directories named Archives in both /var/www/cgi-bin and in /var/www/html. The documentation is pretty good about what files need permissions of 755 and what needs 777 (yuck!) and what needs more restrictive settings, like 644 or 666.

As an aside, the archives directory being chmodded to 777 makes me nervous. That means that if I install Greymatter to a server that shares space with someone else, the entire world can see that directory. They can’t manipulate anything inside there as long as the files inside have more restrictive permissions, but I always cringe every time I see anything with 777 permissions. I knew people in college who’d just chmod everything to 777 because then it meant everything just worked all the time. Unfortunately, anyone who had telnet access to the machine could then go into that directory and change anything. I’m not as concerned about that, since I don’t share this PC with anyone. But 777 still doesn’t give me warm fuzzies. Unix ain’t Christianity. In Unix, 666 is ok (but 644 is much better), and 777 is a hacker’s delight, and therefore, pure evil.

After you chmod all your files, assuming your server is at 192.168.1.2, go to http://192.168.1.2/cgi-bin/gm.cgi. Greymatter should pop up. Go to the configuration screen and run down the line:

Local log: /var/www/html
Local entries: /var/www/html/archives
Local CGI: /var/www/cgi-bin
Website log path: /
Website entries path: /archives
Website CGI path: /cgi-bin

Set the other stuff the way you want it. Now hit Save Configuration. Now, immediately run Diagnostics and Repair. This will ensure that all files are where they need to be and permissions set correctly. If it can’t find something, do what you have to to satisfy it.

Now you’re ready to start editing templates and adding entries. You’ll need to exercise your HTML skills for that, or rip off someone’s templates. I didn’t look too hard, but I’m sure there are people out there offering Greymatter templates. If you have to, use an HTML generator to draw what you want, then take the code and put it in the template. I know HTML, so I coded mine by hand. That’s why they’re still sparse. The basic layout is there; I need to flesh it out. And I haven’t entered every template yet myself.

Now, for backups and stats… Backups are easy. I use the command tar -c /var/www >/home/dave/backup.tar. It only takes a second. You can compress the tar file and throw it on a floppy with the mcopy command. Or if Samba’s also configured and running, backup to a network-accessible directory and pull the file over to another machine.

For stats, I use LiveWebStats, but I don’t like it. Any Apache log analyzer will work.

There’s one other issue with Greymatter. It sends passwords plaintext, and thus, they’ll show up in your logs. So don’t make your stats public, at least not your referrers. If you’ll have remote editors, you need to consider that vulnerability–an editor’s password can potentially be intercepted.

Setting up Greymatter is a lot of work, but it’s a one-shot deal. You make your design, then it’s content-driven. Change your design, and it applies to the whole site. Nice. And when you publish, you only publish your new stuff.

But overall, I like Greymatter an awful lot.