Thursday, August 13, 2009

Yes you can use Regular Expressions in MS-Access

I've heard it was not possible, but it is:


Private Function testRE()
Dim re As Object, strText as String
strText = ""the short brown fox, jumped over " _
& "the Foxy lad of foxtown in Fox-ville."
Set re = CreateObject("vbscript.regexp")
Dim colMatches
With re
.Pattern = "\bfox\b"
.IgnoreCase = True
.Global = True
End With
'Debug.Assert False
Dim myNum
Set colMatches = re.Execute(strText)
Debug.Print colMatches.Count & " matched"
Dim inttemp As Integer
For inttemp = 0 To colMatches.Count - 1
Debug.Print ">" & colMatches(inttemp)
Next inttemp

Debug.Print re.Replace(strText, "Dog")

End Function


The results:



results:
2 matched
>fox
>Fox
the short brown Dog, jumped over the Foxy lad of Newtown foxtown in Dog-ville.

Wednesday, April 29, 2009

Hurricans are the bane to NJ Devils

For the fourth time this decade, the Carolina Hurricanes have made the playoffs. Every single time they've been there, they've played the New Jersey Devils.

Back in 2001, the Hurricanes lost to the Devils in the first round 4-2, including two shutouts by the Devils, but Carolina won the only game going to overtime.

Since then, it's been all Hurricanes:
2002: the Hurricanes won 4-2, where all four games won by Carolina were won by one goal, including both overtime games in the series.

2006: After the league took a break for a year and the Hurricanes took a break from the playoffs for a while, they once again encounter New Jersey, this time in the second round, and this time only needed 5 games to beat New Jersey, again winning the only game in overtime.

2009: Again, New Jersey in the first round, and this time New Jersey won an overtime game for the first time against Carolina in the playoffs this decade, game 3. But Carolina won in seven, winning one game in overtime and two games with a goal in the last minute. Game 4's goal came with 0.2 seconds left to win 4-3. Game 7's goal came less than a minute after the tying goal, with ~30 seconds left. Which is more dramatic? Gotta go with Game 7.

Thursday, April 16, 2009

Beating Windows Update's IE Quicklaunch


Whenever I update my computer, it seems, Windows insists on adding Internet Explorer to the QuickLaunch area. Hmmm, let's see, if I deleted it, I probably don't want it there. So why does MS add it when there's a security update? No idea, except it probably has to do with pushing the use of their browser.

There are a few problems with this. 1) I didn't give it permission to add something to the QuickLaunch area. 2) I have no way of opting out of this. 3) Except, I could skip updates, which would be a bad idea. 4) I can no longer see the icons I have there, because now now all icons can be shown, and the little double arrow is needed to click twice to the icon I want and IE.

I've found the solution, though. It's simple and I'll never have to remove it again. I added a batch file (yes, those still exist) to my startup that removes IE from the QuickLaunch area. It's simple.

1) Go the the start menu and find the "Startup" folder. Right-click on it and select "open" (not "open all users"). This will take you to some place like:
C:\Users\(yourUserName)\AppData\Roaming\Microsoft\Windows\Start Menu\Programs\Startup on Vista and something similar on Windows XP.

2) Add a new text file to that folder by right-clicking and selecting "New Text File." Rename the file "RemoveIEQuickLaunch.bat" and say OK to the warning about changing the file extension.

3) Open the file with notepad and insert the following:
del "C:\Users\(yourUserName)\AppData\Roaming\Microsoft\Internet Explorer\Quick Launch\Launch Internet Explorer Browser.lnk"
If MS creates it with a different name, you could be more aggressive with:
del "C:\Users\(yourUserName)\AppData\Roaming\Microsoft\Internet Explorer\Quick Launch\*Internet Explorer*.lnk"
4) Save the file and close it.

For Windows XP, you'd need to know the path of the QuickLaunch area, which is similar, just right click on the QuickLaunch area (not an icon), select "open folder", and it will open a window to QuickLaunch, which will tell you the path.

