apeiros_ changed the topic of #ruby to: programming language || ruby-lang.org || Paste >3 lines of text in http://pastie.org || Rails is in #rubyonrails
<headius>
yes, they do, but they're backed by native threads
<Sou|cutter>
headius: this may be a stupid question, but how do you access them?
<Sou|cutter>
just using them gives me NameError: uninitialized constant Fiber
<Sou|cutter>
require 'fiber' also does not work
<Sou|cutter>
actually this is within a spec.. maybe this is yet another rspec issue
<headius>
you probably need to pass --1.9
<Sou|cutter>
ahh, that would do it
<headius>
and if a subprocess is getting launched, you may need JRUBY_OPTS=--1.9 so the subprocess gets it too
<headius>
JRuby 1.7 will be in 1.9 mode by default
stephenjudkins has joined #ruby
<Sou|cutter>
headius: it would appear that jruby is superior to ruby 1.9.3-p125 with fibers
<headius>
well, that's good :)
Clordio has joined #ruby
<headius>
I put in a lot of time trying to get them as fast as possible
<Sou|cutter>
well, even just correctness in this case
<headius>
that's weird...that's so basic
<Sou|cutter>
I know, right? Very frustrating experience playing with fibers today
<Sou|cutter>
headius: if you take rspec out of the equation, that fiber works though. So something strange is going on there...
<headius>
oh, that's interesting
<headius>
something about the rspec context then
<Sou|cutter>
I'm happy to know it works on jruby, though.. I can carry on with my work until this somehow gets fixed in rubyland. At least jruby will very the correctness of my code
<Sou|cutter>
verify, that is
<headius>
do let me know if there's something we don't do right :)
<Sou|cutter>
I'd say this is a feather in your cap :)
<headius>
I'll take it!
ScottNYC has joined #ruby
mdel has joined #ruby
<burgestrand1>
Sou|cutter: I ran it on my end and it works well here
<burgestrand>
1.9.3-p125, rspec 2.9.0
<Sou|cutter>
really?
rking has joined #ruby
<Sou|cutter>
I shall try again
<burgestrand>
Yep
<burgestrand>
Could be a bug in cruby, or perhaps your installation of cruby is broken somehow (or both!)
<Sou|cutter>
ok this IS odd. It works for me in a 'clean' rvm gemset
<Sou|cutter>
let me see
<Sou|cutter>
oh, I was on rspec 2.8.0 hmm, let me try upgrading that
<burgestrand>
I’ll try downgrading
<frontendloader>
chat.stackoverflow, amazing that they spent time on that when freenode exists.
<Sou|cutter>
burgestrand: that seems to make the difference
<Sou|cutter>
burgestrand: are you seeing that same thing (I hope)?
vjacob has joined #ruby
<burgestrand>
trying to get rid of rspec, just uninstalling rspec is not enough to remove rspec-core and the likes :p
<Sou|cutter>
hah.. rspec and it's modules
<Sou|cutter>
pita ;)
<burgestrand>
Sou|cutter: rspec 2.8.0 works as well
pu22l3r has joined #ruby
<Sou|cutter>
burgestrand: I still have this in my terminal backlog
<Sou|cutter>
trying to figure out where I went wrong
<burgestrand>
I’d consider pretty much any segfault a bug, probably not you that went wrong :p
<Sou|cutter>
actually I think there might be something with rvm here
<headius>
gotta love a language runtime that segfaults
<burgestrand>
exciting
EvanR has joined #ruby
<Sou|cutter>
I had done an 'rvm get head' and then 'rvm reload' and then tried switching to 1.9.3... I'm using a 1.9.3 gemset, but it seems to indicate that it's running on 1.9.2
<headius>
ttfn
<frontendloader>
does abusing method_missing to do interesting things have negative consequences?
<Sou|cutter>
Not sure I will trust 'rvm reload' ever again
<burgestrand>
Sou|cutter: perhaps you are using 1.9.2 interpreter that is somehow using 1.9.3 extension libraries
<Sou|cutter>
burgestrand: thanks for verifying
<burgestrand>
rvm has done this thing to me before, when it did I just imploded it and started over
<Sou|cutter>
well it works for me in a new shell
<Sou|cutter>
so it's all good
<burgestrand>
\o/
pu22l3r has joined #ruby
x77686d_ has joined #ruby
<delinquentme>
def my_method(*args) << what purpose does the * server here?
shevy has joined #ruby
<Sou|cutter>
it's like varargs
adeponte has joined #ruby
denysonique has joined #ruby
andrewhl has joined #ruby
davidcelis has joined #ruby
nif has joined #ruby
Teddy2st_ has joined #ruby
x77686d has joined #ruby
hooper has joined #ruby
PsiliPharm has joined #ruby
Shagane has joined #ruby
CheeToS has joined #ruby
BrianE|mobile has joined #ruby
wroathe has joined #ruby
etaylor has joined #ruby
`brendan has joined #ruby
jcromartie has joined #ruby
etaylor has joined #ruby
strife25 has joined #ruby
phantasm66 has joined #ruby
seanstickle has joined #ruby
kvirani has joined #ruby
nif has joined #ruby
fixl has joined #ruby
manizzle has joined #ruby
Teddy2steper has joined #ruby
blueadept` has quit ["Leaving"]
<frontendloader>
if you call my_method(var1, var2, var3) then args will contain an array of those 3 arguments
etaylor has joined #ruby
etaylor has quit [#ruby]
EzeQL has joined #ruby
sectionme has joined #ruby
natemcguire has joined #ruby
Zolrath_ has joined #ruby
Cache_Money has joined #ruby
_null has joined #ruby
nif has joined #ruby
philips has joined #ruby
Transformer has joined #ruby
shtirlic_ has joined #ruby
<bawerd>
anyone tried building 1.9.3-p125 on OpenSolaris/Illumos/SmartOS?
hobbyist has joined #ruby
<delinquentme>
im reading the prag programmer atm ... and it mentions threads in ruby ...
silverhand has quit [#ruby]
<delinquentme>
this is to say you're running multicore type operations in ruby?
rking has joined #ruby
dilas has joined #ruby
adamkittelson has joined #ruby
pu22l3r has joined #ruby
dilas-br has quit [#ruby]
danielvdotcom has joined #ruby
Nisstyre has joined #ruby
nif has joined #ruby
Chryson has joined #ruby
igotnolegs has joined #ruby
gokul has joined #ruby
sacarlson has joined #ruby
nif has joined #ruby
nif has joined #ruby
cachoimechi has joined #ruby
nif has joined #ruby
CheeToS has joined #ruby
nif has joined #ruby
iamjarvo has joined #ruby
odilon has joined #ruby
Bosma has joined #ruby
chessguy has joined #ruby
gen0cide_ has joined #ruby
sonkei has joined #ruby
mbreedlove has joined #ruby
wroathe has joined #ruby
lewis has quit ["Leaving..."]
nari has joined #ruby
n8ji has joined #ruby
ooooooyouuuuu has joined #ruby
<ooooooyouuuuu>
huh
<ooooooyouuuuu>
what do you mostly use ruby for
flashuni has joined #ruby
quest88 has joined #ruby
williamcotton has joined #ruby
andrewhl has joined #ruby
Apocalypse has joined #ruby
nif has joined #ruby
quest88 has joined #ruby
vandemar has joined #ruby
Haydos has joined #ruby
bryanray has joined #ruby
ElderFain has joined #ruby
<batmanian>
Does Ruby have a method for multiplying arrays? e.g. ["Advanced", "Intermediate"] * ["Physics", "Chemistry"] = [ ["Advanced", "Physics"], ["Advanced", "Chemistry"], ["Intermediate", "Physics"], ["Intermediate", "Chemistry"] ]
alanp_ has joined #ruby
kmurph79 has joined #ruby
sonkei has joined #ruby
c9s has joined #ruby
<_ack>
batmanian .product
<batmanian>
_ack thanks
wilmoore has joined #ruby
nonotza has joined #ruby
dql has joined #ruby
ben225 has joined #ruby
senthil has joined #ruby
sonkei has joined #ruby
zeroeth has joined #ruby
RORgasm has joined #ruby
renanoronfle has joined #ruby
nfluxx has joined #ruby
senthil has joined #ruby
nfluxx_ has joined #ruby
Cache_Money1 has joined #ruby
gbinns has joined #ruby
nfluxx_ has joined #ruby
rippa has joined #ruby
NinoScript has joined #ruby
NinoScript has joined #ruby
pu22l3r has joined #ruby
NinoScript has quit [#ruby]
NinoScript has joined #ruby
NinoScript has joined #ruby
tommyvyo has joined #ruby
rushed has joined #ruby
kenneth has joined #ruby
two- has joined #ruby
rking has joined #ruby
ben225 has joined #ruby
shaggy2dope has joined #ruby
pandu1 has joined #ruby
<pandu1>
hello
pandu1 has quit [#ruby]
pandu1 has joined #ruby
pandu1 has quit [#ruby]
ThewyBread has joined #ruby
startlin1 has joined #ruby
davidcelis has joined #ruby
davidcelis has joined #ruby
pu22l3r has joined #ruby
Drewch has joined #ruby
Cache_Money has joined #ruby
lkba has joined #ruby
zetradr has joined #ruby
h4mz1d has joined #ruby
baniseterfiend` has joined #ruby
prometheus has joined #ruby
CoverSli1e has joined #ruby
cobragoat has joined #ruby
yxhuvud has joined #ruby
pu22l3r has joined #ruby
rushed has joined #ruby
Apocalypse has joined #ruby
k3r0 has joined #ruby
andrewh has joined #ruby
wroathe has joined #ruby
Haydos has joined #ruby
pusewicz_ has joined #ruby
neurotech has joined #ruby
MrGando has joined #ruby
nari has joined #ruby
Teddy2steper has joined #ruby
RORgasm has joined #ruby
KL-7 has joined #ruby
wroathe has joined #ruby
gtuckerkellogg has joined #ruby
bluOxigen has joined #ruby
nfluxx has joined #ruby
dfamorato has joined #ruby
Nanuq has joined #ruby
rking has joined #ruby
baniseterfiend` has joined #ruby
tomzx has joined #ruby
jfelchner has joined #ruby
pu22l3r_ has joined #ruby
jfelchner has quit [#ruby]
<wolgo>
hi, I am trying to create a static variable/class variable with @@stuff. I can only access this through an instance. Is this correct? I get errors when I try to something like Class.StaticVariable
banisete_ has joined #ruby
<wolgo>
it seems kind of confusing to me
<wolgo>
but if that is the only way to do it then whatever
scwh has joined #ruby
tar_ has joined #ruby
jfelchner has joined #ruby
sacarlson has joined #ruby
x0F__ has joined #ruby
sonkei has joined #ruby
<mistergibson>
wolgo: @@var_name is set for the entire class of instances. You want to use @variable for instance-related storage needs. Also, you can set a constant (ALL_CAPS_VARNAME) at the class or instance level.
angelGao has joined #ruby
pu22l3r has joined #ruby
pu22l3r has joined #ruby
zeroeth has joined #ruby
andrewh has joined #ruby
dfamorato has joined #ruby
alanp has joined #ruby
mxweas_ has joined #ruby
nikhil__ has joined #ruby
pu22l3r_ has joined #ruby
noric has joined #ruby
serpa has joined #ruby
<serpa>
hi all, anybody use google charts tools with rails ?
andrewh has joined #ruby
jfelchner has joined #ruby
andrewh has joined #ruby
serpa has quit [#ruby]
CheeToS has joined #ruby
charlenopires has joined #ruby
nikhil__ has joined #ruby
joast has joined #ruby
tewecske has joined #ruby
ephemerian has joined #ruby
JohnBat26 has joined #ruby
baniseterfiend` has joined #ruby
Morkel has joined #ruby
jfelchner has joined #ruby
CrazyPickles has joined #ruby
ixx has joined #ruby
RORgasm has joined #ruby
davidpk has joined #ruby
mdw has joined #ruby
ukwiz has joined #ruby
banjara has joined #ruby
scientes has joined #ruby
shruggar has joined #ruby
gtuckerkellogg has joined #ruby
etehtsea has joined #ruby
JohnAvery has joined #ruby
<JohnAvery>
My javascript drop down menus stopped working in development after I "bundle exec rake assets:precomp"
<JohnAvery>
Anyone know how to fix this?
Sou|cutter has joined #ruby
Indian has joined #ruby
nemesit has joined #ruby
francisfish has joined #ruby
davidcelis has joined #ruby
tobago has joined #ruby
doomviking has joined #ruby
tobago has quit [#ruby]
musl has joined #ruby
mcwise has joined #ruby
bier has joined #ruby
bluOxigen has joined #ruby
companion_ has joined #ruby
netogallo has joined #ruby
aibo has joined #ruby
tuxaddicted has joined #ruby
edibrac has joined #ruby
bengl has joined #ruby
andyl has joined #ruby
two- has joined #ruby
musl has joined #ruby
timonv has joined #ruby
aibo_ has joined #ruby
dzhulk has joined #ruby
trivol has joined #ruby
blacktulip has joined #ruby
thomasfuston has joined #ruby
netogallo has joined #ruby
thomasfuston has quit [#ruby]
Goni has joined #ruby
musee has joined #ruby
lunchdump has joined #ruby
examancer has joined #ruby
baniseterfiend` has joined #ruby
rohit has joined #ruby
libertyprime has joined #ruby
berserkr has joined #ruby
RORgasm has joined #ruby
lockweel has joined #ruby
chrassidy has joined #ruby
<chrassidy>
I have a basic understanding of Ruby, my goal is to write a modular game server. Where should I start?
<baniseterfiend`>
chrassidy: learn celluloid or eventmachine
<chrassidy>
can I make a commercial android/ios game that connects to a server I make with these libraries?
richardlxc has joined #ruby
<mistergibson>
chrassidy: I would suggest you also evaluate em-synchrony (fiber-aware evented coding)
<chrassidy>
mistergibson, thanks
<canton7>
chrassidy, eventmachine, and i imagine celluloid also, use tcp connections (you define what protocol runs over tcp), so yes
<chrassidy>
okay
<mistergibson>
chrassidy: for fiber-aware evented custom http server: sychrony-sinatra would be a good place to start
<mistergibson>
err... synchrony-sinatra
<mistergibson>
very bare bones but effective
<chrassidy>
I'm not planning on writing a web app though
<chrassidy>
more of a mobile game
akemrir has joined #ruby
rohit has joined #ruby
thecreators has joined #ruby
mikeric has joined #ruby
alol has joined #ruby
burgestrand has joined #ruby
deobald has joined #ruby
nikhil__ has joined #ruby
Foxandxss has joined #ruby
radoen has joined #ruby
<radoen>
hi all people
telling has joined #ruby
<radoen>
i have a trouble whit a module when lunch them interpreter says me ./beef.rb:116:in `<main>': uninitialized constant BeEF::Core::Websocket (NameError)
<d34th4ck3r>
how to exit from ruby script ? stopping further ruby execution ?
iamjarvo1 has joined #ruby
<species>
you say "exit"
<Sou|cutter>
exit exitcode
RORgasm has joined #ruby
nlc has joined #ruby
Targen_ has joined #ruby
chico has joined #ruby
sirdeiu has joined #ruby
andrewhl has joined #ruby
<d34th4ck3r>
thanks
nemesit|osx has joined #ruby
hobbyist has quit ["Leaving..."]
NinoScript has joined #ruby
paradoja has joined #ruby
m_3 has joined #ruby
kawa_xxx has joined #ruby
m_3 has joined #ruby
h4mz1d has joined #ruby
cmasseraf has joined #ruby
nixnub has joined #ruby
ZachBeta has joined #ruby
serpa has joined #ruby
zeroeth has joined #ruby
<serpa>
could anybody help me with google charts and rails ?
sirdeiu has joined #ruby
nixnub has joined #ruby
shaggy2dope has joined #ruby
waxjar has joined #ruby
ceej has joined #ruby
rorymckinley has joined #ruby
MrGando has joined #ruby
iamjarvo has joined #ruby
fayimora has joined #ruby
<apeiros_>
serpa: #rubyonrails
dwon has joined #ruby
<serpa>
<apeiros_> #rubyonrails Cannot join channel (+r) - you need to be identified with services. What does mean ?
banjara has joined #ruby
Shagane has joined #ruby
Shagane has quit [#ruby]
Shagane has joined #ruby
Clordio has joined #ruby
wallerdev has joined #ruby
sbanwart has joined #ruby
<Seppman>
serpa: it means that you have to identify with a service (like nickserv)
waxjar has joined #ruby
otters has joined #ruby
CheeToS has joined #ruby
<serpa>
Seppman: thanks !
kevinbond has joined #ruby
<Seppman>
you're welcome. Greetings from the republic of austria
odilon has joined #ruby
wilmoore has joined #ruby
Eldariof59-ru has joined #ruby
sonkei has joined #ruby
<apeiros_>
the sepp man! :D netter nick
mxweas_ has joined #ruby
Axsuul has joined #ruby
Axsuul has joined #ruby
Cache_Money has joined #ruby
nfluxx has joined #ruby
* Kovensky
wonders if ther are any plans to add dynamic scoping to ruby, or D-like "on scope exit" blocks
<Kovensky>
just happened to see http://pastie.org/3745443, and it's not thread safe and if it raises the ArgumentError it'll have unintentionally overwritten STDOUT.sync
<Kovensky>
if it had dynamic scoping though, just doing "local STDOUT.sync = true" would take care of it (borrowing the 'local' keyword from perl)
<Kovensky>
(would be thread safe and not affect anything called from outside benchmark's scope)
<apeiros_>
Kovensky: pure curiosity here - do you have any link to docs/info on D-like "on scope exit"?
Teddy2steper has joined #ruby
<apeiros_>
you might want to look at ensure, though
fowl has joined #ruby
<apeiros_>
i.e., line 14 of your pastie should into an ensure block
<Kovensky>
"on scope exit" is because I forgot the actual syntax, but lemme look up on dlang.org :v
<apeiros_>
and I think you should do argument checking first, i.e. line 7 `raise ArgumentError, "no block" unless` should be the first line of the method
<apeiros_>
but TIL iterator? is an alias of block_given?
<apeiros_>
ca_bud: you probably are having a precedence issue. use () to make it clear
<Kovensky>
unrelated rant: the simple-rss gem isn't unicode-safe :(
<apeiros_>
fowl: oh wow, you got that quite wrong
<apeiros_>
fowl: take the ternary *operator*, it can take even 3 operands
sonkei has joined #ruby
<Kovensky>
ended up using the builtin rss which is, but took a bit more effort to copy to my own data structures
<apeiros_>
(which is why it is named ternary, after all…)
<fowl>
ternary isn't an operator, its a language construct :p
<fowl>
i'm here to split hairs
<apeiros_>
fowl: yes, it is a language construct, and an operator
<apeiros_>
you're splitting the hairs wrong, though :-p
<apeiros_>
you could argue that + - etc. are operators, IMO they're not
<apeiros_>
there's absolutely no argument however that &&, ?: etc. are operators
<otters>
they're methods
<apeiros_>
otters: correct, which is why I tend to not see them as operators in ruby.
<otters>
are they operators in other languages?
<apeiros_>
otters: sure
<otters>
okay
<Kovensky>
+ and - are priviledged methods
<Kovensky>
with their own precedence rules and other evil non-method-y things :E
<otters>
syntactic sugar!
<Kovensky>
(alternatively, force everyone to write in polish notation \o/)
<otters>
which ruby is 30% of
ZachBeta has joined #ruby
<otters>
there's magic everywheeeere
<ca_bud>
now i'm getting undefined method `[]' for nil:NilClass. I'm assuming my model[table][f][:values].present? is returning nil and I can't call present on it. does this sound right? if so what is the fix?
<Kovensky>
anything there could be nil
<Kovensky>
model could be nil, model[table] could be nil, model[table][f] could be nil...
Morkel has joined #ruby
<fowl>
you're 3 levels in and lost your way
<otters>
you are in a maze of twisty index lookups, all alike.
<Asher>
syntactic sugar = all language is
_|christian|_ has joined #ruby
<shevy>
nice boobs = all what a man ever needs
<otters>
possibly off topic
jgrevich has joined #ruby
<bounce>
here, have some moobs
<ca_bud>
what is the best way to handle the lookup? model[table] and model[table][f] should both be good. I know that values will sometimes be in the hash and sometimes not. I would like to test for that.
natemcguire has joined #ruby
<bounce>
the best way is to check your assumptions
wroathe has joined #ruby
<ca_bud>
I'll verify now
Russell^^ has joined #ruby
<shevy>
what
<shevy>
that code is flip-flopping
drake10 has joined #ruby
<shevy>
like the schroedinger cat
<shevy>
that beast can not decide whether it is dead or alive
Drewch has joined #ruby
<bounce>
too many video games, I tells ya
drake10 has quit [#ruby]
<ca_bud>
verified, model[table] and model[table][f] are both present
<shevy>
bounce I miss the 1990s... I liked the video games back then more than today
<bounce>
I haven't played a video game in ages. bsd-tris on a terminal was a favourite though.
<shevy>
bounce did the modern days also lose you as gamer?
<ca_bud>
that leaves the question of why model[table] and model[table][f] [:values].present? is not working. am I using the wrong test to test nil?
<shevy>
fowl still plays games... he was lost to skyrim for some months
<shevy>
ca_bud, that is really kinda ugly ... model[table][f] [:values].present?
RubyRedGirl has joined #ruby
<bounce>
well, alright, there's this stupid little game on my secondary phone that is good for passing the time on the loo, but otherwise. supposedly written in java, so.
indeterminate has joined #ruby
<otters>
ca_bud: when I'm having chained [] nil problems, I usually replace [] with fetch
io_syl has joined #ruby
serpa has quit [#ruby]
<ca_bud>
fetch? i'll look it up now.
* bounce
needs a new computer. maybe then there'll be games.
<shevy>
bounce :(
<shevy>
I gave up hope.
MrGando has joined #ruby
<otters>
ca_bud: it's [], but raises an exception when it fails, and tells you what key it wanted
<fowl>
lol shevy
<shevy>
the tablet games are all super trivial and really just to pass ... 10-20 minutes
<shevy>
but it's cool that you can turn it, and things respond to it being turned
<shevy>
it's like a joystick with a big LCD screen :P
<bounce>
could do something as quaint as install chess or go on it
<ca_bud>
fetch is interesting, but it does not look like you can chain them.
<ca_bud>
never mind.
<otters>
it's a method
<otters>
of course you can chain them
<shevy>
haha I sometimes play online chess... but so far I always lost against human players. so now I beat artifical intelligence on the easiest levels
<ca_bud>
I realized that last second. thanks
<shevy>
you can chain pretty much... except for the foo! methods with those bang
<shevy>
I still did not understand .tap though
<bounce>
blame mr T
<shevy>
it reminds me of magic the card game...
<otters>
tap just calls the block and then returns the object
<shevy>
hmm
<apeiros_>
yupp, tap is basically: def tap; yield; self; end
<shevy>
oh
<shevy>
odd, that explanation I understand a lot better than the sentence :)
mdw has joined #ruby
<apeiros_>
actually, I think it's: def tap; yield(self); self; end
kevinbond has joined #ruby
<apeiros_>
would have to check that, though
mengu_ has joined #ruby
CannedCorn has joined #ruby
<shevy>
ok that one confuses me a bit more again
<shevy>
I dont think I've seen yield(self) so far either
<bounce>
huh, two-and-a-half years dead channel, still around. fun.
<shevy>
what is that
cpruitt has joined #ruby
<bounce>
#jobs
RubyRedGirl has quit [#ruby]
wallerdev has joined #ruby
RubyRedGirl has joined #ruby
__class__ has joined #ruby
RubyRedGirl has quit [#ruby]
RubyRedGirl has joined #ruby
RORgasm has joined #ruby
JohnBat26 has joined #ruby
bglusman has joined #ruby
JohnBat26 has joined #ruby
<Kovensky>
the yaml module's documentation is... underwhelming ._.
tommyvyo has joined #ruby
<shevy>
Kovensky it is quite nice compared to
<shevy>
IRB documentation
<shevy>
!!!!!!
<shevy>
but if you ask me, if I were matz, I would make a new rule
wroathe has joined #ruby
<shevy>
there must be new standards for documentation. EVERY module that does not qualify, will be thrown OUT of std ruby distribution
fbernier has joined #ruby
<Kovensky>
dbm's documentation is also underwhelming :v
<shevy>
out with it!
<Kovensky>
and all the documentation I found in the yaml module is that YAML::DBM has the same interface as DBM
<shevy>
all out!
<shevy>
ruby must stop being so lazy
<Kovensky>
another annoying thing: you can't get ri to inline all the documentation
<Kovensky>
you either have to use ri to query one method at a time, or have to use rdoc and a browser
<shevy>
ah ri I dont mind
<shevy>
I look at the online docu
<bounce>
(this is where something like nroff wins)
<Kovensky>
I thought ri was a perldoc equivalent but it's much, much more annoying :(
<Kovensky>
perldoc loses in that it has no indexing inside documentation, but it's still less annoying than having to query method by method in ri
<bounce>
"everybody has a browser anyway; browsers are the future" -- you just need to conform, you unconforming silly person, you
<rking>
Kovensky: There's YAML.load_file and YAML.dump(obj, io_obj)
kevinbond has joined #ruby
<tar_>
I've been naively casting []byte to string and it finally bit me when I started slicing the strings… what's the correct way to do that? I don't see anything in strings or unicode/utf8
cachoimechi has joined #ruby
RubyRedGirl has joined #ruby
araujo has joined #ruby
araujo has joined #ruby
<apeiros_>
tar_: I don't quite get what you were doing
<apeiros_>
paste some code?
<tar_>
hm
maletor has joined #ruby
<apeiros_>
I assume you have an array of bytes, but bytes in what representation? integers in 0..255? single character strings?
<apeiros_>
also, you didn't specify *how* and *what* bit you
<tar_>
actually, sorry, I used to handle the []bytes directly. Now I'm unmarshaling JSON into a struct with a string field.
<tar_>
slicing like str[4:5] doesn't seem to account for multi-byte characters
<fowl>
strg+q let me guess strg is short for straussbegaussen?
<shevy>
fowl hehehe not sure
<shevy>
I think it is the control key
<shevy>
"Steuerung" Strg
<fowl>
ich bin ein verdammter idiot
<bounce>
na klar
<harryk>
is this channel of Ruby language or German language? )
<shevy>
fowl is learning a new language
<shevy>
I want Mon_Ouie to teach me french
<fowl>
shevy, my favorite german word is einige
<shevy>
hmm
<shevy>
that's "several" ... or "a few" ...
<Mon_Ouie>
Qu’oie-je ?
jarred has joined #ruby
<harryk>
mine is schwein ))
<bounce>
should do a thorough german localisation of ruby
<ca_bud>
I have a string for a model name and I would like to use that string to create a record. e.g. "mymodelname".create(:name=>1234). is there a way to do this?
<ca_bud>
meta-programming.
<harryk>
ca_bud: 'create' should be a method of String class - in this case your code is right i think
<ca_bud>
harryk: so your saying that Mymodel.create is equal to "Mymodel".create?
<ca_bud>
I don't think that is right
<fowl>
you said "mymodelname".create
<ca_bud>
harryk: this might be a better example Mymodel.first vs "Mymodel".first, I need some method to convert my string into a model
<fowl>
wtf is a model, this is a rails question?
<shevy>
a model is a young, beautiful woman who is always on the verge of dying from hunger
<ca_bud>
oops! sorry, I thought I was in the rubyonrails IRV
<ca_bud>
IRC
<ca_bud>
my mistake
<bounce>
expert in the art of dying beautifully from hunger
<species>
ive actually had sex with a model and she wasnt actually that good
<Kovensky>
can a hash's each / each_key / each_value modify the hash in-place?
<species>
being skinny can be problematic, to a point
<bounce>
ca_bud: term of art is "channel"
<ca_bud>
thanks, gtk
<harryk>
species: plump girls rule :))
<species>
not necessarily "plump" but I like a bit of meat on those bones
Synthead has joined #ruby
<shevy>
yeah
<shevy>
land whales
<fowl>
Kovensky, did you try it? I got no warnings
<Kovensky>
fowl: thinking about it a bit showed that I can't do what I thought about doing with it :X
<harryk>
when i hear a word 'meat', i imagine a peace of bloody beef ))))
<fowl>
you shouldnt internalize a bunch of strings if they come from user input though
<Kovensky>
but with to_sym instead of to_s
<fowl>
yea that was my fowl (haha)
_ramo has joined #ruby
<Kovensky>
well, it's the yaml file I was reading to begin with :>
proxie has joined #ruby
<Kovensky>
need the keys in order to do processing in it
<Kovensky>
(have to find keys with certain names, compile regexps, etc)
<Kovensky>
(it's the user's fault if he has duplicates in the same scope!)
<fowl>
its not about duplicate keys
<fowl>
symbols are never garbage collected, so if i see you interning strings from users im going to flood it with gibberish until it runs out of memory
<Kovensky>
lol
<fowl>
then im going to sit back and drink a nice cup of hot chocolate
<Kovensky>
it's a config file, if it has enough content to OOM the computer it has enough contet to... inconvenience the user =p
Bosma has joined #ruby
<Kovensky>
a proper config file also doesn't have many unique strings
<fowl>
try this btw YAML.load"hi: a\nhi: b\nhi: c"
<Kovensky>
I count... 9 in the current format (assuming well-formed)
tobago has joined #ruby
<Kovensky>
fowl: sounds evil :P
<Kovensky>
assuming YAML reads strings as strings though you'll get three "unique keys" "hi"
<fowl>
why would you assume that crazy behaviour lol
<Kovensky>
hm, I also have hashes inside arrays inside hashes :S
* Kovensky
expads symbolify
<Kovensky>
+n
Foxandxss has joined #ruby
<fowl>
{'hi' => 'a', 'hi' => 'b', 'hi' => 'c'} just leaves you with {'hi' => 'c'}
<Kireji>
is there a place where I can post a bounty for a script I want written? it's simple, I just don't have time to do it
<fowl>
limen*
<fowl>
LINE*
<Kovensky>
fowl: nah, not playing ruby golf :P
<Kovensky>
not yet at least
<Kovensky>
also, I keep writing "done" after "do" blocks ._.
<fowl>
lol
<fowl>
if you use 'then' you dont have to use semicolons, this is valid: if false then :a elsif poo then :b else if somethingelse then :c else :d end end if true
<fowl>
note the postfix if, for posterity
Eldariof27-ru has joined #ruby
noyb has joined #ruby
<Kovensky>
oh, so it supports that syntax?
<canton7>
puts "Yes, it does" if true
<Kovensky>
puts "cool" until false
josefig has joined #ruby
josefig has joined #ruby
weszlem has joined #ruby
ryanf has joined #ruby
<weszlem>
Hi, i want to start reading ruby source code. Are there any articles like quake 2 source code review (http://fabiensanglard.net/quake2/index.php) that can help begginers?
jfelchner has joined #ruby
<weszlem>
*beginners
Pavel has joined #ruby
Teddy2steper has joined #ruby
<josefig>
weszlem: I don't think so
<weszlem>
josefig: maybe you know then, how can i start reading the code? i mean - where to start?
francisfish has joined #ruby
RORgasm has joined #ruby
<josefig>
weszlem: that's a very abstract question, what I did when I started was, open the ruby docs on one side and the code on the other side, so I was reading and when I didn't know anything, I went to the ruby docs and understand first the syntax and everything , so I continued reading ;>
<josefig>
But really, is up to you.
<weszlem>
josefig: thank, i'll try that. maybe it will be easier to start with rubinius source code..
sacarlson has joined #ruby
joaoh82 has joined #ruby
<josefig>
weszlem: well, you can try that ;)
<banseljaj>
weszlem: You can try finding stuff on github
mxweas_ has joined #ruby
dfamorato has joined #ruby
Drewch has joined #ruby
strife25 has joined #ruby
ca_bud has quit [#ruby]
looopy has joined #ruby
baniseterfiend` has joined #ruby
nif has joined #ruby
fayimora has joined #ruby
timonv has joined #ruby
fayimora_ has joined #ruby
headius has joined #ruby
rking has joined #ruby
rking has joined #ruby
fayimora has joined #ruby
Synthead has joined #ruby
Zolrath has joined #ruby
zmoazeni has joined #ruby
fbernier has joined #ruby
_ramo has quit [#ruby]
emmanuelux has joined #ruby
igotnolegs has joined #ruby
ZachBeta has joined #ruby
Clordio has joined #ruby
morelikefmb has joined #ruby
rking has joined #ruby
rking has joined #ruby
morelikefmb has quit [#ruby]
looopy has joined #ruby
phinfonet has joined #ruby
mbriggs has joined #ruby
d2dchat has joined #ruby
Teddy2steper has joined #ruby
davidd___ has joined #ruby
species has joined #ruby
Teddy2steper has joined #ruby
baniseterfiend` has joined #ruby
nif has joined #ruby
yelvert has joined #ruby
kevinbond has joined #ruby
looopy has joined #ruby
davidcelis has joined #ruby
phinfonet has joined #ruby
phinfonet has joined #ruby
rckts has joined #ruby
jfelchner has joined #ruby
Teddy2steper has joined #ruby
pedrohenrique has joined #ruby
CannedCorn has joined #ruby
timonv has joined #ruby
phinfonet has joined #ruby
d34th4ck3r has joined #ruby
phinfonet has joined #ruby
phinfonet has joined #ruby
phinfonet has joined #ruby
phinfonet has joined #ruby
NinoScript has joined #ruby
maletor has joined #ruby
phinfonet has joined #ruby
kawa_xxx has joined #ruby
NinoScript has joined #ruby
seanstickle has joined #ruby
wilmoore has joined #ruby
zeroeth has joined #ruby
moshee has joined #ruby
hooper has joined #ruby
zemanel has joined #ruby
mythmon has joined #ruby
kevinbond has joined #ruby
kevinbond_ has joined #ruby
dfamorato_ has joined #ruby
* Kovensky
shakes fist at MatchData raising exceptions on #[String] if the requested named capture doesn't exist
<Kovensky>
kinda annoying to deal with when the regexps are user-controlled :S
<shevy>
I hate users
<shevy>
they are like a hungry horde of hippos
cachoimechi has joined #ruby
mikeric has joined #ruby
tentimes has joined #ruby
thone has joined #ruby
<apeiros_>
Kovensky: Regexp#named_captures is your friend
<tentimes>
Hi folks - does anyone know what the state of affairs is with WxWidgets on Ruby? I see the last version of WxRuby is 2009 and am wondering is it worth using?
drake10 has joined #ruby
<Kovensky>
apeiros_: I'm using names
<apeiros_>
Kovensky: ah, sure, that works too
<apeiros_>
even better, if all you need is the names
<shevy>
tentimes, I think it is dead
<shevy>
most ruby toolkits are dead
<Kovensky>
but yeah, I have to do match.names.any?{|x| x == key} checking for every access...
looopy has joined #ruby
<apeiros_>
Kovensky: meet Array#include?
<apeiros_>
also, if I knew what you do I could probably show you even more elegant solutions
<apeiros_>
e.g. Array's set methods might be of interest to you (&, |, -)
<shevy>
I am gonna say it... it'll surpass php in a few months
<Kovensky>
apeiros_: so (%w{...} & match.names).each { |w| ... } without worrying inside the each? =p
<apeiros_>
Kovensky: yes
<apeiros_>
for code clarity, I wouldn't put the literal there, though. use a constant or whatever.
d2dchat has joined #ruby
shaggy2dope has joined #ruby
kmurph79 has joined #ruby
neersighted|AFK has joined #ruby
<Kovensky>
hm, you know code is gtting dense when you have ]]]]
<Kovensky>
getting*
<shevy>
hmm
<shevy>
that's a lot of ]
adamkittelson has joined #ruby
zeroeth has joined #ruby
yoklov has joined #ruby
<apeiros_>
Kovensky: writing all code on a single line is not compulsory in ruby…
<apeiros_>
local variables are a nice thing
<Kovensky>
apeiros_: it's more like nested hashes
<tentimes>
Surely Ruby is on the up-and-up though? I would much rather write something in Ruby, but I suppose javascript is good for web stuff
phinfonet has joined #ruby
RORgasm has joined #ruby
<shevy>
tentimes well... ruby could still gain some folks, but javascript that is instantly available for ALL who go to the www
<Kovensky>
apeiros_: and the hash's index is given by another hash access and so on
<apeiros_>
Kovensky: deeply nested primitive datastructures too are a code smell
<shevy>
I mean you only have to look at how crappy PHP yet it is more popular than ruby still
<apeiros_>
proper classes ftw.
<tentimes>
wel Rails (am I allowed to say Rails in here? ;) is catching up on PHP
<tentimes>
I am writing my new server side stuff in rails having made a last minute change from deciding to use PHP
<tentimes>
Hence me learning Ruby
<tentimes>
Ruby is addictive though
<Kovensky>
apeiros_: this is actually a throwaway structure used for sorting and discarding of suboptimal elements ._.
<tentimes>
I had to spend some time today going through Kernel stuff in C and then the wrappers in C++, and omg is Ruby so much nicer to work in...
<Kovensky>
though in truth I'm just making up this filtering method as I go :P
<apeiros_>
shevy: I don't know, I looked at TIOBE for a long time… but… an index where logo (ffs, that's not used anywhere but introduction of total noobs) is in front of actually used pervasively used languages like ActionScript (flash)
h4mz1d has joined #ruby
ckrailo has joined #ruby
<shevy>
hmm
<apeiros_>
Kovensky: "this is just…" is how most fundamentally broken software starts :-p
<shevy>
odd... going to find out about logo
<apeiros_>
(all too often the second part reads: "…a rough prototype")
<Kovensky>
apeiros_: well, quick overview of what I want to do:
<Kovensky>
I have a name, a version and a revision
<apeiros_>
Kovensky: oh, hey, hey, it's your code
<apeiros_>
I'm just blabbering old knowledge :-)
jfelchner has joined #ruby
<Kovensky>
I want to keep all name+versions I have, but only keep the name+version pairs that have the highest revision
<Kovensky>
nah, it's just that there's probably a better way to do this :P
brngardner has joined #ruby
<apeiros_>
Kovensky: code and sample in & output is better for that than explaining
<apeiros_>
I can read code much better than peoples explanations :-p
eam has joined #ruby
brngardner has joined #ruby
poorlilrichboy has joined #ruby
flaggy has joined #ruby
Kireji has joined #ruby
PsiliPharm has joined #ruby
derpmcherp has joined #ruby
<Kovensky>
:p
<Kovensky>
I need to make a sample set...1
davidpk has joined #ruby
derpmcherp has quit ["Leaving"]
RangerMauve has joined #ruby
williamcotton has joined #ruby
<RangerMauve>
Hey, does anyone know if WEBrick can use ERB files?
<ryanf>
RangerMauve: webrick is just the web server, it doesn't know anything about where the content comes from
<RangerMauve>
Er, let me rephrase then. Can it process erb files?
<ryanf>
if you want to make a simple app with templates, sinatra is probably your best bet
<RangerMauve>
Well I already have something going with making WEBrick servlets, but I want to simplify it more
<Kovensky>
it should've been obvious on the syntax highlight too <_<
<adhominem>
with TCPServer.accept I can get new sessions, test their IP, and then possibly close them
pu22l3r has joined #ruby
<adhominem>
I'm looking for a way to avoid accepting certain IPs in the first place
<canton7>
adhominem, your firewall?
<tentimes>
There is a c module for that that I had to include in nginx to do with GeoIP
<adhominem>
sorry; a way to do it in ruby
<tentimes>
If you can get the IP, the GeoIP module and the database it uses, it might help
<adhominem>
like TCPServer.blacklist .. but I don't see that method
<tentimes>
I doubt there is a direct way
<adhominem>
yeah
<adhominem>
looking for an indirect way still in ruby
<adhominem>
lol
<apeiros_>
Kovensky: when you don't use the return value of .map, then you really want .each, not .map
<tentimes>
Unless you can find a portal that will give you the GeoIP location from an IP?
<tentimes>
IT's not totally straightforward
<tentimes>
An IP does not map easily to a location
<adhominem>
like say i just want to never accept connections from 155.155.155.155
<adhominem>
yeah that's okay
pu22l3r_ has joined #ruby
<tentimes>
ahh sorry
<adhominem>
i just want to avoid accepting connections from a random IP at all in ruby
<tentimes>
I'm sure there is a way to mask the IP
td123 has joined #ruby
Sailias has joined #ruby
<Kovensky>
(geoip blocks are evil and you should feel ashamed for teaching other people how to do it)
<tentimes>
but sorry, I have not done that yet in Ruby
<apeiros_>
Kovensky: so the first list of input-hashes aren't really hashes but match-data objects?
* Kovensky
runs
<tentimes>
I block out all of Russia, China and a lot of other countries automatically from my website. Reduced DDOS and Spam 97%
<Kovensky>
apeiros_: the list is an array of objects that have already been approved by regexps, and the regexp's MatchData is stored in the match accessor
adhominem was kicked from #ruby by apeiros_ [don't cross-post]
<tentimes>
DOn't cross post? lol
<Kovensky>
in this refactor though I have already changed the code to do the MatchData parsing in the regexp code itself (where it belonged in the first place) and stuff the available names in a hash
Synthead has joined #ruby
<apeiros_>
tentimes: yes. I'm sick of assholes who think it's ok to waste peoples time.
<Kovensky>
and also to initialize the integer elements with -1 if nil
<tentimes>
ah - I obviously didnt see what else he had done
<apeiros_>
tentimes: cross-posted. as the kick-reason says.
mengu_ has joined #ruby
<tentimes>
What's the data structure?
<tentimes>
I mean, is it all ints?
<tentimes>
(sorry that was @Kovensky)
<tentimes>
I used to program in assembler. If you imagine how the datastructure is eventually going to be accessed (and how well that compiles down) I find that makes as much sense as the method sometimes
<Kovensky>
no, some of them are strings; but out of them only :name is relevant (the idea is to sort by :name, sort that list internally by :ep, then sort that list internally by :ver and only keep the one with the highest :ver)
<Spaceghostc2c>
I know some assembly on the x86 architecture!
<tentimes>
And is it in memory or in a database?
<flaggy>
yay!
fbernier has joined #ruby
keymone_ has joined #ruby
keymone has joined #ruby
<Kovensky>
tentimes: in memory
<Kovensky>
anyway, rephrasing that in my mind helped come by with a different approach
<Kovensky>
I have [:name, :ep] pairs that must be unique; in case of duplicates, they are deduplicated by keeping only the one with the highest :ver
<Kovensky>
keeping the one with the highest :ver is made easier by Enumerator#max_by
<apeiros_>
Kovensky: using a proper class would help with that
<apeiros_>
you could use it as a hash key
<apeiros_>
makes it easy to check whether a name/ep pair already exists
<apeiros_>
you could also implement <=> properly, so figuring the newest would be easy as well
<Kovensky>
...indeed
<Kovensky>
(wrt using that pair as hash key)
<apeiros_>
(<=> + Comparable)
<Kovensky>
I keep forgetting Hash can use any object, not just string
codezombie has joined #ruby
<Kovensky>
apeiros_: the class that encapsulates that data actually includes Comparable, but uses <=> for a different purpose
<Kovensky>
(sorting by :id)
<apeiros_>
also it'd help you with properly arranging code. i.e. make a class method to parse the input string and create an instance from it
<apeiros_>
so: valid_versions = strings.map { |string| VersionThingy.from_string(string) }.compact
<apeiros_>
then map it to get only the newest ones: by_name_and_ep.each_value.map { |versions| versions.max }
<apeiros_>
voilà
<apeiros_>
proper classes ftw.
derpmcherp has joined #ruby
ScottNYC has joined #ruby
<irmbrady>
Any Jekyll users about?
danielvdotcom has joined #ruby
<Kovensky>
I'll just ad a new class that < Hash that I can use for the match data (instead of dumping them on a Hash)
<Kovensky>
and then include Comparable and do the <=> impl
<apeiros_>
o0
<apeiros_>
keys don't need to inherit from Hash
<apeiros_>
they must implement #hash and #eql? properly
<Kovensky>
oh, not keys
<Kovensky>
the container itself
<apeiros_>
I don't see what that'd give you
<Kovensky>
(or, rather the values)
Synthead has joined #ruby
gregorg has joined #ruby
gregorg has joined #ruby
ben225 has joined #ruby
strife25 has joined #ruby
derpmcherp has joined #ruby
derpmcherp has quit ["Leaving"]
ceej has joined #ruby
gloomer has joined #ruby
ca_bud has joined #ruby
Drewch has joined #ruby
tatsuya_o has joined #ruby
chico has joined #ruby
<ca_bud>
Can someone help me with the code to insert a block of text into an existing text file? I don't want to append, I actually want to insert the text after the 3rd line and move all other text down.
prometheus has joined #ruby
<burgestrand>
ca_bud: you rewrite all of the file from that line you want to change
Squarepy has joined #ruby
<ca_bud>
burgestrand: can you recommend any reference material to show to do it?
<ca_bud>
thanks, I will give it a read along with more googling.
_ack has joined #ruby
x77686d has joined #ruby
nixnub has joined #ruby
wefawa has quit [#ruby]
STP has quit [#ruby]
<Kovensky>
apeiros_: by making e.info an instance of an Info < Hash class that implements hash as [self[:name], self[:ep]].hash and an appropriate <=>, I made sanitize() be:
<Kovensky>
...though that max_by probably can be just a max, and that last compact is unecessary...
<gurugeek_>
hello is anyone here doing some freelancing interested in a paid project ?
<apeiros_>
Kovensky: hm, ok, not what I'd do, but well. don't forget to implement eql? accordingly.
<Kovensky>
apeiros_: I made eql? just [self[:name], self[:ep]] == [other[:name], other[:ep]]
<Kovensky>
(IIUC eql?'s contract correctly)
SeySayux has joined #ruby
lewis has joined #ruby
<lewis>
for those who do not use ruby for ror, what else do you use it for
<canton7>
sinatra, general shell scripting, anything other people use python/perl/bash for
<chico>
^ dis
<chico>
plus, sysadmins use chef/puppet
<lewis>
canton7: : general shell scripting, for example?
strife25 has joined #ruby
<Kovensky>
the most "ror" I've written in my life has been a dvorak typo of "lol" ._.
<lewis>
So not many people use it to build finish product
<canton7>
lewis, bits and bobs on my server, monitoring stuff mainly
<lewis>
products* , or with macruby
<Kovensky>
('r' is exactly to the left of 'l' in dvorak)
<canton7>
lewis, also written a rather nice backup program in ruby, which I use
<lewis>
canton7: i meant a program of the dimension of what people write with c, c++, java...
<canton7>
and other little projects, which have ended up with a finished product
<canton7>
oh, no
<lewis>
yet ruby is fully capable to do so, no? is it a lack of libraries?
<canton7>
like python, or other scripting languages, I don't think it would work too well with an application of that size. Mainly because of performance and lack of static typing
derpmcherp has joined #ruby
<lewis>
canton7: ruby is more than a scripting language
<canton7>
I guess there's JRuby -- I've no idea whether anyone's used it for anything enterprisy
<Kovensky>
aww, Enumerable methods return standard Arrays instead of my extended objects :(