book crossing

A friend sent me a link to bookcrossing.com… interesting concept. From their email:

“The website encourages people to Read, Register, and then Release their books “into the wild” and then track where they go and the lives they touch. Great concept… share your books and follow their progress forever.”

importing large(45mb) xml files

I mentioned that I had to import a large weather file as part of the FJ project… it *works* using simple VBScript and MSXML but it turns out that it kills the server. Couple other options I found:

a) probably the best way to do it was would be to use SAX instead of DOM, unfortunately MSXML doesn’t support SAX via VBScript, only C++ and Visual Basic. Applicable article here on MSDN re: extracting data from a large document.

b) import the data directly into SQL Server using SQL Server Bulk Load functionality, which is the way I’m heading right now… How to? Here.

Great article here on using SAX 2.0 and Java to process large XML documents.

Translucent Databases

Interesting article on oreillynet.com in response to the recent hacking of Yale student admission information by Princeton. The gist is that sensitive data that you don’t need to physically see, but only compare/search/parse should be put into your DB hashed. Excerpt:

“For example, what if a police department needs to build a database of sexual-assault victims that lets them identify trends but hides personal information? You could use a translucent database where the first column is the hash of the victim’s name, and the second column is a hash of their full address, and the third column is a hash of their block and street. You can now group incidents together by grouping entries with identical block hashes; you can see if the incidents refer to the same person by checking to see if those hashes are different.”

More information on translucent databases can be found here.

crazy browser tricks

Found this via http://cms-list.org/, my small brain can’t figure out how this would be useful, but nonetheless, try changing your <body> tag to look like this:

<body contenteditable=true>

and then view your page… type away, move images, *resize* images, delete text… wow. Kinda cool. As usual, it’s IE 5.5 (and higher) specific, although some people have written workarounds to get it to work in Mozilla.

MSDN documentation: http://msdn.microsoft.com/library/default.asp?url=/workshop/author/dhtml/reference/properties/contenteditable.asp

nyc is fun

Just got back from our weekend in NYC (pictures here). I had a great time. Drove down to NYC in a rented 2002 PT Cruiser, got to Yankees Stadium 2.5 hours before game time (4:05pm start). Yankees Stadium staff closed Monument Park before we could get in, so I didn’t get to walk through that, but we did get to hang out on the lower levels for the first couple hours, took alot of pictures. Yankees lost 8-0 to the A’s which made me secretly happy inside. Eric Chavez & Miguel Tejada hit home runs for the A’s, Alfonso Soriano, though he didn’t hit one out of the park, showed some stellar defense. He’s amazing.

Drove to our hotel in the Upper East Side, Hotel Melrose (which used to be the Barbizon Hotel, I stayed here a couple times when I did work for FAO.com last year). I love this hotel! Fun place, reasonable rates, nice area. We learned that the Melrose Hotel, up until the late 1970’s, was an all-women’s hotel.

We walked along Lexington and got down to Rockefeller Center where we had dinner in the Rink Bar located in the bowl where the ice skating happens in the winter time. It was probably 75 degrees with a beautiful breeze… great night.

This morning we got up and had muffins at a local cafe, walked to Central Park and sat on a bench next to Conservatory Water, trying to pick out people that live in New York (in contrast to tourists like us), watching radio controlled sailboats, and drinking in the warm sun. We walked right past the Metropolitan Musuem of Art and then decided to check that out. I was naturally impressed by the fabulous pieces of armor men wore in the Medieval times, but most interested in the stained glass and glass mosaic pieces, probably because Karen could offer insight as she justed finished a glass mosaic class.

Finally, we walked all the way down to 34th and went ‘shopping’ at Macy’s, something Karen’s wanted to do forever… New York city is a cool place.

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.

Now with 50% less caffeine!