Now whenever I log in, the internet explorer icon is removed if it ever got added!

Labels:

Tuesday, February 03, 2009

Better, by far, than we deserve


The tennis this past week has been stellar. Serena completes another solid run in Australia, winning as she did in the previous odd years to have 4 titles in 2003, 2005, 2007, and 2009. A few other good stories on the women's side, including Jelena Dokic's comeback and Carla Suarez Navarro's surprising run to the Quarterfinals, and the Venus-Serena doubles win.


The men's side was at least as good, with an amazing 5-set win by Rafael Nadal over countryman Fernando Verdasco, who beat expectations along with Andy Murray and last year's finalist Jo-Wilfried Tsonga. With extra drama because his final opponent, Roger Federer, had 2 days of rest compared to his 1, Nadal got inside Roger's head once again and won in another 5-set match, solidifying not his but many others' claim that he is the best right now, perhaps better than Federer when it is all said and done. For my part, I love to see Nadal not worry about who is the best ever, who has more rest or a more fair draw, or any of the other things he can't do anything about, and just play tennis with all his heart and that is an extraordinary amount of heart.

This match wasn't as good as the 5-set Wimbledon final between the two, nor was it as good as the Verdasco-Nadal match. But it was amazing tennis. It's better than we, as tennis fans and players, deserve. Consider the poor football fans who have the Steelers and Cardinals to watch in the Super Bowl. That was exciting, at least at the end, but the winners could only do so by being thuggish and a bit lucky. The quality of the tennis and its players is very high right now, even if exceptionally concentrated at the top for both men and women, and I'm very grateful.

Labels:

Monday, January 26, 2009

The wisdom of 3 years

My son Joe and I have been watching a few tennis matches over the course of the last week in the Australian Open. Joe likes watching tennis (or any sport, really), and wants to know who is who. I tell him. Now he can identify Andy (Roddick), Serena (Williams), Carla (Suarez Navarro, she beat Venus Williams), James (Blake). In the match we just watched, between James Blake and Jo-Wilfried Tsonga (pictured right), Joseph had the following observation:

"I don't think Jo likes the ball very much."

I respond: "Why is that?"

"Because he just HITS the ball away REALLY quickly."

James Blake probably feels the same way. Tsonga won 6-4, 6-4, 7-6. James had a chance in the 3rd set, being up a break, but couldn't keep it.

Sometimes James is called a streaky player. The difficultly in being streaky is that it's a lot easier to have a bad streak that costs you 10 points in a row than it is to have a good streak that wins you 10 in a row. Ditto for a few service games. Tough loss for James, as the draw was open after with Verdasco having knocked off Andy Murray.

