Become a fan of Slashdot on Facebook

 



Forgot your password?
typodupeerror
×
User Journal

Journal Journal: Triplanetary 1

I've uploaded a new book to mcgrewbooks.com. Edgar E. Smith was a well known science fiction writer known as "the father of space opera", and Doctor Smith was a food engineer in his other life. The novel I've uploaded is Triplanetary, first published in serial form in Amazing Stories in 1934.

Some of the dialogue is a bit juvenile, but it would make a great movie.

User Journal

Journal Journal: An Accidental Book 1

I've read books accidentally, meaning to read a single chapter and winding up reading it in one setting, but I've never started writing one accidentally.

Until now.

Tired of editing Random Scribblings and Voyage to Earth and Other Stories (Formerly titled "Mars Bars"), I thought I'd look for another science fiction novel in the public domain a little less ancient than The Time Machine to add to my web site.

I didn't find one, so decided to just make a book of public domain short stories by the 20th century greats. I found a LOT, and started assembling a book. Somehow, I wound up adding commentary and thought "Hey! New book!"

Then I discovered that one of the short stories wasn't so short -- in fact, it was a full blown novel. So for the last several days I've been formatting it to put on my web site. E.E. "Doc" Smith's Triplanetary will be posted in a few days.

I'll let you know when it's there. I guess I'm working on three books again. The collection I'm working on is tentatively titled "Yesterday's Tomorrow".

User Journal

Journal Journal: Systemd's solution to large init scripts 1

(Note: When you write code, you're making a UI for programmers. Learn to do it well.)

Below you can see a traditional unix init script. It's long, but if you're familiar with shell-script you can figure out what is going on. There is a lot of redundancy here, most init scripts have a switch that runs an option based on the first command-line parameter, for example. One solution is to put common code in a function, but Poettering decided to use config files.

Let's examine the general tradeoff between putting code in a function, and using config files (a form of declarative programming). Config files are fine as long as there aren't too many special cases. If there are too many special cases, you end up with so many options and keywords that it would have been easier to just use a scripting language.

The good side is systemd saves a lot of typing. Way down at the bottom, is a unit file for the same init script. It's clearly shorter, and easier to type.

The bad side is it has arcane keywords which are are not discoverable merely by looking at the file. This is a pattern that repeats itself over and over in systemd, things are easier if you know how to do them, but the system itself is inscrutable without arcane knowledge.

Ideal systems fulfill the requirements while making it easy for those who want to dig deeper. The system opens like the petals of a rose.

#!/bin/bash
# Starts the abrt daemon
#
# chkconfig: 35 82 16
# description: Daemon to detect crashing apps
# processname: abrtd
### BEGIN INIT INFO
# Provides: abrt
# Required-Start: $syslog $local_fs
# Required-Stop: $syslog $local_fs
# Default-Stop: 0 1 2 6
# Default-Start: 3 5
# Short-Description: start and stop abrt daemon
# Description: Listen to and dispatch crash events
### END INIT INFO
 
# Source function library.
. /etc/rc.d/init.d/functions
ABRT_BIN="/usr/sbin/abrtd"
LOCK="/var/lock/subsys/abrtd"
OLD_LOCK="/var/lock/subsys/abrt"
RETVAL=0
 
#
# Set these variables if you are behind proxy
#
#export http_proxy=
#export https_proxy=
 
#
# See how we were called.
#
 
check() {
    # Check that we're a privileged user
    [ "`id -u`" = 0 ] || exit 4
 
    # Check if abrt is executable
    test -x $ABRT_BIN || exit 5
}
 
start() {
 
    check
 
    # Check if it is already running
    if [ ! -f $LOCK ] && [ ! -f $OLD_LOCK ]; then
        echo -n $"Starting abrt daemon: "
        daemon $ABRT_BIN
        RETVAL=$?
        [ $RETVAL -eq 0 ] && touch $LOCK
        echo
    fi
    return $RETVAL
}
 
stop() {
 
    check
 
    echo -n $"Stopping abrt daemon: "
    killproc $ABRT_BIN
    RETVAL=$?
    [ $RETVAL -eq 0 ] && rm -f $LOCK
    [ $RETVAL -eq 0 ] && rm -f $OLD_LOCK
    echo
    return $RETVAL
}
 
restart() {
    stop
    start
}
 
reload() {
    restart
}
 
case "$1" in
start)
    start
;;
stop)
    stop
;;
reload)
    reload
