Archive for the ‘Tech’ Category

Ubuntu notes

December 21st, 2006 by daryl

I’ve been running Fedora Core 4 on my laptop for a year and a half now, and I figured it was about time to update to something newer. I had tried Ubuntu briefly on the laptop at the very beginning but wasn’t impressed. I’ve also had Ubuntu running as the OS on my backup machine for a while, but I never use that machine manually, so I haven’t done much testing. Here go some miscellaneous notes after a couple of days of using Ubuntu (Edgy Eft). This is on my Sony Vaio VGN-FS550, which I absolutely love.

The install was fairly easy, and for the first time in the history of linux on laptops for me, the wireless just worked out of the box with no poking around to find drivers and just the right config. Setting up the widescreen was also pretty easy, if a little different from on FC4. On the latter, I had to google around until I learned about a tool called 915resolution that helps you set up widescreen displays, and then I added some config mumbo jumbo to my /etc/rc.local file to adjust the screen resolution on startup. Ubuntu, it turns out, has a nifty package for 915resolution (so no more hunting around — just do “apt-get install 915resolution”), but it doesn’t have /etc/rc.local, so I had to find out how to make it run on startup. Ubuntu does this through /etc/default. When you install a package that may run at startup, it gets a file added in here by the package installer, and you add config to that file. So voila, within a matter of minutes, I had my widescreen set up (compare to hours of clueless googling and trial and error to get it set up originally in FC4).

The Alps mouse was a little more difficult. To fix this, you have to google around and find an xorg.conf config that’s close to what you need and then tweak it until it works. To find out what device to use, you can cat /proc/bus/input/devices and look for the mouse. In my case, it looks like this:

I: Bus=0011 Vendor=0002 Product=0008 Version=7321
N: Name=”AlpsPS/2 ALPS GlidePoint”
P: Phys=isa0060/serio4/input0
S: Sysfs=/class/input/input6
H: Handlers=mouse1 event5 ts1
B: EV=f
B: KEY=420 0 70000 0 0 0 0 0 0 0 0
B: REL=3
B: ABS=1000003

The “Handlers” line in theory tells you what to plug into the InputDevice section in xorg.conf (which in my case looks like this):

Section “InputDevice”
Identifier “ALPS”
Driver “synaptics”
Option “CorePointer”
Option “SendCoreEvents” “true”
Option “Device” “/dev/psaux”
Option “Protocol” “auto-dev”
Option “Protocol” “auto-dev”
Option “LeftEdge” “120″
Option “RightEdge” “830″
Option “TopEdge” “120″
Option “BottomEdge” “650″
Option “FingerLow” “14″
Option “FingerHigh” “15″
Option “MaxTapTime” “180″
Option “MaxTapMove” “110″
Option “ClickTime” “0″
Option “EmulateMidButtonTime” “75″
Option “VertScrollDelta” “10″
Option “HorizScrollDelta” “10″
Option “MinSpeed” “0.45″
Option “MaxSpeed” “0.75″
Option “AccelFactor” “0.020″
Option “EdgeMotionMinSpeed” “200″
Option “EdgeMotionMaxSpeed” “200″
Option “UpDownScrolling” “1″
Option “CircularScrolling” “0″
Option “CircScrollDelta” “0.1″
Option “CircScrollTrigger” “2″
Option “SHMConfig” “true”
EndSection

Googling around revealed to me that the “Device” line should use something like “/dev/input/event5″ where the event number matches what you found in /proc/bus/input/devices. The problem I encountered was that the event number varied from bootup to bootup. So one time, the hard-coded xorg.conf would work, and another it wouldn’t. I finally settled on using /dev/psaux, and it seems to work, though I haven’t rebooted since the last time it worked, and I’m not convinced that it’s not still a little flakey. The last time I started up, it wasn’t working, and then I did ctrl-alt-f1 to get to a different screen and then ctrl-alt-f7 to get back to the main screen, and I wonder if that isn’t what made it start working. It was after that switch that the touchpad started functioning fully. Who knows what’ll happen the next time I reboot?