Joseph has lots of interesting comments. The other one that comes to mind is when we were watching football, he enjoyed calling out the numbers that were on the football players jerseys. After a while he was getting frustrated. After I asked him what's wrong, he said "I'm trying to find 8-7 (player #87)." I told him that he should look on the edges of the field, where the wide-receivers were. After about 10 minutes, he starts whooping hooray. Sure enough, 87 had just come on the field and Joe had spotted him.

Ah, the little things in life.

Labels:

Friday, January 16, 2009

11 foods I'm supposedly not eating

The NY Times did a story that Men's Health originally did about the 11 foods "you" aren't eating. Taken literally, I hope you're not eating them now, because few of these foods would be welcome as you interact with the computer!

Here's the story.

How accurate are they? Are you eating some of the foods they list? Do you disagree?

1. Beets: YES – especially beet treat and grated on salads.
2. Cabbage: YES – especially in ground nut stew.
3. Swiss chard: YES
4. Cinnamon: YES, on oatmeal. Maybe I’ll splurge on that now.
5. Pomegranate juice: no. It doesn’t come in the CSA.
6. Dried plums: no. Do dried figs or dates give me any credit?
7. Pumpkin seeds: rarely.
8. Sardines: no
9. Turmeric: sometimes, again, now I’ll splurge and add extra when it goes in the curry.
10. Frozen blueberries: yes, if I can remember to eat them, which isn’t often.
11. Canned pumpkin: no, but I eat fresh ones in the fall, once in my bread (see the blog photo at top).
So I get 6/11, better than half but not great.

And I have a feeling my score will drop unless I find a CSA in the US.

How do you score?

Labels: ,

Thursday, January 08, 2009

Joe vs. the volcano

We had to get our driver's licenses, car insurance, and car registration done. Our Canadian insurance and registration expired Jan 2, and it was December 29 (the first working day after Christmas). That left the 29,30, and 31st to do it. Doable, right, we have plenty of time.... We'll see.

The first day, we checked the website and found out that you have to have proof of identity, your old driver's license, and proof of car insurance to get a driver's license. However, to get car insurance, you need a driver's license. Hmmm, what to do? My wife went to the DMV and chatted with the guy who worked there whose daughter was going to Canada to University. He asked her all sorts of questions about that, but not about her proof of car insurance. The whole process took three hours, though.

"Joe" (meaning us) 2 (like basketball, 2-points for something done), the volcano (bureaucracy) 1 (for the wait time).


I went to see our old All-State insurance agent who was very helpful when we moved to Canada and still had US-based car insurance. He had my old driver's license on file and said that they'd probably give me the same number. Catherine called us and gave us her number. He gave me a proof of insurance form that I'd need to get my driver's license, and I helped him navigate his new Word 2007 to print the print option, which is not in an obvious location (just use Ctrl-P I said).

Joe 4, the volcano 1.


Then I went to the DMV to get my license. They needed my proof of insurance form, but I had it, and my wait was shorter (different DMV). I answered some of the questions wrong and had to squint a bit to pass the eye test, but I passed and got my license.

My wife also managed to get the car inspected for the annual state inspection, having refused defeat as the gas stations said they couldn't do it because they were full, as she found "Mr. Inspector" in the phone book and took the car there.

Joe 8, the volcano 1.


After one day, we're looking pretty good, maybe tomorrow would solve the rest.

The next day, the 30th, we were supposed drive to a different state to visit more family, but we had to get our car registered first. Ambitious, but possible?

We both went and took our 7-month old with us to the vehicle registration place (in Canada, insurance and registration and titles are all done in one place and are indeed only one piece of paper). We dutifully checked the website to see what we'd need. It clearly stated: 1) proof of insurance (check), 2) proof of residence (check), 3) NC driver's license (check), 4) previous title and registration (check, but Canadian, so iffy), 5) various forms we filled out from their website, 6) the annual state inspection.

We got the directions to the place off the website and printed off directions from Google, plus I had a new handy GPS navigation unit. We got near the place, but couldn't find it. The address placed in within the bounds of a hospital, so we looked all around and couldn't find it. We looked on the other side of the street in a shopping center. Nothing. Finally, we drove further down the street and saw a sign for something related to state-run vehicle something. We followed the signs. When we got there, there was a sign in front of it saying if you needed to register your vehicle, go to a different place instead. We did so and found it. The address on the NC DMV website was wrong, listing the address as "West such-and-such St." instead of "East such-and-such St." Details.

Joe 8, the volcano 2.


We got there and the line was out of the door and into the parking lot. We got in line. Soon the line was ACROSS the parking lot. The screw on our Canadian license plate was stripped, so I couldn't get it off with my Canadian looney and tooney that I had handy (Canadians have large $1 and $2 coins which are really handy). I finally got part of the jack out of the trunk and managed to unscrew the thing. The line was moving, we got into the place.

Joe 8, the volcano 3.