;;
force-reload)
    echo "$0: Unimplemented feature."
    RETVAL=3
;;
restart)
    restart
;;
condrestart)
    if [ -f $LOCK ]; then
        restart
    fi
    # update from older version
    if [ -f $OLD_LOCK ]; then
        restart
    fi
;;
status)
    status abrtd
    RETVAL=$?
;;
*)
    echo $"Usage: $0 {start|stop|status|restart|condrestart|reload|force-reload}"
    RETVAL=2
esac
 
exit $RETVAL

-----------------------------------------------------------------------------------------

[Unit]
Description=Daemon to detect crashing apps
After=syslog.target
 
[Service]
ExecStart=/usr/sbin/abrtd
Type=forking
 
[Install]
WantedBy=multi-user.target

Reference to the examples.

User Journal

Journal Journal: systemd - Why did Debian Adopt it? 8

There's a Debian debate page, but it's disappointing and everything systemd does is listed with equal value. Thanks to Russ Albery for making a much more balanced assessment, explaining what he likes. The short answer to the question is: SystemD makes things much easier for people writing init scripts. It wasn't about cgroups, or speed, or login managers, it was about writing easy init scripts.

Here are the major complaints he has with the traditional startup system:

* Lack of integration with kernel-level events to properly order startup.
* No mechanism for process monitoring and restarting beyond inittab.
* Heavy reliance on shell scripting rather than declarative syntax.
* A fork and exit with PID file model for daemon startup.

He furthermore points out these problems with startup scripts:

The model of fork and exit without clear synchronization points is inherently racy, the boot model encoded into sysvinit doesn't reflect a modern system boot, and maintaining large and complex init scripts as conffiles has been painful for years. Nearly every init script, including the ones in my own packages, have various edge-case bugs or problems because it's very hard to write robust service startup in shell, even with the excellent helper programs and shell libraries that Debian has available.

Those are the main things that systemd fixes for a distro builder, and probably why so many distros have switched to systemd, because it was built for them.

User Journal

Journal Journal: Is Microsoft Sirius? 1

I had to laugh when I ran across this article.

"Cortana's UI now expresses 18 different emotions. Siri remains detached and aloof."

Yes, Microsoft is apparently the Sirius Cybernetics Corporation with its " Genuine People Personalities". So when are they going to make that "Marvin" interface?

User Journal

Journal Journal: Amnesia 4

If slashdot still hasn't fixed the "fine in preview, fucked in submit" bug, there's a readable version here.

