Yxhuvud has quit [Quit: No Ping reply in 180 seconds.]
pilne has quit [Read error: Connection reset by peer]
Yxhuvud has joined #ruby
pilne has joined #ruby
nullmoose[m] has joined #ruby
nadir has joined #ruby
jyaworski has joined #ruby
arescorpio has joined #ruby
eckhardt has joined #ruby
chris349 has joined #ruby
<chris349>
How can I stop nill method errors? I get them too often for stupid things. Right now I can not run a db:migrate because an smtp server setting is missing! SMTP server setting should have nothing to do with a db:migrate
cschneid_ has joined #ruby
white_lilies has quit [Ping timeout: 248 seconds]
SuperL4g_ is now known as SuperL4g
SuperL4g is now known as SuperLag
erlend has quit [Ping timeout: 256 seconds]
erlend has joined #ruby
cschneid_ has quit [Ping timeout: 264 seconds]
roamingdog has joined #ruby
<mroutis>
SMTP server settings load in the initializer, and the db:migrate task requires to run the whole rails environment
<mroutis>
I guess is easier to get ActiveRecord::Base.connection_options or whatever when everything is loaded
guacamole has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
<mroutis>
chris349: you'll get used to it, dude
_antares_ has quit [Quit: Connection closed for inactivity]
<chris349>
I have the smtp settings in /production.rb set to load from secrets.yml
<chris349>
Is there any way to make it better so this unrelated error doesnt happen? Even if the SMTP setting is wrong db:migrate should not fail!
workmad3 has joined #ruby
cadillac_ has quit [Read error: Connection reset by peer]
jyaworski has quit [Ping timeout: 240 seconds]
pilne has quit [Quit: Leaving]
cadillac_ has joined #ruby
<mroutis>
what I do, chris349, is having some `ENV.fetch('SMTP_USER') { '' }`
<mroutis>
or `ENV['SMTP_PASSWORD'] || ''`
<mroutis>
so it doesn't set the value to `nil`
workmad3 has quit [Ping timeout: 256 seconds]
samort7 has quit [Quit: Leaving]
shuforov has joined #ruby
cadillac_ has quit [Read error: Connection reset by peer]
cadillac_ has joined #ruby
jyaworski has joined #ruby
mroutis has quit [Remote host closed the connection]
shuforov has quit [Ping timeout: 268 seconds]
aupadhye has joined #ruby
obzidian has joined #ruby
jyaworski has quit [Ping timeout: 240 seconds]
cpruitt has joined #ruby
quarters has quit [Changing host]
quarters has joined #ruby
quarters has joined #ruby
<lystra>
Hi. I installed ruby-2.4.4 and want to install the loquacious-1.9.1 gem outside of the standard ruby install path. To do that, I installed as follows: https://gist.github.com/twwlogin/214fb5d369de5a4272baeb4e36fff0d1. Then I tried to install bones-3.8.4.gem and but it couldn't find loquacious, even after setting RUBYLIB. Is there another way to add the directory I want to the search path for gems?
guacamole has joined #ruby
guacamole has joined #ruby
guacamole has quit [Changing host]
KeyJoo has joined #ruby
cpruitt has quit [Ping timeout: 240 seconds]
cpruitt has joined #ruby
cpruitt has quit [Ping timeout: 248 seconds]
alex`` has joined #ruby
ur5us has quit [Ping timeout: 240 seconds]
Sammichmaker has quit [Read error: Connection reset by peer]
mjolnird has joined #ruby
sagax has joined #ruby
arescorpio has quit [Quit: Leaving.]
_aeris_ has quit [Read error: Connection reset by peer]
redlegion has quit [Read error: Connection reset by peer]
_aeris_ has joined #ruby
redlegion has joined #ruby
roamingdog has quit []
oleo has quit [Quit: Leaving]
bow_ has joined #ruby
jyaworski has joined #ruby
Azure|dc has joined #ruby
jyaworski has quit [Ping timeout: 240 seconds]
troys has quit [Quit: Bye]
konsolebox has quit [Ping timeout: 256 seconds]
anisha has joined #ruby
Azure has quit [Ping timeout: 264 seconds]
konsolebox has joined #ruby
armyriad has quit [Quit: Leaving]
donofrio has quit [Remote host closed the connection]
jane_booty_doe has joined #ruby
sauvin has joined #ruby
reber has joined #ruby
cpruitt has joined #ruby
cadillac_ has quit [Ping timeout: 240 seconds]
alfiemax has joined #ruby
cadillac_ has joined #ruby
cpruitt has quit [Ping timeout: 260 seconds]
cpruitt has joined #ruby
armyriad has joined #ruby
physicist__ has joined #ruby
cpruitt has quit [Ping timeout: 240 seconds]
docyam2 has joined #ruby
shuforov has joined #ruby
docyam2 has quit [Client Quit]
docyam2 has joined #ruby
docyam2 has quit [Client Quit]
anisha_ has joined #ruby
anisha has quit [Ping timeout: 240 seconds]
erlend has quit [Ping timeout: 260 seconds]
erlend has joined #ruby
roshanavand has joined #ruby
jyaworski has joined #ruby
alfiemax_ has joined #ruby
shiroeni has joined #ruby
alfiemax has quit [Ping timeout: 240 seconds]
orbyt_ has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
terens has joined #ruby
DTZUZO has quit [Ping timeout: 260 seconds]
workmad3 has joined #ruby
jyaworski has quit [Ping timeout: 240 seconds]
roshanavand has quit [Ping timeout: 260 seconds]
workmad3 has quit [Ping timeout: 240 seconds]
tomphp has joined #ruby
conta has joined #ruby
rahul_bajaj has joined #ruby
sauvin has quit [Ping timeout: 260 seconds]
sauvin_ has joined #ruby
cpruitt has joined #ruby
cpruitt has quit [Ping timeout: 276 seconds]
Burgestrand has joined #ruby
bow_ has quit [Quit: Leaving]
Burgestrand has quit [Ping timeout: 264 seconds]
karapetyan has joined #ruby
inerthia has joined #ruby
mikhael_k33hl_ has quit [Quit: Page closed]
shiroeni has quit [Ping timeout: 264 seconds]
karapetyan has quit [Read error: Connection reset by peer]
nadir has quit [Quit: Connection closed for inactivity]
biberu has joined #ruby
tomphp has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
alex`` has quit [Ping timeout: 240 seconds]
alex`` has joined #ruby
suukim has joined #ruby
karapetyan has joined #ruby
jeen has quit [Quit: This computer has gone to sleep]
andikr has joined #ruby
RoneDreamer has joined #ruby
TomyWork has joined #ruby
karapetyan has quit [Remote host closed the connection]
x0f has quit [Ping timeout: 255 seconds]
suukim has quit [Quit: Konversation terminated!]
RoneDreamer has quit [Remote host closed the connection]
suukim has joined #ruby
BH23 has quit [Ping timeout: 268 seconds]
eckhardt has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
<lucabertoni>
Hi, I'm learning Ruby basics from http://docs.ruby-doc.com/docs/ProgrammingRuby/. In the section "Classes, Objects, and Variables", before the heading "Specifying Access Control", it says "Ruby differs from other OO languages in another important way. Access control is determined dynamically, as the program runs, not statically[...]". Can anyone explain me why it does work in this way?
jyaworski has joined #ruby
<dminuoso>
lucabertoni: Because Matz said so.
<Bish>
And nature made it so
<dminuoso>
lucabertoni: It's to ensure that you can't possibly reason about your code when staring at the editor.
<Bish>
no bad marketing for ruby in here
rrichardsr3 has quit [Quit: Apparantly my attempt to stay awake has failed...]
<dminuoso>
lucabertoni: People will try you that "it enables meta programming techniques". For 99.95% of Ruby programmers however it just delays design issues and bugs.
<dminuoso>
lucabertoni: Part of it is related to the fact that classes are defined at runtime. People can reopen classes and define methods.
<Bish>
that's so fun
beefjoe88 has joined #ruby
<dminuoso>
lucabertoni: Which makes it impossible to reason aobut what methods actually are in your method.
amar has joined #ruby
cabotto has joined #ruby
<lucabertoni>
dminuoso: Tnx!
beefjoe88 has quit [Remote host closed the connection]
<dminuoso>
You could have some `if gets.chomp == "hi"; class Foo; def magic; end; end; end`
<dminuoso>
Because why not.
<lucabertoni>
Well, wait, lol that's pure magic, never seen before
<dminuoso>
lucabertoni: The only thing that Ruby determines statically is whether some identifier is considered a variable or not.
<lucabertoni>
dminuoso: Tnx!!
<dminuoso>
That's about the extend of it.
beefjoe has joined #ruby
_aeris_ has quit [Remote host closed the connection]
cpruitt has joined #ruby
<Bish>
something in ruby that can f* with X11 windows?
_aeris_ has joined #ruby
jyaworski has quit [Ping timeout: 240 seconds]
nima_m has quit [Quit: nima_m]
roshanavand has joined #ruby
nima_m has joined #ruby
cpruitt has quit [Ping timeout: 264 seconds]
ellcs has joined #ruby
nima_m has quit [Client Quit]
nima_m has joined #ruby
beilabs has joined #ruby
roshanavand has quit [Ping timeout: 240 seconds]
yohji has joined #ruby
karapety_ has joined #ruby
karapetyan has quit [Read error: Connection reset by peer]
RoneDreamer has quit [Remote host closed the connection]
amar has quit [Remote host closed the connection]
apeiros has quit []
nima_m has quit [Quit: nima_m]
nima_m has joined #ruby
amar has joined #ruby
<nima_m>
##join linux
RougeR has quit [Ping timeout: 240 seconds]
amar has quit [Remote host closed the connection]
RougeR has joined #ruby
RougeR has joined #ruby
RougeR has quit [Changing host]
minimalism has quit [Quit: minimalism]
nima_m has quit [Client Quit]
nima_m has joined #ruby
zautomata3 has quit [Ping timeout: 260 seconds]
apeiros_ has joined #ruby
tomphp has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
tomphp has joined #ruby
tvw has quit [Ping timeout: 255 seconds]
tomphp has quit [Client Quit]
jyaworski has joined #ruby
nima_m has quit [Quit: nima_m]
nima_m has joined #ruby
apeiros_ is now known as apeiros
Burgestrand has quit [Quit: Closing time!]
nima_m has quit [Client Quit]
nima_m has joined #ruby
venmx has quit [Ping timeout: 260 seconds]
enyo has quit [Quit: Page closed]
venmx has joined #ruby
terens2 has joined #ruby
jyaworski has quit [Ping timeout: 240 seconds]
<akkad>
irc is hard
za1b1tsu has joined #ruby
<apeiros>
akkad: how come?
terens has quit [Ping timeout: 268 seconds]
jyaworski has joined #ruby
rikai has quit [Ping timeout: 265 seconds]
terens has joined #ruby
tomphp has joined #ruby
ferr has joined #ruby
ferr has left #ruby [#ruby]
nima_m has quit [Quit: nima_m]
nima_m has joined #ruby
terens2 has quit [Ping timeout: 268 seconds]
erlend has quit [Ping timeout: 264 seconds]
rikai has joined #ruby
ellcs has quit [Ping timeout: 240 seconds]
jyaworski has quit [Ping timeout: 248 seconds]
erlend has joined #ruby
_antares_ has joined #ruby
inerthia has joined #ruby
alfiemax_ has quit [Remote host closed the connection]
nima_m has quit [Client Quit]
nima_m has joined #ruby
jnollette has quit [Remote host closed the connection]
jerematic has joined #ruby
\void has joined #ruby
dionysus69 has quit [Quit: dionysus69]
tomphp has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
dionysus69 has joined #ruby
jnollette has joined #ruby
lucabertoni has quit [Quit: WeeChat 2.1]
Mike11 has joined #ruby
alfiemax has joined #ruby
face has joined #ruby
roshanavand has joined #ruby
venmx has quit [Ping timeout: 268 seconds]
venmx has joined #ruby
nima_m has quit [Quit: nima_m]
nima_m has joined #ruby
tomphp has joined #ruby
tomphp has quit [Client Quit]
tomphp has joined #ruby
tomphp has quit [Client Quit]
alfiemax has quit [Remote host closed the connection]
nima_m has quit [Quit: nima_m]
nima_m has joined #ruby
alfiemax has joined #ruby
unreal has joined #ruby
alfiemax has quit [Remote host closed the connection]
sagax has quit [Ping timeout: 248 seconds]
nima_m has quit [Quit: nima_m]
nima_m has joined #ruby
tomphp has joined #ruby
amatas has joined #ruby
tomphp has quit [Client Quit]
AJA4350 has joined #ruby
dionysus69 has quit [Read error: Connection reset by peer]
karapetyan has quit [Remote host closed the connection]
jyaworski has quit [Ping timeout: 248 seconds]
erlend has quit [Ping timeout: 240 seconds]
VladGh_ has quit [Quit: Lost terminal]
amar has quit [Ping timeout: 264 seconds]
kurko_ has joined #ruby
erlend has joined #ruby
VladGh has joined #ruby
_antares_ has quit [Quit: Connection closed for inactivity]
inerthia has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
Emmanuel_Chanel has quit [Ping timeout: 255 seconds]
za1b1tsu_ has quit [Ping timeout: 260 seconds]
dionysus69 has quit [Ping timeout: 240 seconds]
RougeR has quit [Ping timeout: 255 seconds]
AJA4350 has quit [Remote host closed the connection]
bmurt has joined #ruby
Psybur has joined #ruby
ellcs has quit [Ping timeout: 248 seconds]
obzidian has quit [Ping timeout: 240 seconds]
oleo has joined #ruby
ellcs has joined #ruby
amatas has quit [Quit: amatas]
<sylario>
what is the name of the ruby mechanism allowing to have syntax like "scope :something" or "validates :somefied, params: 'foo'" ?
amatas has joined #ruby
<mozzarella>
optional parentheses?
alfiemax has quit [Remote host closed the connection]
cpruitt has joined #ruby
chocoelho has quit [Quit: Konversation terminated!]
<sylario>
mozzarella: ho... it's just nice little function call, I should have guessed it
<sylario>
THx mozzarella
jeffreylevesque has joined #ruby
kurko_ has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
guacamole has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
amelliaa has quit [Quit: -]
RougeR has joined #ruby
amatas has quit [Ping timeout: 276 seconds]
chmurifree has quit [Excess Flood]
terens has quit [Remote host closed the connection]
rfoust has joined #ruby
chmurifree has joined #ruby
rwb has joined #ruby
silviu has joined #ruby
_antares_ has joined #ruby
RoneDreamer has joined #ruby
k0mpa has joined #ruby
rippa has joined #ruby
jyaworski has joined #ruby
ur5us has quit [Remote host closed the connection]
inerthia has joined #ruby
tomphp has quit [Ping timeout: 264 seconds]
obzidian has joined #ruby
howdoi has quit [Quit: Connection closed for inactivity]
kurko_ has joined #ruby
RoneDreamer has quit []
cyberjam1s has joined #ruby
yeticry has quit [Ping timeout: 255 seconds]
DTZUZO has joined #ruby
KeyJoo has joined #ruby
yeticry has joined #ruby
karapetyan has joined #ruby
ellcs has quit [Ping timeout: 240 seconds]
dionysus69 has joined #ruby
iceden has joined #ruby
jyaworski has quit [Ping timeout: 256 seconds]
nadir has quit [Quit: Connection closed for inactivity]
karapetyan has quit [Ping timeout: 256 seconds]
ellcs has joined #ruby
amatas has joined #ruby
tomphp has joined #ruby
chouhoulis has joined #ruby
tomphp has quit [Client Quit]
jyaworski has joined #ruby
shuforov has quit [Ping timeout: 240 seconds]
ellcs has quit [Ping timeout: 248 seconds]
tomphp has joined #ruby
nicesignal has quit [Remote host closed the connection]
nicesignal has joined #ruby
ellcs has joined #ruby
obzidian has quit [Ping timeout: 248 seconds]
jyaworski has quit [Ping timeout: 240 seconds]
herbmillerjr has joined #ruby
alfiemax has joined #ruby
jottr has quit [Ping timeout: 256 seconds]
obzidian has joined #ruby
silviu has quit [Remote host closed the connection]
alfiemax has quit [Read error: Connection reset by peer]
silviu has joined #ruby
alfiemax has joined #ruby
samort7 has joined #ruby
shuforov has joined #ruby
silviu has quit [Ping timeout: 264 seconds]
Emmanuel_Chanel has joined #ruby
Rapture has joined #ruby
obzidian has quit [Ping timeout: 240 seconds]
obzidian has joined #ruby
mlkkk has quit [Remote host closed the connection]
amar has joined #ruby
tomphp has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
suukim has quit [Quit: Konversation terminated!]
mlkkk has joined #ruby
alfiemax_ has joined #ruby
amar has quit [Ping timeout: 248 seconds]
alfiemax has quit [Ping timeout: 248 seconds]
cyberg has joined #ruby
mlkkk has quit [Ping timeout: 256 seconds]
rrichardsr3 has joined #ruby
jottr has joined #ruby
andikr has quit [Remote host closed the connection]
fyrril has quit [Ping timeout: 276 seconds]
cheba has joined #ruby
<cheba>
Hi!
<cheba>
I’ve encountered an unexpected behaviour. I wonder if it’s a bug and if so if it’s a known one.
<cheba>
Ruby 2.4
<cheba>
> [1, 1.0].min
<cheba>
=> 1
<cheba>
> [[1, 0.0].max, 1.0].min
<cheba>
=> 1
<cheba>
Ruby 2.5
<cheba>
> [1, 1.0].min
<cheba>
=> 1
<cheba>
> [[1, 0.0].max, 1.0].min
<cheba>
=> 1.0
<cheba>
Sorry for the wall of text…
<apeiros>
why is that unexpected?
RougeR has quit [Ping timeout: 240 seconds]
<dminuoso>
Well that is actually rather strange.
BTRE has quit [Ping timeout: 248 seconds]
tomphp has joined #ruby
tomphp has quit [Client Quit]
<apeiros>
I don't think min/max make any guarantees with regards to order
<apeiros>
and the change in order is likely a result of some optimization. and literal-array + min/max just recently got one (it no longer creates an array).
tvw has quit []
tvw has joined #ruby
BTRE has joined #ruby
tomphp has joined #ruby
InfinityFye has joined #ruby
obzidian has quit [Ping timeout: 240 seconds]
alfiemax has joined #ruby
ray_sploit has joined #ruby
alfiemax_ has quit [Ping timeout: 268 seconds]
InfinityFye has left #ruby [#ruby]
Burgestrand has quit [Quit: Closing time!]
<cheba>
Thanks.
beilabs has joined #ruby
ellcs has quit [Ping timeout: 260 seconds]
ray_sploit has quit [Ping timeout: 240 seconds]
<dminuoso>
apeiros: Im not seeing it.
chocoelho has joined #ruby
biberu has quit []
<dminuoso>
Ah well actually I can now.
<dminuoso>
I guess vm_opt_newarray_min/vm_opt_newarray_max changed somehow
<dminuoso>
apeiros: I think it's silly to allow comparing Integer with Float
<dminuoso>
Well. If you compare Integer with Float, you deserve to have shit break.
<havenwood>
I just avoid Floats, generally.
jds_ has joined #ruby
<havenwood>
Floats Considered Harmful
<cheba>
DMINUOSO: cool
<apeiros>
meh. just be aware that floats are approximations.
<dminuoso>
Even if just for the reason that 3.0 might not exactly be 3..
<dminuoso>
But your average joe programmer wont even know what IEEE stands for.
<dminuoso>
havenwood: They are actually quite good if you understand the reasoning behind it.
<apeiros>
otherwise: programming considered harmful.
<apeiros>
3.0 is always exactly 3. it's just that ruby might present something as 3.0 which isn't.
shuforov has quit [Ping timeout: 248 seconds]
troys has joined #ruby
<apeiros>
I still wish we had better support for decimal floats (IEEE actually contains that, it's just that hardware barely supports it, and hence most software doesn't either)
guacamole has joined #ruby
guacamole has joined #ruby
guacamole has quit [Changing host]
<apeiros>
IME most mistakes come from the misconception that floats worked in a decimal fashion. people are otherwise usually quite aware of limitations when using limited precision. e.g. that you can't reprsent 1/7 in decimal precisely.
<dminuoso>
apeiros: Okay my notation sucked a bit. My point is, if you pick an arbitrary number and just add .0 to the end, it might not be the same number anymore
<apeiros>
dminuoso: you have to go beyond 56 digits iirc to have that be true ;-) (javascript for lack of true integers even has a function to determine how long a float is safe for integers)
<dminuoso>
you mean 52 *binary* digits
<apeiros>
or was that beyond log10(2**56) digits?
<apeiros>
yeah, possible
<apeiros>
it's not really a number I committed to memory
clemens3_ has quit [Ping timeout: 240 seconds]
<apeiros>
well, you can derive it from the size of the mantissa, and that I don't remember either 😅
conta has quit [Ping timeout: 240 seconds]
<apeiros>
seems to be 52 bits, so log10(2**52) digits then.
karapetyan has joined #ruby
<dminuoso>
apeiros: So code that only does what you expect it to when values are inside some (from a users perspective) rather arbitrary ranges sucks.
Cavallari has quit [Quit: Cavallari]
<dminuoso>
It introduces code that suddenly breaks when you have some number greater than 4503599627370496 floating around
<apeiros>
dminuoso: true. but that's a limitation of all hard and software.
<dminuoso>
apeiros: except that threshold is not obvious at all. floats work just fine beyond that
<apeiros>
various number of limitations are not obvious
ramfjord has joined #ruby
<cheba>
As far as I can tell IEEE 1.0 is quite precisely 1.
<apeiros>
I do agree with the base idea that a language should help spotting less obvious limitations
rrichardsr3 has quit [Quit: He who dares .... wins.]
<apeiros>
and avoid them where possible. but as with most things, those come at a trade-off and it's not always easy to decide which way to choose
<cheba>
Moreover, the difference is not because of float imprecission. It just an arbitrary order it pics a value. [[1, 0.0].max, 1.0].min vs [1, 1.0].min.
<apeiros>
I mean the most expensive way is probably to let everything be symbolic math until IO happens
karapetyan has quit [Ping timeout: 268 seconds]
obzidian has joined #ruby
<apeiros>
cheba: the result 1.0 and 1 are equivalent and as stated in the bug, both are valid
<cheba>
In both cases the first element of the array is Integer 1. However, lang pick different values based on how I contruct the value.
<apeiros>
and as said, min/max make no guarantees on order.
<cheba>
Fair point on no guarantee.
<cheba>
I don’t quite agree on equivalence. See last comment on the bug.
ramfjord has quit [Ping timeout: 240 seconds]
<havenwood>
cheba: It's not a stable sort either. They optimize the unstable case.
<apeiros>
i.e. they don't state "returns the *first* (or *last*) element with the minimum value". only "returns the element with the minimum value"
<apeiros>
yeah, I disagree with the last comment in the bug
<havenwood>
"As far as I know, sort stability is rarely required, not worthy for slows down sorting in general. If there's stable sort routine faster than current one, please tell me." ~ Matz
<apeiros>
they depend on non-agreed-upon behavior
<havenwood>
"I still think that Ruby should have a core method for stable sorting." ~ Matz
<apeiros>
it's their duty to normalize in-/output to suite their needs and match the actually agreed-upon behavior
<apeiros>
you can always stably sort with an unstable sorter.
<apeiros>
ary.sort_by.with_index { |x,i| [x, i] }
<apeiros>
i.e. sort by occurrence if the values compare as equal.
tubbo has joined #ruby
<apeiros>
(occurrence index? whatever you want to call it)
<cheba>
I’m not quite sure how sorting hactors in here since 1 is equivalent to 1.0. You simply can not sort them in Ruby.
<apeiros>
"in ruby"
<apeiros>
you can sort them in ruby. if you think the type is part of the sorting, then you have to specify that in your sort algorithm.
<havenwood>
and if they're equal, the order isn't guaranteed
<apeiros>
yepp
<apeiros>
just as the order of 1,1,1,1 is not guaranteed
<apeiros>
just that you won't notice the difference
<havenwood>
i noticed, you swapped the first and third ones!
<havenwood>
tricky...
<apeiros>
psssh
<havenwood>
;-P
<apeiros>
or to make a different example: sort a number of people by age in years
<apeiros>
with an unstable sort, people of the same age will end up in any order
<apeiros>
and just like with float vs. integer - if that matters to you, then *specify* the additional sorting criteria.
<apeiros>
(and obviously, same applies for min/max)
karapetyan has joined #ruby
fuxx has joined #ruby
<apeiros>
so yeah, I quite disagree with that last comment on the bug. use a tool wrongly, then don't complain about "wrong" results.
jcarl43 has joined #ruby
tubbo has quit [Quit: WeeChat 2.0.1]
TomyWork has quit [Remote host closed the connection]
KeyJoo has quit [Ping timeout: 260 seconds]
jyaworski has joined #ruby
cheba has quit [Quit: cheba]
hogetaro has quit [Quit: Leaving...]
jyaworski has quit [Ping timeout: 248 seconds]
guacamole has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
ellcs has joined #ruby
tomphp has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
bheesham1 is now known as bheesham
conta has joined #ruby
psychicist__ has joined #ruby
erlend has quit [Ping timeout: 240 seconds]
hinbody has joined #ruby
erlend has joined #ruby
hinbody has left #ruby [#ruby]
guille-moe has quit [Remote host closed the connection]
guille-moe has joined #ruby
inerthia has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
jyaworski has joined #ruby
_antares_ has quit [Quit: Connection closed for inactivity]
jottr has quit [Ping timeout: 265 seconds]
reaVer has quit [Remote host closed the connection]
amar has joined #ruby
amar has quit [Ping timeout: 264 seconds]
eckhardt has joined #ruby
herbmillerjr has quit [Quit: Konversation terminated!]
eckhardt has quit [Client Quit]
BTRE has quit [Ping timeout: 248 seconds]
jrabe has quit [Quit: Disconnected]
jrabe has joined #ruby
silviu has joined #ruby
Tharbakim has quit [Ping timeout: 248 seconds]
n008f4g_ has joined #ruby
roshanavand has joined #ruby
grilix has joined #ruby
Tharbakim has joined #ruby
Tharbakim has joined #ruby
Tharbakim has quit [Changing host]
jyaworski has quit [Ping timeout: 264 seconds]
chris349 has joined #ruby
grilix_ has quit [Read error: Connection reset by peer]
Mike11 has quit [Quit: Leaving.]
noodle has quit [Ping timeout: 265 seconds]
silviu has quit [Ping timeout: 240 seconds]
troulouliou_div2 has joined #ruby
jyaworski has joined #ruby
alfiemax has quit [Remote host closed the connection]
cabotto has joined #ruby
noodle has joined #ruby
shuforov has joined #ruby
chocoelho has quit [Quit: Konversation terminated!]
alfiemax has joined #ruby
schneider has quit [Ping timeout: 248 seconds]
kanobt61_ has joined #ruby
beefjoe has quit [Remote host closed the connection]
guacamole has joined #ruby
guacamole has joined #ruby
guacamole has quit [Changing host]
minimalism has joined #ruby
<kanobt61_>
Is there a nice way to stub a method on a class, but have the test fail the the class doesnt respond to the stubbed method? (with minitest and mocha)
<kanobt61_>
I feel like I have done this before out of the box, but can't seem to remember it.
yohji has quit [Remote host closed the connection]
jyaworski has quit [Ping timeout: 260 seconds]
<kanobt61_>
I guess i could add an assertion like: class.respond_to?(:method).must_equal true
<havenwood>
fub: An aside, but Brightbox maintains Ruby packages for Ubuntu - if you're looking to use a package manager but have more versions available: https://www.brightbox.com/docs/ruby/ubuntu/
<dminuoso>
catphish: You should feel bad for wanting it.
<dminuoso>
It's a strong indicator your design is wrong.
docyam2 has joined #ruby
<catphish>
dminuoso: reading that code is a strong indicator that wanting it is wrong
<dminuoso>
Also consider it a joke rather. When you poke too much around in that class you will seg fault things left and right
<dminuoso>
Because I didn't bother to do it right.
amar has quit [Ping timeout: 248 seconds]
<catphish>
i'm trying to come up with a better design, the problem i have is that i'm trying to parse a network packet, part way through the packet i find out that it's a more specific type of packet
karapety_ has joined #ruby
<dminuoso>
So far it doesnt sound like a problem.
<catphish>
the best way i have to do it at the moment is start parsing in a class method of the superclass, then create the instance of the subclass once i know what it is, but it always ends up messy
reaVer has quit [Remote host closed the connection]
<dminuoso>
stop thinking in the superclass.
<dminuoso>
You have some `PacketParser` that is responsible for parsing stuff.
<dminuoso>
That packet parser just takes a stream and produces maybe a list of MagicPackets.
jds_ has quit [Quit: Connection closed for inactivity]
<dminuoso>
Based on whats in the stream, it might make a UnicornPacket or a GoblinPacket..
roshanavand has quit [Ping timeout: 240 seconds]
docyam2 has quit [Client Quit]
banisterfiend has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
karapetyan has quit [Ping timeout: 248 seconds]
ski7777 has quit [Remote host closed the connection]
ski7777 has joined #ruby
<catphish>
actually yes, that works, provided the length of the packet doesn't need to be determined by its type specific parser
<dminuoso>
uh what
<catphish>
PacketParser just has to find the start and end of each packet, do the minimum possible work to determine its type, then hand off the data to the appropriate class
<dminuoso>
Well PacketParser might dispatch to a UnicornParser or a GoblinParser.
<catphish>
to clarify, i don't want one huge class that knows how to parse every possible type of packet
<catphish>
that's what i'm getting at, yes
<dminuoso>
If I had the time I would be writing femtoparsec for ruby :-)
<dminuoso>
It kind of could work
conta has joined #ruby
<catphish>
though i must admit, i'd be inclined to make UnicornParser just a class method of UnicornPacket, is that bad design?
<dminuoso>
It doesn't really belong there in my opinion.
<catphish>
i suppose it depends on the complexity, but you may well be right, i value your opinion :)
<dminuoso>
catphish: UnicornPacket just has some def initialize(a, b, c, d, e, f); end
<dminuoso>
catphish: It's the parsers job to figure out how to take some stream of tokens, and make UnicornPackets out of that.
<dminuoso>
They are not really related
<catphish>
that would indeed be neat
reaVer has joined #ruby
<dminuoso>
catphish: How is your need for performance?
<dminuoso>
Oh wait.
<dminuoso>
Ruby, there is none.
<catphish>
lol
ramfjord has quit [Ping timeout: 256 seconds]
<catphish>
tbh need for performance is high, this is more of a prototype for something that'll end up in c if it works
<dminuoso>
I dont see what possible gains you could hope for to write it in Ruby first then.
<dminuoso>
catphish: Mind my asking, what kind of packets do you want to parse?
<dminuoso>
This doesn't sound like fun in either Ruby or C.
conta has quit [Ping timeout: 260 seconds]
<catphish>
once i really understand it, and my concepts work in ruby (where i feel comfortable and work fast) i will consider moving it to c (or have someone else do so)
<dminuoso>
Im actually rolling a RADIUS server in Haskell right now. :P
<catphish>
i once write a redius server in ruby
<catphish>
it worked well :)
<dminuoso>
catphish: You should see how much fun monadic parser combinators are.
<dminuoso>
Let me see if I still have my things
jyaworski has joined #ruby
ramfjord has joined #ruby
reaVer has quit [Remote host closed the connection]
<dminuoso>
catphish: Just something along those lines.
n008f4g_ has joined #ruby
workmad3 has joined #ruby
<catphish>
well that's gone some way over my head :(
alfiemax has quit [Ping timeout: 240 seconds]
<dminuoso>
catphish: That's just ruby..
<dminuoso>
catphish: It's rather simple really.
<dminuoso>
opcodeParser is a parser. formally you can think of a parser as something that takes a stream of data, consumes a bit of data and gives some (intermediate) result
<catphish>
ok
<dminuoso>
`opcodeParser >-> opcode { ... }` lets you glue a parser together with a handler that is ran if the parser succeeds.
<dminuoso>
now the only rule is, each handler must produce a new parser that is then run afterwards.
<dminuoso>
so inside the handler you get to use the result of the previous parser.
<dminuoso>
word8i parses a simple 8 bit word into an integer
darkhanb has joined #ruby
<catphish>
i see, i've never even seen a >->
<dminuoso>
catphish: that's just method >
<dminuoso>
and a stabby lambda
<dminuoso>
:P
<catphish>
ah i see
<dminuoso>
catphish: You'd also have `>>` which sequences two parsers, and throws away the result of the first
workmad3 has quit [Ping timeout: 240 seconds]
<dminuoso>
and then some combinators that take a parser and return a new parser
<dminuoso>
like `count`
<catphish>
well that's cool
<dminuoso>
It's a very intuitive way of writing parsers, it's silly easy to use.
<dminuoso>
Just tricky to write efficiently.
<dminuoso>
that is, its tricky to write the underlying implementation of the combinators efficiently
<catphish>
i'm going to concede that while i learned something here, i suspect that for tonight i'm just going to mash together a pile of if statements in a big method
<catphish>
because i'm too tired or stupid to get my head around how to write those properly
amar has quit [Remote host closed the connection]
<dminuoso>
Well normally you'd just use a library..
jyaworski has quit [Ping timeout: 240 seconds]
<catphish>
thank you for taking the time though, i hope soon once i get it working, i can tidy a lot
<dminuoso>
catphish: usually network protocols can easily be parsed by just consuming stuff and simple rules.
<catphish>
yeah, part of my problem is that the data has to be consumed as you go along
<catphish>
i hate that, i like things to be a fixed structure known upfront
<catphish>
but often you have to work it out as you progress through the packet :(
conta has joined #ruby
psychicist__ has quit [Ping timeout: 260 seconds]
<catphish>
i've never known a protocol with so many varible sub-headers
<dminuoso>
at least they are specified..
<catphish>
indeed
amar has joined #ruby
<catphish>
the most bothersome thing is that i find myself passing the tcp socket down to the parsers, and trusting them to read the correct amount of data
phenom has quit [Ping timeout: 260 seconds]
<catphish>
rather than just having a top level parser read one while packet and know the socket is in a sane state ready for the next packet
cloaked1 has joined #ruby
gregoryja_true has joined #ruby
conta has quit [Ping timeout: 248 seconds]
amar has quit [Remote host closed the connection]
amar has joined #ruby
jottr has quit [Quit: WeeChat 2.0.1]
amar has quit [Remote host closed the connection]
<catphish>
i'm sure i'll get there :)
darkhanb has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
venmx has quit [Ping timeout: 248 seconds]
n008f4g_ has quit [Ping timeout: 240 seconds]
dviola has quit [Quit: WeeChat 2.1]
jyaworski has joined #ruby
Guest13365 has quit [Ping timeout: 256 seconds]
ryzokuken has quit [Remote host closed the connection]
jenrzzz has joined #ruby
jenrzzz has joined #ruby
quobo has quit [Quit: Connection closed for inactivity]
sanscoeu_ has joined #ruby
sanscoeu_ has quit [Read error: Connection reset by peer]
sanscoeur has quit [Read error: Connection reset by peer]
sanscoeur has joined #ruby
jyaworski has quit [Ping timeout: 240 seconds]
cpruitt has quit [Remote host closed the connection]