I should note that most of the touchpad functionality was fine out of the box. It was simply the bit that lets you slide your finger down the right-hand side to scroll a window that was busted. I use that a whole lot, so it was pretty high priority to get it fixed. This did eat up a couple of hours of time over a couple of days, but it was the only frustrating part of the install.

The mouse is still a little flakey. Sometimes when I click something (a link or a taskbar item, for example), it just waits until there’s another click or a mouse movement to register the click. I suspect this is something I can tune in xorg.conf, but for the moment, it’s only a minor annoyance that hasn’t justified the further research yet.

Ubuntu comes with a nifty little program called Tomboy that lets you take notes easily. It’s basically a local wiki. If you want to add a note, you just hit alt-f12, and a little menu pops up from nowhere out of the task bar showing recent notes and letting you add one. You can easily link notes together, do some basic text formatting, etc. I’m not sure it’s something I’ll use a lot, but it does strike me as potentially useful.

I’ve had cause this morning to try to write an apache module in perl, and that meant compiling Apache::Constants against apache, which I had installed using apt-get. Which meant that there were no source files lying around that I could find. After some fruitless googling, I eventually checked the man page for apt-get and saw that you can get sources using “apt-get source [package]“. I did this but had troubles with the configure command (”error 77: C compiler cannot create executable”), which I resolved by doing “apt-get install g++”. So now I had apache sources ready to compile the perl module against, but it turned out that the module wants apache 1.3. Which meant that my labors were more or less a dead end, save that I learned how to get package sources in ubuntu. Someone in the ubuntu irc channel suggested as an alternative to downloading sources that I could just install the -dev package, though frankly, I’m not sure where ubuntu would put the sources for that either, so it may not be a valid alternative for my purposes. (While writing this paragraph, I learned that — duh — there’s Apache2::Const, which was already installed and does for apache2 what Apache::Constants does for apache.)

Bootup for this machine now takes about 14 years, and I read somewhere that they actually sped things up significantly in this release. Those who installed the previous releases I gather are still waiting for their systems to be ready for use. It also bugs me that I can’t see the status of the system as it boots up. I’ve always found it comforting to see what part of the bootup process the system was in. I suspect there’s a way to get to this view. Luckily for me on all counts, I shut down rarely.

The battery life is crappy now. Under FC4, I could get a solid hour or hour-and-a-half out of a fully charged battery. The other day, plugged in downstairs, I ran the computer upstairs on battery for a minute, and it almost immediately told me I had only 18 minutes of battery left. On the plus side, Ubuntu’s battery indicator seems to work at least marginally with this system, telling me at minimum whether I’m on AC power or battery. This feature alone would have saved me a number of accidental shutdowns in the past due to inadvertent lack of AC power.

Ubuntu’s UI in general feels just a little more sluggish and less polished than that of FC4, but in general, I’m satisfied with it so far.

The ubuntu online presence and community seem outstanding.

Limiting ssh access with the command option in authorized_keys

December 6th, 2006 by daryl

Using public keys to log in via ssh to servers is a wonderful thing if only because it prevents you from having to type your password each time you want to log in. I’ve been using this method happily for years. Today, I learned something new (to me) about using public keys to log in. In the authorized_keys file that lists accepted keys for a user, you can specify the “command” option along with some other things that allow you to limit what people can do when logging in.

Say for example you wanted to grant someone access to an svn repository with a real user account (because you have other privileged users already hitting the repository with user accounts and so can’t use svn’s authentication). But you don’t want this person to have a full shell or in fact to be able to do anything but use svn. The command option lets you dictate what operation is performed upon login. You prepend the default key output with the command information, as follows:

command=”program” ssh-dsa AAAABtce9euch… user@example.com

So in my example, I add the following:

command=”svnserve -t –tunnel-user=svn_username”

This makes it so that as soon as svn_username logs in, he gets a tunnel to the svnserve command. If he’s issuing svn commands at his command line and sending the appropriate output, this is great. If he’s trying to ssh directly, he gets some server status gobbledegook and is effectively locked out from actually logging into the server. Just what I needed.

