klebervirgilio has quit [Ping timeout: 276 seconds]
datanoise has joined #ruby-lang
Asher has quit [Quit: Leaving.]
chekcmate has joined #ruby-lang
datanoise has quit [Ping timeout: 245 seconds]
dzhulk has joined #ruby-lang
Asher has joined #ruby-lang
workmad3 has quit [Ping timeout: 255 seconds]
eban has quit [Quit: WeeChat 0.3.8]
eban has joined #ruby-lang
brianpWins has quit [Quit: brianpWins]
tbuehlmann has joined #ruby-lang
beho has joined #ruby-lang
workmad3 has joined #ruby-lang
eban has quit [Quit: WeeChat 0.3.8]
eban has joined #ruby-lang
Spakman_ has left #ruby-lang [#ruby-lang]
dankest has quit [Quit: Leaving...]
dankest has joined #ruby-lang
bzalasky_ has quit [Remote host closed the connection]
ryez has joined #ruby-lang
mercwith1mouth has quit [Ping timeout: 256 seconds]
mercwithamouth has quit [Ping timeout: 256 seconds]
Asher has quit [Quit: Leaving.]
r0bgleeson has quit [Read error: Connection reset by peer]
Banistergalaxy has quit [Ping timeout: 252 seconds]
dankest has quit [Quit: Leaving...]
cultureulterior_ has joined #ruby-lang
workmad3 has quit [Ping timeout: 240 seconds]
mantono has quit [Remote host closed the connection]
Wardrop has joined #ruby-lang
<Wardrop>
In the following example, does anyone know to get a reference to "Test" in the context of the included comment:
<Wardrop>
class Test; class << self
<Wardrop>
# How do I get a reference to "Test" from here
<Wardrop>
end
<Wardrop>
doing anything like "self.class" or "self.superclass" seem to get object associated with the singleton_class, not the actual class.
<yorickpeterse>
That's because you're already evaluating code on class level
<yorickpeterse>
Though I'm not entirely sure how to get it without explicitly using "Test"
<Wardrop>
Indeed, that's the problem.
<Wardrop>
I'm surprised that the singleton class seems to have no exposed relationship to it's actual class.
emocakes has joined #ruby-lang
chendo_ has joined #ruby-lang
dr_bob has quit [Read error: Connection reset by peer]
<Wardrop>
No one knows?
<manveru>
hm_
gnufied has quit [Quit: Leaving.]
klebervirgilio has joined #ruby-lang
<Wardrop>
I've decided to put it in as a feature request. I'm hoping someone will say that request and tell me how to do it, but I have a feeling it's going to have to be added.
gnufied has joined #ruby-lang
klebervirgilio has quit [Read error: Connection reset by peer]
klebervirgilio has joined #ruby-lang
<manveru>
yeah, i don't see any way atm
<manveru>
there must be a pointer to the original class somewhere in C, but if there is it's not exposed to ruby
<manveru>
maybe check rubinius?
dankest has joined #ruby-lang
<manveru>
meh, it's C++ ins rbx too :(
io_syl has quit [Quit: Computer has gone to sleep.]
chendo_ has quit [Ping timeout: 252 seconds]
sush24 has joined #ruby-lang
<dbussink>
manveru: we might be able to expose it some way in rbx if it's really useful :)
<Wardrop>
Yeah. I've already got a #to_hash method which returns a merged hash, where as #hash provides access to the local internal hash.
<Wardrop>
I should think of a better name though
<Wardrop>
Yeah I actually just wrote that code as an example. It probably doesn't work :)
<Wardrop>
Sorry
xcombelle has quit [Read error: Connection reset by peer]
<judofyr>
Wardrop: oh, don't be sorry, it was just a FYI because it can cause problems later ;)
<Wardrop>
Oh sorry, I thought you ran the code and it didn't work. I now realise that you were given an example of how overriding #hash is bad
xcombelle has joined #ruby-lang
<Wardrop>
Anyway, this is all for a class called "InheritableStruct". It's basically a struct implemented as a class singleton, where values of parents can be overridden by children.
<Wardrop>
This will end up going into the web framework I'm working on called Scorched.
<judofyr>
Wardrop: #hash is also a terrible name. you shouldn't name stuff based on the types. #attributes might be better ;)
<injekt>
or to_hash
<injekt>
which is something in 2.0 anyway, a hash representation of an object
<Wardrop>
I like #attributes, thanks :)
s1n4 has joined #ruby-lang
krz has quit [Quit: krz]
jxie has quit [Quit: leaving]
vlad_starkov has quit [Read error: Connection reset by peer]
vlad_starkov has joined #ruby-lang
carloslopes has joined #ruby-lang
s1n4 has quit [Quit: leaving]
Banistergalaxy has joined #ruby-lang
mantono has joined #ruby-lang
Qfwfq has quit [Ping timeout: 255 seconds]
beho has quit [Remote host closed the connection]
sush24 has joined #ruby-lang
Rubennn has joined #ruby-lang
gix has quit [Ping timeout: 252 seconds]
beiter has quit [Quit: beiter]
jtoy has joined #ruby-lang
gix has joined #ruby-lang
nkr has joined #ruby-lang
vlad_starkov has quit [Ping timeout: 255 seconds]
vlad_starkov has joined #ruby-lang
Mon_Ouie has joined #ruby-lang
zmack has quit [Remote host closed the connection]
Wardrop has quit [Quit: Wardrop]
zmack has joined #ruby-lang
beho has joined #ruby-lang
<chekcmate>
injekt: hey big guy
goatish_mound has joined #ruby-lang
My_Hearing has joined #ruby-lang
<injekt>
chekcmate: hey
<yorickpeterse>
injekt: he wants you
<chekcmate>
injekt: my boss is absent, i haz free time and im tinkering some ruby daemon, basically a tiny tcpserver
<chekcmate>
maybe i dont know the right term, but when doing system calls via that tcpserver, how would you guys get the return?
<chekcmate>
i now write it to a file (you know, like "ls > foo.txt" writes the return into foo.txt)
Mon_Ouie has quit [Ping timeout: 245 seconds]
<chekcmate>
and afterwards read it
<chekcmate>
so the client gets the return
<chekcmate>
but how do you actually do that?
<chekcmate>
yorickpeterse: don't be jealous, coming to you next time :)
<yorickpeterse>
Don't worry, I'm already occupied
<yorickpeterse>
by the one %1
jtoy has quit [Quit: jtoy]
<chekcmate>
:>
<yorickpeterse>
well, probably something like 0.00000000001% but you get the idea
<yorickpeterse>
fuck, now I want to know
<chekcmate>
hahaha
<chekcmate>
hm... Win32::Registry invites to add a daemon to the registry..
jtoy has joined #ruby-lang
<yorickpeterse>
Apparently I'm occupied by the 0.00000000014285714285%
<chekcmate>
:D
<chekcmate>
yorickpeterse are there ruby trojans?
<yorickpeterse>
You mean activesupport?
* yorickpeterse
runs
<chekcmate>
no, basically...
<chekcmate>
at all
<yorickpeterse>
Not that I know of
<yorickpeterse>
Though sometimes Ruby is used for script kiddie toolkits
<judofyr>
Metasploit ;)
<chekcmate>
yea, that has lots of rubyish stuff in it
<yorickpeterse>
that's probably because those people are too lazy to learn a real programming language such as Node.js
MartynKeigher has quit [Ping timeout: 245 seconds]
<chekcmate>
"i386-mingw32"
<chekcmate>
wasn't that mswin?
gustavnils has joined #ruby-lang
noop_ has joined #ruby-lang
ruurd has joined #ruby-lang
MartynKeigher has joined #ruby-lang
chendo_ has quit [Quit: Computer has gone to sleep.]
ruurd has quit [Read error: Connection reset by peer]
dzhulk has joined #ruby-lang
kgrz has quit [Ping timeout: 252 seconds]
yfeldblum has quit [Ping timeout: 248 seconds]
vlad_starkov has quit [Remote host closed the connection]
beiter has joined #ruby-lang
<certainty>
is there a method that traverses an enumerable and returns the result of the first block that evaluated to a truthy value?
<lianj>
.find
<certainty>
find returns the element not the value of the block no?
<lianj>
true
<certainty>
something like map(:something).compact.first
<certainty>
only in one metod that stops as soon elt.something is truthy
<lianj>
there prolly is something but i usually just do a each with break inside if i need that behavior
<certainty>
hmm possible, i can just return
<judofyr>
certainty: don't think it's there already
<judofyr>
certainty: I've used used pattern before: foo.each { |bar| return yield(bar) || next }
<judofyr>
although it's a bit magic
<certainty>
moar magic :)
<judofyr>
not often you have both yield, return and next in the same expression
<lianj>
:D
dustint has joined #ruby-lang
<judofyr>
certainty: in Ruby 2.0: foo.lazy.map { |x| x * 2 }.find { |x| x }
lcdhoffman has joined #ruby-lang
<lianj>
hmmm
<judofyr>
hmmm?
<certainty>
judofyr: nice
<judofyr>
or, you can do the same without lazy now
<certainty>
i wish Object defined identity
<yorickpeterse>
y u no use #find(&:x)
tonni has quit [Remote host closed the connection]
<certainty>
thet you could be more ideomatic like foo.lazy.map{|x| x + 2}.find(&:identity)
<lianj>
judofyr: is there a nice 2.0 feature writeup?
<chekcmate>
no.. I'm out of work, I need someone to annoy
<jtoy>
is it safe if multiple threads are writing to the same file?
<yorickpeterse>
no
<yorickpeterse>
Not without a mutex
<yorickpeterse>
Unless you don't care for write order
<jtoy>
i don't care about the write order,each thread is writing 1 line though
<jtoy>
at a time
<apeiros_>
jtoy: write order doesn't mean "order of lines"
<apeiros_>
it means "at any character"
<jtoy>
right now i just have the threads throw the data into a queue and then another single thread pulling from the queue and writing to the file , is that the fastest way?
<jtoy>
apeiros_: ok, then that does matter
<apeiros_>
using a queue is a sane approach IMO, yes
<apeiros_>
whether it's the fastest - no idea
sush24 has joined #ruby-lang
<jtoy>
apeiros_: is the only alternative a mutex ? queues are the only way i've done threading
jbsan has quit [Quit: jbsan]
[[johnonymous]] has joined #ruby-lang
toretore has quit [Read error: Connection reset by peer]
<yorickpeterse>
Queues don't ensure a single thing writing at once
<yorickpeterse>
Unless there's only one worker
jbsan has joined #ruby-lang
<jtoy>
yorickpeterse: i know, i have 1 worker who's only job is to read from thread and write the data
<yorickpeterse>
When it comes to threads, whenever you read/write data to a single location you'll most likely need a mutex
toretore has joined #ruby-lang
<yorickpeterse>
jtoy: in that case, no
<yorickpeterse>
since there's only one worker active at a time
<yorickpeterse>
However, I'd still do it in case you want to scale up to multiple workers
<apeiros_>
yorickpeterse: I was assuming that he writes a complete "package" to the queue
<apeiros_>
and then the queue very much ensures that those stay in one piece
<jtoy>
i have a pool of other threads that push data onto the queue, it seems like idont need the mutex?
<apeiros_>
jtoy: just make sure that you write atomic pieces to the queue. i.e. anything that must not be interspersed with other data must be written to the queue in one piece.
<jtoy>
apeiros_: yes, it is complete. the data on the queue is all that is written to the file
dhruvasagar has quit [Ping timeout: 260 seconds]
jbsan has quit [Quit: jbsan]
QaDeS has joined #ruby-lang
imperator has quit [Quit: This computer has gone to sleep]
chekcmate has quit [Quit: Page closed]
__BigO__ has joined #ruby-lang
tonni has quit [Remote host closed the connection]
anildigital_work has quit [Ping timeout: 256 seconds]
akamike has quit [Ping timeout: 260 seconds]
anildigital_work has joined #ruby-lang
nXqd has quit [Ping timeout: 256 seconds]
KA__ has joined #ruby-lang
GarethAdams has joined #ruby-lang
<certainty>
mutex all along
<jtoy>
certainty: you mean its already doing a mutex with the queue?
<certainty>
nope
<certainty>
the queue is synchronized but you need to synchronize the access to the file
<jtoy>
i don't even see why i need the mutex, i have 100 threads doing work and they put data into a queue, then a single thread worker reads off of that and writes, no one else accesses the file
dr_bob has quit [Quit: Leaving.]
<certainty>
so auire the mutex, write the line (flush it uif you don't have line-buffering), and release the mutex
<andrewvos>
Anyone having an issue install gems?
<certainty>
aquire,even
<certainty>
jtoy: ah you have a single worker that does the write?
<certainty>
i thought you had multiple writers
<jtoy>
no
<certainty>
then you don't need to synchronize the access to the file
<jtoy>
i could have the workers write directly, but i imagine it would be slower then using a queue
<jtoy>
certainty in general is that correct?
<certainty>
jtoy: what is correct? that it's slower?
sush24 has quit [Quit: Leaving]
dr_bob has joined #ruby-lang
<jtoy>
certainty: that a queue with one writer is faster then 100 threads and muteness to write a file
imperator has joined #ruby-lang
<certainty>
it does basically the same, so i don't expect it to be faster. but it is a better abstraction, that scales better
davidbalber|away is now known as davidbalbert
<certainty>
the workers don't have to care how the stuff is written or by whome
<certainty>
qeues are good :)
<certainty>
lockfree qeues are better :)
stonerfish has joined #ruby-lang
QaDeS has quit [Ping timeout: 240 seconds]
Steve-W- has joined #ruby-lang
<jtoy>
certainty: I'm just using the queue class from threaded, not sure if i should be using better ones
<certainty>
that's ok
<certainty>
don't optimize prematurely
<jtoy>
certainty: ok, if i need it later, what would be the library I should look into?
Steve-W- has quit [Client Quit]
enebo has joined #ruby-lang
Qfwfq has joined #ruby-lang
asdfqwer has joined #ruby-lang
thoughtfulgoblin has joined #ruby-lang
QaDeS has joined #ruby-lang
sush24 has joined #ruby-lang
<thoughtfulgoblin>
hi i've got some code that's running really slow.. basically for remove duplicate points and check for points that have duplicate timestamps and id's but different values
<jtoy>
injekt: I just tested slop on another box with auto create and got the same error, Im going to look into it later today
carloslopes has joined #ruby-lang
<injekt>
jtoy: ok great, feel free to create an issue if you find something
<andrewvos>
injekt: Oh Jesus Christ
sepp2k1 has joined #ruby-lang
sepp2k has quit [Ping timeout: 264 seconds]
srbaker has joined #ruby-lang
yfeldblum has joined #ruby-lang
gnufied has quit [Quit: Leaving.]
cored has quit [Ping timeout: 255 seconds]
lun_ has joined #ruby-lang
cored has joined #ruby-lang
cored has quit [Changing host]
cored has joined #ruby-lang
srbaker has quit [Quit: Computer has gone to sleep.]
spuk has joined #ruby-lang
mr_white has quit [Read error: Connection reset by peer]
mr_white has joined #ruby-lang
mr_white has quit [Read error: Connection reset by peer]
mr_white has joined #ruby-lang
Nisstyre-laptop has joined #ruby-lang
srbaker has joined #ruby-lang
beiter has quit [Quit: beiter]
nertzy has joined #ruby-lang
Nisstyre-laptop has quit [Read error: Connection reset by peer]
Nisstyre-laptop has joined #ruby-lang
<injekt>
aye
judofyr has quit [Remote host closed the connection]
stonerfish has quit [Quit: Leaving.]
hack is now known as megha
stonerfish has joined #ruby-lang
dhruvasagar has joined #ruby-lang
krohrbaugh has joined #ruby-lang
GarethAdams has quit [Quit: Leaving...]
noop has quit [Ping timeout: 255 seconds]
noop_ has quit [Ping timeout: 256 seconds]
mistym has joined #ruby-lang
mistym has joined #ruby-lang
mistym has quit [Changing host]
kcassidy has left #ruby-lang [#ruby-lang]
bzalasky has joined #ruby-lang
skade has quit [Quit: Computer has gone to sleep.]
bzalasky has quit [Remote host closed the connection]
b1rkh0ff has quit [Read error: Connection reset by peer]
Nisstyre-laptop has quit [Quit: Leaving]
lcdhoffman has quit [Ping timeout: 252 seconds]
Nisstyre-laptop has joined #ruby-lang
dr_bob has left #ruby-lang [#ruby-lang]
stardiviner has joined #ruby-lang
amerine has joined #ruby-lang
akamike has joined #ruby-lang
__butch__ has joined #ruby-lang
gregmoreno has joined #ruby-lang
Qwak has joined #ruby-lang
b1rkh0ff has joined #ruby-lang
beiter has joined #ruby-lang
tylersmith has joined #ruby-lang
sush24 has quit [Remote host closed the connection]
solars has quit [Ping timeout: 252 seconds]
sush24 has joined #ruby-lang
__BigO__ has quit [Remote host closed the connection]
therod has quit [*.net *.split]
neurodamage has quit [*.net *.split]
Silex has quit [*.net *.split]
totallymike has quit [*.net *.split]
bougyman has quit [*.net *.split]
nibbo has quit [*.net *.split]
tpope has quit [*.net *.split]
knu has quit [*.net *.split]
wizonesolutions has quit [*.net *.split]
jaska has quit [*.net *.split]
bougyman has joined #ruby-lang
bougyman has quit [Changing host]
bougyman has joined #ruby-lang
wizonesolutions has joined #ruby-lang
wizonesolutions has quit [Changing host]
wizonesolutions has joined #ruby-lang
krz has joined #ruby-lang
__BigO__ has joined #ruby-lang
therod has joined #ruby-lang
jaska has joined #ruby-lang
knu has joined #ruby-lang
totallymike has joined #ruby-lang
nibbo has joined #ruby-lang
neurodamage has joined #ruby-lang
tpope has joined #ruby-lang
Silex has joined #ruby-lang
chimkan has quit [Ping timeout: 248 seconds]
sush24 has quit [Quit: This computer has gone to sleep]
stonerfish has quit [Ping timeout: 276 seconds]
nkr has joined #ruby-lang
ddfreyne has quit [Excess Flood]
ddfreyne has joined #ruby-lang
dhruvasagar has quit [Ping timeout: 256 seconds]
stonerfish has joined #ruby-lang
geopet has joined #ruby-lang
ddfreyne has quit [Excess Flood]
ddfreyne has joined #ruby-lang
Flock_of_Smeagol has joined #ruby-lang
l0st1 has quit [Quit: leaving]
workmad3 has joined #ruby-lang
swav_ has quit [Remote host closed the connection]
geopet has quit [Quit: geopet]
skade has joined #ruby-lang
eydaimon has joined #ruby-lang
<eydaimon>
trying to parse a csv file with this character: 'Æ' but I keep getting the error: 'invalid byte sequence in UTF-8'. my code is: "CSV.foreach(file, headers: true, encoding: "UTF-8") do |row| ... "
<eydaimon>
any ideas?
krohrbaugh1 has joined #ruby-lang
krohrbaugh1 has quit [Read error: Connection reset by peer]
krohrbaugh1 has joined #ruby-lang
havenwood has joined #ruby-lang
Flock_of_Smeagol has left #ruby-lang ["Leaving"]
krohrbaugh has quit [Ping timeout: 276 seconds]
mercwith1mouth has joined #ruby-lang
mercwithamouth has joined #ruby-lang
apeiros_ has quit [Remote host closed the connection]
ddfreyne has quit [Excess Flood]
ddfreyne has joined #ruby-lang
agile has quit [Remote host closed the connection]