Thoughts on Perl and Emacs, technology and writing

Simple HTML Grid widget – part 4

I know that last time I said we would look at passing data to other pages and data sorting but instead I thought I would make a brief diversion into sqlite. Playing around with table data such as this:

I can’t imagine the thinking behind making string->url take a perfectly valid URL and breaking it. If you must do this, at least provide a function that doesn’t have this behaviour, say string->url and string->borked-url. This totally unreasonable design decision has damaged my confidence in the PLT scheme standard library. It is possible to work around the stupid default behaviour (although the fix presumably breaks URLs with semi-colons in the query string).

Then the functions to extract the interesting data and store it in the database. The symbol, price and change from the previous day are the first, second and fifth fields respectively. I think this csv file only changes once a day so we fix the time portion of the datetime to an arbitrary value. I haven’t named the functions particularly well here, but they should convey my intent at least.

Share this:

Like this:

Related

9 Responses

The strange thing is that the standard recommens semi-colons instead of ampersands.
So string->url doesn’t break the url per se, it is the Yahoo server, that doesn’t follow
the standard. As you found out, you need (current-alist-separator-mode ‘amp) to force it
to use ampersands.

Strange things usually have an explanation, the PLT mailing list is the place to get it.

And as far as the comment goes “(although the fix presumably breaks URLs with semi-colons in the query string)” — I dont believe this is the case, but if you’re having problems, please do let us know, either on the plt-scheme mailing list, or via bug report.

I ran into this same issue today, and not being very familiar with Scheme (I’m just trying to expose the library to Arc in a reasonable way), I wasn’t sure how to fix it. Your solution was quite helpful.