To prevent further interactivity during the session, you can pass some other options, as follows:

command=”svnserve -t –tunnel-user=svn_username”,no-port-forwarding,no-agent-forwarding,no-X11-forwarding,no-pty

You can also have some other fun with the command, though. For example, just to play around, I created a user and added the command “ls /tmp”. Sure enough, when I ssh’d in as that user, I got the output from an ls command. I could see more practical applications, however. For example, you might add “ps -eaf” as a command and have a script try to log a user in periodically and parse the output to see if a given program is running. There are no doubt much better ways of handling this particular case, but you see my point.

powered by performancing firefox

When did I change my mysql database structure?

November 30th, 2006 by daryl

A stats tracking application I’ve slowly built over the last six months or so recently started showing some potentially anomalous data for one of its views. A number that has trended upward steadily for all time suddenly dipped substantially (5%) and wallowed about at the low number for a week before beginning to trend upward again. During the low period, I looked into the matter to try to determine whether there was a problem with the stats or whether the numbers were legitimately low.

My first step was to identify any changes that had been made to the stats program immediately prior to the dip. There were a couple of changes that couldn’t possibly have related to the issue and one that seemed unlikely to have caused a problem but that merited investigation. So in a copy of the code and on a copy of the production database, I rolled back the possible culprit and re-crunched the stats. The numbers came back the same, so the possible culprit I had identified was in fact not the culprit.

Next, I wanted to determine whether or not I had made any recent changes to the database structure that could possibly have skewed my calculations (I do all sorts of calculations and caching on raw data). This wasn’t as straightforward as just viewing an svn log to determine when any relevant files were changed. But there is a way to tell when (if not how) a database was last changed. You need only look at the timestamps on the files that contain information about your database structure. This works for mysql, in any case. Here are the steps I took:

  1. Figure out where your data files are stored. If you don’t know, try typing “ps -eaf |grep mysql” (or the equivalent on your linux distro) and looking for the “datadir” parameter in the command line string. Change into that directory.
  2. There, you should see a directory whose name corresponds to the database you want to check for changes. Change into that directory.
  3. Next, do something like “ls -la *.frm” or, if there are many tables, “ls -la <tablename>.frm”. This lists timestamps for the files that store table structure, which tells you when the tables were changed.

In my case, I have a production database and a staging database that stay pretty close to in sync. Luckily, I had synced data between the two but hadn’t synced a change I had made to a production table’s structure. So the timestamp for my production table corresponded to the date on which our stats dip appeared. I could then get a mysql prompt and type “show create table <tablename>” for both my production and my staging databases to see what the difference between them was.

It turned out to be that I had simply dropped an extraneous index in production, something that shouldn’t have affected my stats. That crunching stats in both the staging and the production environments had the same end result corroborates my conclusion that the index change didn’t matter.

As my stats had begun trending upward again and we had just come off the Thanksgiving holiday break, I felt pretty confident after doing this little diligence pronouncing the dip a product of holiday lag. In any case, now you know, if you didn’t already, how you can check to see when you last changed a mysql table’s structure.

powered by performancing firefox

shrtlnk

September 27th, 2006 by daryl

Sometime earlier this year, I started work on a little side project called shrtlnk. I hinted at it in a post on this blog, but I don’t think I released the url. You probably know about tinyurl, which gives you an easy way to send big long urls around to people in a way that they won’t be affected by line breaks in mail clients or generally be unsightly. It does this by generating a random short string and appending it to the end of the tinyurl domain. Where shrtlnk differs is that it has a memory. You get to name the links you save for later recall rather than one-time sending. If you create a user account, you get your own set of labels. That is, if somebody else labels something “bank,” it’s not going to prevent you from labelling something “bank.” If you’re not logged in, labels are allowed on a first-come, first-served basis. I’m not positive this is going to be terribly useful to anybody, but that’s why I’m announcing it to my three readers before trying to do anything like a broader deployment. If you try it and think it might be useful, let me know. If it’s useless, let me know that too. If you can think of ways it could be improved, let me know, but don’t hold your breath for instant changes to the site. I had planned to hold off release of this until I had developed a Firefox/Flock extension to make saving links a cinch, but it’s obvious to me that I’m not going to have time in the near future to take care of that. Anyway, try it out if you’re game, and no harm done if you’re not.

