anannie has quit [Read error: Connection reset by peer]
cantonic has quit [Quit: cantonic]
anannie has joined #ruby-lang
havenn has joined #ruby-lang
rararadar has joined #ruby-lang
sora_h is now known as s0ra_h
ttilley has quit [Ping timeout: 276 seconds]
anannie has quit [Read error: Connection reset by peer]
anannie has joined #ruby-lang
qwerxy has quit [Quit: offski]
sepp2k1 has quit [Read error: Connection reset by peer]
tenderlove has joined #ruby-lang
Axsuul has quit [Ping timeout: 276 seconds]
Axsuul has joined #ruby-lang
enebo has quit [Quit: enebo]
JoshWines has joined #ruby-lang
tenderlove has quit [Ping timeout: 244 seconds]
jperry2 has quit [Ping timeout: 276 seconds]
totallymike has joined #ruby-lang
lfurrea has joined #ruby-lang
lfurrea has quit [Client Quit]
lfurrea has joined #ruby-lang
Banistergalaxy has joined #ruby-lang
guns has joined #ruby-lang
s0ra_h is now known as sora_h
towski has quit [Remote host closed the connection]
replore has joined #ruby-lang
<Erlkoenig>
i would like to have my own 'Hash' class with one method, specific to my application, added. If I just derive from the Hash class, i can't instantiate it the neat way original ruby hashes are created (like "{:a => 1, :b => 2}"). Is there any way to make my own Hash, which has a nice way to create, and my custom instance method?
sailias has quit [Ping timeout: 268 seconds]
<canton7>
you could always monkey-patch Hash: re-open it and add your method inside
<Erlkoenig>
hm, i'd certainly dislike having my own special method in a general-purpose-hash...
<Erlkoenig>
i'm writing some library code, and the lib users might have fun with that one
<heftig>
class Foo < Hash; end; Foo[:foo,1,:bar,2]
<canton7>
make Foo accept a Hash? Foo.new({:my => 'hash'}). Or make a method: Foo({:my => 'hash'})
<heftig>
Foo.new.merge({foo: 1, bar: 2})
<Erlkoenig>
canton7: then i had to copy, somewhat unelegant
<Erlkoenig>
(03:08:22) heftig: class Foo < Hash; end; Foo[:foo,1,:bar,2] <--- that works... but why?! :D
<heftig>
works like Hash[1,2,3,4]
<heftig>
Hash#[] is smart enough to use self.new, so it works if you subclass it
<Erlkoenig>
aah.. genius
<Erlkoenig>
thanks, thats goood
JoshWines has quit [Remote host closed the connection]
josh^ has quit [Remote host closed the connection]
sora_h is now known as s0ra_h
lsegal has joined #ruby-lang
josh^ has joined #ruby-lang
anannie has quit [Read error: Connection reset by peer]
anannie has joined #ruby-lang
havenn has quit [Remote host closed the connection]
Nisstyre has joined #ruby-lang
<MouseTheLuckyDog>
I'm not sure whether to ask hear or in #rails, but I think this is a question.more appropriately held here. I want to use ActiveRecord to create classes that can be accessed from one of two database programs.
<MouseTheLuckyDog>
To be a little clearer I want some classes to be used to access sqlite, and a group of other classes to access postgresql.
anannie has quit [Read error: Connection reset by peer]
dous has quit [Remote host closed the connection]
anannie has joined #ruby-lang
rararadar has quit [Remote host closed the connection]
Nisstyre has quit [Quit: Leaving]
rararadar has joined #ruby-lang
anannie has quit [Read error: Connection reset by peer]
jtoy has joined #ruby-lang
anannie has joined #ruby-lang
Nisstyre has joined #ruby-lang
havenn has joined #ruby-lang
jtoy has quit [Quit: jtoy]
anannie has quit [Read error: Connection reset by peer]
anannie has joined #ruby-lang
RORgasm has joined #ruby-lang
havenn has quit [Remote host closed the connection]
RORgasm has quit [Remote host closed the connection]
RORgasm has joined #ruby-lang
dfr|sf has joined #ruby-lang
anannie has quit [Read error: Connection reset by peer]
anannie has joined #ruby-lang
Nisstyre has quit [Quit: Leaving]
cantonic has joined #ruby-lang
Nisstyre has joined #ruby-lang
s0ra_h is now known as sora_h
cantonic has quit [Client Quit]
rararadar has quit [Ping timeout: 246 seconds]
Nisstyre has quit [Quit: Leaving]
Nisstyre has joined #ruby-lang
CarlB_the_great has joined #ruby-lang
tyro has joined #ruby-lang
sora_h is now known as s0ra_h
sailias has joined #ruby-lang
s0ra_h is now known as sora_h
guns has quit [Quit: guns]
sailias has quit [Quit: Leaving.]
tyro has quit [Quit: tyro]
pr0ton has joined #ruby-lang
replore has quit [Remote host closed the connection]
lun_ has quit [Remote host closed the connection]
replore_ has joined #ruby-lang
banisterfiend has joined #ruby-lang
jtoy has joined #ruby-lang
CarlB_the_great has quit [Remote host closed the connection]
ananna has joined #ruby-lang
Banistergalaxy has quit [Ping timeout: 252 seconds]
dous has joined #ruby-lang
dous has quit [Changing host]
dous has joined #ruby-lang
rdavila has joined #ruby-lang
anannie has quit [Ping timeout: 276 seconds]
lcdhoffman has quit [Quit: lcdhoffman]
dous has quit [Ping timeout: 246 seconds]
dfr|sf has quit [Remote host closed the connection]
mistym has quit [Remote host closed the connection]
cantonic has joined #ruby-lang
Bosox20051 has joined #ruby-lang
mk03 has quit [Ping timeout: 252 seconds]
lfurrea has quit [Quit: leaving]
arooni-mobile has joined #ruby-lang
jtoy has quit [Quit: jtoy]
ananna has quit [Read error: Connection reset by peer]
anannie has joined #ruby-lang
tenderlove has joined #ruby-lang
tenderlove has quit [Remote host closed the connection]
Nisstyre has quit [Quit: Leaving]
<zzak>
what happened to redcarpet on github?
<zzak>
oh, tanoku renamed to vmg
etan has quit []
banisterfiend has quit [Remote host closed the connection]
Banistergalaxy has joined #ruby-lang
drumond19 has joined #ruby-lang
bhrgunatha has joined #ruby-lang
Bosox20051 has quit [Read error: Connection reset by peer]
rdavila has quit [Quit: rdavila]
musl has quit [Read error: Connection reset by peer]
musl has joined #ruby-lang
igotnolegs has joined #ruby-lang
mistym has joined #ruby-lang
bhrgunatha has quit [Quit: ChatZilla 0.9.88.2 [Firefox 15.0/20120827221415]]
<judofyr>
Mon_Ouie: LiveTracer: tracing Rack-applications in production
Criztian has joined #ruby-lang
<judofyr>
so it starts as a "regular" profiler: showing you that this action took 100ms
<judofyr>
and maybe profiling some other stuff (like SQL-calls)
<judofyr>
but then it also gives you the possibility to trace anything else
rue|w has quit [Remote host closed the connection]
<judofyr>
so if you see that 50ms is spent in an action (excluding SQL calls etc) you can trace it and see how long method calls take time
rue|w has joined #ruby-lang
rolfb has joined #ruby-lang
dous has joined #ruby-lang
dous has quit [Changing host]
dous has joined #ruby-lang
_malte has quit [Remote host closed the connection]
_malte has joined #ruby-lang
justinmcp has quit [Remote host closed the connection]
rohit has joined #ruby-lang
Hakon has quit [Quit: Leaving...]
<manveru>
judofyr: y u hate threads? :P
justinmcp has joined #ruby-lang
<judofyr>
manveru: hm? thinking about sampling?
banisterfiend has joined #ruby-lang
<manveru>
if your server runs more than one thread, how you gonna figure out which call comes from where?
<judofyr>
manveru: my web app is single-threaded :)
<judofyr>
besides, there's Thread#set_trace_func
<manveru>
oh :)
<manveru>
i was already using the binding.eval('Thread.current') to figure it out, but that's even nicer
mylordangus has quit [Ping timeout: 244 seconds]
countdigi has joined #ruby-lang
<darix>
set_trace_func is a bit verbose
hollymann has quit [Ping timeout: 260 seconds]
meise has joined #ruby-lang
banisterfiend has quit [Ping timeout: 244 seconds]
banisterfiend has joined #ruby-lang
hollymann has joined #ruby-lang
andoyasushi has quit [Ping timeout: 255 seconds]
banisterfiend` has joined #ruby-lang
x0F_ has joined #ruby-lang
x0F has quit [Disconnected by services]
x0F_ is now known as x0F
banisterfiend has quit [Ping timeout: 246 seconds]
Hakon has joined #ruby-lang
seoaqua has joined #ruby-lang
seoaqua has quit [Client Quit]
Hakon has quit [Client Quit]
lun__ has quit [Remote host closed the connection]
_malte has quit [Remote host closed the connection]
_malte has joined #ruby-lang
sandbags has quit [Remote host closed the connection]
replore_ has joined #ruby-lang
banisterfiend` has quit [Ping timeout: 240 seconds]
seoaqua has joined #ruby-lang
banisterfiend has joined #ruby-lang
Guest32067 has quit [Quit: Leaving...]
vlad_starkov has quit [Remote host closed the connection]
seoaqua has quit [Client Quit]
jxie_ has joined #ruby-lang
jxie has quit [Ping timeout: 246 seconds]
vlad_starkov has joined #ruby-lang
seoaqua has joined #ruby-lang
vlad_starkov has quit [Remote host closed the connection]
seoaqua has quit [Killed (idoru (Spam is off topic on freenode.))]
dous has quit [Ping timeout: 244 seconds]
seoaqua has joined #ruby-lang
Xzyx987X has quit [Ping timeout: 244 seconds]
banisterfiend has quit [Ping timeout: 246 seconds]
banisterfiend` has joined #ruby-lang
<manveru>
better too much output than too little... at least for features like that :)
banisterfiend has joined #ruby-lang
sandbags has joined #ruby-lang
sandbags has quit [Changing host]
sandbags has joined #ruby-lang
Xzyx987X has joined #ruby-lang
banisterfiend` has quit [Ping timeout: 276 seconds]
GeekOnCoffee has quit [Ping timeout: 244 seconds]
ruurd has joined #ruby-lang
rohit has quit [Read error: No route to host]
dhruvasagar has joined #ruby-lang
fgomez has joined #ruby-lang
cantonic_ has joined #ruby-lang
emanon_ has joined #ruby-lang
Hakon has joined #ruby-lang
replore_ has quit [Remote host closed the connection]
banisterfiend` has joined #ruby-lang
banisterfiend has quit [Ping timeout: 272 seconds]
cantonic has quit [Ping timeout: 268 seconds]
cantonic_ is now known as cantonic
sush24 has joined #ruby-lang
Hakon has quit [Quit: Leaving...]
ruurd has quit [Quit: Leaving...]
dhruvasagar has quit [Remote host closed the connection]
burgestrand has joined #ruby-lang
seoaqua has quit [Ping timeout: 244 seconds]
mwjcomputing has joined #ruby-lang
futurechimp has left #ruby-lang [#ruby-lang]
_malte_ has joined #ruby-lang
burgestrand has quit [Quit: Leaving.]
burgestrand has joined #ruby-lang
dous has joined #ruby-lang
dous has quit [Changing host]
dous has joined #ruby-lang
_malte has quit [Ping timeout: 264 seconds]
s1n4 has joined #ruby-lang
totallymike has quit [Quit: WeeChat 0.3.7]
burgestrand has quit [Quit: Leaving.]
GeekOnCoffee has joined #ruby-lang
kvirani has joined #ruby-lang
burgestrand has joined #ruby-lang
guns has joined #ruby-lang
fgomez has quit [Read error: No route to host]
mylordangus has joined #ruby-lang
meise has quit [Quit: leaving]
meise has joined #ruby-lang
stardiviner has joined #ruby-lang
meise has quit [Client Quit]
meise has joined #ruby-lang
burgestrand has quit [Quit: Leaving.]
burgestrand has joined #ruby-lang
sepp2k has joined #ruby-lang
burgestrand has quit [Quit: Leaving.]
Elico1 has quit [Quit: Elico1]
tyro has joined #ruby-lang
Elico1 has joined #ruby-lang
burgestrand has joined #ruby-lang
mylordangus has quit [Quit: ZzzZzz...]
fgomez has joined #ruby-lang
s1n4 has left #ruby-lang ["leaving"]
Hakon has joined #ruby-lang
burgestrand has quit [Quit: Leaving.]
tonni has quit [Remote host closed the connection]
Jay_Levitt has quit [Quit: Jay_Levitt]
seoaqua has joined #ruby-lang
mistym has joined #ruby-lang
mistym has quit [Changing host]
mistym has joined #ruby-lang
tonni has joined #ruby-lang
Hakon has quit [Quit: Leaving...]
Criztian has quit []
lele|w has joined #ruby-lang
dous has quit [Ping timeout: 246 seconds]
Criztian has joined #ruby-lang
pablo__ has quit [Ping timeout: 260 seconds]
Axsuul has quit [Ping timeout: 268 seconds]
seoaqua has quit [Ping timeout: 268 seconds]
sailias has joined #ruby-lang
mistym has quit [Remote host closed the connection]
emanon_ has quit [Read error: Connection reset by peer]
jxie_ has quit [Quit: leaving]
Hakon has joined #ruby-lang
Erlkoenig has joined #ruby-lang
burgestrand has joined #ruby-lang
hollymann has quit [Quit: hollymann]
chendo_ has quit [Ping timeout: 244 seconds]
runeb has quit [Remote host closed the connection]
<Erlkoenig>
does the ruby license in any way restrict the usage of my program's source (.rb) files and the files used and generated by my program? As far as I got it, i may do whatever i want with these files, like proprietary commercial software or whatever, is that correct?
burgestrand has quit [Quit: Leaving.]
<darix>
Erlkoenig: it does not
tyro has left #ruby-lang [#ruby-lang]
<darix>
also embedding the ruby in a commercial program shouldnt be an issue.
<Erlkoenig>
oh great, thanks
<darix>
Erlkoenig: fun can start with some C extensions for ruby which link libraries with funny licenses
<darix>
readline extension linking GPLed libreadline e.g.
<darix>
or openssl
yats has quit [Read error: Connection reset by peer]
<darix>
also you should watch out for licenses of the gems you use
<Erlkoenig>
uhm. i'm using "stock" ruby and trollop, which uses the same license as ruby. Does that contain any such libraries?
<darix>
as i said ... readline could be an issue
<darix>
or openssl
<darix>
:)
<Erlkoenig>
they are included in "stock" ruby? or just referenced (as in you have to install them seperately)?
<rue|w>
Someone mentioned that leaving out OpenSSL causes all kinds of problems
emanon_ has joined #ruby-lang
<rue|w>
But you *can* build without
<rue|w>
And the restriction would really only apply if you’re bundling Ruby into a product you’re offering
<Erlkoenig>
oh good, i'm not planning to do that
rindolf has joined #ruby-lang
Hakon has quit [Quit: Leaving...]
<rindolf>
Hi all. http://paste.debian.net/188417/ - this code gives me «./binary_puzzle_solver.rb:292: syntax error, unexpected ')' (SyntaxError)» - why?
<Erlkoenig>
well in fact my program will be opensource and just .rb files (probably a gem), but it might be used to develop proprietary commercial software, and i would like to make sure that those who do that don't have to fear license problems from ruby...
<Erlkoenig>
rindolf: because you have a , before your )
ryez has joined #ruby-lang
<rindolf>
Erlkoenig: oh.
<rue|w>
If they’re concerned, they’ll be familiar enough with licences to make the determination
codewrangler has joined #ruby-lang
Hakon has joined #ruby-lang
<rindolf>
Erlkoenig: it sucks that Ruby does not support it.
<rindolf>
Erlkoenig: I think Perl and Python do.
<rindolf>
Erlkoenig: and it does not handle it gracefully either. :-(
<rindolf>
Erlkoenig: why not put it under a permissive licence or a weak copyleft licence then?
elux has joined #ruby-lang
tyro has joined #ruby-lang
<Erlkoenig>
rindolf: that's why i'm using a permissive license, but i wanted to make sure that the ruby license wouldn't cause any problems
<Erlkoenig>
rue|w: probably... but it might be nice to be able to advertise "licensing of #{my_program} and it's dependencies suitable for commercial use" or something
<rue|w>
You don’t want to make claims like that without a lawyer.
<rue|w>
You’ll find yourself establishing shit you can‘t back up at some point :P
<zzak>
i like making things more complicated than they have to be
<zzak>
injekt: patches welcome :)
<Erlkoenig>
zzak: better than not being able to do it otherways. :D
<injekt>
:D
<injekt>
zzak: keep reading it as 'gloryhole' :S
cmaxw has quit [Read error: Operation timed out]
bubonicpestilenc has joined #ruby-lang
yats has quit [Read error: Connection reset by peer]
yats has joined #ruby-lang
<zzak>
injekt: lets keep it pg
Dreamer3 has joined #ruby-lang
rins has quit [Quit: leaving]
lcdhoffman has joined #ruby-lang
josh^ has quit [Remote host closed the connection]
savage- has joined #ruby-lang
pdm has joined #ruby-lang
|Vargas| has quit [Quit: ...]
lcdhoffman has quit [Client Quit]
<pdm>
hi, is there a way to make PStore not start the file from scratch every time, or is this just how PStore works? (sorry if question is not appropriate for here)
ruurd has quit [Quit: Leaving...]
lcdhoffman has joined #ruby-lang
<pdm>
OH n/m, typing things into irc often helps on its own
jakob- has quit [Quit: jakob-]
<matti>
Hehe
Dreamer3 has quit [Quit: Computer has gone to sleep.]
dfr|sf has joined #ruby-lang
Dreamer3 has joined #ruby-lang
gsav_ has quit [Quit: Lost terminal]
rolfb has joined #ruby-lang
anannie has quit [Read error: Connection reset by peer]
nXqd has quit [Ping timeout: 272 seconds]
anannie has joined #ruby-lang
rue|w has joined #ruby-lang
havenn has joined #ruby-lang
yats has quit [Ping timeout: 240 seconds]
coryf has quit [Remote host closed the connection]
anannie has quit [Read error: Connection reset by peer]
anannie has joined #ruby-lang
dfr|sf has quit [Remote host closed the connection]
rue|w has quit [Ping timeout: 240 seconds]
Criztian has quit []
kitallis has quit [Quit: Computer has gone to sleep.]
sush24 has quit [Quit: This computer has gone to sleep]
anannie has quit [Read error: Connection reset by peer]
dfr|sf has joined #ruby-lang
anannie has joined #ruby-lang
kvirani has joined #ruby-lang
totallymike has joined #ruby-lang
fgomez has quit [Ping timeout: 272 seconds]
anannie has quit [Read error: Connection reset by peer]
anannie has joined #ruby-lang
Criztian has joined #ruby-lang
qwerxy has quit [Quit: offski]
anannie has quit [Read error: Connection reset by peer]
anannie has joined #ruby-lang
sush24 has joined #ruby-lang
headius has joined #ruby-lang
anannie has quit [Read error: Connection reset by peer]
anannie has joined #ruby-lang
PatrixCR has joined #ruby-lang
PatrixCR has left #ruby-lang [#ruby-lang]
robotmay_ has quit [Remote host closed the connection]
<anannie>
Hi I'm trying to build a small text adventure game. As it's all driven by numerical options, I wrote this small program ( git://gist.github.com/3667368.git ) to extract numbers from whatever the user types in. Can someone please help me convert it into idiomatic ruby? I want to learn how to think in ruby.
<rue>
That’s single digits, though, not multi-digit numbers.
Hakon has joined #ruby-lang
<wnd>
lianj's suggestion is even neater and handlers multi-digit numbers
<rue>
Yes
<wnd>
handles, even
<rue>
str.scan(/\d+/).map(&:to_i)
lcdhoffman has quit [Quit: lcdhoffman]
<rue>
So, scan the string for sequences of one or more digits, extract each individual sequence, and then use the String#to_i method to convert each into an actual number
yats has quit [Ping timeout: 272 seconds]
<anannie>
\d+ is essentially a placeholder for any pattern that resembles a number?
<canton7>
"one of the digits 0-9 one or more times"
<anannie>
rue: Yeah that's what I was doing, but my code wasn't as neat and dense as yours. How do you get from my https://gist.github.com/3667368 to str.scan(/\d+/).map(&:to_i)
lcdhoffman has joined #ruby-lang
lcdhoffman_ has joined #ruby-lang
<anannie>
It's quite neat, can you please explain how you figured out the implementation in ruby? It seems like an opaque magical process to me
<rue>
lianj’s code in this case; most of it is simply knowledge of what the language gives you: the #scan method, regexps, and the #map method
<wnd>
or even str.scan(/-?\d+/).map(&:to_i) if you need negatives
<anannie>
rue: Will this book Eloquent Ruby that I plan to read next teach me that?
<rue>
anannie: The iteration idiom (#map in this case) is important. It could actually be used to improve your original code, too. Where you use the for…in construct, you could use the #each method instead. It works for any Enumerable
<anannie>
wnd: what does the ? in -? signify? That the - is conditional?
<rue>
It’s optional
ylluminate has quit [Quit: Bye!]
<rue>
-> store
lcdhoffman_ has quit [Client Quit]
<injekt>
pick me up some cheetos please rue
havenn has joined #ruby-lang
<rue>
OK. Should I grab a multicolour refill too?
lcdhoffman has quit [Ping timeout: 240 seconds]
<injekt>
sure let's make it a party
qwerxy has joined #ruby-lang
<rue>
anannie: It’ll give you the tools to start considering these things, yes
<wnd>
anannie, you may want to read more about regexps (or regular expressions) if you need to extract pieces from text or do non-trivial string matching
<anannie>
rue: Okay. I'll work my way through that next.
<anannie>
wnd: I'll do that as well
RegEchse has joined #ruby-lang
macmartine has joined #ruby-lang
<wnd>
but you'll do fine without regexps. regexps can get very dirty very easily.
<rue>
Try out map (and other Enumerable methods) in irb/pry for fun. [1,2,3].map {|i| i + 10 } # etc. Now, seriously, store
<anannie>
rue: Thank you
<anannie>
wnd: I'd rather learn something that important than ignore it
<injekt>
[1,2,3].map(&method(:puts))
sepp2k1 has joined #ruby-lang
<anannie>
what the &method do over here?
<injekt>
anannie: just dont put regexp to the top of the learn list, ensure you get grips on the language first
<anannie>
and why have you inserted the : before puts?
<anannie>
injekt: Noted.
<injekt>
method(:puts) try that in irb
<injekt>
:puts is a symbol
sepp2k has quit [Ping timeout: 276 seconds]
anannie has quit [Read error: Connection reset by peer]
<injekt>
method(:puts).call("hello")
anannie has joined #ruby-lang
<injekt>
heh
<anannie>
injekt: Sorry about that, spotty connection. By symbols you mean something that shares the same address? Isn't puts a function?
<injekt>
anannie: yes, if you're just learning ruby now I highly recommend ignoring that and coming back to it later
<anannie>
injekt: That makes sense if it was just a variable, but what does that mean for a function?
<anannie>
injekt: I'm curious now... I know I probably won't understand it, but I would love to take a crack at it. Is there a resource I can read?
<injekt>
dont use function :) ruby has methods because all function type things are bound to an object (so they're methods)
jxie has joined #ruby-lang
<injekt>
anannie: method(:puts) calls the method 'method' and passes the Symbol object :puts to it, this method returns an instance of the Method class
<Erlkoenig>
i'd like to allow my program's users to specify some sort of Hash(where both key and value are Strings) on the command line, where one ARGV[] entry is one complete hash, perhaps something like "ruby prog.rb name:jack,place:home" ---> {"foo" => "blubb", "bar" => "bla"}.
<Erlkoenig>
I now need some code to parse this String representation of my Hash, to get an actual ruby Hash. What's the most easy way to do that, while being able to use escape characters to also specify "," in the value-strings (like "ruby prog.rb name:john\,jack,place:work")?
<Erlkoenig>
ah nice, but now what if the name contains a comma?
<injekt>
...
<Erlkoenig>
some sort of escaping is needed, so \, can be specified
<darix>
injekt: you have to many whitespaces in that line ;p
<darix>
Erlkoenig: and you need better parsing.
<darix>
be creative
<injekt>
darix: habit
<injekt>
I always separate { and |
<Erlkoenig>
is there no easy standard way to do it? i know how to do it myself, but i'm too lazy
havenn has quit [Remote host closed the connection]
<injekt>
...
<injekt>
well now I'm definitely not helping you
<darix>
i think i know your problem
<anannie>
injekt: I'm afraid I don't understand.
havenn has joined #ruby-lang
<injekt>
anannie: we expected that. Continue learning Ruby and all will make sense
goshakkk has joined #ruby-lang
<anannie>
injekt: Okay, back to it then
<Erlkoenig>
injekt: what? i thought that there might be an easy fast way to do it, rather than writing a complete parser on my own
sush24 has quit [Quit: This computer has gone to sleep]
Hakon has quit [Quit: Leaving...]
<darix>
Erlkoenig: stating that you are just too lazy and expect us to write the code to solve your problem is like telling the girl you just want sex without the date hazzle and it usually only works for Barney.
<darix>
hassle even
<injekt>
i like hazzle
<Erlkoenig>
wah, i didn't want anybody to write a lot of code for me, i just wanted to know whether there is a 2-line-solution that you could give me
<darix>
now i want chocolate
Dreamer3__ has joined #ruby-lang
Dreamer3 has quit [Ping timeout: 246 seconds]
<injekt>
Erlkoenig: if you want to split on , but also ignore , then you need something more than a hacky 2 liner
Dreamer3__ is now known as Dreamer3
<Erlkoenig>
yes, it could have been possible that ruby already has support for something like that
<injekt>
ok
<Erlkoenig>
e.g. String#parse_with_escapes or something...
<injekt>
right
tenderlove has joined #ruby-lang
<Erlkoenig>
in this case, i'll just leave a "# TODO - better parsing here." and look at the more important parts...
workmad3 has quit [Ping timeout: 252 seconds]
<darix>
or you could ban "," in names
<Erlkoenig>
well the thing with names was just an example to make it easier, in fact any character can appear...
<darix>
or use a regexp with split
<darix>
and use backtracking in the regexp to check if the , is after a \
<Erlkoenig>
but what about "foobar\\," ? :D
sandbags has quit [Remote host closed the connection]
* darix
hands Erlkoenig a gun and points it on Erlkoenig's foot. > now pull the trigger
havenn has quit [Remote host closed the connection]
<injekt>
the thing is, adding the escapes wont help
<Erlkoenig>
ah very nice, that's what i was looking for
<whitequark>
ragel is pretty awesome, it also has nice docs
<whitequark>
note through that it's an abstraction for a state machine
levicole has joined #ruby-lang
<whitequark>
you might think that it's a parser at times because it has somewhat similar grammar syntax
<whitequark>
it is not
yellow5 has joined #ruby-lang
<whitequark>
and that's important
<whitequark>
e.g. it does not have an (implicit) stack
<whitequark>
it has explicit commands for manipulating the stack, through
<elux>
hey guys..
blowmage has joined #ruby-lang
<zzak>
what's a good way to determine 32bit or 64bit os, so i can include the appropriate binary
<elux>
my app uses ActiveSupport.. but I really want it to stop overriding ::JSON or whatever it is doing because its using its json encoding/decoding instead of mine.. very annoying.. any suggestions?
<drbrain>
zzak: 1.size
<Erlkoenig>
oh well thanks, i'll look at it. luckily the license states "Use of Ragel makes no requirements about the license of generated code. " ...
<drbrain>
well, it'll tell you how your ruby was compiled
<whitequark>
drbrain: ewwww
<whitequark>
implementation detail
<Erlkoenig>
drbrain: that's no good
icooba has quit [Quit: Computer has gone to sleep.]
spectra has joined #ruby-lang
<whitequark>
zzak: it depends on what you're trying to do
<whitequark>
if MRI ext, then extconf.rb would already generate the right binary
<zzak>
include a 64bit statically compiled binary
<drbrain>
the best way is to probably use cpuid
<whitequark>
if FFI, then FFI has a field
adgar has joined #ruby-lang
<zzak>
or fall back to 32bit
<whitequark>
drbrain: wrong
<whitequark>
drbrain: you can use 32-bit OS on 64-bit CPU
<whitequark>
or you can even use 32-bit userspace on 64-bit CPU
ivanoats has quit [Remote host closed the connection]
gorelative has joined #ruby-lang
ivanoats has joined #ruby-lang
gorelative has left #ruby-lang [#ruby-lang]
yats has joined #ruby-lang
ndboost has joined #ruby-lang
ndboost has quit [Client Quit]
<elux>
hrmm
<lianj>
bradland: really want '_'
<elux>
does anyone know how to make the JSON gem work with Time..? ie. require 'json'; Time.now.to_json .. ends in "Stack level too deep"
<bradland>
lianj: i could live with - or .
<bradland>
just need something to follow across with my eye
<lianj>
elux: works fine here.
<lianj>
bradland: " " would be easy :D
<bradland>
indeed :)
<bradland>
%75s and i'm done
<bradland>
well %-75s
<elux>
hrmm yes.. works here too.. shitty... must be a bunch of overriding or some bs that broke it
yats has quit [Ping timeout: 272 seconds]
goshakkk has joined #ruby-lang
<outoftime>
this is kind of obscure, but is there a way in a rescue block to instruct the interpreter to move on to the next matching rescue?
emanon_ has quit [Quit: Leaving]
mwjcomputing has quit [Quit: Leaving]
totallymike has quit [Quit: WeeChat 0.3.7]
<drbrain>
outoftime: no, other than by nesting
<outoftime>
drbrain: got it. just wanted to make sure there wasn't something clever i was missing : )
<drbrain>
… or putting common exception handling logic in methods
anannie has quit [Read error: Connection reset by peer]
anannie has joined #ruby-lang
<rue>
outoftime: What’s your use case? Sounds a little smelly
thedarkone_ has joined #ruby-lang
Nisstyre-laptop has quit [Quit: Leaving]
adgar has quit [Ping timeout: 252 seconds]
spectra has quit [Ping timeout: 240 seconds]
adgar has joined #ruby-lang
<elux>
is there a way to un-define a class.. method, etc.. ? ..
spectra has joined #ruby-lang
s1n4 has left #ruby-lang ["leaving"]
jtoy has quit [Quit: jtoy]
dfr|sf has joined #ruby-lang
dfr|sf has quit [Remote host closed the connection]
<outoftime>
rue: I'm sure it does. I'm catching an exception that wraps another exception. I want to do one thing if the wrapped exception is one type, and otherwise do something else. the "something else" also applies to more generalized exceptions than the one I'm catching.
dfr|sf has joined #ruby-lang
dfr|sf has quit [Remote host closed the connection]
NOKAH has quit [Ping timeout: 240 seconds]
<rue>
Couldn’t you define more wrappers?
<outoftime>
rue: I'm not the wrapper
<outoftime>
rue: from a different library
<rue>
That’s never stopped anyone!
qpingu has joined #ruby-lang
<rue>
elux: No. You can do Const = nil, but that still leaves the object around, included, extended etc.
<outoftime>
I'm not about to monkey-patch excon just so my exception handling is slightly more elegant : )
<rue>
Do it because their way sounds terrible
<outoftime>
i would if this were app code, but the code i'm working on is also library code
<outoftime>
I am a pretty strong believer in not screwing with code you don't own in libraries.
goshakkk has quit [Quit: Computer has gone to sleep.]
pr0ton_ has joined #ruby-lang
<rue>
Screw ’em
<outoftime>
heh
lun_ has quit [Remote host closed the connection]
lun_ has joined #ruby-lang
CoverSlide has joined #ruby-lang
pr0ton_ has quit [Quit: pr0ton_]
bradland has quit [Quit: bradland]
dfr|sf has joined #ruby-lang
programR has joined #ruby-lang
anannie has quit [Read error: Connection reset by peer]
arooni-mobile has quit [Ping timeout: 244 seconds]
lcdhoffman has joined #ruby-lang
<drbrain>
ok?
<whitequark>
well, I dunno. each time I think that there should be some kind of rubygems policy to prevent names like "trollop" actually happening to nice gems, I arrive to the realization that it'd make the situation worse
<whitequark>
it's censorship, it's unclear who'll be applying the policy, etc.
<zenspider>
wow. what horseshit
<whitequark>
but I wonder why doesn't e.g. CPAN contain that
<drbrain>
a sphincter is a a ring of muscle, you have something like 60 of them
<whitequark>
yeah I know
<drbrain>
that's a long way from "trollop"
qwerxy has quit [Quit: offski]
<zenspider>
trollop is just an irc bot that annoys the ops... I don't see how it's offensive.
<whitequark>
I was overgeneralizing. for some reason people tend to choose strange names for gems
<whitequark>
zenspider: erm, it's a nice CLI parser
<zenspider>
quite frankly, the puritanical notion that everything in the world needs to be intellectually nerfed needs to die.
<whitequark>
none of these names actually offend me, but I'd like to avoid the kind of issues like described in the /. article.
<whitequark>
maybe I'm wrong after all.
<whitequark>
but I don't see why would you name your project (which is presumably was written to be popular) in a controversive way
<whitequark>
to cause rants?
mistym has quit [Remote host closed the connection]
<drbrain>
the good name was taken
<whitequark>
english contains, I dunno, ~20k often used words?
<whitequark>
through there are 43k gems
justinmcp has quit [Remote host closed the connection]
wpaulson has joined #ruby-lang
wpaulson has quit [Client Quit]
_malte_ has quit [Remote host closed the connection]
<Erlkoenig>
whitequark: the names in that article are maybe a bit unlucky, but names like "firefox" are probably better to remember - and make nicer "brand" names - then "opensource-web-browser"... applies to gems too
imajes has quit [Excess Flood]
imajes has joined #ruby-lang
<whitequark>
Erlkoenig: I don't say that you only should select boring and descriptive names for your gems; I don't think so
<whitequark>
but I do think that one should avoid controversional ones
<whitequark>
I don't see any reason not to.
<Erlkoenig>
well people tend do like to mess up conventions... so some like to give their projects "funny" names... like libsexy or something
<Erlkoenig>
I'd just say let them do what they want, if you don't like the name, don't use the lib/app. so if you got a really bad name, nobody will use your lib/app and you might consider using a friendlier one...
<whitequark>
that doesn't work when a gem becomes a rails dependency or something like that
shyouhei has quit [Quit: Tiarra 0.1+svn-39036: SIGTERM received; exit]
<Erlkoenig>
the idea is to have the "market" rule that out... if it has a weird name, it probably won't become a rails dep
<whitequark>
to name an example, paperclip, a quite popular attachment management gem, depends on cocaine
<whitequark>
and I guess that thoughtbots won't really take that as an issue if they added this dependency in first place
<whitequark>
and, well, more often than not the gem is really great, it's just the name which sucks
<Erlkoenig>
hum... the opensource community is large and diverse... you probably can't avoid such things really, and rather just live with them
<Erlkoenig>
it's something like the cost for a shitload of libs and apps that do every crazy thing you can imagine
<whitequark>
try searching for such names on CPAN
<whitequark>
which is bigger than rubygems
<eam>
stupid module names is a problem fairly unique to the ruby community
<whitequark>
^ that
<drbrain>
I've had a bigger problem with poor organization inside gems with good names than with bad gem names
<eam>
in fact, I name my modules reasonably when I distribute them for other languages (but not for ruby)
<drbrain>
(speaking of stupid module names)
<eam>
just to fit in
<eam>
drbrain: yeah, that's a big issue as well
<eam>
lots of clever, little of standardization and best practices
<whitequark>
well, that problem is quite global to every language which is actually used at present moment
<eam>
whitequark: the clever, or the module structure?
<whitequark>
eam: both I'd say
<eam>
I think most languages have a reasonable module structure. Perl has this mostly figured out, as does C
<whitequark>
lol C
<eam>
?
<eam>
C's structure is arguably the best
<whitequark>
there isn't even a cross-platform way to build a shared object in C, and now we talk about module structure
<Erlkoenig>
eam: nonexistant? :D
<whitequark>
C doesn't have modules to be precise.
solars has quit [Ping timeout: 245 seconds]
<eam>
Erlkoenig: eh? I'd take ld.so and dlopen() over require any day
<eam>
whitequark: sure it does
<whitequark>
eam: I'm pretty sure that ld.so and dlopen are not parts of C standard
<eam>
you have object files, static and shared libraries
<eam>
they're part of the C standard library, bro
<whitequark>
there isn't even a single way to build a shared library across different Unices
<eam>
it's how the C standard library is implemented
benanne has quit [Quit: kbai]
<eam>
whitequark: that's by design, it's called abstraction
<whitequark>
not to talk about different platforms
<eam>
and you'll find similar abstraction in ruby
<Erlkoenig>
(00:43:06) eam: they're part of the C standard library, bro <--- dlopen() doesn't exist on windows
<whitequark>
eam: they're not part of the C standard library
<whitequark>
they're part of POSIX indeed
<eam>
implemented using the exact same mechanisms in fact
<whitequark>
but that has nothing to do with C stdlib
<eam>
whitequark: you're saying dlopen is not part of libc?
<whitequark>
eam: write me a cross-platform way to load a shared object
<eam>
don't confuse ANSI C with the C standard library
lcdhoffman has quit [Quit: lcdhoffman]
<eam>
they are different
qwerxy has joined #ruby-lang
<eam>
Erlkoenig: and it does, btw
<whitequark>
eam: are you trolling?
<Erlkoenig>
maybe in the cygwin runtime, but not when using "plain" C
<eam>
no, do you not understand how C handles modules?
<Erlkoenig>
windows has LoadLibrary which is part of the Win32API... but not dlopen()
<whitequark>
as per dlopen, search MSDN for it
<whitequark>
windows definitely doesn't have dlopen
deryl has joined #ruby-lang
<eam>
Erlkoenig: you're saying win32 doesn't have dlopen, sure. but posix on windows does
<whitequark>
is not part of Windows
<eam>
it is
<Erlkoenig>
posix on windows works until Windows NT or something?
<whitequark>
because you cannot call Win32 subsystem from the POSIX on Windows
<whitequark>
due to the way it interacts with csrss
<eam>
sure
<whitequark>
and now I'm sure that you are trolling
<eam>
I'm trolling? you're the one saying C object files aren't the way that C implements modules
<eam>
and you're focusing on dlopen() and ignoring object files or archives
<whitequark>
again: C language doesn't have modules, it has translation units which are a completely different story
<eam>
this conversation is ridiculous
<Erlkoenig>
c object files are something like modules, but lack namespaces
<eam>
whitequark: C has object files
<eam>
Erlkoenig: not all languages have namespaces
<Erlkoenig>
and without namespaces things are getting... intereseting
<eam>
modules != namespaces
<whitequark>
yes. so? object file doesn't contain all information you need to interface with it
<whitequark>
you need at least a complementary header
<eam>
whitequark: that's right, that's how C does it
<eam>
I'm glad you finally agree (can't believe this is an argument)
<Erlkoenig>
eam: so what exactly are you calling a module?
<whitequark>
and there, for example, isn't a portable way to manage headers/object files for different versions of the same library
<whitequark>
every one does it in their own way
<whitequark>
compare, for example, Qt, zlib and glib
<eam>
Erlkoenig: 15:42 < eam> you have object files, static and shared libraries
tenderlove has quit [Remote host closed the connection]
<whitequark>
to speak about standartization
<eam>
this is seriously off topic guys
<eam>
my comment was not contentious
<Erlkoenig>
whitequark: yep, and that's very very evil
qwerxy has quit [Quit: offski]
<eam>
the point is that C's version of modular code is very well structured
<whitequark>
Erlkoenig: indeed, and I don't understand how anyone would call the crutch C has instead of proper modules "reasonable"
<Erlkoenig>
well in the end it's a question about the definition of "module"...
deryl has quit [Client Quit]
<whitequark>
more like "completely unusable"
<eam>
whitequark: I said it had a better defined structure, and culturally does not suffer from the disjoint hodgepodge going on in the ruby module space -- and I don't see you submitting evidence to the contrary
iamlacroix has joined #ruby-lang
<Erlkoenig>
hehe... try to compile a C++ GTKmm application for Win32, on Linux...
deryl has joined #ruby-lang
<whitequark>
ok. what should a module system provide, in your opinion?
<eam>
I see you arguing that C isn't modular, which is a bizarre stance
<whitequark>
I would say namespacing and isolation
<drbrain>
if namespacing is not provided by the language you probably don't have "modules"
<whitequark>
it has neither
<drbrain>
eam: "modular" is not the same as "having modules"
<eam>
whitequark: you are suggesting libraries do not have private symbols?
<eam>
that would be incorrect
<Erlkoenig>
eam: symbols of different libraries can mix up
deryl has quit [Client Quit]
<eam>
Erlkoenig: exported symbols yes
<whitequark>
eam: they do, but public symbols are not isolated from each other
<Erlkoenig>
if two libraries have a public symbol with the same name
<Erlkoenig>
and that's what i'd call "interesting" :D
<eam>
whitequark: the same is true of ruby, if two modules touch Kernel
deryl has joined #ruby-lang
<eam>
it's perfectly possible to have isolation in C
deryl is now known as Guest39894
<whitequark>
eam: but ruby has namespacing, and C does not
<Mon_Ouie>
I guess that's part of why people want refinements in Ruby
<eam>
whitequark: sure
<Erlkoenig>
by prefixing every method with the module name... but not everyone does that
Guest39894 has quit [Client Quit]
<whitequark>
and we're back at the "standartization" part. no, C modules are absolutely not consistent across the ecosystem
<Erlkoenig>
also specifying the module's name this way a thousand times is not fun
<whitequark>
way less consistent than ruby ones
ryez has joined #ruby-lang
<eam>
all these nitpicks don't change the fact that the culture of building C libraries is very well structured -- perhaps moreso than any subsequently developed language environment
<eam>
which is the topic we're discussing, btw
<Erlkoenig>
what?! no
<whitequark>
... would you also say that autotools are good?
<Erlkoenig>
e.g. how do you link against gtk libraries?
erichmenge has joined #ruby-lang
<Erlkoenig>
and how do you link against zlib?
havenn has quit [Remote host closed the connection]
erichmenge has quit [Client Quit]
<eam>
whitequark: autotools aren't part of any library interfaes
<eam>
that's something completely different
<whitequark>
and if you it's "well structured", then why do we have "$PKGNAME-config" in some cases, "pkg-config -l $PKGNAME" in another, and a thousand of other incompatible methods ?
<whitequark>
autotools are supposed to fix what's broken with C modules, namely that there is no standard way to do anything with them
<Erlkoenig>
and - why does pkg-config only supply lib/inc flags suitable for GCC - what if i wanted to write a GTK application using e.g. the MS Compiler?
<whitequark>
for example, there is no standard way to build a shared object on Unix
<eam>
you're confusing portability with language structure
postmodern has joined #ruby-lang
<eam>
again, that is not what I'm talking about
<whitequark>
if language actually is modular, it should enforce interoperability across implementations
<whitequark>
otherwise it isn't.
<eam>
that's silly
<Erlkoenig>
well the core language itself might be nicely structured... but all of the neccessary eco system around it has some... problems
<eam>
and patently false
cored has quit [Quit: Lost terminal]
<whitequark>
you can as well call each implementation a different language; that's true about C in some degree
<whitequark>
each compiler has its own set of incompatible extensions
<whitequark>
and tons of flags to enforce compatible behavior
alexkira has quit [Remote host closed the connection]
<eam>
Erlkoenig: when I look in /usr/lib, or across the swath of libraries in yum, I do not see the mess that I see on rubygems in terms of module structure, organization, and implementation
<eam>
that is my point
<eam>
I did not mean for you guys to get so ratholed on the particulars
iamlacroix has quit [Remote host closed the connection]
<Erlkoenig>
what structure are you seeing in /usr/lib ?
<whitequark>
eam: there isn't even a consistent way to name a shared object.
<eam>
Erlkoenig: interface in /usr/include, clear functional delineation between libraries
<whitequark>
libopencv_video.so.2.3.1 vs libopenjpeg-2.1.3.0.so libindicate-gtk.so.3.0.3
<eam>
whitequark: there is, though not everyone follows it
<eam>
jesus dude stop trolling
<whitequark>
you are contradicting itself
<Erlkoenig>
and where do you see it on windows C:\Program Files\Application 1\lib\, C:\Program Files\Application 2\lib, C:\Program Files (x86)\Application3\lib ... etc :D
<whitequark>
*yourself
<eam>
there are exceptions in every language environment
<whitequark>
and now you're proving that C isn't any better than Ruby with your own words
<eam>
the point is that there are certain issues rampant in the ruby communtiy which are rare in C or other language environments
<eam>
whitequark: no, you are seriously confused and hearing what you want to hear
<whitequark>
eam: which particular issues are you talking about?
<eam>
I'm not going to repeat myself; this is not productive
<whitequark>
you never told one
<Erlkoenig>
(00:58:35) eam: Erlkoenig: interface in /usr/include, clear functional delineation between libraries <- regarding the files themselves, maybe. but just finding and providing the neccessary include paths to the compiler is problematic again
<whitequark>
except Kernel monkey-patching, but it's not a modularity issue
<eam>
the logs tell another tale and I suggest you re-read them if you're still confused. I'm done with this
<whitequark>
you can do LD_PRELOAD in C as well, doesn't mean it's any better
<zenspider>
ok. this is bullshit noise. ruby or stfu
<Erlkoenig>
censorship :o
<zenspider>
yup. welcome to a topic oriented channel.
<zenspider>
go to #hottub or #bullshit
<eam>
thank you
<drbrain>
##c
snorkdude has joined #ruby-lang
tenderlove has joined #ruby-lang
havenn has joined #ruby-lang
havenn has quit [Remote host closed the connection]
<whitequark>
I'm also not really sure that strong structuring like CPAN's actually provides some value except for eyecandy
<whitequark>
if you know what SFTP is, you'd also know that it's for Net. otherwise, why would you care?
<eam>
whitequark: generally I'd say anything with matching substrings, eg libgtk, libX, libpg ...
<eam>
really would rather not digress though
<eam>
the bigger issue in my opinion is that the labels are descriptive of function
<whitequark>
well, see above, ruby also has that convention and it's used a lot
<whitequark>
as per descriptive names, yeah, I agree
<eam>
none of the stuff we're talking about is an absolute
<eam>
I'm only speaking to the overwhelming behavior of each community
<whitequark>
ok
<zenspider>
generalizations about a programming language's libraries being "uncute" will always be disproven. libiberty, for example
<whitequark>
... or the fact that binary formats are called ELF and DWARF for no apparent reason
<whitequark>
(DWARF doesn't even have a backronym)
jtoy has joined #ruby-lang
<Erlkoenig>
what's the problem about ELF? it's perfectly reasonableß
<eam>
zenspider: only if they're absolute generalizations, which mine was explicitly not
<eam>
the comments about prevalent behavior are well supported
billyoc has joined #ruby-lang
mistym has joined #ruby-lang
mistym has quit [Changing host]
mistym has joined #ruby-lang
<amerine>
zenspider: I was one of the people who read your talk description and worried that it was going to be bad. I just watched it and I thought you gave a great talk. Thank you.
jtoy has quit [Quit: jtoy]
tenderlove has quit [Remote host closed the connection]