Our Various Blogs

August 10, 2010

Stories

spraints - boo!

Once upon a time, there was a little boy who bounced his head on the wall long enough that a little door appeared. What was inside the door? He tried to open the door, but it was locked.

“I’ll get my dad’s keys, and then I’ll be able to open the door and see what is inside!”

The first key he tried didn’t work. “Daddy, what is this key?” “That’s the key to my car. I used it this morning to drive myself to work.”

The next key he tried didn’t work either. “Daddy, what is this key?” “That’s the key to the tractor. When you put it in the ignition, turn it on, and press the starter button, the tractor goes vroom-vroo-vroo-vroo-vroom. Mommy used that key yesterday to turn on the tractor and plow the field.”

He tried another key, but it didn’t work. “Daddy, what about this one?” “That’s one that I used this morning to get the mail.”

“This key will work,” thought the little boy as he grabbed a funny-looking key with a round end. It did not work. “What’s this one, daddy?” “That’s a key for a cabinet that’s full of computers.”

“I wonder if I will ever find a key that works!”


by Matt at August 10, 2010 11:32 AM

August 09, 2010

Software

spraints - boo!

This post is about how to run your favorite rack application on IIS 7 using IronRuby. I’ve been unsatisfied with most other windows ruby app hosting I’ve tried, and IronRuby-Rack looks like it will fix that. (I haven’t tried deploying to JRuby on Windows, but I assume that experience would be pretty good.)

Surely I’m not the first to the punch on this, but there were some things I had to figure out that I thought I’d share.

I’m doing this in the context of a sinatra application I’m writing. More on the specific app later, but it wasn’t worth writing if it wasn’t going to run on IIS, or at least on Windows.

Also, I tried the ironruby-rack gem, but it’s pretty rough at this point. The best thing about it is that it included IronRuby.Rack.dll. My major complaint is that it put web.config in the root of the app, which meant that all the .rb files are in the web root. It seemed much classier to make public the web root, with web.config in there.

It wasn’t too hard to get the app running.

A rackup file seemed like a sensible first step, and it was. You can’t get very far these days without a rackup file.

I snagged IronRuby.Rack.dll from the ironruby gem, and checked it in public/bin. This was done because I’m lazy and didn’t want to build it myself. It’d be really nice if IronRuby.Rack was a stand-alone github project so I could fork it and patch it. Cloning all of ironruby just for a version of IronRuby.Rack that probably isn’t current wasn’t very interesting to me.

My rake tasks build the rest of the aspnet application. The tasks are aspnet:copybin, aspnet:logdir, aspnet:webconfig, and aspnet. The last just invokes the others.

aspnet:copybin finds IronRuby.Rack’s dependencies in the current ironruby environment and copies them into public/bin.

aspnet:logdir creates a directory for IronRuby.Rack to put its logs into. IronRuby.Rack is fussy about this directory existing, and about its ability to write to said directory.

aspnet:webconfig is more interesting. The web.config file it generates sets up the ASP.NET handler for ironruby.rack and tells it where everything is. I do bindingRedirects so that IronRuby.Rack can find the IronRuby version that I grabbed in aspnet:copybin. I started with the templates in the ironruby-rack gem and trimmed it down to what my app needed.

Here’s what I learned while crafting the web.config file:

IronRuby.Rack includes two hooks for ASP.NET: a module and a handler. The module seemed like the way to go, so I tried it first. I was a bit disappointed that it grabbed each request at the beginning of the application pipeline, and called EndRequest. It would have been fine if I didn’t care about anything that IIS was doing for me, but I did. I needed other modules to run (particularly the WindowsAuthentication module), and having IronRuby short-circuit the process broke that. I switched to the handler, and was much happier.

Also, IronRuby.Rack doesn’t mess with Environment.CurrentDirectory at all, so if your app needs to know about the directory it lives in, you need to tell it about that. Rails is pretty tolerant about this, with its Rails.root stuff, but bundler isn’t. Bundler was looking in c:\windows for my Gemfile. My first impulse was to set environment variables in web.config, but IronRuby.Rack doesn’t have hooks for that. So my app.rb has another bit of bundler bootstrapping that most apps can leave out: ENV['BUNDLE_GEMFILE'] ||= File.expand_path(__FILE__ + '/../Gemfile')

As a nice side-effect of using ASP.NET, to restart the application I just need to “rake aspnet:webconfig”. ASP.NET reloads the application whenever web.config changes.

Github is where to go to see the complete Rakefile.


by Matt at August 09, 2010 10:59 AM

August 05, 2010

Farm

burkefarm - boo!

Hi friends,

Things are a little crazy around here- August and it’s just me & my three-year-old most days. We’re still looking for any kind of help, full time, part time, or even one time. Thank you so much to all of you who have come out & worked on the farm this season- it really makes a difference. Extra hands are needed now through mid to late October.

Today I’ll be doing some tractor mowing, getting the fall planting area ready. The next several days look dry, finally. We already have radishes, lettuce, beets, & carrots in the ground. The broccoli, cabbage, beet, turnip & radish transplants remaining are about ready to be transplanted, and the kale is more than ready. I’ll also be direct seeding more lettuce & salad greens. Once the hoophouse tomatoes expire, we’re thinking winter spinach… yum.

Mark your calendars: October 16th is going to be Garlic Planting day on the farm. We’ll be planting lots of garlic! Pitch in dinner, we’ll provide meat and a vegan entree. Rain date or mud date is October 23rd, the following Saturday.

This week at Trader’s Point & Carmel:

Tomatoes – field tomatoes are just starting to come in
Cucumbers, probably last week of them
Flowers
A little bit of: red & green okra, wax beans, long beans, husk cherries and / or tomatillos

In your CSA boxes on Monday:

Tomatoes
Potatoes
Melons
Basil
Eggplant (from Magnolia Mill farm)
One of the following: Lettuce, cucumbers, okra, wax beans, long beans, husk cherry, tomatillos, peppers

Coming soon: Peppers, celery, basil galore.


by burkefarm at August 05, 2010 12:38 PM

July 29, 2010

Farm

burkefarm - boo!

Hi friends,

We have a running joke around here that every time I turn on the drip irrigation, it rains. Well, I did it again today. We have three quarters of an inch in the rain gage now, and who knows what will be in there tomorrow morning!

We’re working hard to get things ready for September & October, so that we can have more things on the tables at market than we do now. Special thanks to all of you who have come out to the farm & helped out so far this year- it really makes a difference, and we love to share the joys of rural living!

We are now completely without home internet, so please call if you need to preorder something, miss a CSA pickup. or otherwise need to talk to one of us. (317) 836-5061 rings both of our phones.

This weekend, our market tables will look a lot like last weekend, minus the blueberries:

Cucumbers
Just a little garlic- we’re getting to the end of it
Tomatoes
Flowers
Possibly red potatoes or fingerlings- depends how many more come out of the mud tomorrow.

See you soon!

Matt & Lisa


by burkefarm at July 29, 2010 11:15 AM

July 21, 2010

Farm

burkefarm - boo!

Newsletters or lack thereof
Field News
We’re Hiring!
Up & coming eggs & other fall things
Markets this weekend

Hi friends,

Apologies for no email news last week. We’re having rural internet issues.

We’ve been busy with fall planting & transplanting, weeding, and scouting for and finding insects. And did I mention harvesting? The hoophouse tomatoes are in full swing right now.

We have an immediate opening for a full-time person from now until mid-to-late October- either farm help, child care, or both. Experience in either area considered a bonus. Please pass the word on to your friends & acquaintances. Housing and meals are available as part of compensation.

We’ll be offering “egg shares” from October through February. Organically-fed, free range chickens, green & brown eggs, home delivery available. More details will be on our web site soon.

Did you know we’re on facebook now? You can “Like” the Farming Engineers. We’ll be putting more stuff on there soon, when our internet is working better.

At the markets this weekend:

Traders Point:

Tomatoes
Garlic
Asian seedless cucumbers
Flowers

Carmel:

Tomatoes
Garlic
Flowers
Maybe cucumbers
Blueberries, if we have a good day picking them.


by burkefarm at July 21, 2010 08:45 PM

July 12, 2010

Farm

spraints - boo!

The Victim

Young Master (or Miss) Fox recently moved to the neighborhood, and didn’t know his way around town. He ended up in a bad part of town* (for foxes) and…. well, now he’s six feet under.

* – not actually near any town.

The Crime Scene

The victim was found in the old red barn. The crime may have been committed in the barn, but it could have occurred near the fox’s home, in the ditch by the road.

The Suspects

Stripey: a young adult female cat. Normally very passive. A loner, she doesn’t like to eat with the other cats. Though she is missing eight teeth, she does have all of her razor sharp claws.

Pudgy: a middle-aged female cat. Very belligerent, she picks fights with other cats on a regular basis, especially when food is in sight. She is also equipped with razor sharp claws.

OC (full name “Orange Cat”): a neutered male with orange and white fur. Usually stays pent up in the barn. Still has razor sharp claws.

BBK (full name redacted): a neutered male with black fur. Though his meow is unintimidating, hunting transforms him into a ferocious predator. His black fur may indicate his stealthy habits. He is also equipped with razor sharp claws.