KnoxBloggers

September 13th, 2006 by daryl

I waited a few days to blog this because Perry and Mike blogged it near-simultaneously, and I wanted to have a little space between all the KnoxBloggers posts on the KnoxBloggers web site. Huh?

So, KnoxBloggers.com is a little site Mike and Perry and I set up to support the blogging tools meetup group we’re sort of the ring leaders of. The front page aggregates blog posts of designated users (hence my wanting time between posts about the site itself; else there’d've been three posts in a row saying more or less the same thing). There’s also an about page where area bloggers can scrape source code for a button to promote the site. Then there are tools and services pages, where we’ll list and point to posts/discussion about the topics we discuss at our meetings. And you can find information about upcoming meetups at the site as well.

If you’re interested in tools used for blogging and are in the Knoxville area, check it out, maybe sign up at the site, attend our second meeting next week (topic podcasting), and maybe you’ll get your site’s content aggregated on the site eventually. For whatever that’s worth.

Flock in Print

September 8th, 2006 by daryl

I picked up Cal Henderson’s Building Scalable Web Sites the other night hoping to learn something about “The Flickr Way” of building scalable web sites. I’m about halfway through and have mixed feelings so far about its usefulness for my purposes, but I couldn’t help feeling a little thrill when I encountered a reference to Flock on page 142. This portion of the book gives a brief explanation of the http request/response life cycle, and Cal happened to be using Flock while generating his example request (which returns a 404, if you’re interested, though the example suggests otherwise ;) ).

I suppose I shouldn’t have been terribly surprised to see a Flock reference in a book by a guy from Web 2.0 darling Flickr. That Lloyd and Cal are buddies (there are photos to prove it) and that Cal has been spotted at SuperHappyDevHouses (the creation and proliferation of which past Flockers Termie and Factoryjoe have been instrumental in) should have rendered it even less of a surprise. Still, when I saw the example, I flopped the book down and exclaimed to my wife, “Hey, Flock’s in this book! Woo hoo!”

Timed disabling of Wordpress comments

September 6th, 2006 by daryl

I wrote the other night about my frustration with comments in Wordpress. The anti-spam tools that come with the software are great for squashing spam, but I still occasionally go through periods during which I get a bunch of emails asking me to log in and moderate spam, and that irritates me. Most of these moderation requests are for spam on old posts. So I decided to write a Wordpress plugin that would auto-disable comments and pings on old posts. This allows me to keep comments open for those who read my stuff and would like to comment within a reasonable timeframe but keeps me from having to go back and manually run mysql queries by hand (or, worse yet, manually edit old posts) to turn off comments on individual posts. (The Wordpress options for commenting affect only future posts.)

The plugin is a simple one, providing an option under the “Manage” and “Manage Comments” administrative screens allowing you to set the number of days old a post must be to have its comments disabled. If you post infrequently, this plugin won’t do you much good, as its action is triggered by the saving of a post. If you post every few days as I tend to, though, it’ll do an ok job of keeping old posts from picking up comment spam. The default threshold is 14 days. So any time I add or save a post, Wordpress runs a query that disables comments and pings on all posts created more than 14 days ago. That’s all there is to it.

Download the plugin here if you think you’d find it useful.

Comments

September 3rd, 2006 by daryl

Before we dive in here, take a look at the screenshot. 2,398 spam comments caught since I last checked a couple of weeks ago. 19,135 since I upgraded my wordpress version a few months ago. That’s plenty more spam than most of my three millions of readers could even imagine getting. In the interest of complete honesty, I’ll confess that I don’t see all of those spam comments. Wordpress’s Akisment plugin is great about catching a lot of them. But from time to time, it gets to where I see “please moderate me” messages from 5 or 10 spam comments every couple of days from assholes peddling Hoodia or V1agakra or whatever, and that’s more than it’s really worth to me to get the occasional “so tell me again how you do this in Drupal?” question or the odd quip from a friend. So, as you read, consider that, besides the occasional infuriating blog comment spam, I get probably a couple hundred other email spams a day, and if you have a problem with my attitude toward blog comments, I invite you to get bent.