Amnesia
        He awoke wondering where he was... on a medic. Why was... oh, hell, why was he being held down? And then the big question hit him â" Who am I?
        And who, besides the medic itself, which was only a robot, had imprisoned him? And why?
        There was a tube leading into his arm... was he in a hospital? It smelled like a hospital.
        The medic beeped, and said âoecondition improved, now stable.â
        He must have had some kind of accident, but he couldnâ(TM)t remember his own name, let alone how he wound up in a hospital.
        âoeComputer!â he said, hoping the hospital computer could shed some light. It was apparently not paying attention, because it ignored him. He lay there strapped to the robotic table for what seemed like forever when the medic again beeped and spoke. âoeCondition improved, now fair.â
        âoeComputer!â
        No answer.
        Damn. âoeMedic!â
        No answer.
        Another eternity passed, and the medic reported âoeCondition good, patient released.â The straps came loose and he sat up on the medic, waiting for a nurse or doctor that never showed up. Didnâ(TM)t someone have paperwork when a patient was released?
        He decided to look around the hospital to find someone and tell them that he shouldnâ(TM)t have been released, that he had no memory. He used the rest room and went searching for help.
        This, he thought, was the strangest thing... this hospital seemed to have no doctors, no nurses, no administrative staff, nobody. Not even any patients. He walked down hall after hall, and found nothing but locked doors and more hallways.
        He started to panic, and muscle memory reached his hand into his pocket for a phone. There was none there.
        That panicked him. Why didnâ(TM)t he think of it before? It could have told him at least who he was, if not where he was and why.
        He started running, down first one hallway then another, until he collapsed in exhaustion and anguish. He sat there in the hallway, head in his hands, sobbing softly.
        Quite a while later he finally came to his senses, sort of. He got up and decided to just walk around, looking for... anything, really, but especially people. Where was everyone? It would be nice if he could find a sandwich, too; he was starting to get a little hungry. That added to his already numerous worries.
        He found no exits, no unlocked doors, no people, no sandwiches. It was hard enough to keep his fear below panic levels, but then what was obviously some sort of alarm went off. Was the building on fire? He stopped, with no idea what to do.
        He looked up â" werenâ(TM)t there skylights showing stars earlier? But his memory was impaired, after all, not able to remember his name or anything before waking up on the medic.
        He heard the first sounds that didnâ(TM)t come from robots that heâ(TM)d heard since awakening, and it scared him even more â" the sound of hail. Perhaps there were skylights, but were now shuttered.
        At this point he was aware that the alarm was almost certainly a tornado warning, and he couldnâ(TM)t find the stairway! Maybe this building didnâ(TM)t even have a basement, but who in their right mind would build a structure in a tornado zone without one? But without a stairwell, it might as well not have a basement. He huddled in a doorway waiting for the tornado to destroy him and the building.
        The sounds of hail stopped, the siren stopped, and yes, there were skylights; the shutters opened then, showing stars once again. Odd that the storm had started and ended so fast. The shutters must have closed before the clouds rolled in.
        He started to continue his fruitless search.
        A robot wheeled past, and he had an idea. The robot would certainly lead him to something.
        It did. Down a hallway heâ(TM)d not yet explored and probably had run past more than once in his earlier panic was a large door that stood wide open, the automatic pocket doors recessed. Inside was a huge room filled with tables and chairs, but still no sign of humanity at all. The robot heâ(TM)d followed dragged another robot away. Puzzling.
        At least he had somewhere to sit besides the floor. He sat down at one of the many tables to rest, thinking heâ(TM)d have to figure out how to find his way back before continuing his search.
        He just couldnâ(TM)t stop wondering what the hell was going on. Was he being studied in some sort of weird experiment? Was he a prisoner by design, or by accident? Was he a criminal? Did he have a family?
        Without even thinking he started praying out loud, âoeOh, Lord, please help me...â
        A mechanical voice chimed in. âoeCan I help you, sir?â
        He looked up at the robot. âoeYes,â he said, âoehow can I get out of this building?â
        âoeIâ(TM)m sorry, sir, but that is not in my database. Can I get you something to drink?â
        âoeYes, cold water, but first, where am I?â
        âoeThis is the commons area, sir. Would you like a menu?â Without waiting for an answer, the video screen displayed a menu.
        âoeYes, Iâ(TM)ll have a cheeseburger, brogs, and a caffeine shike.â
        âoeYes, sir,â it said, and started to roll away.
        âoeWait!â the man said. âoeWhat is this the commons of?â
        âoeThat information is not in my database.â
        âoeCan you tell me what this building is?â
        âoeIâ(TM)m sorry, sir, but that information is not in my database. Is there anything else, sir, or should I fetch your order?â
        âoeNo, go on.â It rolled off. He put his elbow on the table and rested his head in his hand.
        The robot came back shortly with his water and shike and rolled away again.
        âoeWhat the hell is going on?â he wondered aloud, again.
        The robot came back in with his food and wheeled away. He ate, still not able to figure out how to examine his prison and still find his way back to this âoecommonsâ. At least he had food and drink now, which relieved him greatly and made exploration of this building far less, yet still, important.
        Then he thought: A commons. A common area. People should show up here, perhaps he should just wait for someone to show up?
        Several hours later and the skylight still showed stars. Was he in Antarctica? Or was he... Yes, that explained everything. He was on a space ship, but why? Where was it going? Where was the captain?
        Was he the captain? Or... a horrifying thought came to him. Was he a pirate who had killed the captain and thrown the body out the airlock?
        His thoughts were interrupted by the sounds of humanity â" boots walking down the hallway, and cautious whispering voices.
        He looked around the doorway and saw ten heavily armed, armored, and helmeted men.
        âoeOh shit,â he thought. He was captain, but didnâ(TM)t even recognize his own boat, let alone how to run it, and now there were pirates who would surely murder him and steal the ship and whatever cargo it was carrying. He cowered in a corner, wishing for something to defend himself with.
        They came in, weapons drawn, with the men in the back facing the other way and backing in. The man in front lowered his weapon and raised his face shield. âoeJerry? Christ, man, what the hell is going on?â
        âoeMy name is Jerry? Are you sure? I donâ(TM)t know who I am!â
        âoeJesus, Jerry, Iâ(TM)ve known you for years, youâ(TM)re Jerry Smith. I was scared shitless for you, what the hell happened? Did you get attacked by pirates?â
        âoeI... I donâ(TM)t think so. Iâ(TM)d be dead if they had. The first thing I remember is waking up on a medic wondering who I was and where I was and why I was on a medic. I wandered around for hours, I donâ(TM)t think anybody else is here.â
        âoeOkay, Joe, check the pilot room. Rob, would you do an engine inspection?â
        âoeSure thing, boss.â
        âoeJerry, where are your phone and tablet?â
        He shook his head. âoeNo idea, but I was sure wishing I had them.â
        They took Jerry to Earth with them while another man piloted Jerryâ(TM)s ship there.
        He did eventually get his memory back after a lot of therapy. His phone had been in his captainâ(TM)s quarters, and he had been doing inspection in machine storage when a can of something that had been improperly stacked by a malfunctioning robot had fallen, hitting him in the head and knocking him cold. A medic had taken him to sick bay, leaving the tablet laying on the floor, effectively locking him out of everything. Clearly, some policies, at least, would have to be changed.
        Jerry never captained another ship. In fact, he spent the rest of his life on Earth and never entered space again.

