20090220

My Art

This was what I did tonight/this morning.

Media: Duncan Donuts coffee grounds (regular blend), rubber cement, old coffee, old green tea, Colgate Whitening Bubbles toothpaste, Jelly Bellys, echinacea supplements (pill and crushed), Edge gel shaving cream, Joy ultra concentrated lemon dishwasher detergent, Speed Stick deodorant on 8.5x11 medium weight copy paper.  "Paintbrush" constructed from wooden chopsticks, Kleenex tissue, rubber bands.

I call it 'Collapsing Hydrocarbon Waveform'.

20090113

Bash 101

So are you new to Linux?  Are you the kinda person who's like "Awesome, Linux!" and you're also like "Awesome, Command Line Interface (CLI)!", but you're also like "I don't know how to use the command line effectively and desire to know more on this topic in order to advance my knowledge of the Unix world!"

If so, this article is for you.  It's really just to get you started.

This isn't really a technical guide.  This is a list of practical tips that, looking back, I wish I had seen somewhere when I started to make myself use the CLI on a regular basis.  Once you get used to the CLI, you start to use it a lot; on my Linux box, the only window I usually have open that isn't a terminal is Firefox.  Everything else - with a few exceptions - can, in my opinion, be done effectively from the command line.

So here's my list of tips for the CLI beginner:

1. Make use of auto-completion
This is a small tip, but useful if you don't already know it.  If you're using the bash shell, you can usually press
[ Tab ] to do this.  In other words, say I have a directory I want to cd (change directory) to:

  • user@localhost:~$ ls
  • Directory_1 Directory_2 Directory_3 Other_Directory
  • user@localhost:~$ cd Directory_2

Instead of taking the extra few seconds to type in "Directory_2", you can simply start the word and press tab.  In this case, suppose you type "Dire[ Tab ]".  As soon as you press [ Tab ], the shell will complete the word "Directory_" for you.  It won't, of course, put the number, because there's more than one choice.  If you had typed "Oth[ Tab ]" or even just "O[ Tab ]", it would completely fill the word "Other_Directory" for you.

This same tip will work if you are starting to type an executable name in your
$PATH (the variable that knows where to find all of your executable files).  Suppose you wanted to run the program gnome-system-properties from the command line (which would actually launch a GUI, but can be useful anyway).  To speed things up, type a few letters and hit [ Tab ].  Bash will complete the string as far as it can until there is any uncertainty, which probably means up to 'gnome-'.  Perhaps you've forgotten the exact name of what you're trying to run?  Hit [ Tab ] again and you'll be given a list of possible completions.  Start typing again hit [ Tab ] to complete if you get lazy.

You will still, however, have to press
[ Enter ].

P.S. - If this isn't working, you might not be using the bash shell (type set | grep SHELL or something reasonably equivalent to find out what you're using).  This doesn't mean all hope is lost.  If you're just in plain old sh, for example, you can use the wildcard character '*' to complete your phrase.  In the first example above, then, you could type 'cd Dire*2' to go to Directory_2.

2. Understand I/O Redirection
As many people will tell you, piping and I/O redirection is perhaps the most powerful part of the nature of the CLI.  Take this example:

Suppose you had to build a toy car.  You need someone to carve the right shape, someone to put on the wheels, someone to screw everything in, and someone to put it in the correct package.  In one case, you could give the car to the person who carves it, and then take it back.  You would put the car in a box and go find the person to put on the wheels.  When they were done, you would package it and take it to the person adding the screws.  Finally, you would put it back in a package and take it to the person who puts it in the package for marketing.

In another example, though, you could setup an assembly line and use a conveyor belt.  This removes your role as the messenger and removes the intermediate packaging.  This second example is analogous to the CLI.  Whereas in the GUI example one has to use a program, save the result, and then open a whole new program, the CLI-master can simply tell each program in line to pass on their result to the next program.  You might write, for example:

  • user@localhost:~$ carver | wheeler | carpenter > correctBox

Here, the carver program sends it's output to the wheeler program which sends it to the carpenter program which then writes all of its output to the file correctBox.

As a more useful example, consider this command in my .bashrc file:

  • alias dl = 'ls -laht | sed -n /^d/p'

After the next two tips, you'll understand what that does.

3. Use Stream Editors
More specifically, I mean that you should try to understand the power of commands like
sed and grep.  Programs like these can help you get the data you want from other commands.  Say, for example, that I wanted to find all of the C source files in my ~/Code directory.  I might write something like:

  • user@localhost:~$ ls Code | grep '\.c'

First of all, do you understand why simply grep .c doesn't give the same results in general?  If not, we'll get to that in a second.  Right now just realize that the period is a special symbol (a metacharacter).

The above command does this:  first, it uses the
ls command to print out all of the regular files and folders in the directory.  The grep command then receives these filenames (just the names, not actually the files) as they are generated, and it selectively decides which ones to output.  In this case, it only prints out the strings which contain the substring '.c', which is more-likely-than-not a C source file.  Of course, if you happen to have a file called "a.b.c.d.e.txt", it will catch this as well.

For dealing with more advanced structured, we can use
sed (among other tools); that, however, is a topic beyond the scope of this article.  As a basic primer, it can be said that sed usually operates on text using regular expressions, a powerful tool that the Perl hacker may already be familiar with.  This is what it does in the above example; for everything output by ls -laht (which, by the way, is a listing of the current directory in Long form with All files listed (as opposed to only non-hidden ones) in Human-readable file sizes, sorted by Time modified), sed only lets through lines that start with the letter 'd', which, using ls's long form, means that they are directories.  That's why I called this alias dl - it stands for directory listing (in my head, at least).

It should be noted that this is only a basic usage of
sed, and in fact this exact same thing can be done with grep (ls -laht | grep ^d).  That '^' in both the sed and grep expressions is called a metacharacter.  Just like the period that we were searching for in the first grep example above, we would have to backslash-escape the character like this if we actually wanted to search for the character '^':

  • user@localhost:~$ ls -laht | sed -n /\^d/p

In this case, '^' would no longer mean 'beginning of line'; instead, it tries to find the caret symbol within the inputted text.

4. Force yourself to use the CLI by trying to do everything with it until it gets to the point where you know where you want to be.
This is an interesting point that other people might not suggest, but I did this and it seemed to work.  If you really do have a desire to use the CLI but don't know how, just try forcing yourself to use it.  I did this by installing Fluxbox as my desktop environment and making the only two things in my menu 'firefox' and 'gnome-terminal'.  I use Alpine for my mail, VIM as my editor, Irssi as my IRC client, CenterIM as for Google Talk, and then I usually have one or two other terminals open just for kicks.  One probably has Nethack open.  The only non-terminal based program I use in Linux is Firefox, because the the Web really has evolved beyond the reasonably capacity of, say, Lynx (some might argue that point).  I also use VLC occasionally to watch movies, which obviously can't be done in the CLI.  I used to even use the CLI for playing music, but since my music started being centralized on my Mac, I usually just plug my speakers into my iPod.