A couple of people have given me crap about turning comments off. My general philosophy is as follows: If you know me and want to comment on something I’ve said and your comment is worth any effort at all, you probably know my email address and will just email me. If it’s not worth the extra two seconds it takes to start an email message, it’s probably not worth my time to read it. Sorry, just being honest. Really, I’m giving you credit here. I know you’re possessed of the faculties to make humorous quick one-off comments on my blog, and for the past few weeks, I’ve been saving you the effort of typing them in. You can thank me by buying me something off my Amazon list.

Given the complaints (who knew I wrote anything so compelling?), I’m turning comments back on for future posts. As most of my comment spam comes from long-uncompelling posts, perhaps I’ll just go through every once in a while and disable comments on individual posts older than a given age. Anyway, for the time being, I’m allowing comments again. Enlighten me, dear three millions of readers.

Knoxville Blogger’s Meetup Post Mortem

August 23rd, 2006 by daryl

Tonight, I attended the blogger meetup that Mike organized. Counting Mike’s brother and girlfriend (both of whom were mostly absent but were warm bodies in occasional attendance, so I’ll count them provisionally), there were eight of us, all tied to Mike through past or current jobs or the aforementioned relationships. One guy was an apparently random acquaintance of Mike’s who since connecting with him has gotten a job at Mike’s place of work through no help from Mike (more or less at random, that is). Weird. Anyway, so we had a pretty decent crowd for a first meetup, though I hope that for future meetings, we can expand our network a bit and bring in some new folk. (Which let me say is a strange thing for me to hope because I’m generally pretty reclusive and not interested in adding more people to the list of those I feel obligated to remember or communicate with. Let’s keep that our little secret.)

We had discussion of three items on the agenda: photo manipulation/hosting tools, Flock as the blogger’s browser, and video blogging.

First, Mike gave an overview of Google’s Picassa, which includes a desktop client for photo manipulation and a (beta) web service for display of photos in albums. The client looks pretty nice, with basic and pretty easy-to-use tools for manipulating photos. Want to bring out highlights in a picture? Just hit the highlights button and adjust the levels (or something like that). It seems like a great lightweight tool for doing the sort of basic operations that those of us who’re intimidated by Photosho or The Gimp are likely to want to do. As for uploading and displaying, there are some weak points. You can’t upload one-off photos, for example — they all have to go into an album. For most users, this is probably fine, but it’s nice to be able to post a one-off screen shot as well. The web display itself seems pretty weak. There’s a concept of favorites or friends, and there are settings to be able to publicly list albums, but there seems to be no interface for searching for photos or friends. If I happen to know Mike’s gmail username and know the base url for the photo service, I can assemble a url that will show me his albums, but that’s not user-friendly to say the least. I imagine the service will be expanded to fix these problems. All of this is basically moot for me, as the client isn’t available for linux, but it was interesting nevertheless.

Next, Mike gave a demonstration of Flickr’s capabilities. I hadn’t expected to learn much here, but he showed me some things I hadn’t looked into before, most of the details of which I’ve forgotten by now but will delve back into as need arises. There’s more you can do with Flickr’s organizer tool than I had ever discovered; I had always thought of it as merely a way to organize sets, but you can batch add tags, set privacy, etc., and with some of the gaps in Flock’s ability to batch edit photos, these things are very useful. There are also some neat views of photos and tags that I hadn’t looked into. My impression of Flickr in recent months has been a better one than previously. Things seem more discoverable since some features were added to the site. Between that and Mike’s demo, I may find myself actually using the site more than I’ve been accustomed to doing in the past.

