Page 7 of 36

Previous page

Attack of the Beetles

The past couple days the Asian lady beetles have really been out in force. They are all over the outside of the house. At least they helped me find a gap in one of my window frames which I was able to close up. This is probably the most of these beetles that I’ve seen at one time…wonder if it has any connection to the drought. Perhaps they are flocking to my house exterior since there’s a water source nearby.

The (Mostly) Dry Turkey Creek

Cricket Frog
Last week I took a few hours off and headed down to the Turkey Creek. I’ve kayaked down there twice and hiked trails a few times, but this time my goal was to hike the creekbed. The idea came to me the last time I paddled there, as it was hard to get good photos while the kayak was moving so quickly. I figured that with low water I could wade and take my time with the camera.

It takes a steady day or two of rainfall to get the Turkey Creek to the optimal 2-4 foot paddling level. As it has been ridiculously dry here in western South Carolina all summer and fall, I was sure that I’d be able to walk in the creek. I arrived at our standard put-in, just below the Key Bridge. Normally the water is around the bottom of the steps (like this). This time the water was almost completely gone; there was just a trickle in the middle of the creek, far from the steps. I thought I’d be in for a totally dry hike, but I was wrong. Not too far down-“stream”, there were spots where the creek was full from bank to bank, but not really moving.

At the dry put-in I found several small pools, teeming with speedy water bugs. Didn’t have much luck photographing them, but as I was doing it, nearby movement caught my eye and I spied a frog. It was an unusual brown color and fairly bumpy, but to me it looked more like a frog than a toad. It was a good photo subject, and from looking at my field guide at home, I think it was a cricket frog.

From here I decided to start slogging down the creek. The water was fairly warm and mostly shallow. In general it was clear enough to see the higher ground, but every once in a while I’d have to cross a dark, deeper section. I started out by telling myself I wouldn’t get deeper than my knees. Getting those wet, I decided not to get the shorts in the water. But it wasn’t long before the pantlegs were a little wet. I eventually decided to not go deeper than my waist in order to protect my camera backpack. A couple times the creek got so deep that I had to find a fallen tree trunk to wade across and balance with my hiking pole. But I was able to get about a third of a mile downstream without getting my shirt or the camera gear wet.

The creekbed alternated between rocks, gravel, and mud. The mud had trapped gases which got released as I walked, bubbles popping with lovely stagnant fragrances. Once I came across a nice section of what looked to be the same sort of jagged phyllite I saw last winter.

I didn’t see a lot of wildlife while I was actively wading. It is noisier than kayaking and perhaps my element of surprise was diminished. I managed to see a few turtles, lots of fish confined to the shallow sections, and I heard plenty of birds. However, as I stopped to take a break on a gravel bar, I was treated to four deer crossing the creek in the distance. Wish I’d had the camera ready for it.

I stopped for lunch on another gravel bar. Most of the shoals were overgrown with vegetation, a testament to how long it had been since these bars were fully submerged. After I ate I watched a flycatcher in a tree and debated whether it would wait for me to put the telephoto lens on the camera. I decided to give it a try and of course the bird bailed just as I was ready. But that did prepare me to photograph the flash of yellow that appeared nearby in the same tree. The bird stayed just long enough for me to identify it as my first Hooded Warbler, but not long enough for me to get a decent photo. The blurry result resides at BirdSite for now. Still, it was great to see a new bird species out there in the middle of “nowhere.”

I got a little sloppy on my return hike/wade. There were a couple deep sections where I couldn’t remember exactly where I had come down, so I had to guess heading back up. At one section I was walking along a submerged tree trunk and slipped, soaking my shirt and getting the bottom of the backpack wet. Fortunately I had recovered without getting any of the lenses wet. Grateful, I resolved to be more careful for the rest of the walk.

I arrived back the steps in good order and headed back uphill. The last time I was here there was unfinished trail bridge just below the Key Bridge. It looked finished, so I hiked up to it and was able to walk out on it. It’s in good shape for future hiking and mountain bike traffic.

And so ended my little adventure. It was interesting to travel the creek on foot, but I think I still prefer to paddle it!

Photo Album

Buy my Saturn Vue

Saturn VUE

My 2003 Saturn Vue is for sale. Buy it!

Update 2008-01-26: Sold!

Improving upon Rails' validates_inclusion_of

I’m fairly new to the Ruby language and the Ruby on Rails framework, but it worked nicely for quickly building my website BirdSite.

I was using validatesinclusionof fairly regularly to make sure the data in my models was valid. But then, watching the development log, I noticed extra SQL queries being made when I accessed my main model. It seems that validatesinclusionof was forcing the model to make queries to the related models even when I didn’t need data from them.

Some Googling led to a blog post that did the validation a different way. It worked well, until I added the code to a new model today and it broke. The code was translating the model field name into a string from which to call the model itself. But the code assumed that the model would be a single word. I added a change to strip the spaces out, and it worked again.

I contacted the company that hosts the blog and they confirmed that it was a problem, and they didn’t know of a nicer Ruby way to correct it short of dropping the spaces with search/replace. They updated their code.

I’m glad I could help out. It really works better than the standard validatesinclusionof.

Rails acts_as_ferret without DRb

I wanted to add a search feature to my Ruby on Rails application BirdSite. There is a plugin called “actsasferret” which allows Rails applications to use the Ferret search engine (based on Lucene).

Using this tutorial, I was able to get search up an running. It worked great on my development system. But there was a warning that you needed to run the indexer using a DRb server instead of directly from the Rails app. This is because the index cannot handle multiple processes writing to it simultaneously. (I also ran into this problem using PHP with another engine called Xapian).

I was hoping my new site was low traffic enough to avoid problems. Since I’m hosting it on a shared server, I can’t run a DRb server there anyway. But I got my first indexing exceptions less than 24 hours after I loaded my stuff onto the live server.

So I decided to try periodic indexing by a cron job. This would allow me to update the index once an hour, from a single process. The downside is that the search index is only updated hourly, but I decided I could live with that.

The first step is telling your Rails app to not index the content when updating. My model already had a before_save method, so I added this code:

in the model

def beforesave
  # other stuff goes here

  # disable automatic ferret indexing…move it to a cron job

Then I had to create a rake task which would build the index:


desc “Updates the ferret index for the application.”
task :ferretindex => [ :environment ] do | t |
  # here I could add other model index rebuilds
  puts “Completed Ferret Index Rebuild”

This task is simplified: I’m telling it to rebuild the entire index each hour. I’m guessing when my dataset gets big enough, this will be really slow. In that case I’ll need to track all the model instances that got updated in the past hour and just index those.

Finally, I needed a cron job to run the rake task, making sure to set the environment to “production”:

cd /railsapp && rake ferretindex RAILS_ENV=production

So far this is working well, and I haven’t received any indexing exceptions since.

Next page