#ruby-lang - Thu 17 May 2007 between 00:20 and 01:09

NY Lost Funds



dewwhen producing output with erb templates, what's the preferred method for html-escaping stuff?
AriaIf you want pure stdlib, CGI.escape_html, as far as I know.
dewah, right, it's a manual job, fair enough ;)
what else is out there for templating, btw?
Ariaxtemplate, amrita, markaby, cerise, geez, there's a lot...
Almost pythony.
dewhmm okay
xtemplate, amrita and cerise appear to actually parse the html
well, suppose they're assuming xml/xhtml
and markaby is nice, but not quite what i'm after
dammit, i'm gonna end up attempting to roll my own templating thing
(and probably failing :))
eetfunkHow can I connect to a local socket in Ruby? I am using InternetMessageIO right now, but would like to be able to connect directly through the local socket for performance.
wyhaineseetfunk, http://ruby-doc.org/stdlib/libdoc/socket/rdoc/classes/TCPSocket.html
eetfunkwyhaines: thanks i'll check it out
wyhaineseetfunk, what is it that you are doing?
teferieetfunk: um, I sincerely doubt that using tcp sockets locally is a bottleneck
eetfunkwyhaines: i'm hacking smtp.rb to make it connect on the local socket. we have a special implementation of an smtp server here and it also listens on a local socket
teferi: we're passing a lot of data to the socket
teferithat's what sockets are for
eetfunkso you think i might just be wasting my time?
teferiI do
eetfunkok. i'll reconsider it then :)
BaconYou'd probably be better off spooling mail by piping to sendmail (or whatever the local MTA names the spooler)
eetfunkBacon: as I said, we're talking SMTP, but it's not a "real" smtp server.
mrturtleBest way to order an array based on frequency?
deworder an array based on how frequently things appear in it?
c, a, b, b, a, a --> a, a, a, b, b, c ..?
mrturtleSorry...I'm not very clear. [5, 5, 2, 2, 2, 7] -> [2, 5, 7]
dewah
use a hash
(forgive my lack of ruby skills here)
loop through the array, do something like hash[array_element]++
that'll give you a hash mapping keys to counts
then sort the keys based on the value
crap i don't know how to sort, or i'd give you some code ;)
actiondew looks it up
dewlooks it up
tpopetwo bad group_by isn't in core because that'd be great for this
I love that attitude dew, keep it up
here, let me help

Page: 2 9 16 23 30 37 44 51 

IrcArchive

NY Lost Funds