SeepingN has quit [Quit: The system is going down for reboot NOW!]
<Radar>
That fizzbuzz example from #14916 is cool
ciro has quit [Ping timeout: 268 seconds]
eckhardt has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
r29v has joined #ruby
<havenwood>
Hooah!
darkhanb has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
cagomez has quit [Remote host closed the connection]
cagomez has joined #ruby
<ule>
Hey guys, what would you use to paginate a hash? Lets say I have a list with 100 items and want to paginate this into 5 groups
<ule>
Not sure if there is a magic enumerable method that does this out of the box
<ule>
a kind of group_by(n elements)
cagomez has quit [Read error: Connection reset by peer]
ali_g has joined #ruby
<havenwood>
ule: each_slice
<leitz>
Looking at the dry-core gem. In lib/ there's directory dry and file dry-core.rb that just has require 'lib/dry/core'. In lib/dry/core there's a dry directory and 'core.rb' that just has Module Core inside module Dry, with no other real code. There are ruby files in lib/dry/core that have Module Core defined inside Module Dry. Is the "require 'lib/dry/core'
<leitz>
in the first file what sets this module up to be used?
lytol_ has quit [Remote host closed the connection]
<havenwood>
ali_g: When you #map over a Hash the |a| in your block argument is indeed an Array of two elements, the key and value.
\void is now known as Time-Warp-ish
Time-Warp-ish is now known as \void
<havenwood>
(I'm assuming `a` is short for Array, in your naming scheme.)
<havenwood>
ali_g: Your example would work with: a.first.to_f
<havenwood>
ali_g: `a` is an Array, not a Hash, so you can't use #[] with "amount" since Array#[] expects an Integer.
Freshnuts has joined #ruby
<havenwood>
ali_g: Does that make sense?
<ali_g>
@havenwood I am seeing my mistake now, I thought I was grabbing a value from the key but I wasn't, I ended up with two array of 2 values. I can't use .first because the h in the example will be changing sometimes including more than one "amount" value, but I conclude from what you are saying that map is the wrong tool for this
<havenwood>
ali_g: h['amount'].to_f #=> has 700.0
<ali_g>
yes
<ali_g>
I'm looking to return an array with all the values for amount converted to string
<badeball>
dionysus69: my guess would be that Kernel#format converts it to a float and you lose the resolution again. can you try the builtin BigDecminal#to_s with 'F', IE. BigDecimal.new('123').to_s('F')
<dionysus69>
oh that sounds like it should work :D let me try
<Tempesta>
sorry, how can I download for windows?
<Bish>
dionysus69: safe a pair of 2 integers, there is no dateformat that can hold it
<tbuehlmann>
dionysus69: are you looking for BigDecimal.new('0.1000000000000000001e1').to_s('F')?
<Bish>
well i bet my nuts it has a numerical type for that
<dionysus69>
yea big decimal
<dionysus69>
I have precision at 32 and scale at 18
<snickers>
Hi, someone know why active record on oracle return 0.28522e5 for integer 28522
<Bish>
wlel no, since that is IEEE754
<Bish>
well time to lose my nuts, since postgres doesnt seem to have that by default
<Bish>
i would store an array of 2 integers.
<dionysus69>
dunno, haven't worked with any db but postgres for past 5 years
<Bish>
well best choice either way in my opinion
<Bish>
but if you want it to have losless, creating your own type / saving it as an array is your only choice
* Bish
checks what his ORM is doing
Alina-malina has joined #ruby
<dionysus69>
yea I think so too ^.^ but where I come from, everyone uses either mysql oracle or mssql
<Bish>
mysql is great... it's fast in shit, but if it gets slow
<Bish>
have fun finding out why
<Bish>
or funny things like.. inserting emojis into a varchar type
<Bish>
and mysql is like "Okay, i inserted it :)"
<Bish>
and the column entry is empty
<dionysus69>
the only slowness I dealt with dbs was because of SSD I/O bottleneck
User458764 has joined #ruby
<badeball>
Bish: you have a binary format in psql, so if you can serialize / deserialize your preferred float type in you language then you're good to go
<Bish>
or the bug that existed since 1997 (which finally got fixed right now)
<Bish>
that u cannot regex for utf8(dafuq!? why did people use that)
<Bish>
badeball: that doesnt help if your precision just cannot handle it
User458764 has quit [Client Quit]
<Bish>
im surprised my ORM does not seem to be able to save rational types either :o
<badeball>
of course not, but it means that you can store / retrieve without lsos
<badeball>
loss*
<Bish>
well.. yeah but the number is already "broken" then
<Bish>
so the trick would be to serialize a Rational
<Bish>
or complex even
<Bish>
and having a type for that database-ish
fmcgeough has joined #ruby
<Bish>
but who would even need that except for experimental physicists?
fmcgeough has quit [Client Quit]
<badeball>
unless you can represent integers of arbritary length, then a rational suffers from the same presicion problems
fmcgeough has joined #ruby
<Bish>
hm, yah
TJ- has joined #ruby
<Bish>
is it really the same? or similiar?
<badeball>
a rational and a floating point are just two different ways of representing numbers, but constrained by the same reality
<Bish>
yeah but you wont have things like
<Bish>
"oh i cannot represent that number, let's take the nearest"
<Bish>
so i wouldn't say it's the same thing.. but limited aswell, sure
<Bish>
but when in doubt, store the number as a string, write a integer lib(does that exist in ruby?)
<Bish>
and you have slow, limitless(except for memory) fractions
<dionysus69>
Bish tbuehlmann as I wanted to format the number I found that include ActionView::Helpers::NumberHelper includes number_with_precision(any_number, precision: 18)
<dionysus69>
so if the number is 0.001 I want to show 0.0010000....
<Bish>
eh, you want to display pointless numbers :D?
<dionysus69>
yea I guess :S :D it's for UX :D
<badeball>
rationals can help you avoid accumulating floating errors over multiple arithmic operations
<dionysus69>
I am dealing with cryptocurrencies
<dionysus69>
the problem is that bitcoin for example uses floats
<dionysus69>
while ethereum and cardano use integers
<Bish>
wait what again someone talks about bitcoin?
<dionysus69>
so I decided to use floats for all so I am converting everything to bigdecimal
<Bish>
don't use floats at all
<Bish>
how does bitcoin uses floats?
<dionysus69>
the rpc server I mean
<Bish>
oh.. really?
<dionysus69>
returns balance of let's say 1.00001
<Bish>
yeah that is not float
<Bish>
you shouldn't use float for that
<dionysus69>
I could convert it to integer but , then I would have to convert it back to float to show to user
<Bish>
no you don't you want your own way of representing it
<dionysus69>
by float I mean BigDecimal
<Bish>
you don't want representation errors, even if it's just for displaying
elphe has quit [Ping timeout: 264 seconds]
<dionysus69>
i figured by now that floats are unreliable :P
<Bish>
literally every code i read about cryptocoins so far used integers
<dionysus69>
so far everything's correct
<dionysus69>
only glitch so far was with format("%.#{precision}f", number) as I just found out
<dionysus69>
it's a choice, as I said, I encountered 0 mismatches
<Bish>
well, i am not much of a math person, but most likely you won't have some
<Bish>
as long as you're not calculating with these numbers
<Bish>
but i wouldn't do it, simply becuase.. i don't know in future you, or someone working with your software
<Bish>
might use that float for calculation
<Bish>
you shouldn't use float, because it isn't
<dionysus69>
I am tutoring one guy and he already knows this :D
<Bish>
remember me when shit hits the fan
<dionysus69>
I will, you are not the first one to warn me, wink wink people here :D
deathwishdave has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
<Bish>
yeah i remember the last time i think
<Bish>
you had a different name and were kinda trollish, is that possible?
<dionysus69>
lol no, this is my only nick on irc, ever
<Bish>
okay, then a different person was doing the same thing
<dionysus69>
:P
deathwishdave has joined #ruby
<Bish>
i feel like even if float were fine
<dionysus69>
big decimal is convenient cause postgres supports it, I don't see a problem with proper testing before deployment
<Bish>
juggling around with it would be more work than writing your own format for a integer number
<Bish>
you do not even need rationals..
<dionysus69>
nah of course I don't :D so far I don't get how I would use them
<Bish>
the amount of satoshis is fukin known, you don't need a floating POINT because there is not point, like literally
<Bish>
the datatype you want to use there is integer
<Bish>
a single one
<dionysus69>
oh well, if any funny thing happens, I can reconvert everything to ints in day or two
<Bish>
well.. if your database is already corrupted by floating point errors
<Bish>
thats when u correct it:D while the solution would be so easy
<Bish>
my i ask what you're writing so i never but my cryptocoins there?
<dionysus69>
lol, I was already asked that
<dionysus69>
you will know when it gets famous ^.^
<Bish>
just trying to "insult" you so you're not doing this huge mistake
<Bish>
especially when working with currencies
<Bish>
really, don't do it, i am getting sick of sounding like "teh-irc-guy"
<Bish>
but don't do it
<dionysus69>
well, I inherited this software and bigdecimals were already there, I never bothered to change because they work
* Bish
is hurting
Tempesta has quit [Quit: See ya!]
GodFather has quit [Remote host closed the connection]
elphe has joined #ruby
<Bish>
how many bits does a bitcoin balance have btw?
<Bish>
or rather.. what is the max amount of a transaction
<dionysus69>
meaning?
<dionysus69>
you can transact any amount
<Bish>
i doubt it
<Bish>
i can't send 21000001 bitcoins
<dionysus69>
dunno, no one probably has enough bitcoin to cause a software error while transacting
<dionysus69>
oh lol that's what you mean
<Bish>
yes, and i guess the limit is before that
<dionysus69>
well yea I know there's finite amount
<dionysus69>
more than 3-4 million is probably lost too
<dionysus69>
while testing and stuff in early years
GodFather has joined #ruby
alem0lars has joined #ruby
vonfry has joined #ruby
kapil___ has quit [Quit: Connection closed for inactivity]
vonfry has quit [Quit: WeeChat 2.2]
* Bish
threw away so many 0.0x btc adresses, because they werent worth anything
<Bish>
i even remember installing the bitcoin client as a kid (<18) being being like "wats dis lul, i mine a bit, what does this mean"
<Bish>
must've been 17 (im 28 now)
postmodern_ has quit [Quit: Leaving]
_aeris_ has quit [Remote host closed the connection]
_aeris_ has joined #ruby
FernandoBasso has joined #ruby
apparition47 has joined #ruby
mikecmpbll has joined #ruby
tdy has quit [Read error: Connection reset by peer]
tdy has joined #ruby
kapil___ has joined #ruby
vondruch_ has joined #ruby
vondruch_ is now known as vondruch
FernandoBasso is now known as Penelope_Pitstop
beefjoe has joined #ruby
vondruch has quit [Quit: vondruch]
asphyxia has quit [Ping timeout: 268 seconds]
beefjoe has quit [Ping timeout: 276 seconds]
TJ- has quit [Ping timeout: 265 seconds]
ciro has joined #ruby
mikecmpbll has quit [Quit: inabit. zz.]
TJ- has joined #ruby
c0ncealed2 has quit [Remote host closed the connection]
c0ncealed2 has joined #ruby
DaniG2k has joined #ruby
cadillac_ has quit [Ping timeout: 260 seconds]
cadillac_ has joined #ruby
mikecmpbll has joined #ruby
deathwishdave has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
conta has joined #ruby
DaniG2k has quit [Quit: leaving]
deathwishdave has joined #ruby
lxsameer has quit [Ping timeout: 264 seconds]
mikecmpbll has quit [Quit: inabit. zz.]
ur5us has quit [Remote host closed the connection]
ur5us has joined #ruby
ur5us has quit [Ping timeout: 255 seconds]
lxsameer has joined #ruby
redlegion1 is now known as redlegion
lxsameer has quit [Ping timeout: 248 seconds]
TJ- has quit [Ping timeout: 240 seconds]
lxsameer has joined #ruby
nickjj_ has joined #ruby
gix has joined #ruby
lxsameer has quit [Ping timeout: 260 seconds]
clemens3_ has joined #ruby
conta1 has joined #ruby
MuffinPimp_ has joined #ruby
ryzokuken_ has joined #ruby
spiette_ has joined #ruby
uplime- has joined #ruby
bak1an has joined #ruby
galeido_ has joined #ruby
TJ- has joined #ruby
fumck has joined #ruby
x0f_ has joined #ruby
coffeecupp has joined #ruby
conta has quit [*.net *.split]
clemens3 has quit [*.net *.split]
yokel has quit [*.net *.split]
spiette has quit [*.net *.split]
micutzu has quit [*.net *.split]
al2o3-cr has quit [*.net *.split]
brendan- has quit [*.net *.split]
Genya has quit [*.net *.split]
nickjj has quit [*.net *.split]
coffeecupp__ has quit [*.net *.split]
axsuul has quit [*.net *.split]
ryzokuken has quit [*.net *.split]
x0f has quit [*.net *.split]
yadnesh has quit [*.net *.split]
MuffinPimp has quit [*.net *.split]
fuxx has quit [*.net *.split]
arahael has quit [*.net *.split]
n3b has quit [*.net *.split]
galeido has quit [*.net *.split]
claw has quit [*.net *.split]
matled has quit [*.net *.split]
brodul has quit [*.net *.split]
esObe has quit [*.net *.split]
balo has quit [*.net *.split]
pocketprotector has quit [*.net *.split]
tectonic has quit [*.net *.split]
jerryskye has quit [*.net *.split]
chamunks has quit [*.net *.split]
aef has quit [*.net *.split]
badeball has quit [*.net *.split]
jmaister has quit [*.net *.split]
Radar has quit [*.net *.split]
audy has quit [*.net *.split]
uplime has quit [*.net *.split]
osp2 has quit [*.net *.split]
fumk has quit [*.net *.split]
oblique has quit [*.net *.split]
freeze has quit [*.net *.split]
dostoyevsky has quit [*.net *.split]
seggy has quit [*.net *.split]
MuffinPimp_ is now known as MuffinPimp
conta1 is now known as conta
uplime- is now known as uplime
brodul has joined #ruby
jerryskye has joined #ruby
mzo has joined #ruby
infernix has quit [Ping timeout: 266 seconds]
unshackled has quit [Ping timeout: 240 seconds]
Alina-malina has quit [Ping timeout: 256 seconds]
oblique has joined #ruby
arahael has joined #ruby
n3b has joined #ruby
al2o3-cr has joined #ruby
al2o3-cr has quit [Max SendQ exceeded]
TJ- has quit [Ping timeout: 265 seconds]
al2o3-cr has joined #ruby
TJ- has joined #ruby
BTRE has quit [Read error: Connection reset by peer]
BTRE has joined #ruby
infernix has joined #ruby
balo has joined #ruby
white_lilies has joined #ruby
snickers has quit [Ping timeout: 268 seconds]
white_lilies has quit [Ping timeout: 260 seconds]
nickjj_ is now known as nickjj
Inline has quit [Remote host closed the connection]
beefjoe has quit [Read error: Connection reset by peer]
beefjoe has joined #ruby
TJ- has quit [Ping timeout: 255 seconds]
postmodern has joined #ruby
bmurt has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
mikecmpbll has quit [Quit: inabit. zz.]
hgost has joined #ruby
balr0g has joined #ruby
conta has quit [Quit: conta]
gnufied has joined #ruby
dionysus69 has quit [Ping timeout: 260 seconds]
beefjoe has quit [Read error: Connection reset by peer]
beefjoe has joined #ruby
TJ- has joined #ruby
ciro has quit [Ping timeout: 248 seconds]
Mike11 has joined #ruby
tty has quit [Quit: tty]
Xiti` has quit [Quit: Xiti`]
apparition47 has quit [Quit: Bye]
za1b1tsu_ has quit [Ping timeout: 256 seconds]
chouhoulis has joined #ruby
bmurt has joined #ruby
Xiti has joined #ruby
ciro has joined #ruby
mroutis has joined #ruby
maryo has joined #ruby
arup_r has joined #ruby
mzo has quit [Ping timeout: 256 seconds]
<arup_r>
I have some guids from twitter feed. I would like to compare the guid like which one is bigger. Those values are like "1024009734402256896" and "999729751781724165". If I do compare them by converting them to integer using `.to_i` like "1024009734402256896".to_i > "999729751781724165".to_i will there be a problem? As the numbers are keep growing.
<arup_r>
if so, what will be the safest approach?
bmurt has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
bmurt has joined #ruby
<arup_r>
anyone here? :)
<Demos[m]>
yeah
<Demos[m]>
so there are different types of guid
mroutis has quit [Remote host closed the connection]
<Demos[m]>
the numbers don't nessassarly indicate anything about the guid
<Demos[m]>
newer ones will tend to be larger (because many guids are generated via time based methods, or hwid based methods)
<Demos[m]>
for hwids the ids tend to grow with time (although there's no cosmic reason for this), for time based ones time moves forward
<Demos[m]>
there are also random guids that truely are just random
<Demos[m]>
I belive you can somehow identify them but I forget how
<Demos[m]>
what does "bigger" mean to you?
<arup_r>
well. say in future "1024009734402256896" becomes "102400973440225689684848484848484444", and if I do call .to_i on it, I hope it will not break .
<ciro>
I don't understand what you mean when you say "time periods"
<sylario>
two dates
<ciro>
yes...
<ciro>
a date interval
<ciro>
(Date.today)..(Date.tomorrow)
<ciro>
for example, isn't it?
<sylario>
yes
<sylario>
well, i probably used a bad namming for my objects then :/
<sylario>
too late
<Demos>
Can you ever really know what tomorrow's date will be?
nowhere_man has joined #ruby
<Demos>
:>
yohji has quit [Remote host closed the connection]
za1b1tsu_ has joined #ruby
ur5us has joined #ruby
ur5us has quit [Ping timeout: 256 seconds]
<sylario>
Yup, it really seems periods is rarelly used for time interval in english :
zapata has joined #ruby
<ciro>
sylario: in spanish it makes sense
<sylario>
in french too
<sylario>
><
<ciro>
in english... well, I'm not a native english speaker, can not tell
<sylario>
It seems not
<sylario>
well, that code base will probably never be touched by a native speaker
<ciro>
hehe
<sylario>
And I bet it's the same in Italian than in French or spanish, so no problems here
<ciro>
sylario: I renamed more than a half of the class names in the app in my last job
<ciro>
lol
<sylario>
that's not a fun activity
<ciro>
it was my first task, my boss commanded me to to it because the first programmers they hired did not speak english very well, and the class names, variable names, etc, had spanglish names or names in english that did not make any sense at all
<ciro>
it was funny, 80K lines of code in a Ruby on Rails app
<sylario>
Rails was my first framework with pluralization, quickly learned the ie/y english rules
<havenwood>
jrich523: it does make sense to set an instance variable on init if you have what you need to calculate it and it doesn't change.
Guest83186 has quit [Ping timeout: 268 seconds]
NightMonkey has joined #ruby
<jrich523>
yeah i feel like i could just createa a bunch of attr_reader and sort it all out on init, or maybe its to only trigger errors if its actually looked at, vs load?
<jrich523>
hmm it doesnt like 2 ||, the raise at the end is angry about the string being there?
<jrich523>
if i wrap it || ( raise "" ) its ok, kinda wierd
<z64>
`raise("foo")` instead
<jrich523>
ohh ok
<jrich523>
that looks better
AJA4350 has joined #ruby
cats has quit [Ping timeout: 244 seconds]
cats has joined #ruby
bmurt has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
beefjoe has quit [Remote host closed the connection]
mtkd has joined #ruby
ModusPwnens has joined #ruby
memo2 has quit [Quit: WeeChat 1.4]
r29v has quit [Quit: r29v]
r29v has joined #ruby
<ModusPwnens>
style question: I have a block of code that I need to share within two different scopes in the same method. This shared block of code does NOT need to be shared outside of that method. Is it bad practice to use a proc/lambda for that to reflect that it doesn't need to be shared outside of the method?
venmx has quit [Ping timeout: 256 seconds]
bmurt has joined #ruby
mtkd has quit []
Sina has quit [Ping timeout: 256 seconds]
marius has quit [Ping timeout: 256 seconds]
Guest13679 has quit [Ping timeout: 256 seconds]
sriehl has quit [Ping timeout: 256 seconds]
heyimwill has quit [Ping timeout: 256 seconds]
AndroidKitKat has quit [Ping timeout: 256 seconds]
marius has joined #ruby
sriehl has joined #ruby
eblip has quit [Ping timeout: 256 seconds]
tfitts has quit [Ping timeout: 256 seconds]
Guest83186 has joined #ruby
sauvin has quit [Read error: Connection reset by peer]
AJA4350 has quit [Ping timeout: 256 seconds]
AJA4351 has joined #ruby
zapata has quit [Ping timeout: 256 seconds]
balr0g has quit [Ping timeout: 256 seconds]
adambeynon has quit [Ping timeout: 256 seconds]
SuperTux88 has quit [Ping timeout: 256 seconds]
krasnus has quit [Ping timeout: 256 seconds]
orbyt_ has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
nemesit|znc has quit [Ping timeout: 256 seconds]
Sina has joined #ruby
AndroidKitKat has joined #ruby
AJA4351 is now known as AJA4350
tfitts has joined #ruby
AJA4350 has quit [Remote host closed the connection]
adambeynon has joined #ruby
User458764 has quit [Ping timeout: 240 seconds]
mtkd has joined #ruby
Guest83186 has quit [Ping timeout: 240 seconds]
orbyt_ has joined #ruby
Guest83186 has joined #ruby
nemesit|znc has joined #ruby
AJA4350 has joined #ruby
balr0g has joined #ruby
heyimwill has joined #ruby
SuperTux88 has joined #ruby
orbyt_ has quit [Ping timeout: 244 seconds]
krasnus has joined #ruby
mensvaga has joined #ruby
<mensvaga>
I'm trying to build an RPM out of a ruby gem. But the resulting RPM doesn't install any ruby files, and it tries to install stuff by default into my home directory.
eb0t is now known as eblip
<mensvaga>
Is there an example spec file that I can use to modify the spec file that gem2rpm creates so I can make RPMs out of gems that are similar to what gets installed when I do something like:
<mensvaga>
yum install rubygem-io-console
Guest83186 has quit [Ping timeout: 260 seconds]
def_jam has joined #ruby
dendazen has joined #ruby
Azure has quit [Ping timeout: 268 seconds]
sameerynho has quit [Ping timeout: 248 seconds]
alfiemax has quit [Ping timeout: 268 seconds]
elphe has quit [Ping timeout: 248 seconds]
ur5us has joined #ruby
Azure has joined #ruby
<eam>
mensvaga: try fpm
ur5us has quit [Ping timeout: 264 seconds]
^mtkd has joined #ruby
TJ- has quit [Ping timeout: 276 seconds]
mtkd has quit [Read error: Connection reset by peer]
<havenwood>
alaing: What were the names of the ones still being run?
<havenwood>
paths*
<alaing>
except instead of models i replaced it with features
<havenwood>
alaing: Can you show examples of the path of one that isn't properly excluded?
<havenwood>
Like, I expected this file to be excluded: nope/spec/features/why_not_spec.rb
<havenwood>
alaing: Right now we know the exclusion glob you used, but without an example path you expected to be exlcuded there's nothing for us to go on.
<alaing>
one sec i might need to test it on another folder. features is rather long and slow running
Zaab1t has joined #ruby
<alaing>
I tried that ruby command and it returned []
<havenwood>
alaing: what did you expect it to match?
Zaab1t has quit [Client Quit]
<havenwood>
Give us the path of one of the specs you thought it would see!
<alaing>
path to a file that should be excluded?
<havenwood>
alaing: Yup, what's a file you expected to be matched by that glob that wasn't.