Monday, May 23, 2005
Sunday, May 22, 2005
Scything
With the return of spring, and grass that threatens to overgrow my driveway while I sleep, my mind (and body) turn to scything. If you're still reading, please allow me to make this recommendation as emphatically as I can:
If you use a weedwhacker, consider a European-style scythe instead. These are not "your grandfather's" scythe. They are so light that it is possible to mow without even working up a sweat. And scythesupply.com will create a custom-length handle for you, which makes using your scythe an exercise in ergonomic bliss.
I won't be too long-winded, but I will finish by offering a list of great reasons to switch from weedwacking to scything:
If you use a weedwhacker, consider a European-style scythe instead. These are not "your grandfather's" scythe. They are so light that it is possible to mow without even working up a sweat. And scythesupply.com will create a custom-length handle for you, which makes using your scythe an exercise in ergonomic bliss.
I won't be too long-winded, but I will finish by offering a list of great reasons to switch from weedwacking to scything:
- No power-cords, no gas
- No noise. Hear your surroundings while working.
- No dangerous projectiles
- Refuse is more manageable (easy to rake and pile, without pulverised plant matter stuck to walls)
- Refuse is potentially useful (you can harvest this as hay if you
like) - Mow any time of day without annoying the neighbors
- Excellent, ergonomic, gentle exercise.
Thursday, May 19, 2005
Nifty Knitter
Here is a picture of the tool I used to knit Arthur's hat from a few posts down.
And here is a nice page that shows how to use it.
And here is a nice page that shows how to use it.
Good Use for Regex
Ever want to extract data from someone else's webform?
If you can view the html source of the page and find consistent code that delimits the form data you can use .NET regular expressions to capture the form data in groups. Then, you can loop through the regular expression matches and extract the data from the groups. Here's an example:
Here is the code that separated the form titles from the form data:
And here is the regular expression pattern I used (note the concatenation " & Chr(34) & " is VB specific, but the rest is .NET universal). Note I'm using good deal of literal text. Undoubtedly this could be pared down, but I had some trouble figuring out how to do it, so, for expediency this is it:
If you can view the html source of the page and find consistent code that delimits the form data you can use .NET regular expressions to capture the form data in groups. Then, you can loop through the regular expression matches and extract the data from the groups. Here's an example:
Here is the code that separated the form titles from the form data:
</TH><TD valign="top" class="formbody"><table border=0
cellpadding=0 cellspacing=0><tr><td class="formbody">
And here is the regular expression pattern I used (note the concatenation " & Chr(34) & " is VB specific, but the rest is .NET universal). Note I'm using good deal of literal text. Undoubtedly this could be pared down, but I had some trouble figuring out how to do it, so, for expediency this is it:
([a-zA-Z ]+?)(?::</TH><TD valign=" & Chr(34) & "top" & Chr(34) & " class=" & Chr(34) & "formbody" & Chr(34) & "><table border=0 cellpadding=0 cellspacing=0><tr><td class=" & Chr(34) & "formbody" & Chr(34) & ">)(.*?)</td")And finally the code to handle the results:
Imports System.Text.RegularExpressionsThe handling of the strings could also undoubtedly be refactored too. But hey, we all start somewhere.
Dim reggie As Regex
Dim midge As Match
Dim sAry as string
'pass the html code and the regex pattern, and this line executes the regex find
For Each midge In reggie.Matches(strSubj, stPat)
'based on the value of group 1
sAry = midge.Groups(1).ToString
Select Case sAry
Case "Title"
'you can assign the value of group two to the appropriate place
sTitle = midge.Groups(2).ToString
Case "Begin"
dBegin = midge.Groups(2).ToString
Case "End"
dEnd = midge.Groups(2).ToString
'.......
End Select
Next
Tuesday, May 17, 2005
More .NET Fun
Today I spent some time discovering how to make webrequests in .NET. I'm noticing a pattern emerging with this .NET stuff. It takes me a long time to figure out how something works. Usually I find examples on the internet, probably 75% of those wind up being straight out of the MSDN documentation and the rest is found on other sites that Google finds me.
The slowest part of today was overcoming the 401 authentication problem I was having in accessing a secure internal server. The solution appears to be a combination of preauthenticate and using the correct method to call in the webrequest. I'll post the successful code when I'm writing from my other computer. This reminds me of a second pattern I find when trying to code with .NET: there are many valid looking ways to accomplish a task, but, as with all coding languages it tends to be quite particular about which one you use. Many of the examples I found off of MSDN were wrong for me. And the ones on MSDN carefully demonstrate only the methods of the current topic. The trick seems to be identifying the methods that associate to accomplish the task you want. Anyway, it's all in good fun.
The upshot is that I now feel capable of tapping data from the web via my applications. This has been a goal of mine, so I feel good about that.
I've found some more regex resources
http://www.thecodeproject.com/
This seems to be a cool place because they often (always?) provide the source for their apps. And there are several regex testers available for download in C# and VB.NET.
Currently nagging the back of my mind: How to search and replace a strange character from inside an Excel file? (Without buying a utility to do it. ;))
The slowest part of today was overcoming the 401 authentication problem I was having in accessing a secure internal server. The solution appears to be a combination of preauthenticate and using the correct method to call in the webrequest. I'll post the successful code when I'm writing from my other computer. This reminds me of a second pattern I find when trying to code with .NET: there are many valid looking ways to accomplish a task, but, as with all coding languages it tends to be quite particular about which one you use. Many of the examples I found off of MSDN were wrong for me. And the ones on MSDN carefully demonstrate only the methods of the current topic. The trick seems to be identifying the methods that associate to accomplish the task you want. Anyway, it's all in good fun.
The upshot is that I now feel capable of tapping data from the web via my applications. This has been a goal of mine, so I feel good about that.
I've found some more regex resources
http://www.thecodeproject.com/
This seems to be a cool place because they often (always?) provide the source for their apps. And there are several regex testers available for download in C# and VB.NET.
Currently nagging the back of my mind: How to search and replace a strange character from inside an Excel file? (Without buying a utility to do it. ;))
Saturday, May 14, 2005
Sunday, May 08, 2005
New Stuff!
Several of you have asked me for photos of the house. Soon I will be able to provide them as I've just ordered a new Canon EOS 350D camera from newegg.com. I bought it without the lenses since Heidi already has two nice Canon EF lenses. I've been desperately needing a camera since I lost my previous one, which I was so happy with. I had it for a year and was still tickled pink about it when I lost it. Its loss cut me deep, which I think contributed to the one year wait before buying new.
This also means that I'll be able to send pictures of some other new stuff I already picked up for outfitting our new house. This table looks terrific in our dining area. It seats twelve, once we get some chairs, that is :). I got the table for a great price, but I may be sunk trying to get 12 matching chairs for it. :-
The kids are out whacking, hacking, tugging and climbing on everything in sight. They are like a couple baby orangutans, decimating foliage by the minute. They've really begun to have fun in our new place, with the weather warmer and the plants growing at an almost visible pace. Can't wait to get some more pictures of them.
This also means that I'll be able to send pictures of some other new stuff I already picked up for outfitting our new house. This table looks terrific in our dining area. It seats twelve, once we get some chairs, that is :). I got the table for a great price, but I may be sunk trying to get 12 matching chairs for it. :-
The kids are out whacking, hacking, tugging and climbing on everything in sight. They are like a couple baby orangutans, decimating foliage by the minute. They've really begun to have fun in our new place, with the weather warmer and the plants growing at an almost visible pace. Can't wait to get some more pictures of them.
Tuesday, May 03, 2005
Occupancy
Did I mention we were finally awarded an occupancy permit by Clark County? The inspector said he was surprised we got it, considering the preference of the people in the office. I'm not sure how I feel about that. Glad that we got through. Sad if it doesn't help others do the same, should they choose.
Subscribe to:
Posts
(
Atom
)