Thursday, May 30, 2013

WeMo and Linux

Finally got the WeMo to join my home network. The trick with the Android phone was: sheer stubbornness. I just kept hitting the green "Networks" button until it saw my home network. This after a week of messing with various Python scripts and Miranda.

Once it was on the home network, getting it to work from the command line was mostly straight-forward. My thanks to Eric Blue for the Perl library. The one issue that I did run into was that I learned that the belkin.db file is not portable, across machines. In short, each machine that will control the WeMo needs to "discover" it and record its own "belkin.db" file.

For the record, the WeMo is connected to the home network via WPA-PSK, on channel 11. I didn't need to set up any special channels or networks. However, I did need to install Net::UPnP::ControlPoint before discovery would work.

Notes will be in the wiki shortly (link at top of page).

Monday, May 27, 2013

Broken feed

My apologies. Just realized that, when I changed the tag line a couple weeks back, I'd used an illegal character in the description field. I've fixed it and ran the feed through a validator to check. It now only complains about the age of the namespace I'm using. To fix part of this, I'm pushing it through FeedBurner. The link for it is here.

I've also removed some of the junk from the front page and from the code that generates the static content. Please bare with me while I trim the mold off of the 10+ year-old code.

Monitoring the RPi's temp

Following is a simple Munin plugin that will monitor the temperature on your Raspberry Pi. Assumption is that you have Munin installed on the RPi.







#!/bin/sh

case $1 in
config)
cat <<'EOM'
graph_title RPi Temperature
graph_vlabel temp
temp.label C
EOM
exit 0;;
esac

echo -n "temp.value "
/opt/vc/bin/vcgencmd measure_temp|cut -d'=' -f2|cut -d\' -f1


Save the above as a file called "pitemp". You'll also want to edit /etc/munin/plugin-conf.d/munin-node and add the following entry:







[pitemp]
user root

Above will show up in the system's "Other" category. You can alter this by adding a line to the script. See Munin's "How to Write Plugins" page for more detail.

Sunday, May 26, 2013

Auto-update not necessarily good

Following is for my own notes and for anyone that needs 'em. Below is "the hard way" because I couldn't remember the changes that I'd made to the admin account's name and password.

