nyc: here we come

Tomorrow morning Karen and I are getting up early and driving to New York to hang out for the weekend. We’re going to the Yankees vs Oakland baseball game in the afternoon (my first time at Yankee Stadium!) and then exploring various places in New York City we haven’t already seen (hey look! nycvisit.com is written ColdFusion, too bad the developers didn’t put in any effort to catch errors, nor did they turn off debugging). Should be fun!

Last year I taught two Windows 2000 certification courses @ PREP Community Computer Center. They maintain a mailing list for people interested in community computer centers across the country… got this interesting link today from that list: http://www.networkforgood.org/npo/fundraising/donations/, so if you’re a not for profit organization, sign up! Free online donations!

wsh for windows automation

Follow up to last night’s post on wget. The wget app (in my case) needs to run every couple hours during the day. Windows 2000 and higher has a built task scheduler which I could (and will) use to schedule the execution of the task, but to do this I’d have to type some kludgy command line arguments AND I’d have to have administrator access to the machine in order to change any of the properties of the task. There must be a better way… enter Windows Script files(.wsf), which is “.. a text document containing Extensible Markup Language (XML) code, incorporates several features that offer you increased scripting flexibility. (from MSDN). It’s kinda like ANT, except Windows specific.

My download wget script eventually looks like this:

http://someserver.com/myxmlpacket2.xml.gz

FileName.xml.gz

http://someserver.com/myxmlpacket.xml.gz

theNameofMyFile.xml.gz

Couple things to notice: a) a wsf is valid xml, b) you can run multiple jobs in one file, and c) you can reuse your existing VBS scripts. So now, seeing my wsf file, how would I call that using the Windows Task Scheduler? You want to run cscript.exe, which is in c:\$winnt$\system32\, so you’re run command would look like this:

C:\WINNT\system32\cscript.exe //Job:daypart c:\wget\wget.wsf

where ‘daypart’ is the name of the job within your wget.wsf file. Using WSF as a wrapper for the wget executable allows you to easily tasks to a specific jobs. Even better, you can access almost anything on a Windows system or network using VBScript/WSH, including accessing network connections, creating local applications, and managing the system registry.

wget

As part of the site I’m working on, we’re offering a customizable weather swf that gets syndicated weather from intellicast. Intellicast posts their weather downloads as a GZIP xml file every 3 hours during business hours and they recommend that you use wget to retrieve the file. Turns out wget is a pretty cool little piece of software, albeit with spotty directions for Windows users. Here’s how to install and use wget on a Windows machine if you’re curious:

a) Download v1.8.1 from http://space.tin.it/computer/hherold/. Why not 1.8.2? I got errors when trying to use it…

b) Unzip the files to a location on your computer.

c) Create a text file called “config.wgetrc”. Open up the included HTML helper page and cruise to the “Sample Wgetrc” section and copy the sample config to your text file. Save this file.

d) Add a System Variable (right click ‘My Computer’ –> Properties –> Advanced –> Environment Variables –> New). The variable name should be ‘wgetrc’ and the value should be the path AND file name to the file you created in step c (ie: variable value = ‘c:\wget\config.wgetrc’ if you used the file name I suggested).

e) Bring up a command prompt (Start –> Run –> type ‘cmd’). Cruise over to your wget directory (on my computer: c:\wget). Type ‘wget http://cephas.net/’.

f) You’re done! You’ve successfully retrieved my homepage! Notice the file created in the wget directory.

My illustration was very simple, you can do much so much more than just retrieving one web page. It’s real power is illustrated when you need to retrieve an entire website (for archiving or mirroring purposes) or a large file (ie: a 10MB XML file) among other things. Here are some other sample commands:

Saving a file/site to a different directory
‘wget -O c:\mydirectory\newfile.html http://www.cephas.net/’

Retrieve all the gifs from a directory (directory browsing must be on)
‘wget -r -l1 –no-paren -A.gif http://www.server.com/images/’

Mirror your website
wget –mirror http://www.yoursite.com/

For complete syntax and more examples, check the wget.html file that was zipped w/ the source.

large files

Spent some time today working on importing a largish XML file (approx 46MB) into SQL Server. I didn’t spend any time thinking about the best way to do it, just the only way I knew how… read it into memory, parse out the parts you want.. it was taking 90 seconds just to read it into memory. Is there a better way?

This is a pretty cool way to look at your outlook mail.

tourist day in Boston

Friday night Karen and I drove to Maine to pick up a friend (hi April!) from California who is visiting the East Coast for the summer to show her Boston on Saturday/Sunday.

Had dinner Friday night @ Wild Willy’s, a mom and pop burger joint in York (have the Bubba burger if you get a chance). Drove home.

Saturday we got up, Karen made Chocolate Chip and Dried Cherry Scones. Drove into Boston. Parked at the Common. We thought we’d get the 30,000 view first so we walked to the John Hancock tower, which ended up being closed. Walked to the Prudential instead. Got some pictures of Fenway, the Hancock Tower, and the Charles.

Then we bought Old Town Trolley passes and hopped on the Trolley. Got off in the Fort Point Channel district, saw the Boston Tea Party replica. Had lunch (King Crab legs, a Jonah crab, chowda, cob, and melon).

Walked to the Aquarium. Got back on the Trolley. Took the trolley to the USS Constitution, aka “Old Ironsides” (pictures: here, here, and here). Took the tour of the USS Constitution. Walked the USS Casspin (a US Navy World War II Destroyer! try to find the Hedgehogs if you ever visit!). Trolley’ed again.

Walked through Beacon Hill. Saw the Bull & Finch Pub (inspiration for Cheers). Walked to the famous ducks in the Garden, took pictures.

T’ed it to Harvard Square. Walked through Harvard’s campus. Saw the Memorial Church of Harvard University. Took pictures of the church.

T’ed it to Park Street. Walked to the North End while taking pictures. Had dinner @ Rossina. Walked to see the Feast. Walked to Mike’s Pastries. Got dessert.

Walked (w/ dessert) through the North End, Hay Market Square, the Holocaust Memorial, Government Center, and down Tremont Street to lay on the grass and watch some of Shakespeare on the Common: Henry V. Ate our dessert (tiramuso, lemon tarte, and chocolate eclaire). Watched the stars and took blurry pictures (can someone help me figure out how to take pictures at night?). Walked to Loews Theater. Watched Minority Report. Movie ends at 1am. In bed by 2am. What a day!

weekend starts today

next birthday I want this. If you think it’s science fiction, check out the movie. Amazing. Can I add it to my Amazon wishlist?

took the day off today, so my weekend starts today. I’m working outta my wife’s office because our house doesn’t have A/C and it’s sticky hot outside.

Ben Forta wrote an article on CF that showed up on meerkat & xml.com (i’m assuming because it mentioned XML). Notice that they’re running CFMX, an Access database, and no error handling. Poor, poor development practices. Come on guys!

What an interesting movement this is (found here). The mailling list lives here.

xml

tomorrow @ MINDSEYE I’m giving a presentation to management/design/creative on XML, basically a high level overview of what it is and how they should be thinking about it. After working with Spectra, which used a pseudo XML called WDDX to store data, I’ve created a couple different methods (CF/ASP/JSP) of managing data in web applications, but none of them have been automatic, meaning you couldn’t just send fire method x on object A and persist the data to the db. Data Binding or data persistence does do that… I just haven’t been able to use it in a site yet… so, here’s a link to an article on xml.com about data binding and XML which compares .NET to Java’s open source castor framework. Really interesting. I need this book too.

Now with 50% less caffeine!