Category Archives: computers

The The The The The

Hi, I’m just testing something here.

I don’t know if you notice this kinda stuff, but I do.

If you have “Enable Post Pages” set to Yes on the Archive section of your blog settings, each post you create actually results in the creation of a separate webpage.

The name of the webpage filename will be some form of what the title of your post is.

For example, for my Negative Space Signage Update post, the name of its HTML page is “negative-space-signage-update.html”.

There are rules which cause deviations from this naming convention. For example, if your post title is really long, your HTML filename will just use the first handful of words (if I am bored at some point, maybe I’ll figure out the length where the cutoff occurs). If your post title has punctuation, the punctuation is omitted from the HTML filename.

I have also noticed some common words (“a”, “an”, “the”) are omitted as well. For example, Here Come The Birds becomes “here-come-birds.html”.

Which brings us to this post. What if I have a post that only consists of words that are normally omitted?

I don’t know what’s going to happen.

So, I publish this, and hope Blogger doesn’t break. Although it would be kinda cool if I broke Blogger.

UPDATE:

Crazy… The title of the webpage of this post is “the-the.html”.

I’m wondering if the first “The” is disregarded, then it takes whatever follows the “The” as a word for the post title.

Something like this

The The The The The

Oh you can bet I’ll be testing this some more. More excitement to follow!

UNIX Script Goodness And Variable Prefix/Suffix Stripping Fun


Here’s something you probably have no interest in, but it’s a script I wrote to help me with UNIX shell programming that I engage in from time to time.

There’s a nice way of easily taking a piece of text (often called a “String” by programmer-types) and stripping off pieces of it, either from the front or the back, using variable evaluation.

One thing to note about UNIX is that are many, many different ways to do the same thing. This is just one little feature of UNIX I like to use.

I wrote a script to help me when I want to do this prefix/suffix stripping kind of variable evaluation.

Here is the script in its entirety:

function showUsage {
print
print ‘USAGE:’
print ‘ksh -f variableTest.sh
print
print ‘=============================================================================================================’
print ‘${variable#pattern} evaluates variable, but removes the smallest portion of its prefix which matches pattern.’
print ‘${variable##pattern} evaluates variable, but removes the largest portion of its prefix which matches pattern.’
print ‘${variable%pattern} evaluates variable, but removes the smallest portion of its suffix which matches pattern.’
print ‘${variable%%pattern} evaluates variable, but removes the largest portion of its suffix which matches pattern.’
print ‘=============================================================================================================’
print
print ‘Special instructions:’
print ‘======================’
print ‘To stop the shell from interpreting wildcards you may use for patterns,’
print ‘run this script like the following:’
print
print ‘ksh -f variableTest.sh
print
print EXAMPLE: ksh -f variableTest.sh aabbcc \’a*\’
print
print
exit 1
}

clear

if [ $# -ne 2 ]
then
showUsage
fi

variable=$1
pattern=$2

print
print ‘=============================================================================================================’
print ‘${variable#pattern} evaluates variable, but removes the smallest portion of its prefix which matches pattern.’
print ‘${variable##pattern} evaluates variable, but removes the largest portion of its prefix which matches pattern.’
print ‘${variable%pattern} evaluates variable, but removes the smallest portion of its suffix which matches pattern.’
print ‘${variable%%pattern} evaluates variable, but removes the largest portion of its suffix which matches pattern.’
print ‘=============================================================================================================’
print
print ‘variable: ‘ $variable
print ‘pattern: ‘ $pattern
print
print ‘${variable#pattern} ‘ ${variable#$pattern}
print ‘${variable##pattern} ‘ ${variable##$pattern}
print ‘${variable%pattern} ‘ ${variable%$pattern}
print ‘${variable%%pattern} ‘ ${variable%%$pattern}

Most of this script is just printing stuff out to the screen. There’s a whole big piece of code that just tells you how to run the script.

Anyways, say you want to find out what directory you are in on a UNIX file system, and want to save this off in a variable, but without all the nested subdirectories your directory rests in (UNIX is all about the nested subdirectories).

You can use this script to figure out the right pattern to get your current directory minus the path.

Example:

Let’s say I’m in:
/usr/appl/abc/very/very/long/directory

After some trial and error running my script, I can eventually figure out how to get my current directory, minus the path.


>ksh -f variableTest.sh /usr/appl/abc/very/very/long/directory ‘*/’

variable: /usr/appl/abc/very/very/long/directory
pattern: */

${variable#pattern} usr/appl/abc/very/very/long/directory
${variable##pattern} directory
${variable%pattern} /usr/appl/abc/very/very/long/directory
${variable%%pattern} /usr/appl/abc/very/very/long/directory

Your current working directory (including the path) is stored in a variable called $PWD.

So, to get your current working directory only in a script you are writing, you can just write the following line:


MY_DIRECTORY=${PWD##*/}

Why did I write a script to do this? Because I can never remember how the pattern matching works, and thought it would be easier to write a script to show me instead.

Now, you’re probably asking me, “Splotchy, why would you put something in a program that many, including you, do not fully understand or remember how it works?”

As Matty Boy would say, that’s a great question, hypothetical question asker!

One thing that I neglected to mention about UNIX programming is that it is notoriously squirrelly. And this feature I am making use of is pretty damned squirrelly, too.

Oh no! Not YOU again!

          _                         _
         |_|          ___          |_|
         | |         /___\         | |
        _| |_      (| ‘o’ |)      _| |_
      _| | | | _    (_ – _)    _ | | | |_ 
     | | | | |’ |    _| |_    | `| | | | |
     |          |   /     \   |          |
      \        /  / /(. .)\ \  \        /
        \    /  / /  | . |  \ \  \    /
          \  \/ /    ||_||    \ \/  /
           \__/      || ||      \__/
                     () ()
                     || ||
                    ooO Ooo

An ASCII Monkey Gives You The Finger

          _                         _
         |_|          ___          |_|
         | |         /___\         | |
        _| |_      (| ‘o’ |)      _| |_
      _| | | | _    (_ – _)    _ | | | |_ 
     | | | | |’ |    _| |_    | `| | | | |
     |          |   /     \   |          |
      \        /  / /(. .)\ \  \        /
        \    /  / /  | . |  \ \  \    /
          \  \/ /    ||_||    \ \/  /
           \__/      || ||      \__/
                     () ()
                     || ||
                    ooO Ooo

What’s In Your Keyboard?

Okay, so we have played What’s In Your Clipboard? here and here.

I’m sure you’ll appreciate this new game.

Here’s how you play…
WHAT’S IN YOUR KEYBOARD?

1) Take your computer keyboard and turn it upside-down.
2) Bang the bottom edge of your keyboard on a hard flat surface for a good five or six minutes (if it is a laptop, you might want to tap rather than bang).
3) Take the detritus which falls out of your keyboard and push it into a pile.
4) Photograph the pile.
5) Put the photograph in a secret place. This photo is to remind you to clean your keyboard frequently — do not share this photo with anyone under any circumstance, because they most likely will shun you for the rest of your life.
6) Post a comment here to indicate how sparkly clean and grunge-free your keyboard naturally is!

Repeat as necessary, and most importantly, have fun.

Splotchy, The Artificially Stupid Robot

I’ve used the word “Splotchy” for a pretty long time.

I have been using the domain name Splotchy.com since 1999, and was probably was using “Splotchy” for other websites a year before that.

What’s the significance of the word to me? None, really. I just like it. That’s pretty much it.

Seeing as I have been using this word on the web for a long time, you’d think there would be a fair chance I might come up first in a search engine looking for it.

But you’d be wrong. This comes up.

Meet Splotchy, the Artificially Stupid Robot.

You can type comments or questions to Splotchy, and he answers in his own inimitably stupid way.

Here’s a transcript of a recent conversation between myself and the dumb robot.

I, Splotchy ==> why do you come up before me in google?
splotchy the robot ==> I always come up before you in google

I, Splotchy ==> Why do you think that is?
splotchy the robot ==> I am genetically programmed to think that is

I, Splotchy ==> Do you really expect me to believe you are intelligent, and aren’t just a series of canned phrases programmed to respond to key phrases you find in a question?
splotchy the robot ==> so what if I really expect you

I, Splotchy ==> So that’s what passes for an intelligent response?
splotchy the robot ==> what is it you are getting at?

I, Splotchy ==> You’re a phony and I don’t love you any more.
splotchy the robot ==> you should

I, Splotchy ==> Should not
splotchy the robot ==> you bet

I, Splotchy ==> Bet what?
splotchy the robot ==> hugh?

I, Splotchy ==> Visit http://isplotchy.com/blog, where what little intelligence in evidence is natural, baby!
splotchy the robot ==> ga-ga-goo-goo

How Computer Programming Pollutes The Mind

This post will probably not make sense to you. Still, I’ll soldier on.

As I had a quick lunch over at the UIC cafeteria today while picking up a schoolbook for MizSplotchy, I noticed a Studs Terkel autograph on a poster where he had also scrawled “Peace = Sanity”.

The first thought that popped into my head was, to properly indicate equality and not assignment, he should have used “==” instead of “=”.