Sat down yesterday to read the various RSS feeds with TT-RSS. Instead of the login screen, was met with a screen with a number of complaints about SPHINX, MEMORY, and a couple about crypto. The one at the top was "FEED_CRYPT_KEY should be exactly 24 characters in length" (it's what I searched with).

The cause turned out to be an automatic update for TT-RSS. The new version didn't like the old config.php file, because it was missing a number of new settings (four, IIRC). This part was easily fixable. I made a backup copy of the old config file (just to be safe), and then copied the new config.php-dist over the old config.php. In short:







cp config.php config.php.bak.20130525
cp config.php-dist config.php

Editing the usual settings in the new config.php fixed the getting-to-the-login screen issue, but I still couldn't log in. Instead, TT-RSS started responding with "Your access level is insufficient to run this script." The script remained unnamed.

A little bit of research later, it turned out that I needed to change a setting in the database. What was happening was that the new code was attempting to update the database schema but my account didn't have sufficient access to the MariaDB database.

With apologies to Postgres users, the following fix is for TT-RSS users who employ a MySQL or MariaDB back-end. In short, access the database from the command line and run the following:







use ttrss;
select id,login,access_level from ttrss_users;
update ttrss_users set access_level=10 where id=2;
quit

Of course, you'll need to edit the above to suit your own instance. The purpose of the select line was to check the access_level for my account. The update line gives my login admin-level access. The next time I logged in, I followed the prompts, TT-RSS updated the database, and everything went back to normal and I was able to log in.

To clean up, you'll need to set your access level back to the original value. Use the above steps to change access_level back to 0 (for a regular user account) or 5 (for a power_user account). An alternative would be to use preferences to reset the admin account password, log in with that account, and use "Preferences - Users" to change your user account's access back to that for a normal user.

The above needed to be done because I couldn't remember the admin username and password. If you do remember it, when TT-RSS complains about insufficient access, just log in with the admin credentials and skip the changes to the database.

Thursday, May 23, 2013

Getting myself in trouble

My wife once discovered me, laying on the floor of the office, mostly under the desk, not visibly moving. She panicked until she figured out that I was screwing the mounting bracket for a switch to the bottom of my desk. Ever since, there's been a hardware moratorium at our house.

Of course, there's been exceptions. She did buy me the Raspberry Pi last December. It's what I've been up to the last few nights, though, that may be ruining that exception or maybe even triggering a Crazy-Eddie-The-Used-Car-Salesman event (i.e., "everything must go!").

In an effort to cut back on the electric bill, I'm moving a number of "core" services off of the desktop computer (which draws 300W 24x7) and placing them on a "slightly modified" GoFlex Home and the RPi. This will lower the power drain by about 90 percent (less than 30W).

The dangerous part: the only place to put them (to be able to use wake-on-LAN to remotely start the house server) is on my wife's desk. Her desk has a hutch, which causes the monitor to hide a bunch of empty space behind it. I took advantage of it being dark back there and positioned the GoFlex in there with the LED facing where it can't be seen.

Earlier this evening, I was looking for an innocuous place to put the RPi. I discovered that her monitor has VESA mounts. Since the other half of her present to me was a VESA-mount case for the RPi, I wonder if she'll notice a couple extra cables (power & Ethernet) running to the back of her monitor. We'll see...

Tuesday, May 21, 2013

Scripted Xchat tab renaming

Following is a shell script that will rename a specific tab in Xchat. Reason I came up with this is that Bitlbee produces some very ugly channel names in Xchat. In one of the much older, branch versions of Bitlbee, there was a function that allowed you to rename the channel. This has since gone away.

While poking around in the Xchat command set, I found the settab command which allows you to temporarily (until the next join) rename a channel. A bit of further research showed a dbus interface to Xchat. From there, it was simple.








#!/bin/bash

#following renames specific channels in Xchat2

# "#192.168.2.215_docs" to "docs"

context=`dbus-send --dest=org.xchat.service --print-reply --type=method_call /org/xchat/Remote org.xchat.plugin.FindContext string:"bitlbee" string:"#192.168.2.215_docs" | tail -n1 | awk '{print $2}'`

dbus-send --dest=org.xchat.service --type=method_call /org/xchat/Remote org.xchat.plugin.SetContext uint32:$context

dbus-send --dest=org.xchat.service --type=method_call /org/xchat/Remote org.xchat.plugin.Command string:"settab docs"

The configurable bits are the two "string" entries in the line starting with "context" and the "settab docs" entry in the last line beginning with "dbus-send". Note: if you make an error in the "string" entries, the channel name for the previous call will be changed. (You'll know what I mean when it happens.)

Chain a bunch of these in a single script and you can mass rename channel tabs. Add a desktop launcher for the script and you can mass rename Xchat tabs with a single mouse click. Enjoy!

Saturday, May 18, 2013

Eating my own dog food

When working on Unix systems with other people, I often point out that rule #1 is "Read The Fine Manual". Alternative phrasing can include: "What's the man page say?" or "You should search Google for that." The idea being that they should get used to looking things up. Asking questions should be the method-of-last-resort.

That being said, it looks like I need to be eating my own dog food. At one point, early in the development (it may have been a branch) of Bitlbee, there was the ability to rename the channel. Instead of having to live with "#identica_packetgeek", you could make the channel name look like "identica". This function was short-lived as it wasn't retained in later versions.

In setting up a new document management system, complete with Statusnet instance to track document updates, I needed to point Bitlbee at the new interfaces (Statusnet and XMPP). I don't remember why it was that I was reading the XChat2 docs, but I stumbled across the "/settab" commend. It's exactly what I'd needed.

Now my Bitlbee channel list looks like: "news", "docs", "identica", and "twitter", instead of "#192.168.2.215_news", "#192.168.2.215_docs", "#identica_packetgeek", and "#twitter_packetgeek". Much, much cleaner!

Now you'll have to excuse me while I take myself out back and beat myself up.

Saturday, May 11, 2013

Modifying SemanticScuttle to open a new window

One of the annoying things in SemanticScuttle is that clicking on a listed link opens that link in the current window. This is easily fixed:

  1. Find bookmarks.tpl.php and open it in your favorite text editor.

  2. Fidn the line containing the word "taggedlink" and add the following (inside of the href brackets):  target="_NEW"


The line should look something like:

    <a href="'. htmlspecialchars($address) .'"'. $rel .' target="_NEW">'

That's it. Clicking on a link should now open the listed bookmark in a new tab or window (depending on how you have your browser configured).

Building my own search engine

(From the How Hard Could It Be? Department) Google Reader's pending retirement caused me to start looking for alternative readers. I decided that Tiny Tiny RSS was about the best so went about attempting to install it on the house server. Right away, it complained about the version of PHP employed.

Knowing that this would cause trouble with the KnowledgeTree instance, it looked like a general upgrade was needed. Discovered a problem: KnowledgeTree no longer offers their Community Edition. Ignoring the fact that this effectively angers anyone that ever contributed code to the project, this left me in a difficult spot: run TT-RSS in a VM or come up with alternatives.

After looking at various other DMS software, I started reading about how search engines index documents. Terms like inverse indexing, relative scoring, and soundexes have become familiar. After experimenting with various text management tools and a number of databases, I'm more in awe of Google (and Bing, somewhat) now than I was before.

All that being said... In the interim, I'm running the last available Community Edition of KnowledgeTree, running on the latest version of PHP, with known work-arounds in place (there's a growing number of them).

I'm also learning about some of the obstacles that are inherent with indexing documents. Example: (and it's a horror) PDF appears to be a typesetting language. Even the good text extractors have issues with it. The letter "f" and bolding causes no end of problems in extracted text (there's usually a space after each "f" and bolding tends to produce "doubled" characters in extracted text).

Hopefully, at the end of all this, I'll have a simple program to index all of the documents (pdf, doc, & txt) that I've gathered over the years. If "simple" is unrealistic, I'll probably shoot for "portable".

Wednesday, May 1, 2013

Getting there

Attempting to get the wiki online. There seems to be an issue with file ownership and write permissions. I'll be working on it over the next few days.

Fixing stuff

It's starting to look like it will take a very long time to correct all the munging that Posterous did to each post's formatting and punctuation as they are all manual. I've decided to put it up as-is, work on a local copy, and push the updates to the blog on a weekly basis. It keeps the blog online, without interruption.