June 15

Quickly Check Crontab Path for Running Bash Scripts

Posted by seditiousbroom

sudo bash
echo $PATH

Use output to update the PATH= line at the beginning of the desired crontab.

May 24

VIM Configuration for Writers

Posted by seditiousbroom

This article is not meant as defense for using vim as a writer's tool. Instead, it offers solid version control in a single backup directory. Each time vim is used to view or edit a file it creates a new backup file in the $home/archives folder. Each backup file includes an ISO 8601 formatted date stamp in the filename.
  1. # cd $home
  2. # mkdir archive
  3. Edit .vimrc to include the following:
    "Version control backup with ISO 8601 date stamp in filename
    set backup
    set backupdir=$HOME/archive
    set directory=$HOME/archive
    au BufWritePre * let &bex = '_' . strftime("%Y-%m-%d") . '~'
A few other .vimrc options to consider:
  • "Enable the backspace key to delete previous characters
    set bs=2
  • "As-you-type spell check usingdefault language dict if installed
    set spell
  • "Word wrap that only adds line break when you press Enter
    set formatoptions=1
    set lbr
  • "Enable incremental search without case sensitivity except explicit caps
    set incsearch
    set ignorecase
    set smartcase
  • "Buffer scrolling
    set scrolloff=3

December 31

Accidental Hedonist v9.1

Posted by seditiousbroom

This version of the Accidental Hedonist, the popular food blog, was mostly a new header. The absinthe lady returns in a transparency with a border fade near the bottom third of the picture. A new font with three-layer drop shadow was used for the name of the web site. Also, new, themed, colorized RSS buttons form a menu across the top.

AH retains the recently created static, four-column layout in whites, browns, and reds. The site is largely run by a modified b2evolution engine with advertisements from blogads, Google AdSense, and others.

Several spam prevention techniques are used. E-mail spam is blocked by using a secure mail form for web site members and also a clever trap set for bots that collect e-mail addresses. Referrer spam is turned away via b2evolution's built-in blacklist. Comment spam is filtered by both b2evolution's built-in blacklist and a turing test plugin.

Other features include:

  • polls (Democracy plugin)
  • written works status bar (custom code)
  • 1-click RSS subscriptions (to web-based services such as bloglines)
  • user food journals (b2evolution, autoblog plugin, and custom code)
  • list of most recent user food journal posts (custom code)
  • simple print pages (custom code)

December 27

Install New Fonts in Ubuntu Linux 8.10

Posted by seditiousbroom

If you wish to install a new font on Ubuntu Linux:

  1. Find the font you like and download the .ttf file. Select the .tff files and copy (ctrl+c) them to the clipboard.

  2. Save anything you are working on and close all open applications.

  3. Open your home folder with Nautilus (default file manager on default Ubuntu installations)

  4. Click the View menu option and select Show Hidden Files.

  5. Look for a folder named .fonts. Open that folder and paste (ctrl+v) the previously copied .ttf files into the .fonts folder.

  6. Open your terminal of choice. On default Ubuntu installations the gnome-terminal is available under the main Applications > Accessories menu. Type of copy+paste the following and then enter your superuser password:

    sudo fc-cache -f

  7. Allow your computer a few minutes to rebuild the fonts cache. A new terminal line with your username prompt will appear when the fonts cache is rebuilt.

That is it. You should be able to select the new fonts from within all variable font applications on your linux box.

December 16

Accidental Hedonist User Journals

Posted by seditiousbroom

Food Journals for registered users of Accidental Hedonist are now active. All new users will be asked if they wish to create a blog on Accidental Hedonist during registration. This makes Accidental Hedonist into a sort of food blog network. If you are not a registered user on Accidental Hedonist and wish to sign up, please go here.

If you opt to create a new blog, your username will be used in the blog's address. Please choose your username accordingly. Food journal addresses will look something like:


Many thanks to Francesco Castronovo for the b2evolution autoblog plugin. I had to (and likely will continue to) hack it quite a bit for use as Kate wished on this site. However, it provided a very useful starting point.

I am still working out the bugs, but basic blog creation, posting, editing, and all that good stuff works reasonably well. I'm documenting changes to the live software (but not the changes I'm testing) here.

November 24

MediaWiki Word Count Tab

Posted by seditiousbroom

My National Novel Writing Month project just passed the 40k mark, and I find that I'm in need of a little structure. I know basically what I want for my final two 5k chapters. I have to line a few ducks first, though.

I slowly started putting everything into a wiki last week. Then, yesterday, when I crossed the 40k word barrier, I sped up the process so I could finish. At first I went with Wikka Wiki. It has a cute, handy, and easy to implement word count action. Copy the code. Paste it into a new document. Name the document and upload it to the right directory. Done. Wikka Wikki has ease of plugins down to a science.