So I suggest you do something similar - just keep Googling things like "best CLI programs" or "favorite terminal applications" until you know a reasonable amount about what's out there (and what's good) for the command line.  Make yourself use them for a month and see how you feel.  I decided not to go back (although I can't say that very well now that I have a Macbook, but it was true for a long time up until a few months ago).

Best of luck!

5. Links & Resources

Bash Beginner's Guide
Advanced Bash Scripting
Linux Shell Scripting Tutorial
CLI Apps
Favorite Command Line Programs

20090110

SCTA-1

Since this is my personal blog, I thought I should share a bit about a personal project.  Sherwin and I have just finished what we think is a stable build of our encryption algorithm SCTA-1 (Stream Cipher Test Algorithm 1).  You can read about and download it at our SourceForge.net site.

Don't trust it for your encrypted data just yet though.  We're going to see if we can find any cryptanalysts willing to find weaknesses before we get too excited.

It's definitely been a fun project to work on, though.  Lots of brainstorming, mathematics, and even some physics.  I wouldn't mind doing something like this for a living.

20090109

Windows 7: OS X

So I was looking reading Friday's xkcd, I did a bit of exploring on Windows 7. I have to admit, from what I've seen, I think it'll be a big improvement over Vista. This doesn't mean I'll use it, of course; I just think it'll be a better experience for most users.

In fact, some of the stuff they were doing just looked suspiciously good to me.  And then it hit me - they're OS X-ifying Windows!  I don't have a problem with that, per se; as a matter of fact, it's kind of nice to see that Mac is enough of a threat that Windows is being forced to let go of some older, clunky models in order to compete in the market.  What kind of stuff are they doing, then?

The biggest thing that tipped me off was the new taskbar.  It is, virtually, OS X's dock.  You can now drag frequently used programs to the taskbar and use stack-like structures to manage files and applications... just like OS X.  Sadly, though, Windows seems not to have adopted OS X's method of managing processes.

Touch screen capacity is something else that's been added to Windows 7.  Of course, touch screens have always been available in the sense of hardware mouse emulation, but now the touch interface is recognized by Windows and special features, including some gestures, are available.  The Windows site made it unclear as to whether or not multi-touch is available.  This is, again, a technology Apple has been in the spotlight on; I commend Microsoft, however, for beating Apple to making touch displays a part of their OS.

Perhaps most exciting is the introduction of Internet Explorer 8, because it probably forcasts more failure for Microsoft.  It's the same ugly, clunky interface we saw in IE 7.  I really wish Microsoft would scrap this technology and rebuild their approach to web browsers from the ground up.

Windows Live has some new advancements that seem to be encroaching on Apple's MobileMe service; but as I use neither of these services, I can't really comment with any authority on what's going on there.

It's, strangely, one of the smaller new features in Windows 7 that made me consider OS X possibly taking away a good market share from Windows in the near future; their new device management system apparently does an amazing job recognizing and configuring devices.  This is great news, of course, and something that OS X has also done well in the past.  The Microsoft video demonstrated plugging in a device and showed the dialog popup that provided options for, among other things, syncing the device's calendars, music, etc.

I think the problem Windows is going to see soon is the barrier to entry they've created for good open source software.  Apple provides developers with clean and extensive tools and documentation on their operating system, while Microsoft's developers tools are hidden away inside their Visual Studio suite.  OS X is particularly nice to work with, of course, because of BSD under the hood; but even so, Apple's attitude toward developers seems so much more inviting than Windows that I think we'll see a lot of developers shift to working primarily in OS X (Paul Graham had already noted in 2005 that many of his hacker friends were converting to macs).

The calendar syncing is what made me think of this.  I'll admit that Apple is very stingy about iTunes/iPods, but, otherwise, they make it quite easy to interact not only with the system but with Apple's own software.  AppleScript and Objective C both offer extensive compatibility and command over the components of OS X, iLife, and other Apple software.  I doubt, however, that you can sync your mobile device with anything but Outlook in Windows 7. (Note; I'm not saying that Apple doesn't want you to use iCal.  I'm saying that it's much easier for a developer to write a quick script to sync with something other than iCal through an OS X interface than it is to do a similar task in Windows).

And... apparently, they're calling themselves Windows Gurus now.

Huh.

Anyway, I'm really looking forward to seeing MS market share go down.  Shareholders?  Now is the time to switch to Apple.

You can find more information on Windows 7 here.  Since Microsoft just doesn't understand the idea of standards and collaboration, though, I think you'll need to install Microsoft Silverlight to see the videos. I guess Flash or even embedded video just isn't Windowsy enough.

exposition on the paradox of philites

Jackson, I stole your phrase "convenient fiction" from Facebook.  I liked it, and I hope you don't mind.

***

EXPOSITION ON THE PARADOX OF PHILITES
Matthew Daniels

There is a curious force behind the Philites which one can only know once one associates long enough and close enough to that group. A race of would-be intellects, seeded with the forlorn philosophies of a more cynical age, the Philites are to be found in most corners of the developed world.  They are oftentimes sad, in pain, or in a state of distress, oftentimes of their own choosing.  This is the paradox of the Philites; they submit themselves to these states of what we foreigners can only surmise to be the manifestations of awkward philosophies of life, from which happiness will bloom at some time and location to be announced at a later date.

Why does the Philite do what he does?  Why does he shun reason?  Why does he profess stupidity at every turn, but continue to act in the manner with which he claims to clearly see the fault?  And why is that anger blinds him so much more quickly than his fellows?
This may be a task more suited for the psychologist than the philosopher, but we shall take a stab at it nonetheless.  What follows is what we hypothesize and investigate.

The Philites are a weak-minded group; not necessarily in the realm of intellect, but it is clear that the survival of their mental state depends on social confirmation.  This is odd, indeed, since each and every Philite will undeniably claim to be a unique individual, and that this individuality is indeed the highest trophy of their being.  Those of us on the outside looking in, of course, can clearly see how false this is.  I do not argue that each and every person is not unique - it is my belief that each soul is built with a bit of a craftsman's touch, and that the slightest details can make a person a special character unlike any other.  But I do argue that in a quest for individuality (which we may all face at some point or another), the Philites take the easy way out - they conform to a culture whose members claim not to conform.  It is a prebuilt package for freedom; a cookie-cutter philosophy for those rushing to establish with the world that they are, in fact, individuals.  The Philite culture is a convenient fiction of rebellion and contempt for society, fabricated and delivered to those not ready to pursue their own dreams.

The adoption of Philite culture is not unlike subscribing to some magazines.  The middle aged man who has always wanted a sailboat, but is too nervous to pay for one or to sail one, may just subscribe to a sailing magazine to satiate his own fictions. The widow who no longer tends her garden may nonetheless subscribe to Better Homes and Gardens, if only to remember what her garden was like and fantasize about the new flowers she might - but will probably not - plant in the spring.

In the same way that the woman hides in the colorful pages of Better Homes and Gardens instead of tending to her own garden, thirsty for attention, the Philite hides beneath the mask of a synthetic freedom as his life and its opportunities shrivel up.  He may adopt habits that accent this lifestyle, as well - he is oftentimes a smoker or drinker trying to relieve the "pain" of life which his culture seems to pursue so vigorously.

The practicing Philite will loyally argue that this is all false.  He will likely maintain that all the choices he made were unbiased and simply the manifestation of his own being. In particular, he is quite certain that no Philite representative knocked on his door one day with a membership form.

But of course, a representatives have been knocking on his door for years.  These representatives are the music, movies, and other cultural pressures which together are the identity of the Philite way.

***

To be proofread, edited with a hatchet, edited with a scalpel, and concluded...

20081222

f[8,9,10,11] user guide

We (the Fedora Documentation team) just finished reorganizing the User Guide for Fedora 8 (we're kinda behind).  It can be found at https://fedoraproject.org/wiki/F8_User_Guide.

I recently volunteered to take the lead on the User Guide, and one thing we're trying to do is catch up to F10 while also cleaning up our style and organization (this is something the entire team is looking at for all our docs).  One thing that we are particularly pushing is new user friendliness.

So if anyone is willing to, please take the time to look at that user guide above, browse through a few sections, and send me some suggestions on... whatever.  Does it say something that perhaps you have no clue about?  Something that an experienced Linux user writing it might understand, but that you, the new user, can't decode?  Help me out here by showing me the weak points in our communication.

And hey, if anyone is feeling really volunteery, you can join the Fedora Docs team and help edit these documents.  No experience is necessary, and in some cases (like making things more new-user friendly) a lack of experience can be pseudo-desirable.  Just let me know if you're interested.

20081206

printer god

So about a month or two ago, I  posted this blog entry: when you give a moron a printer. It was about me getting upset because I reloaded a paper tray in the library printer and had to wait for the past 40 minutes worth of documents to come out.  What really upset me was that, among those documents printed, I got three copies of a girl's bank information, including username, password, SSN, address, mother's maiden name, etc.

Today, the library has no extra paper available.  I've come to print a lot of stuff, and am sitting right by the main East printer.  It turns out that, while trays 2 and 3 are empty, tray 4 is stocked plenty full of paper.  The issue is that the printer won't default to tray 4; it always asks you to confirm skipping over both trays 2 and 3 before drawing from tray 4.

That's fine.  You just hit the confirm button a few times and it works.

But nobody seems to understand this.

So today, I'm the printer god.  I'm a deus ex machina, making sure your documents are successfully printed.

I even wrote a fucking sign, that looked like this (except in blue gel pen):
Hit the green button twice for your title page, then hit it two more times for your document.
I put this notice right next to the viewscreen on the printer.  The one that tells you to confirm going to tray 4.  But apparently people look at neither the bright blue screen nor my dark blue ink; they just get upset because their document isn't printed.  They don't notice the green "Attention" light blinking away furiously, begging them to look at the status on the blue screen.  They just sigh and whine.  So I reach over and double tap the button for them.

This all goes back to my idea that we should seriously be doing more educating in school about basic computer, networking, and printing.  Kids need to know this stuff.  CCIT wasn't even open in the library today, so there was nowhere to go for help.  People need to learn the basic operation of networks and peripherals, and they need to know how to interpret the controls of a basic machine.  They'll need to; our reliance on them is going up drastically, and will continue to do so.

So please, do a bit of practice with your own printer, scanner, et cetera.  Friends don't let friends be idiots with printers and networking devices.