Re: [q-lang-users] cgi.q
Brought to you by:
agraef
From: Tim H. <q...@st...> - 2006-05-19 22:18:07
|
Albert Graef <Dr....@t-...> writes: > Tim Haynes wrote: > > Eep, well spotted. OK, I'm attaching the latest version I have in use here. > > Dear Tim, > > thanks a lot indeed. I'm ready to commit the new version to cvs, but with > Q 7.1 I get: Error cgi.q, line 91: invalid character escape `\?'. Here's > the corresponding line: > > > (regex "" "^http://[^?]+\?(.*)$" HR (reg 1) ) > > You probably want a \\? there? (Yes, John, I admit that you were right > all along: It's hard to spot such bugs without making unrecognized char > escapes a syntax error. (-:) Oh, drat, you've got me - I've not upgraded Q to 7.1 on the live site. Fix it by all means! :) I keep meaning to normalize everything and make one central library of the Q modules, too... > > * A `strictatoi' function (a wrapper around val that only works if the > > string is a number - saves a risk of Q-injection! - also uses `matches') > > I don't know whether this is helpful, but you can also use `valq' to do a > "safe parse" without evaluating anything: > > safe_atoi S = I where 'I:Int = valq S; Ah, thanks :) > BTW, do you still have a Q-powered page available anywhere? I remember > that you once had a part of the interface to your picture collection > written in Q, is that still the case? Yes indeed - I'm up to at least 3 sites, now: http://pig.sty.nu/Pictures/ http://scot-pics.sty.nu/ http://pig.sty.nu/wittering/ Mostly they're simple db<->xml+xslt things, althoguh scot-pics includes imagemagick and wittering/ is an increasingly complicated not-blog thing(TM) with spam-reduced comments and support for pinging technorati etc. > In case someone is interested in this side of Q programming, I also have > a little Q-powered website. The entry point is here: > > http://muwiinfa.geschichte.uni-mainz.de:5050/kirnberger.html Neat! > Hmm, it just came to me that I should probably put some Q cgi scripting > examples on q-lang.sf.net... Sounds good to me. There's a test function in cgi.q that might help; if I get a moment I might try & write a cleaner db->xml->xslt sample as well. ~Tim <http://spodzone.org.uk/> |