User Journal

Journal Journal: systemd - A descendent of Apple's LaunchD 1

Systemd is a descendent of Apple's launchd, Lennart suggested the world watch this movie to learn about it, so why? What is good about launchd?

OSX has an excellent inter-processing message system, part of the mach kernel (which they got from CMU). Because of this, many times processes talk to each other through the standard messaging queues. If you use a library to launch a browser window, or query wifi strength, it will communicate through a message queue (although the library takes care of the details).

The interesting thing is that launchd can open a message queue before the recipient is running. So launchd doesn't launch services until they are needed, and if they aren't needed, they never get launched. The benefit is that resources are preserved, things don't get launched until someone sends a message.

The benefit here is dependency resolution. Instead of forcing a deep calculation of what depends on what, or forcing the server script to declare everything it depends on, you can say "manage all these thousand services!" and only the few that are needed will be used, when they are needed.

Another thing I think Lennart copied from launchd is the declarative config files. You don't need to write a shell script, you merely need to indicate what should be launched, and maybe give it configuration options like "relaunch on failure" or "launch completely before receiving message." Of course, some people like config files, others prefer scripts.....that's not an argument I want to get into here, I'm merely pointing out things that seem to have come from launchd. (

What is bad:

Launchd is utterly undiscoverable. It would have been nice of them to put a README in /etc/rc/ or something saying, "hey, all your startup scripts are gone, look elsewhere."

Launchd has a complex hierarchy of directories that it searches for startup scripts. They have justifications for why, and a reason behind each one.......but justifications and reasons are not the same as good design. Every bad design decision ever made had a justification and a reason.

User Journal

Journal Journal: Systemd - Efficiency and Pike's Rules of Programming 4

(DISCLAIMER: These are my notes and might be wrong.)

Lennart Poettering has never heard of Rob Pike's rules of programming. Let's examine why:

He said, "On my system the scripts in /etc/init.d call grep at least 77 times.... that has to be incredibly slow...., and should be rewritten in C."

You can time it yourself, with this command:

time for i in {1..77}; do grep user /etc/passwd > /dev/null; done

On my machine it takes 0.229 seconds.

Lennart didn't get the speed increase he wanted. From his benchmark report, "booting up with Upstart takes 27s, with systemd we reach 24s." This result isn't too bad: when I've made a similar mistake of writing code before timing anything, ignoring Pike's rules for programming, once I actually slowed the system down.

If you don't measure, you can't optimize.

For entertainment and enlightenment, here is a quote by Ken Thompson talking vaguely about Pike's rules for programming:

Early Unix programmers became good at modularity because they had to be. An OS is one of the most complicated pieces of code around. If it is not well structured, it will fall apart. There were a couple of early failures at building Unix that were scrapped. One can blame the early (structureless) C for this, but basically it was because the OS was too complicated to write. We needed both refinements in tools (like C structures) and good practice in using them (like Rob Pike's rules for programming) before we could tame that complexity.

User Journal

Journal Journal: SystemD: The Beginning 7

DISCLAIMER: THIS CODE REVIEW IS A LONG WORK IN PROGRESS, I COULD BE COMPLETELY WRONG IN ANYTHING I SAY.

To do a proper code review, you need to understand the purpose of the code, what all the stakeholders want. From my own perspective, init scripts work fine, but since Unix companies keep trying to create new init systems, they must have different needs than I do.

Here's a list of the stakeholders. I need to figure out what their goals are.
1) System admins.
2) Desktop users.
3) Distro builders.
5) Android (if systemd turns out to be good enough).
4) Programmers

My suspicion is that systemd has taken over because it makes things easier for 3.

At its core, Unix is a system for programmers. What other system comes with a compiler and multiple interpreters by default? Bash is so much more useable than DOS, or even powershell (yeah, go ahead and flame me but I'm right, Powershell doesn't even have < working). Unix was designed by programmers and for programmers.

The reason I'm talking about it is the traditional init process is incredibly discoverable. All you have to do is look in the /etc/rc directories, and you can figure out how your system boots. You can see it all. For a programmer it's easy. Poking around in the system to understand it is one thing that makes Unix great (and what I like about Slackware: the whole thing is lovingly crafted).

So that describes the approach I am taking to code review, and to the init process. Hopefully Systemd is an improvement.

User Journal

Journal Journal: After Several Months Not Bothering 5

I visit a few threads here, on reasonable topics - like Barrett Brown case, etc.

The level of discourse has really troughed. It's like "conversation" between the Dufflepuds..

It's not worth even trolling these people. There isn't enough signal-to-noise for this to even register.

User Journal

Journal Journal: Well, crap... 8

Patty emailed me and solved the "why isn't anybody buying the Amazon ebook" question -- according to her, it's nearly impossible. She says they won't take a credit or debit card, you have to either have an Amazon gift card or that Amazon Prime crap.

So I don't know what to do. I'd just pull it and put it on the site for free like the other two books, but that would hardly be fair to the two people who jumped through Amazon's hoops.

Suggestions are very welcome.

User Journal

Journal Journal: Stupid Tourist! 2

At an impasse with Voyage to Earth, I hacked out another short story today. Unfortunately, I wrote it in Open Office and slashdot refuses to preview properly; in preview it looks fine but when posted the smart quotes turn to garbage. So rather than pasting it here, I'll have to send you to somewhere less stupid.

User Journal

Journal Journal: The Time Machine

I just added another title to my web site: H.G. Wells' The Time Machine. I hadn't realized that book was 8000 words short of being a novel.

It only took a day or so to fix up, but then it isn't a fat book like Huckleberry Finn, which has so many illustrations that I'm going to have to upgrade my space on the server (as if this hobby doesn't already cost too much). The Time Machine only has three pictures.

Speaking of Huck, like I mentioned, I hadn't read it in decades. I discovered on reading it that Sergy's kid did NOT, in fact, coin the word "Google". The word "Googling" is in chapter 29: "The duke he never let on he suspicioned what was up, but just went a goo-gooing around, happy and satisfied, like a jug that's googling out buttermilk; and as for the king, he just gazed and gazed down sorrowful on them new-comers like it give him the stomach-ache in his very heart to think there could be such frauds and rascals in the world."

Do you think that they'd have named it something else if they knew that "googling" had to do with lack of speed? I found it rather amusing.

You've probably noticed that the posted books I didn't wrire are referenced in the ones I did. I wish I could post Asimov's The End of Eternity.

I should get back to Mars Bars and Random Scribblings...

User Journal

Journal Journal: A New Old Book

About six months or so ago I decided to take a break from writing and do some reading, so I pulled an Asimov collection from the shelf. After half a dozen or so stories, I thought I'd read something that wasn't science fiction. Huckleberry Finn was on my mind, and since my copy was somehow lost I decided to just read it on the web; I remembered it being a really good book, though I hadn't read it in decades.

All the online versions sucked; archive.org, gutenberg.org, the .EDUs, it didn't matter. All had extraneous bullshit and looked thrown together carelessly.

So I thought I'd assemble one that didn't suck; one with borders, a book font, proper justification, all the illustrations by the original illustrator, and put there with thought rather than <p><img src="illustration.jpg"><p>.

I see why the rest looked hastily thrown together; it was a hell of a lot of work. I've been at it full time for a couple of weeks, and although I've posted it at my web site there are still a few bugs.

If you decide to read some Twain and see some bugs, please let me know.

The book isn't really about Huck. It was about Jim. It was an abolitionist book about the horrors of slavery, written before the Civil War.

Folks were sure different back then.

Slashdot Top Deals

Thus spake the master programmer: "After three days without programming, life becomes meaningless." -- Geoffrey James, "The Tao of Programming"

Working...