We finally got a chance to talk to someone and they pulled out their 45-lb. manual for what to do when a car comes from Canada. They said we needed to provide our proof of purchase from Canada or three years worth of registration and insurance proof. Neither exists, though, because the car was purchased in the US (12 years ago, too) and was only registered in Canada for 2 years. We had 1 year's worth of registration there and the previous year was at home, I happened to notice. Maybe we could have it faxed in? But the car was previously registered and titled in NC, surely that should help our case, proving the car was ours. They had to get on the phone with someone in Raleigh and sure enough, that was sufficient.

Joe 9, the volcano 3.


However, we also needed a different inspection for cars coming from Canada. Nothing was mentioned on that on their website. Surely, since the car came from the US and was previously registered in this very state, it wasn't needed. The car was already declared legal to operate in our state. No good, they said, we needed this done, and gave us the phone number to call for the inspector, who only answered the phone from 8-10am. I was so frustrated. We'd spend about 2 hours there and had nothing to show for it, other than an inspector's name and phone number, where they only answered the phone for 2 hours each day. How full would they be?

Joe 9, the volcano 6 (that was a 3-pointer).


We called the highway patrol inspector and left a message that we wanted to get this other inspection. We then called a different vehicle registration place, played dumb and said we needed to register our car, previously registered in state, but subsequently in Canada. We hoped they would do it for us. "Well, you'd need a highway patrol inspection for a car from Canada," they said. Arg, defeat. No use driving there and hearing it in person. It was 1pm and we couldn't do anything else today. And tomorrow was our last day to get this figured out. We thought we'd call the inspector and they'd say they were full today, but how about the next working day, which would be too late.

Lesson for us and anyone: ALWAYS CALL ANY BUREAUCRACY AND CONFIRM EVERYTHING YOU NEED BEFORE GOING. Check the website and bring everything both sources ask for.

Joe 9, the volcano 7.


The inspector called us back about 4pm that day! Surprise, surprise! She asked us to come in first thing in the morning, between 8-10. I said we'd be there at 8. She said, well, make it 8:30, traffic is pretty bad first thing. Nice. That's good for another point for us. But we postponed our trip another day, much to the disorientation of our three-year old who is big on knowing what's next and doesn't like last-minute change.

Joe 10, the volcano 7.


My wife saw the inspector in the morning at 8:30, and she looked around the car and found the EPA certificate under the hood. "That's all I need," she said. Annoying, because this was required for the car to have been registered before. It didn't cost us anything. 2 points for us, but 1 for the volcano.

Joe 12, the volcano 8.


She then went to the registration place (now that we knew where it was), where I was afraid there would be something else to inhibit us. I went ahead and gave my wife the previous year's Canadian registration in case all of a sudden they needed the 3-year's proof of registration. Just in case, you know?

She had to wait in line again, but not as long of a line. 1 point for the volcano.

Joe 12, the volcano 9.


She got to the same person who helped us the day before (she did all she could to help us). They ran through everything again, this time with the inspector's report done. Everything looks good, except...

You knew that was coming didn't you. The "Except" gives the volcano one more point, just because it was there.

Joe 12, the volcano 10.


We turned in our old NC plate to the Canadian agency. They made us do it. We asked if they would send it back to NC. They said normally they were destroyed, but they would see if they could mail it back. (Yeah, right). So now, the records showed us having a valid plate, but no valid insurance, for which there was a hefty penalty we had to pay. My wife explained that we did have insurance the whole time and explained what happened with the Canadian agency. And she had proof that we had it insured, because I had given her the form from last year.

Maybe that would work, they'd have to call Raleigh. Raleigh said it was OK, so they nixed the fine and gave us the plate. We were done. At last. But it was already pushing towards noon or 1pm, too late to start the drive to the next place with two small children, that would have to wait until the next day and year. We had finished, just in the nick of time. Three points to us, 2 for getting the plate, registration and title, and 1 for revoking the fine.

Joe 15, the volcano 10.


Go Joe!

Labels: