Aug. 12th, 2007

alexpgp: (Default)
There is no doubt a part of me that finds it hard to believe that there is something else to life than work, or worry, but from time to time, evidence of same does surface.

Case in point: yesterday, we all had a marvelous laugh over a curious side-effect of Shiloh's having learned how to lie down.

Teaching a dog how to lie down - as taught by Mike, the PetSmart expert - consists in getting the dog to sit (which Shiloh has pretty much mastered) and then commanding the dog to lie down while placing a treat, with one's fingers wrapped around it to keep it inaccessible, just in front of the dog's forepaws. This causes the dog to (eventually) assume the proper "lie down" position.

Then, just as it says on the side of the shampoo bottle, you rinse (your fingers) and repeat. Eventually, the dog is supposed to "get" the connection between the command "lie down" and the proper position.

Yesterday, we learned that we had... perhaps... overdone the training, because now, when we command Shiloh to "sit," she assumes a sitting position and with no further prompting, continues to almost immediately lie down (for her treat). Sometimes, "sit" results in an immediate lie down.

Somewhere, we had performed an incredible amount of negative training. Somehow, though, I'm sure we'll be okay in the end.

Cheers...
alexpgp: (Default)
Part of Google Video's offering was a store that sold videos, delivered in a proprietary locked format that matched the video to your account and software player. You had to have an Internet connection to play the video, since the player had to "check in" with Google before it would play the file.

In the best of all possible worlds, that sort of sucks for the customer (no Internet? no movie!) and represents gravy for Google (which collects data on who watches what how many times), but I'm getting ahead of myself. That's really not the case, because...

It turns out, according to this story, that anyone who "purchased" a video from Google will no longer be able to view it after August 15, owing to a company decision to no longer offer the service.

Isn't that precious?

So, in addition to denying the customer rights granted under US copyright law (bought videos can be resold, lent to friends, donated to charity, etc. and excerpted and copied under the doctrine of fair use), now it turns out that "buying" a product means you're only really renting it for as long as the seller wants.

According to the article, Google's customers are getting a partial credit that must be used within 2 months to buy something of equal or greater value from a specified list of stores.

Ye gods.

Cheers...
alexpgp: (Default)
I was simply too tired last night to explain why the "- 1" was important in the macro line
myRange.End = myRangeEnd - 1
but not decrementing the value ate a lot of time, so hopefully, this post will reinforce the knowledge gained. (Can you tell I don't want to settle down and translate?)

By the time we get to this point in the code, we've selected the contents of the table cell we're working with and assigned them to a range called myRange. We've also saved the value of the end point in a variable called myRangeEnd.

If the pattern we're looking for is found, the next step after copying the pattern is to shorten the range to exclude the found pattern. To do this, I wrote code to move the start of the range over by the length of the pattern and then set the end of the range to the original end value.

Schematically, the initial range looks like:

it's time for {123}all{124} good men and women to party
S------------------------------------------------------E


After the first pattern is found, the range is:

it's time for {123}all{124} good men and women to party
              S----E


Then we move the start point "over" the end point:

it's time for {123}all{124} good men and women to party
                   S


And we restore the original end point:

it's time for {123}all{124} good men and women to party
                   S-----------------------------------E


Only after instrumenting the code to show my selection did I realize what that did. If you work much with Word tables, have you ever noticed what happens if you select text in a cell and go one character past the end? The contents of the entire cell become selected!

That's what was killing me yesterday: everytime the code was executed, the range being examined was being reset to the original range, and I couldn't figure out why.

Extending the end point to one character shy of "the end," i.e., like this:

it's time for {123}all{124} good men and women to party
                   S----------------------------------E


solved the problem. The next time the pattern is searched for, "{124}" will be found (even if it's at the end of the text).

Apropos of which, the macro works like a charm and actually makes it much easier to deal with the source text. It was a good investment in time.

Cheers...

UPDATE: Wordfast has this concept of a "placeable," which basically is any source text string that's not translatable, such as document designations (e.g., the '50578' in "SSP 50578"). It turns out - I find out by accident - that strings such as "{123}" are treated as placeables as well, and since Wordfast has hotkeys for navigating and copying placeables, it turns out my macro sort of reinvented the wheel. Still, I don't regret the time spent developing the code.

Profile

alexpgp: (Default)
alexpgp

January 2018

S M T W T F S
  1 2 3456
7 8910111213
14 15 16 17181920
21222324252627
28293031   

Most Popular Tags

Style Credit

Expand Cut Tags

No cut tags
Page generated Jul. 22nd, 2025 12:53 pm
Powered by Dreamwidth Studios