Category Archives: geek

The

Okay, one last test. Though I am not promising this is my last test.

I predict that if there is only one word in a post title and it’s a normally omitted word, it will be used in the HTML filename regardless.

I imagine they have some extra little bit of logic in the Blogger code to handle this situation.

UPDATE:

Interesting! They actually don’t keep the omitted word, but substituted a generic “blog-post.html” as the HTML filename.

I imagine no one reading these test posts think they are remotely interesting, but I’m all geekily proud of myself. Good job, L’il Splotchy!

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.

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 “=”.

What’s In Your Clipboard?

I was working on an issue at work and thought I had a file system’s subdirectory in my clipboard (the mysterious place that data goes when you “Cut” or “Copy” it on a computer) which I needed to paste in at a UNIX prompt.

But, what I pasted was:
http://samuraifrog.blogspot.com/

So, what’s in your clipboard?