However, my first love is MediaWiki. So I did a fair bit of digging and came across a reasonable little word count hack for MediaWiki page content. Thanks to Kishore Asokan.

MediaWiki Article Word Count

// Getting the total words count
global $wgUser, $wgArticle, $db;
//check if its an article
if($wgArticle && !$_GET['action']) {
$stripped= strip_tags($c);
$exploded=explode(" ", $stripped);
//you can print this variable anywhere you want on the page


I played with the code a bit, but eventually left it as it was. The code is not perfect. It doesn't give an exact word count, but neither do most word processors. What I get is a very reasonable estimate.

I stuck it on a tab in the MonoBook skin and love it.

Here's how:

  1. Download and install MediaWiki, if you haven't already.

  2. Assuming you use the MonoBook skin for MediaWiki, open: skins/MonoBook.php

  3. Around line 124, find:

    echo htmlspecialchars($tab['text']) ?></a></li>
        <?php         } ?>

  4. Insert two line breaks immediately after <?php } ?> but before <ul>.

  5. At the first new line break, copy and paste the MediaWiki Article Word Count code above.

  6. At the second new line break, add a little formatting and a label to fit the word count into a cute, little tab:

    <li><font color="blue">&nbsp; <?php echo $totalwords ;?> words &nbsp;</font></li>

  7. Save the skins/MonoBook.php file and upload it to your server.

When you finish, there should be a word count tab at the top of every article page. Some special pages will show the word count tab as well.

October 19

NaNoWriMo Progress Bar

Posted by seditiousbroom

This is a quick and dirty php and css progress bar. Technically, the code could be used as a progress meter for almost anything (rebuilding a car, stock kept in a pantry, whatever). Consider this code freeware and use it as you wish.

  1. Right-click this file (it's plain text, so no virus worries) and save it to your documents folder or desktop.

  2. Make a few edits.

    • Change the text in quotes after book_title from "My NaNoWriMo" to "The Title of Your Book". Be sure the quotes, equal sign, and semicolon remain. Edit only the text between quotes.
    • Change the zero after book_current_wordcount to match your NaNoWriMo book's current word count. Update that number as often as you like. Remember that, unlike the book title variable, the number after book_current_wordcount does not require quotes. The semicolon must remain though.
    • Optional

      • Change the word meter's border in the style section. The color code is just below the CSS comment: Change border color here
      • Change the color of the word meter itself in the style section as well. The color code is just below the CSS comment: Change progress bar color here

  3. Put the code on your web site. That can be done in several ways. The most common are:

    • Copy+paste your modified code (with the name of your book, etc.) into a spot on your blog's sidebar. Add a header if you like.
    • Save the code as book_progress_1.php (or a similar name), upload the file to your server in the same place as your other template files, and include book_progress_1.php in your sidebar:

August 22

Personal Spelling Dictionary in Firefox 2

Posted by seditiousbroom

I was half asleep, sipping my first cuppa, and misspelled restaurant while typing in a text field. Okay, that's no big thing. I right click and... Doh! I selected the Add to dictionary option as opposed to the correct spelling of restaurant.

No worries. I did a little digging and found that the personal dictionary for the spell check engine used by Firefox 2 is a flat text file named persdict.dat. It is stored in the top level of Firefox profiles. If you also made this mistake and wish to fix it:

  1. Copy and paste these instructions to a handy text editor or print them. If you were editing something important before adding the wrong spelling of a word to your dictionary and you still have that web page open, copy and paste that text to a text editor as well.

  2. Close Firefox 2. FF2 must save new words to the persdict.dat file before you may edit it. That save is done after Firefox 2 is closed.

  3. Find your Firefox 2 profile. Default locations are usually as follows.

    1. Windows XP/2000: C:\Documents and Settings\[User Name]\Application Data\Mozilla\Firefox\Profiles\

    2. Windows Vista: C:\users\[User Name]\AppData\Roaming\Mozilla\Firefox\Profiles\

    3. Windows 95/98/Me: C:\WINDOWS\Application Data\Mozilla\Firefox\Profiles\

    4. Linux: ~/.mozilla/firefox/

    5. Mac OS X: ~/Library/Application Support/Firefox/Profiles/
  4. Open your profile folder. Depending on your installation, the folder may bear your user name. If it doesn't, look for a folder with a name scheme similar to xxxxxxxxx.default.

  5. Find the file named persdict.dat and open it with a text editor.

  6. Delete the incorrectly added word.

  7. Save the persdict.dat file and close it.

That's all there is to it. Reopen Firefox 2 when you're finished and the incorrect spelling will be gone from FF2's spell checking dictionary.

Copy + Paste any text you were editing back into the original web page text field, and you're golden.

June 18

b2evolution skin: l33t_gray

Posted by seditiousbroom

Winner of the 2004 evoSkins Competition.