Boots: an unaltered male cat. Despite his natural condition, he is very tame. He was not originally included in the suspect list, until he was observed in the environs of the late Young Master Fox’s abode. He, also, is equipped with razor sharp claws.

Naturally, none of the suspects have responded to questioning.


by Matt at July 12, 2010 10:21 AM

July 08, 2010

Farm

burkefarm - boo!

Hello everyone,

Dry weather has been welcome this week. We have been back out in the field harvesting garlic, potatoes, squash, snap beans, onions, & cucumbers. Cabbage is almost ready. All of the heat-loving crops such as tomatoes, sweet potatoes, peppers, melons, & okra look great. So do the weeds..

Hard to believe it, but we’ll be seeding fall crops starting next week. Lettuce, broccoli, cabbages, beets, daikon & watermelon radishes, kale, and the eternally frustrating carrots are among the items planned for fall. All the brassica crops (cabbage, broccoli, kale, mustard, collards) are much more delicious when they mature in cool weather, and become sweet when hit by frost. We might even experiment with fall spinach in the hoophouse.

We took a trip to Prelock Blueberry Farm this week and picked lots of tasty, no-spray blueberries. Come out to the Carmel market on Saturday & pick some up, we’ve sure been enjoying them. This blueberry farm is 31 miles from our farm- about as local as you can get for blueberries!

Trader’s Point Market:

Garlic
Flowers
Greenhouse tomatoes

Carmel Market:

Garlic
Blueberries
Maybe flowers, maybe not.


by burkefarm at July 08, 2010 04:37 PM

June 30, 2010

Software

expected_copyright - boo!

I must admit that, in my career so far, character encodings have been a pretty insignificant concern. Most of the software I write is focused on small, domestic audiences. So character sets mean 1-byte vs. 2-byte or a couple of garbage-ish characters at the top of some files. But, after reading Joel’s guidance on character sets, I’ve been more alert to them. I have a better understanding of how character sets work, and I’m paranoid about them causing trouble for me, though how exactly they work is still a bit of smoke and mirrors.

All that said, I helped Dave solve a character set problem yesterday.

In the footer of a site we work on is this:

… except on some pages, where it looks like this:

Interesting.

Dave knew that normal aspx pages showed the symbol correctly, while CGI pages showed  before ©. The CGI pages are handled by an ASP.NET handler that I wrote, which is why he came to ask me.

My spidey-sense whispered “character encoding,” so I started trying to figure out what the charsets were. I popped open Chrome’s developer tools and checked the headers on a plain ASP.NET page and an ASP.NET/CGI page.

ASP.NET: Content-type: text/html; charset=utf-8

CGI: Content-type: text/html; charset=ISO-8859-1

Ahha! It is a charset thing!

“But it says © in the source files,” Dave said. So why does charset matter? Does the browser really interpret ‘©’ differently based on which charset it’s using? Or is ASP.NET being “helpful” again?

I poked through the skin files, finding this:

<asp:Label
   SkinID="FooterCopyrightText"
   Text="Terms and Conditions &copy; 2009 SEP"
   runat="server" />

It looks OK, but because ASP.NET is the consumer of the skin file, ASP.NET is interpreting the &copy; entity and storing it in a string as the character with code point A9. When it writes out the page, it doesn’t bother figuring out whether to make it an entity again (I wouldn’t either), so it outputs the UTF-8 encoding for A9, which is C2A9. To complete our comedy, and in an effort to avoid garbling the CGI output (which is, in fact, more important to get right than the copyright symbol in the footer of the page), the CGI handler is changing the Content-type header to match what the CGI program says it is (ISO-8859-1). In ISO-8859-1, C2A9 is ©.

The quick fix was to change the &copy; to &amp;copy; in the skin file so that ASP.NET actually renders &copy;. The complete fix will be either to align the encoding used by ASP.NET and CGI, or to modify the CGI handler to translate the CGI output from ISO-8859-1 (or whatever encoding it’s using) to UTF-8.


by Matt at June 30, 2010 03:50 PM

June 21, 2010

Software

spraints - boo!

I built version 0.9.1 of git-tfs today. The notable changes are

  1. It should work seamlessly with the TFS client libs that come with VS2008 and VS2010.
  2. It has a new “quick-clone” command.

The quick-clone command is used exactly like clone. The difference is that, while clone will chug for hours trying to get an exact replica of all of the changesets in the TFS repository, quick-clone will just grab a snapshot from TFS.

Look for it on the downloads page at github.


by Matt at June 21, 2010 05:59 PM