At this point in the evening, after a late start, we’re more than an hour into the evening and it’s my turn to present. Mid-presentation (baby’s bed-time), I get a call from my wife that I dismiss. The moral of the story is that we need to plan less stuff for these meetings and trust the power of gab to carry us through to a sufficiently lengthy time. I thought at this point about suggesting that we push either Perry’s vlogging segment or my segment off to a future session, but I wimped out, not wanting to hijack the meeting.

As I result, I rushed through my segment, for which I’m a little embarrassed to admit I wasn’t terribly well prepared. It was clear that Mike had spent some time thinking about what he was going to demo. I had run through doing a blog post in Flock’s editor but hadn’t really scripted anything out, and I think that between that and my being in a rush, I probably did a pretty poor job of showcasing Flock’s capabilities. We’ll be releasing a new version of the software before too long, and there’ll be big changes then, so perhaps I can get some more time then and do a better job. The 30-second version of my presentation is roughly as follows: Hey, there’s an html rich editor, so you don’t have to code html anymore. There’s also this little shelf thing at the bottom that you can drag pictures and text into and then back out of to construct rich blog posts. And there’s this photobar that shows your Flickr photos (and those of others) for easy dragging into blog posts. And you can easily drag/drop upload photos straight from within your browser and get notifications when your friends post their photos. (Not covered in my presentation but important is the fact that this uploader tool works in linux and thus has caused me to upgrade to a pro Flickr account and actually bother to snap photos.)

Now Perry stepped up to the plate to talk about screencasting. A screencast is basically a movie of somebody’s desktop as they use software and explain the process. He reviewed several tools that I was interested in seeing but that were sort of dead ends for me because they can’t be used on linux. (Side note: A week or two ago, I briefly evaluated something called xvidcap for linux; after hacking the config so that it would compile on my system, I wound up finding the software difficult to use, but probably about as good as it gets for this type of software on linux.) In one case, Perry used a piece of screencasting software to do a screencast of the software itself. (It was during this window that my future self came back to visit me and prevented my future untimely demise by suggesting that I take an alternate route home; it was strange.) I found myself thinking during Perry’s presentation that the perfect synthesis of our evening would be Perry’s doing a screencast of Picassa and posting it to his blog using Flock. (My future self had nothing to say about whether this would actually happen, though I did press for an answer.) (Ahem. It’s late and I’m tired.)

After Perry’s talk, we briefly discussed finding a mechanism for publishing events. Orkut (which several of us had signed up for) sucks for this sort of thing, and who wants to pay meetup.com for this? We discussed using Gmail’s calendar, which we should be able to syndicate for publication on a web site if we ever build one. We also discussed finding a plugin for Wordpress and just having a blog site. I think we finally concluded to not worry too much about web infrastructure until the core group’s a little more established and we have any hope of attracting a broader audience.

And so concluded our meetup. I think Mike briefly proposed discussing next time (probably a month or so from now) some of the options for hosting your blog. All in all, it was a good meeting, and I’m frankly a little surprised to report (see note above about my being nearly pathologically anti-social) that I look forward to the next one.

Knoxville Blogger’s Meetup

August 18th, 2006 by daryl

A couple of weeks ago, I was in the driver’s seat for a Flock meetup here in Knoxville. My pal Mike has since begun organizing a Knoxville bloggers meetup to discuss blog tools more generally. Details (straight from Mike’s blog):


When:
Wednesday, August 23rd 7:00pm
Where: Mike’s Place (directions when you RSVP)
What: Knoxville’s local bloggers get together to talk about tools and services that help bloggers.
Who: Anyone who has a blog, wants a blog, or wants to learn about blogs.
Why: We don’t need a why!

You can RSVP to me or go over to Mike’s site to RSVP. Mike’ll give a little presentation on some image hosting/manipulation tools, I’ll give a half-assed demonstration of some of Flock’s features, and Perry will talk a bit about video blogging tools. From there, we’ll talk amongst ourselves about the tools presented and figure out where to go from here with the meetup group.

If you’re already a blogger or are just curious about what all this blogging stuff is all about, this first meetup should provide a good introduction to some of the tools and services available to you.