LuckyABA has quit [Quit: My MacBook Pro has gone to sleep. ZZZzzz…]
newbie1 has quit [Ping timeout: 265 seconds]
nando293921 has joined #ruby
Pumukel has joined #ruby
BackEndCoder has quit [Excess Flood]
BackEndCoder has joined #ruby
Pumukel has quit [Ping timeout: 248 seconds]
eljimmy has quit [Quit: This computer has gone to sleep]
Pumukel has joined #ruby
loechel has joined #ruby
RedNifre_ has quit [Read error: Connection reset by peer]
<hays>
what is the : doing here? def initialize(size:)
Pumukel_ has joined #ruby
RedNifre_ has joined #ruby
Pumukel has quit [Ping timeout: 265 seconds]
<hays>
does that force you to say new size:5 ? intead of new 5
loechel has quit [Ping timeout: 265 seconds]
Pumukel has joined #ruby
<hays>
followup; what does &:foo do?
<hays>
how is it different from &foo
Pumukel_ has quit [Ping timeout: 265 seconds]
loechel has joined #ruby
charliesome has joined #ruby
Pumukel_ has joined #ruby
shinnya has joined #ruby
Pumukel has quit [Ping timeout: 248 seconds]
Pumukel has joined #ruby
loechel has quit [Ping timeout: 248 seconds]
pawnbox has joined #ruby
elifoster has joined #ruby
Pumukel_ has quit [Ping timeout: 248 seconds]
eljimmy has joined #ruby
loechel has joined #ruby
Pumukel has quit [Ping timeout: 265 seconds]
Dudee has joined #ruby
<Dudee>
hy
pawnbox has quit [Ping timeout: 248 seconds]
ezio has left #ruby ["Leaving"]
loechel has quit [Ping timeout: 265 seconds]
Pumukel has joined #ruby
<hays>
is p just short for puts?
<adam12>
hays: puts something.inspect
loechel has joined #ruby
<hays>
why does is seem like its nil
maletor1 has joined #ruby
Pumukel_ has joined #ruby
pavshn has quit [Quit: My MacBook Air has gone to sleep. ZZZzzz…]
blackmes1 has quit [Ping timeout: 244 seconds]
Pumukel has quit [Ping timeout: 248 seconds]
Pumukel has joined #ruby
loechel has quit [Ping timeout: 248 seconds]
Sashimi has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
maletor1 has quit [Ping timeout: 248 seconds]
arnonhongklay has joined #ruby
loechel has joined #ruby
jgpawletko has joined #ruby
Pumukel_ has quit [Ping timeout: 248 seconds]
_djbkd has quit [Remote host closed the connection]
Pumukel has quit [Ping timeout: 248 seconds]
_djbkd has joined #ruby
jgpawletko has quit [Client Quit]
Pumukel has joined #ruby
marr has quit [Ping timeout: 240 seconds]
loechel has quit [Ping timeout: 248 seconds]
_djbkd has quit [Ping timeout: 260 seconds]
Pumukel has quit [Ping timeout: 248 seconds]
Pumukel has joined #ruby
loechel has joined #ruby
helpa has quit [Remote host closed the connection]
helpa-bot has joined #ruby
bmurt has joined #ruby
Pumukel_ has joined #ruby
Dudee has left #ruby [#ruby]
Pumukel has quit [Ping timeout: 265 seconds]
helpa-bot has quit [Remote host closed the connection]
helpa has joined #ruby
Pumukel has joined #ruby
astrobunny has joined #ruby
loechel has quit [Ping timeout: 265 seconds]
Pumukel_ has quit [Ping timeout: 265 seconds]
Pumukel has quit [Ping timeout: 248 seconds]
nankyokusei has joined #ruby
zacstewart has quit [Read error: Connection reset by peer]
zacstewart has joined #ruby
UserOO7 has joined #ruby
Rodya_ has quit [Remote host closed the connection]
pwnd_nsfw` has joined #ruby
Rodya_ has joined #ruby
nankyokusei has quit [Ping timeout: 244 seconds]
pwnd_nsfw has quit [Ping timeout: 272 seconds]
Rodya_ has quit [Ping timeout: 272 seconds]
mistermocha has joined #ruby
hightower2 has joined #ruby
eljimbo has joined #ruby
_sfiguser has joined #ruby
<_sfiguser>
is it true that is always better to use rvm and not instally ruby system wide ?
zeroDi has quit [Quit: WeeChat 1.5]
eljimmy has quit [Ping timeout: 240 seconds]
BlkDynmt has quit [Remote host closed the connection]
mistermocha has quit [Ping timeout: 248 seconds]
<jazzonmym11nd>
_sfiguser: i'd say no.
coolboy has joined #ruby
<_sfiguser>
jazzonmym11nd, ok so when it is suggested to use rvm ?
johnDoe111 has joined #ruby
tdy has quit [Ping timeout: 244 seconds]
<NetSage>
version managers are probably a good habit to get into
NetSage has quit [Remote host closed the connection]
<jazzonmym11nd>
when you are on an OS that doesn't ship ruby or ships an outdated version of ruby, when you want to manage more than one version of ruby.
pokalyis has joined #ruby
coolboy has quit [Remote host closed the connection]
ropeney has joined #ruby
johnDoe111 has quit [Ping timeout: 265 seconds]
<_sfiguser>
jazzonmym11nd, ok so if one is a developer installing different versions of gems etc... it is a good habit right ?
meinside has quit [Quit: Connection closed for inactivity]
<jazzonmym11nd>
bundler solves the problem of managing gem dependencies
duncannz has quit [Remote host closed the connection]
mrBen2k2k2k____ has quit [Ping timeout: 260 seconds]
<_sfiguser>
yeah ok but.. i mean i had problems with system ruby some time ago
fly5566 has joined #ruby
<_sfiguser>
conflicting different versions of the same gem required for two different programs
blackmes1 has joined #ruby
<jazzonmym11nd>
bundler is designed to solve that problem but if you are just an end user who wants to use two gems who have conflicting dependencies then yes i guess gemsets are one way to work around that.
<jazzonmym11nd>
i'm not saying don't use rvm or gemsets, just that it is not always better to use rvm.
<jazzonmym11nd>
i would try both but yes rubinius and jruby don't have the same lock that MRI has.
mrBen2k2k2k has quit [Ping timeout: 255 seconds]
<hays>
getting rubinius installed on my mac is quite the adventure so far
programmerq has quit [Remote host closed the connection]
JoshS has quit [Ping timeout: 240 seconds]
<jazzonmym11nd>
rubinius is still slower than MRI on most benchmarks that are single threaded.
<hays>
right now im building it wirth ruby-install and that seems to be working
programmerq has joined #ruby
JoshS has joined #ruby
harfangk has joined #ruby
<_sfiguser>
which is the faster ruby implementation ?
a7d7p has joined #ruby
JoshS has quit [Remote host closed the connection]
aryaching has quit [Ping timeout: 240 seconds]
<jazzonmym11nd>
id say mri or jruby, it depends what you're doing.
dviola has quit [Quit: WeeChat 1.5]
jshjsh has quit [Ping timeout: 244 seconds]
aryaching has joined #ruby
<_sfiguser>
jazzonmym11nd, i'm doing ruby scripts generally
<jazzonmym11nd>
probably mri then, jruby takes a while to boot
bonhoeffer has joined #ruby
<_sfiguser>
sorry jazzonmym11nd i don't see any mri on "rvm list known"
<jazzonmym11nd>
mri is another word for official ruby
<_sfiguser>
maybe you refer to "mruby" or to "rbx" ?
<bonhoeffer>
i want to make a hash to record number frequencies 1..9 -- what is the best way to initialize this hash?
optiz0r has quit [Ping timeout: 244 seconds]
<bonhoeffer>
thinking something like k = {}; 1..9.map{|r| k[r]=0}
<bonhoeffer>
but that is no good
<jazzonmym11nd>
what's wrong with it?
<_sfiguser>
jazzonmym11nd, why they call it mri ? what does mri stand for ?
<jazzonmym11nd>
official ruby has had a few names historically: matz ruby interpreter(mri), yarv(yet another ruby vm).
<jazzonmym11nd>
mri is 1.8, yarv is 1.9 & beyond.
axsuul has joined #ruby
<_sfiguser>
ok
<_sfiguser>
thanks
<bonhoeffer>
jazzonmym11nd: nothing wrong i guess -- works well
<bonhoeffer>
just looking to see if there is a more efficient way to go about it-- a big array might be O(n)
toretore has quit [Ping timeout: 244 seconds]
ramfjord has joined #ruby
<jazzonmym11nd>
bonhoeffer: you could say Hash.new(0), so that on first key access the default value is always 0, but that makes every key work that way, even "a", or "b" (as possible mistakes in your code)
<bonhoeffer>
nice
<bonhoeffer>
then i can do
<bonhoeffer>
(1..9).map{|k| freq_hash[k]}
<jazzonmym11nd>
why bother?
<jazzonmym11nd>
point of default value like that is lazy initialization.
<bonhoeffer>
oh, because i want to do this: num1.each do |n| freq_hash1[n] += 1 end
<jazzonmym11nd>
just do that then
<bonhoeffer>
to build a hash of frequencies from "12312" => {1 => 2, 2 => 2, 3 = 1}
<jazzonmym11nd>
no need to initialize first.
solocshaw has joined #ruby
<bonhoeffer>
then freq_hash1[n] += 1 won't work for nil
<jazzonmym11nd>
it won't be nil
<jazzonmym11nd>
it'll be 0
symm- has joined #ruby
<bonhoeffer>
because of the Hash.new(0)
<bonhoeffer>
#testing
<jazzonmym11nd>
yea
<jazzonmym11nd>
>> h = Hash.new(0); h[:a] += 1; h[:b] += 1; h
mim1k has quit [Read error: Connection reset by peer]
johnmccabe has joined #ruby
mim1k has joined #ruby
<vasilakisfil>
ok so you are suggesting that there is a performance gain given tht the second one does not freeze the internals
nankyokusei has quit [Ping timeout: 244 seconds]
<apeiros>
I have not the faintest idea from what you read this suggestion.
<vasilakisfil>
hmm then what the code snippet you pasted suggests ?
<vasilakisfil>
that the items inside the array are not frozen, right ?
<apeiros>
correct
<vasilakisfil>
less strings frozen more memory allocation, right (let's say that we deal with longer strings because I think strings like 'a' and 'abc' are highly optimized already)
<vasilakisfil>
right ?
<apeiros>
not necessarily
<vasilakisfil>
ok
<vasilakisfil>
so the only point of freezing strings is for the sake of less error-prone code?
jazzonmym11nd has joined #ruby
<apeiros>
I can't infer intention from that snippet. reducing potential for errors would be one possible reason to freeze strings.
<apeiros>
performance can be another.
mistermocha has joined #ruby
<vasilakisfil>
there was no particular intention from that snipper, it was an example basically asking if there is any point (regarding performance) of doing that
chkm8 has quit [Ping timeout: 265 seconds]
Bounga has joined #ruby
tonini has joined #ruby
nargin has joined #ruby
axsuul has quit [Quit: My Mac has gone to sleep. ZZZzzz…]
kedare has joined #ruby
elenatanasoiu has joined #ruby
<dminuoso>
vasilakisfil: What is your question?
<dminuoso>
vasilakisfil: Are you asking what the advantage of freezing is?
<dminuoso>
Or is this about Symbol#to_proc?
jazzonmym11nd has quit [Ping timeout: 240 seconds]
bsrd has joined #ruby
dionysus69 has quit [Ping timeout: 265 seconds]
<apeiros>
vasilakisfil: I'll answer differently. your question "is there any point in doing A instead of B" - "yes, there are points."
<nargin>
Hi! As far as I understand, in ruby I can do variable substitution in strings using the #{} syntax, such as: "the value of var is #{var}". What I observe is this: if 'var' is not defined, it is replaced by an empty string "". Is there a way to enforce a failure in such a case?
<vasilakisfil>
is there any point doing this? ['a', 'b', 'c'].map(&:freeze).freeze instead of just ['a', 'b', 'c'].freeze ? (talking about performance) <--- that's my question:
pawnbox has joined #ruby
<apeiros>
nargin: if it is not defined, you'll get an exception
toretore has joined #ruby
mistermocha has quit [Ping timeout: 248 seconds]
<dminuoso>
nargin: if var is not defined, you get an error.
<dminuoso>
>> "#{foo}"
<vasilakisfil>
if there is any point freezing every array element instead of just the array
<ruby[bot]>
dminuoso: # => undefined local variable or method `foo' for main:Object ...check link for more (https://eval.in/644528)
<apeiros>
nargin: which means that your variable is defined
<apeiros>
vasilakisfil: see above.
<apeiros>
vasilakisfil: I'll answer differently. your question "is there any point in doing A instead of B" - "yes, there are points."
<nargin>
oh, I it's a special case: it's a variable with an '@' in front
axsuul has joined #ruby
<dminuoso>
vasilakisfil: Whatever you freeze becomes immutable. In case of array the elements are still mutable.
<dminuoso>
vasilakisfil: So if you freeze the array, you can still modify the elements. But if your intention is that the elements must be immutable - then you would freeze the elements.
<apeiros>
nargin: aha. you can do #{@var || raise("danger zone!")}
<dminuoso>
And don't do that.
<apeiros>
note that this will also raise if @var is set to nil or false, not just when it wasn't previously defined.
<dminuoso>
String interpolation with conditions and raising exceptions is not pretty.
AlexRussia_ has joined #ruby
<apeiros>
and on yet another note: not knowing whether a variable is defined at a certain point in your code is a very serious code smell. initialize your variables properly.
<apeiros>
I'd concur with dminuoso. do your assertions before the interpolation.
ta__ has quit [Ping timeout: 244 seconds]
stamina has joined #ruby
jsrn_ has joined #ruby
<nargin>
I need to maintain some other code, not my choice :-) Let me give you some more context, maybe that helps: a have a ruby commandline tool that sets some variable and then replaces them in a template to generate new files. It's a thor class that calls the 'template' function. Now I want to refactor this and find all the errors between the script and the templates.
ixti has quit [Ping timeout: 265 seconds]
banisterfiend has joined #ruby
<nargin>
so I was hoping I can run the (rather big) script and somehow get a flag so it fails on all the problems that exist in the current version with referencing undefined / replaced variables.
workmad3 has joined #ruby
ta_ has joined #ruby
<dminuoso>
nargin: local variables cant be referenced when undefined, as this will trigger a NameErroe exception.
p0p0pr37_ has joined #ruby
<dminuoso>
nargin: As for instance variables, you can use -w/-W to add some additional debugging, which will catch references to uninitialized instance variables.
p0p0pr37 has quit [Ping timeout: 276 seconds]
p0p0pr37_ is now known as p0p0pr37
unshadow has joined #ruby
maletor1 has joined #ruby
blackmes1 has quit [Ping timeout: 244 seconds]
Bounga has quit [Remote host closed the connection]
Tempesta_ has joined #ruby
Bounga has joined #ruby
p0p0pr37_ has joined #ruby
pawnbox has quit [Remote host closed the connection]
_sfiguser has quit [Ping timeout: 265 seconds]
symm- has quit [Ping timeout: 276 seconds]
giz|work has joined #ruby
pawnbox has joined #ruby
Tempesta has quit [Ping timeout: 248 seconds]
p0p0pr37 has quit [Ping timeout: 250 seconds]
p0p0pr37_ is now known as p0p0pr37
<nargin>
dminuoso, thanks. -w is exaclty what I was looking for
maletor1 has quit [Ping timeout: 244 seconds]
<dminuoso>
apeiros: Though technically I told a lie.. :D
<dminuoso>
But someone writing such code should be shot.
A_Drone has joined #ruby
apeiros has quit [Ping timeout: 244 seconds]
init7 has quit [Ping timeout: 250 seconds]
ferr has quit [Ping timeout: 244 seconds]
priodev has quit [Ping timeout: 244 seconds]
seggy has quit [Ping timeout: 244 seconds]
hirvi has quit [Ping timeout: 244 seconds]
vifino has quit [Ping timeout: 240 seconds]
hirvi has joined #ruby
tristanp has quit [Read error: Connection reset by peer]
unshadow has quit [Ping timeout: 244 seconds]
gingray has quit [Ping timeout: 244 seconds]
gingray has joined #ruby
tristanp has joined #ruby
wisn has quit [Ping timeout: 244 seconds]
apeiros has joined #ruby
ferr has joined #ruby
seggy has joined #ruby
aries_liuxueyang has quit [Ping timeout: 244 seconds]
unshadow has joined #ruby
vifino has joined #ruby
<nargin>
I agree :-)
init7 has joined #ruby
aries_liuxueyang has joined #ruby
priodev has joined #ruby
nadir has quit [Quit: Connection closed for inactivity]
griff has joined #ruby
LambdaSix has quit [Ping timeout: 244 seconds]
biberu has joined #ruby
Pumukel has joined #ruby
ocbtec has joined #ruby
loechel has joined #ruby
astrobunny has quit [Remote host closed the connection]
blackmes1 has joined #ruby
blaxter has quit [Quit: foo]
Pumukel has quit [Ping timeout: 265 seconds]
wisn has joined #ruby
loechel has quit [Ping timeout: 265 seconds]
nargin has quit [Quit: Leaving]
Pumukel has joined #ruby
wethu has quit [Quit: This computer has gone to sleep]
ixti has joined #ruby
Pumukel has quit [Ping timeout: 265 seconds]
ur5us has quit [Remote host closed the connection]
Pumukel has joined #ruby
LambdaSix has joined #ruby
alcipir has joined #ruby
sai_ has joined #ruby
Bounga has quit [Ping timeout: 250 seconds]
Immune has quit [Ping timeout: 260 seconds]
DoubleMalt has quit [Ping timeout: 265 seconds]
Pumukel has quit [Ping timeout: 265 seconds]
Pumukel has joined #ruby
akira616 has quit [Quit: Leaving]
ctp has quit [Quit: My Mac has gone to sleep. ZZZzzz…]
Pumukel has quit [Ping timeout: 265 seconds]
jazzonmym11nd has joined #ruby
ctp has joined #ruby
Pumukel has joined #ruby
jazzonmym11nd has quit [Ping timeout: 276 seconds]
ixti has quit [Ping timeout: 260 seconds]
Pumukel has quit [Ping timeout: 265 seconds]
salut has joined #ruby
alcipir is now known as cabs
shortCircuit__ has joined #ruby
<shortCircuit__>
halo
A_Drone has quit [Remote host closed the connection]
Pumukel has joined #ruby
blackmes1 has quit [Ping timeout: 260 seconds]
<salut>
hi
<shortCircuit__>
I have a question. in nodejs to parse a csv .. I usually read the file using stream's and then a csv parser middleware . in ruby is there some way to do this ?
<shortCircuit__>
and is it necessary
yardenbar has joined #ruby
<dminuoso>
So when you say nodejs, why are you asking in #ruby ?
<dminuoso>
Just curiousity..
<shortCircuit__>
no . I am asking if we can do that in ruby :P
<dminuoso>
Ah.
<shortCircuit__>
files maybe 10 12 mb or 2-5 mb .. so I thought it would be useful to use streams ..
<dminuoso>
shortCircuit__: Our CSV library in our library handles files for you already.
spectrum has quit [Quit: Oh Shidd]
<dminuoso>
shortCircuit__: But sure, you can also pass it strings.
wethu has joined #ruby
<shortCircuit__>
I know ruby has csv parser . so does it handle streaming by itself .. also is it necessary to use streaming for large csv files
<dminuoso>
shortCircuit__: You can look how it's implemented yourself.
Pumukel has quit [Ping timeout: 265 seconds]
<xpt>
s/necessary/advisable/
dreamyspell has quit [Client Quit]
tobiasvl has quit [Ping timeout: 250 seconds]
BubonicPestilenc has joined #ruby
<BubonicPestilenc>
hey all
Pumukel has joined #ruby
<BubonicPestilenc>
are there any way to tell active record, that default value for field is ""
<BubonicPestilenc>
don't want ot make fields "null'ed"
<BubonicPestilenc>
(varchar fields)
<dminuoso>
?rails BubonicPestilenc
<ruby[bot]>
BubonicPestilenc: Please join #RubyOnRails for Rails questions. You need to be identified with NickServ, see /msg NickServ HELP
A_Drone has joined #ruby
<BubonicPestilenc>
wrong, i'm using activerecord :D
<BubonicPestilenc>
w/o rails :D
<BubonicPestilenc>
btw, ty
<shortCircuit__>
using a setter getter method ?
astrobunny has joined #ruby
<BubonicPestilenc>
ooh, i've got tons of text- fields :(
gokulnath_ has joined #ruby
maletor1 has joined #ruby
sarkis has quit [Ping timeout: 240 seconds]
conta has joined #ruby
tlaxkit has joined #ruby
Tempesta has joined #ruby
Tempesta has joined #ruby
Tempesta has quit [Changing host]
<shortCircuit__>
use meta programming maybe, get the list of rows and then define method .. I mean normally in migration at database level you should put a default value
<dminuoso>
shortCircuit__: But it seems like the ruby CSV library uses IO streams, basically using IO#gets all over the place.
<salut>
normalize_attribute Gem ?
<dminuoso>
shortCircuit__: So just pass it an IO object, and it will work efficiently.
Pumukel has quit [Ping timeout: 265 seconds]
A_Drone has quit [Remote host closed the connection]
Moosashi has joined #ruby
gokulnath has quit [Ping timeout: 240 seconds]
<BubonicPestilenc>
funny thing
<BubonicPestilenc>
that it feels like sql-mode + strict, but i have disabled it
<shortCircuit__>
dminuoso .. oh nice.. how did you find that ? . I have done some rails and now I hate myself for not doing ruby first
submitnine has quit [Ping timeout: 248 seconds]
Pumukel has joined #ruby
<BubonicPestilenc>
./opt/local/lib/ruby2.3/gems/2.3.0/gems/mysql2-0.4.4/lib/mysql2/client.rb:107:in `_query': Mysql2::Error: Field 'inscription' doesn't have a default value: INSERT INTO `hmdb` (`title`, `created_at`) VALUES ('test', '2016-09-19 10:40:56') (ActiveRecord::StatementInvalid)
Tempesta_ has quit [Ping timeout: 265 seconds]
johnDoe111 has joined #ruby
<dminuoso>
shortCircuit__: I just looked up the implementation of csv.rb, browsed a bit - and then look at what IO#gets does. I noticed it was just calling rb_io_getsline, and I traced that to the implementation in io.c
craigp_ has quit [Ping timeout: 248 seconds]
<dminuoso>
and there I just checked what that function doe.
<dminuoso>
does.
<shortCircuit__>
ao I see
maletor1 has quit [Ping timeout: 264 seconds]
Burgestrand has quit [Quit: My Mac has gone to sleep. ZZZzzz…]
<shortCircuit__>
so basically do an File.read that opens an io . then pass the |file_io| to CSV.new(file_io, ...)
<shortCircuit__>
but yeah foreach sounds easier
<dminuoso>
shortCircuit__: No. Not File.read
<dminuoso>
shortCircuit__: Just File.open
<shortCircuit__>
oh ok
<dminuoso>
shortCircuit__: File.read will actually read the entire content of the File immediately.
submitnine has joined #ruby
Pumukel has quit [Ping timeout: 265 seconds]
Bounga has joined #ruby
jshjsh has joined #ruby
JoshS has quit [Disconnected by services]
jshjsh is now known as JoshS
johnDoe111 has quit [Remote host closed the connection]
a7d7p has joined #ruby
eizua has joined #ruby
blackgoat has joined #ruby
Burgestrand has joined #ruby
axsuul has quit [Read error: Connection reset by peer]
BubonicPestilenc has quit [Quit: BubonicPestilenc]
A_Drone has joined #ruby
johnDoe111 has joined #ruby
rodfersou has joined #ruby
hanmac has quit [Ping timeout: 250 seconds]
johnDoe111 has quit [Remote host closed the connection]
TheHodge has quit [Quit: Connection closed for inactivity]
johnDoe111 has joined #ruby
tlaxkit has quit [Read error: Connection reset by peer]
rodfersou has quit [Ping timeout: 255 seconds]
tlaxkit has joined #ruby
tlaxkit has quit [Remote host closed the connection]
conta has quit [Ping timeout: 248 seconds]
garymeade has joined #ruby
conta has joined #ruby
garymeade has quit [Client Quit]
twe4ked has quit [Ping timeout: 250 seconds]
DoubleMalt has joined #ruby
garymeade has joined #ruby
nankyokusei has joined #ruby
garymeade has quit [Client Quit]
<shortCircuit__>
hi
eregon has quit [Ping timeout: 244 seconds]
twe4ked has joined #ruby
Pumukel has joined #ruby
<wisn>
hello
astrobunny has quit [Remote host closed the connection]
<shortCircuit__>
https://gist.github.com/argentum47/ba89b2a06c35069b9003df0d94e06725 I made this gist .. the thing is, I want to skip the first 13 lines because you can see the csv is sortof fucked by that over part .. The first approach kindof takes 20mb . for a 2mb file where as the foreach takes only 2 mb
<shortCircuit__>
is there a way to use the foreach and yet drop the first 13
eregon has joined #ruby
hanmac has joined #ruby
nankyokusei has quit [Ping timeout: 265 seconds]
GodFather has joined #ruby
aidalgol has quit [Quit: zZzZZzzzz]
LambdaSix has quit [Ping timeout: 240 seconds]
<dminuoso>
shortCircuit__: What do you mean by "the first approach kindof takes 20mb" ?
<matthewd>
shortCircuit__: CSV.foreach('./data/test_data.csv').lazy.drop(13).each do |row|
<matthewd>
The better move would probably be to pass CSV an IO that's already been advanced past the first block though, IMO
gfvcastro has joined #ruby
gingray has quit [Ping timeout: 244 seconds]
jazzonmym11nd has joined #ruby
mistermocha has joined #ruby
arnonhongklay has quit [Remote host closed the connection]
A_Drone has quit [Remote host closed the connection]
johnDoe111^ has joined #ruby
jazzonmym11nd has quit [Ping timeout: 255 seconds]
mistermocha has quit [Ping timeout: 248 seconds]
elenatanasoiu has quit [Quit: WeeChat 1.5]
nuck has quit [Ping timeout: 240 seconds]
elenatanasoiu has joined #ruby
craigp_ has joined #ruby
conta has quit [Read error: Connection reset by peer]
shortCircuit__ has quit [Ping timeout: 240 seconds]
blackmes1 has joined #ruby
nuck has joined #ruby
nuck is now known as Guest92264
eizua has quit [Quit: Leaving]
LambdaSix has joined #ruby
conta has joined #ruby
JeanCarloMachado has joined #ruby
Sashimi has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
griff has quit [Quit: My Mac has gone to sleep. ZZZzzz…]
blackmes1 has quit [Ping timeout: 248 seconds]
griff has joined #ruby
johnDoe111^ has quit [Remote host closed the connection]
johnDoe111 has joined #ruby
johnDoe111 has quit [Remote host closed the connection]
nankyokusei has joined #ruby
johnDoe111 has joined #ruby
johnDoe111 has quit [Remote host closed the connection]
unshadow has quit [Quit: leaving]
johnDoe111 has joined #ruby
gigetoo has quit [Ping timeout: 260 seconds]
spectrum has joined #ruby
gigetoo has joined #ruby
spectrum has quit [Client Quit]
nankyokusei has quit [Client Quit]
maletor1 has joined #ruby
rodfersou has joined #ruby
Pumukel has quit [Remote host closed the connection]
giz|work has quit [Ping timeout: 264 seconds]
maletor1 has quit [Ping timeout: 248 seconds]
Sashimi has joined #ruby
AlexRussia has joined #ruby
jshjsh has joined #ruby
JoshS has quit [Disconnected by services]
jshjsh is now known as JoshS
conta has quit [Read error: Connection reset by peer]
A124 has quit [Ping timeout: 265 seconds]
zipace has joined #ruby
giz|work has joined #ruby
conta has joined #ruby
A_Drone has joined #ruby
A_Drone has quit [Remote host closed the connection]
icey has joined #ruby
Pumukel has joined #ruby
tectonic has joined #ruby
tvl has joined #ruby
JakFrist has joined #ruby
tvl is now known as tobiasvl
Robtop__ has joined #ruby
Pumukel has quit [Ping timeout: 265 seconds]
johnDoe111 has quit [Remote host closed the connection]
Pumukel has joined #ruby
Moosashi has quit [Quit: Moosashi]
nadir has joined #ruby
Moosashi has joined #ruby
pwnd_nsfw` has quit [Ping timeout: 250 seconds]
giz|work has quit [Ping timeout: 255 seconds]
Pumukel has quit [Ping timeout: 265 seconds]
trifling-jest has joined #ruby
Silthias has quit [Ping timeout: 248 seconds]
pawnbox has quit [Remote host closed the connection]
trifling-jest has quit [Client Quit]
shortCircuit__ has joined #ruby
trifling-jest has joined #ruby
<shortCircuit__>
sorry guys got tied up in a standup meetiing
ledestin has joined #ruby
Silthias has joined #ruby
dviola has joined #ruby
<shortCircuit__>
matthewd .. how would one go past the first block?
dviola has quit [Changing host]
dviola has joined #ruby
<matthewd>
shortCircuit__: See the comment I added
<shortCircuit__>
ok
rafadc has quit [Ping timeout: 240 seconds]
<shortCircuit__>
I see
snood1205 has quit [Read error: Connection reset by peer]
Silthias1 has joined #ruby
the_drow has quit [Quit: This computer has gone to sleep]
JakFrist has quit [Quit: My Mac has gone to sleep. ZZZzzz…]
Silthias has quit [Ping timeout: 255 seconds]
snood1205 has joined #ruby
vuoto has joined #ruby
ARCADIVS has quit [Quit: ARCADIVS]
conta has quit [Ping timeout: 260 seconds]
vuoto has quit [Remote host closed the connection]
vuoto has joined #ruby
JeanCarloMachado has quit [Quit: leaving]
JeanCarloMachado has joined #ruby
pwnd_nsfw` has joined #ruby
trifling-jest has quit []
vuoto has quit [Remote host closed the connection]
vuoto has joined #ruby
Robtop__ has quit [Ping timeout: 255 seconds]
JeanCarloMachado has quit [Client Quit]
johnmilton has joined #ruby
<shortCircuit__>
the code is stuck when I ran matthewd
JeanCarloMachado has joined #ruby
giz|work has joined #ruby
johnmilton has quit [Client Quit]
conta has joined #ruby
LoneHerm_ has joined #ruby
cabs has quit [Ping timeout: 272 seconds]
johnmilton has joined #ruby
aryaching has joined #ruby
<matthewd>
shortCircuit__: Sounds like there isn't a "\n" line, then
LoneHerm_ has quit [Ping timeout: 240 seconds]
tectonic has quit []
<matthewd>
shortCircuit__: Add `io.eof? || ` to the until condition, so it stops instead of getting stuck... but then you'll need to work out the right condition to match the real separator line
<shortCircuit__>
ah I see
<shortCircuit__>
ok
blackmes1 has joined #ruby
johnmilton has quit [Ping timeout: 248 seconds]
the_drow has joined #ruby
johnmilton has joined #ruby
<shortCircuit__>
why is it not printing the row .. if I do CSV.foreach().lazy.drop or adding an eof?
conta has quit [Read error: Connection reset by peer]
conta has joined #ruby
alfiemax has quit [Ping timeout: 272 seconds]
sai_ has quit [Remote host closed the connection]
d0nn1e has quit [Ping timeout: 260 seconds]
<matthewd>
With lazy you'd need a .force on the end
arnonhongklay has joined #ruby
<matthewd>
With my version, it's reaching EOF in the first loop, because it never finds a "\n"
<shortCircuit__>
oh had to do .each
d0nn1e has joined #ruby
Pumukel has joined #ruby
<matthewd>
shortCircuit__: Are you using the test file from the gist, or something else?
<matthewd>
shortCircuit__: My version worked for me, on that file
arnonhongklay has quit [Read error: Connection reset by peer]
arnonhongklay has joined #ruby
conta1 has joined #ruby
conta has quit [Read error: Connection reset by peer]
conta1 is now known as conta
aegis3121 has joined #ruby
cdg has joined #ruby
bmurt has joined #ruby
vqrs has quit [Ping timeout: 265 seconds]
chouhoul_ has quit [Remote host closed the connection]
<abhinav>
Johne: thanks.
chouhoulis has joined #ruby
hutch34 has joined #ruby
dionysus69 has joined #ruby
jshjsh has joined #ruby
vqrs has joined #ruby
<Johne>
np, im doing sort of the same thing
<Johne>
httparty is awesome
axsuul has joined #ruby
jazzonmym11nd has joined #ruby
conta1 has joined #ruby
JoshS has quit [Ping timeout: 240 seconds]
conta has quit [Read error: Connection reset by peer]
conta1 is now known as conta
pawnbox has joined #ruby
Pumukel has joined #ruby
lifted has joined #ruby
nankyokusei has joined #ruby
<shortCircuit__>
justin biber is a male thing !!!
Hyuk has joined #ruby
<shortCircuit__>
i mean the name had a male touch to it . I was just listening in youtube and then I switched the tab and I saw the video and a boy singing
<xpt>
/join #ruby-offtopic ?
JakFrist has joined #ruby
Pumukel has quit [Ping timeout: 265 seconds]
Pumukel has joined #ruby
<Johne>
lol
wisn has quit [Quit: Leaving]
nankyokusei has quit [Ping timeout: 265 seconds]
p0p0pr37_ has joined #ruby
aryaching has quit [Read error: Connection reset by peer]
chihhsin has quit [Ping timeout: 265 seconds]
stamina has quit [Quit: WeeChat 1.5]
xdakdr has joined #ruby
aryaching has joined #ruby
arnonhongklay has quit [Remote host closed the connection]
rafadc has joined #ruby
p0p0pr37 has quit [Ping timeout: 265 seconds]
p0p0pr37_ is now known as p0p0pr37
arnonhongklay has joined #ruby
jphase has joined #ruby
Pumukel has quit [Ping timeout: 265 seconds]
Pumukel has joined #ruby
weemsledeux has joined #ruby
aegis3121 has quit [Ping timeout: 248 seconds]
ctp has quit [Read error: No route to host]
mistermocha has joined #ruby
akashdeep_ has quit [Quit: Konversation terminated!]
<shortCircuit__>
when inserting data from csv stream, I would generally run a pgclient.execute "INSERT ..." and then open the connection. so that at first it pools and then when I open the connection then it batches the data
<shortCircuit__>
and then close the connection
ta_ has quit [Remote host closed the connection]
<shortCircuit__>
with events this was easy .. how to design in ruby :P
LoneHermit has quit [Ping timeout: 255 seconds]
ramortegui has joined #ruby
nando293921 has joined #ruby
RedNifre has joined #ruby
vasilakisfil has quit [Read error: Connection reset by peer]
vasilakisfil_ has joined #ruby
malconis has joined #ruby
RedNifre_ has quit [Ping timeout: 255 seconds]
ta_ has joined #ruby
arnonhon_ has joined #ruby
GodFather has quit [Ping timeout: 265 seconds]
ebraga has joined #ruby
arnonhongklay has quit [Read error: Connection reset by peer]
[k- has joined #ruby
blaxter has joined #ruby
pragmaticus has joined #ruby
conta has quit [Ping timeout: 240 seconds]
nankyokusei has joined #ruby
lxsameer has quit [Quit: WeeChat 1.5]
nankyokusei has quit [Remote host closed the connection]
araujo_ has joined #ruby
hotpanca_ has quit [Remote host closed the connection]
hotpancakes has joined #ruby
a7d7p has quit [Quit: a7d7p]
rafadc has quit [Remote host closed the connection]
conta has joined #ruby
pavshn has quit [Quit: My MacBook Air has gone to sleep. ZZZzzz…]
araujo_ has quit [Max SendQ exceeded]
rafadc has joined #ruby
maletor1 has joined #ruby
araujo_ has joined #ruby
ebraga has quit [Ping timeout: 265 seconds]
araujo__ has quit [Ping timeout: 265 seconds]
ebraga has joined #ruby
maletor1 has quit [Ping timeout: 248 seconds]
gokulnath_ has quit [Ping timeout: 276 seconds]
rafadc has quit [Remote host closed the connection]
<stringer>
Hi, how to edit cookie using "open-uri" lib ? I need to access source of site which shows its conetent only when cookie "CookiesAccepted" is set to 1 (default 0)
chihhsin has quit [Ping timeout: 248 seconds]
<stringer>
anybody >
<stringer>
?
tdy has joined #ruby
wombawomba has joined #ruby
Jardayn has joined #ruby
grh has quit [Ping timeout: 265 seconds]
ixti has joined #ruby
karmatr0n has joined #ruby
chihhsin_ has quit [Quit: leaving]
jkeeney has joined #ruby
chihhsin has joined #ruby
jrafanie has joined #ruby
weckl has quit [Ping timeout: 255 seconds]
ebraga has joined #ruby
f4cl3y has quit [Ping timeout: 272 seconds]
Silthias1 has left #ruby [#ruby]
Silthias has joined #ruby
jkeeney has quit [Client Quit]
arnonhongklay has quit [Read error: Connection reset by peer]
<kyle__>
dminuoso: If you already know ruby, it goes pretty quickly. But yeah. My reading list grows much faster than it's consumed :/
<kyle__>
And most of what's on it isn't available in audio-book, so it's not like I can do that while commuting.
antgel has quit [Ping timeout: 240 seconds]
bodgix has left #ruby [#ruby]
jose_leeto has joined #ruby
weemsledeux has joined #ruby
hk238 has joined #ruby
NeverTired has joined #ruby
<snood1205_>
Also, there's a free onion!
panpainter has joined #ruby
<dminuoso>
kyle__: I only read one book on Ruby before, and that was Ruby under a Microscope
craigp has joined #ruby
<kyle__>
I'm trying to remember what the pickaxe book's name was.... I don't think that was it.. But that and Why's are teh only two I've read.
cschneid_ has joined #ruby
weemsledeux has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
jrafanie has joined #ruby
SeepingN has joined #ruby
chouhoul_ has joined #ruby
<toretore>
pickaxe = "Programming Ruby"
johnmccabe has quit [Quit: My Mac has gone to sleep. ZZZzzz…]
domgetter has quit [Ping timeout: 265 seconds]
chouhoulis has quit [Ping timeout: 244 seconds]
blaxter has quit [Quit: foo]
chouhoul_ has quit [Remote host closed the connection]
chouhoulis has joined #ruby
arnonhongklay has quit [Read error: Connection reset by peer]
arnonhongklay has joined #ruby
nitric has joined #ruby
<SeepingN>
o.O
ych has quit [Quit: My Mac has gone to sleep. ZZZzzz…]
mark_661 has quit [Remote host closed the connection]
chouhoulis has quit [Ping timeout: 248 seconds]
RegulationD has quit [Remote host closed the connection]
a7d7p has quit [Quit: a7d7p]
_djbkd has joined #ruby
grh has quit [Ping timeout: 244 seconds]
charliesome has joined #ruby
SteenJobs has joined #ruby
xcesariox has joined #ruby
JeanCarloMachado has quit [Ping timeout: 276 seconds]
ferr has quit [Quit: WeeChat 1.5]
weemsledeux has joined #ruby
<Mrgoose>
LoadError: libc.musl-x86_64.so.1: cannot open shared object file: No such file or directory - /repos/csp/aaa/vendor/ruby/2.2.0/gems/mysql2-0.4.2-x86_64-linux/lib/mysql2/mysql2.so
<boxbeatsy>
hi all, i'm new to ruby and using a class function from a gem. i'd like to monkey patch the class's function to automatically retry if it encounters a specific error. how can i do that?
crdpink has joined #ruby
arnonhongklay has quit [Ping timeout: 260 seconds]
nankyokusei has quit [Ping timeout: 244 seconds]
<apeiros>
boxbeatsy: best is you don't, write your own method instead and use that.
blackmes1 has joined #ruby
<apeiros>
boxbeatsy: but if you insist - you can simply redefine the method.
kaiks has joined #ruby
salut has quit [Quit: salut]
baweaver_away is now known as baweaver
spider-mario has left #ruby ["WeeChat 1.5"]
anisha has quit [Quit: This computer has gone to sleep]
kx has quit [Ping timeout: 265 seconds]
<boxbeatsy>
apeiros: i see. how would i extend the gem's class to add my own method?
salut has joined #ruby
<apeiros>
the same way as if you'd define the method for the first time.
<apeiros>
last definition wins.
Sashimi has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
<boxbeatsy>
apeiros: hmmm, but i don't "own" the class since i'm importing it from a gem
<apeiros>
that doesn't matter
<boxbeatsy>
o interesting, so i can redefine the class and and a new function, and it will just append instead of overwrite?
dminuoso has quit [Ping timeout: 272 seconds]
<apeiros>
>> class Array; def self.new; ["woot"]; end; Array.new
<ruby[bot]>
apeiros: # => /tmp/execpad-ad4260af0e63/source-ad4260af0e63:7: syntax error, unexpected end-of-input, expecting ke ...check link for more (https://eval.in/644791)
jackjackdripper has joined #ruby
grh has joined #ruby
<apeiros>
hm, should probably use some less elementary part as an example :D
blackmes1 has quit [Ping timeout: 272 seconds]
salut has quit [Client Quit]
tdy has joined #ruby
<strongcode>
is it possible to list gemfile dependencies inside my script so i can `bundle` without needing a separate gemfile
blackmes1 has joined #ruby
<strongcode>
gs
stamina has joined #ruby
tomphp has joined #ruby
charliesome has joined #ruby
<boxbeatsy>
nice, that worked. thanks!
<phone>
what is big difference between ruby and python?
<apeiros>
ruby starts with an r, python with a p.
conta has quit [Ping timeout: 265 seconds]
<phone>
:0
nando293921 has joined #ruby
redpants has joined #ruby
nofxx has joined #ruby
<havenwood>
phone: In Ruby there is more than one way to do it and in Python there is one--and preferably only on--obvious way to do it.
<havenwood>
one*
Sashimi has joined #ruby
[k- has quit [Ping timeout: 276 seconds]
ramfjord has joined #ruby
AnarchyAo has joined #ruby
phone_ has joined #ruby
<SeepingN>
irb
<phone_>
I feel it. I agree.
auxbuss has joined #ruby
<Johne>
lol
phone has quit [Ping timeout: 244 seconds]
tdy has quit [Ping timeout: 255 seconds]
claudiuinberlin has joined #ruby
<phone_>
but not necessary.
griff has quit [Quit: My Mac has gone to sleep. ZZZzzz…]
[k- has joined #ruby
auxbuss has quit [Client Quit]
CherryLady has quit []
<phone_>
so so top level method is automatically set as private right?
nando293921 has quit [Ping timeout: 264 seconds]
nando293921 has joined #ruby
bocaneri has quit [Remote host closed the connection]
LemonJuice has joined #ruby
phone has joined #ruby
symm- has joined #ruby
firstdayonthejob has quit [Quit: WeeChat 1.5]
charliesome has quit [Quit: My MacBook Pro has gone to sleep. ZZZzzz…]
phone_ has quit [Ping timeout: 265 seconds]
johnmccabe has quit [Quit: My Mac has gone to sleep. ZZZzzz…]
Uranio has quit [Remote host closed the connection]
airstream66 has joined #ruby
<boxbeatsy>
hi all, i have a module (from a gem) with many classes and class methods. is there a way to wrap every class method in this module with another function?
nitric_ has joined #ruby
<boxbeatsy>
that is, i'd like to catch an error whenever a method of this module's classes is called, and do some specific logging
conta has quit [Ping timeout: 265 seconds]
<nofxx>
boxbeatsy, make you own class that uses that one, rescue from it's errors and voilà
helpa has quit [Remote host closed the connection]
helpa has joined #ruby
nitric has quit [Ping timeout: 240 seconds]
<baweaver>
Look at what I put above Johne
<baweaver>
read it carefully
_sfiguser has quit [Ping timeout: 276 seconds]
ramfjord has joined #ruby
<boxbeatsy>
nofxx: ok, but how would i wrap all of a class's methods in a try/rescue?
rafadc has quit [Ping timeout: 244 seconds]
<baweaver>
chances are you don't need to wrap everything
<baweaver>
Look into Delegators
airstream66 has quit [Remote host closed the connection]
<dminuoso>
boxbeatsy: You can also implement this easily with method_missing, im not entirely sure whether Ruby delegators allow you to hook in between methods like that.
_sfiguser has joined #ruby
<baweaver>
boxbeatsy ^
<baweaver>
Forwardable and SimpleDelegator allow you most anything you'd need
<dminuoso>
baweaver: ah Forwardable, TIL
<nofxx>
boxbeatsy, or maybe, pass the method as param... def your_wrapper(meth); ThatLib.send(meth); all your rescues....
<baweaver>
(which is exactly what delegators can do)
<nofxx>
baweaver, yup.. but how do you custom rescue em?
<baweaver>
You delegate methods to another object but in override cases you call super
<nofxx>
not rethorical, I don't know heh
<nofxx>
ah, I see, thanks
<boxbeatsy>
got it, thanks guys!
<baweaver>
Point of a delegator is in 99% of the cases you don't care
<baweaver>
but in that 1% you want to override it you can.
pwnd_nsfw` has quit [Read error: Connection reset by peer]
pwnd_nsfw has joined #ruby
TinkerTyper has joined #ruby
gp has joined #ruby
Node_036 has quit [Quit: Page closed]
lifeai has joined #ruby
blackmes1 has quit [Ping timeout: 255 seconds]
hazelux has quit []
skweek has quit [Ping timeout: 255 seconds]
tomphp has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
hutch34 has quit [Quit: WeeChat 1.5]
jenrzzz has joined #ruby
the_drow has quit [Quit: This computer has gone to sleep]
candelabra has joined #ruby
johnmilton has joined #ruby
<candelabra>
can I do [1..24].each{|hour| puts hour.to_s}
yardenbar has quit [Ping timeout: 240 seconds]
jrafanie has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
weemsledeux has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
<etetz>
you can but im not sure thatll give you what you are looking for
jrafanie has joined #ruby
<dminuoso>
candelabra: you can do (1..24).each :-)
<candelabra>
ahhh thats it
<dminuoso>
candelabra: and also:
<dminuoso>
?tias
<ruby[bot]>
dminuoso: I don't know anything about tias
* dminuoso
hits apeiros
* apeiros
blinks
mistermocha has joined #ruby
<candelabra>
?(1..24).each{|h| p h}
<dminuoso>
Do we have some tias factoid?
<dminuoso>
candelabra: try it in your ruby interpreter and see what happens
<candelabra>
liek that?
dionysus69 has quit [Quit: dionysus69]
<dminuoso>
I dont know. You tell me.
<candelabra>
sorry I thought the ruby bot was going to do something
LoneHermit has joined #ruby
weckl has quit [Remote host closed the connection]
dionysus69 has joined #ruby
<Johne>
lol
<Johne>
ty baweaver
<Johne>
im blind as a bat
<apeiros>
?try dminuoso
<ruby[bot]>
dminuoso: Why don't you try it and see for yourself?
<apeiros>
!fact alias tias try
<ruby[bot]>
apeiros: I already know that try is Why don't you try it and see for yourself?
<Johne>
ive got bad eyes as is, then had a stroke at age 30 to leave me half blind the left hemisphere of both eyes.
<apeiros>
!fact alias try tias
<ruby[bot]>
apeiros: I will remember that try is also called tias.
<dminuoso>
apeiros: Thanks.
mistermocha has quit [Ping timeout: 260 seconds]
<dminuoso>
candelabra: it can be used to that extend, but it's not to be used for experimentation in this channel.
LoneHermit has quit [Ping timeout: 248 seconds]
Sashimi has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
lifeai has quit [Ping timeout: 248 seconds]
mrBen2k2k2k_____ has joined #ruby
tomphp has joined #ruby
a7d7p has joined #ruby
jshjsh has joined #ruby
pawnbox has quit [Ping timeout: 255 seconds]
ur5us has joined #ruby
JoshS has quit [Ping timeout: 240 seconds]
dionysus69 has quit [Remote host closed the connection]
tomphp has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
nofxx has quit [Ping timeout: 265 seconds]
nankyokusei has joined #ruby
tomphp has joined #ruby
pawnbox has joined #ruby
rippa has quit [Ping timeout: 264 seconds]
AndrewIs_ has joined #ruby
AndrewI__ has joined #ruby
nankyokusei has quit [Ping timeout: 250 seconds]
Andre____ has joined #ruby
mrBen2k2k2k_____ has quit [Max SendQ exceeded]
JakFrist has joined #ruby
symm- has quit [Ping timeout: 265 seconds]
<wrkrcoop>
ive always wondered how you could implement a newsfeed feature … and this morning i woke up thinking “you can use a graph db” … does that sound like the most efficient way to create a newsfeed feature for a social network?
fmcgeough has quit [Quit: fmcgeough]
AndrewIsHere has quit [Ping timeout: 272 seconds]
JeanCarloMachado has joined #ruby
AndrewIs_ has quit [Ping timeout: 248 seconds]
cdg has joined #ruby
maloik34 has quit [Remote host closed the connection]
AndrewI__ has quit [Ping timeout: 248 seconds]
maloik has joined #ruby
AndrewIsHere has joined #ruby
<xemehc>
wrkrcoop: If I recall correctly that's what FB does
sai_ has quit [Read error: Connection reset by peer]
Mr_Pancake has joined #ruby
Sashimi has joined #ruby
Affix has joined #ruby
<wrkrcoop>
so does programming just get easier as you gain more experience? or is it always hard. im coming up on 2 years (6 months of paid programming) and it seems to be getting easier … but im wondering if with progress comes more responsibilities and if thats something i want
sai_ has joined #ruby
sai_ has quit [Read error: Connection reset by peer]
ohcibi has joined #ruby
Affix is now known as Guest40356
sai_ has joined #ruby
<eam>
yes it gets very easy
dminuoso has joined #ruby
<eam>
but then they'll ask you to manage other programmers
<wrkrcoop>
and is that not easy?
<eam>
same kind of learning curve
<wrkrcoop>
interesting
codepete has joined #ruby
ghostlight has quit [Ping timeout: 244 seconds]
<wrkrcoop>
the leads on my team seem to be working constantly and im @ my desk chilling because i finished my story for the sprint
arnonhongklay has quit [Read error: Connection reset by peer]
<eam>
right about when you find managing people is easy you'll realize you've been paid so much and are in so much demand that you don't need to work anymore
chelly has joined #ruby
Rickmasta has joined #ruby
<eam>
and then you'll ascend to a higher plane
arnonhongklay has joined #ruby
Gasher has quit [Quit: Leaving]
mitsuhiko has joined #ruby
<baweaver>
called retirement
manveru has joined #ruby
zack6849 has joined #ruby
zack6849 has quit [Changing host]
zack6849 has joined #ruby
gingray has quit [Ping timeout: 272 seconds]
nankyokusei has quit [Ping timeout: 240 seconds]
<wrkrcoop>
:D
ewilliam has joined #ruby
RedNifre has joined #ruby
<eam>
wrkrcoop: btw, you should pull in more tasks to your sprint if you're done early :)
jeff0x68 has joined #ruby
<baweaver>
shhhhh eam
dminuoso has quit [Ping timeout: 265 seconds]
<eam>
maybe add a feature so your product can send emails
blackwind_123 has quit [Ping timeout: 264 seconds]
arnonhongklay has quit [Ping timeout: 264 seconds]
<jrozner>
I want the code inside the block to update the value in resp that's passed to instrument
<eam>
oh
<eam>
jrozner: I see what you're doing
<jrozner>
execution will pass to instrument and when it yields inside it I want it to update that value
<eam>
you're defining resp as a method parameter
<jrozner>
is that possible?
<eam>
('prevoty:content', payload: resp)
<jrozner>
the api is designed for timing operations and passing information about the data the operation is using, not passing the result
cyphase has quit [Ping timeout: 264 seconds]
<jrozner>
eam: is resp in the method call shadowing the value defined above?
blackwind_123 has joined #ruby
[Butch] has quit [Quit: I'm out . . .]
ap4y has joined #ruby
<jrozner>
eam: basically I just want the second parameter to be the return value of the block
Puffball has quit [Remote host closed the connection]
<jrozner>
but I need the operation itself to occur in the block rather than call the method in the second parameter place so the timing information is present
Zamyatin has quit [Ping timeout: 248 seconds]
Puffball has joined #ruby
cyphase has joined #ruby
heyimwill has joined #ruby
newbie1 has quit [Ping timeout: 255 seconds]
AndrewIsHere has joined #ruby
xemehc has quit [Quit: ZZZzzz…]
Moosashi has quit [Quit: Moosashi]
arnonhon_ has quit [Read error: Connection reset by peer]
jeff0x68 has left #ruby [#ruby]
arnonhongklay has joined #ruby
sai_ has quit [Read error: Connection reset by peer]
newbie1 has joined #ruby
sai_ has joined #ruby
Puffball has quit [Ping timeout: 248 seconds]
Rickmasta has joined #ruby
malconis has quit [Quit: My MacBook Pro has gone to sleep. ZZZzzz…]
aries_liuxueyang has quit [Ping timeout: 240 seconds]
polishdub has quit [Quit: Leaving]
ruby_ has joined #ruby
Moosashi has joined #ruby
flying has joined #ruby
aegis3121 has quit [Ping timeout: 265 seconds]
sai_ has quit [Remote host closed the connection]
charliesome has joined #ruby
charliesome has quit [Client Quit]
krasnus has joined #ruby
sai_ has joined #ruby
ap4y has quit [Remote host closed the connection]
ap4y has joined #ruby
elenatanasoiu has quit [Ping timeout: 255 seconds]
<jrozner>
is there a way in ruby to get the nanoseconds since epoch from a Time object in ruby?
znz_jp has quit [Remote host closed the connection]
gfvcastro has quit [Read error: Connection reset by peer]
ruby_ has joined #ruby
<jrozner>
baweaver: Time.now.nanoseconds isn't epoch time with nanosecond resolution
Moosashi has quit [Quit: Moosashi]
<jrozner>
errr Time.now.nsec
d0nn1e has quit [Ping timeout: 250 seconds]
rafadc has quit [Ping timeout: 265 seconds]
<baweaver>
"The lowest digits of to_f and nsec are different because IEEE 754 double is not accurate enough to represent the exact number of nanoseconds since the Epoch."
[k- has quit [Ping timeout: 265 seconds]
<jrozner>
baweaver: I've read that. It doens't tell me if I can get a milisecond or nanosecond representation though
bjh13 has quit [Remote host closed the connection]
* baweaver
is confused
ta_ has quit [Read error: Connection reset by peer]
<baweaver>
it says on the doc that it's returning nanoseconds since epoch
ta_ has joined #ruby
<baweaver>
ah
<jrozner>
Time.now.nsec doesn't return a constantly incrementing number
<baweaver>
why do you need nanoseconds?
<jrozner>
milliseconds is probably fine
<jrozner>
just looking for something close to that resolution. Second is definitely not high enough
<baweaver>
in any case, beyond my knowledge of Time.
nitric has joined #ruby
<baweaver>
Time#to_f would probably be the best shot though doubles are finnicky enough I couldn't tell you if you could rely on them for anything.
<jrozner>
I'm looking specifically for timing information so it needs to be fairly accurate
<jrozner>
anything better than second is reasonable
nitric_ has quit [Ping timeout: 240 seconds]
firstdayonthejob has quit [Ping timeout: 250 seconds]
moshee has quit [Ping timeout: 265 seconds]
moshee has joined #ruby
moshee has quit [Changing host]
moshee has joined #ruby
LemonJuice has quit [Quit: Leaving]
GodFather has quit [Remote host closed the connection]
Bellthoven has joined #ruby
Bellthoven has quit [Client Quit]
RegulationD has quit [Remote host closed the connection]
Moosashi has joined #ruby
<havenwood>
jrozner: to_r
fullofcaffeine has quit [Remote host closed the connection]
Bellthoven has joined #ruby
arnonhongklay has quit [Read error: Connection reset by peer]
arnonhongklay has joined #ruby
fullofcaffeine has joined #ruby
ekem is now known as rashiekmemakeman
znz_jp has joined #ruby
<havenwood>
jrozner: "This methods is intended to be used to get an accurate value representing the nanoseconds since the Epoch."
dminuoso has joined #ruby
elenatanasoiu has joined #ruby
Moosashi has quit [Client Quit]
whathappens has quit [Quit: Leaving...]
charliesome has joined #ruby
arnonhongklay has quit [Read error: Connection reset by peer]
Paradox has quit [Ping timeout: 276 seconds]
fullofcaffeine has quit [Ping timeout: 272 seconds]
rashiekmemakeman is now known as licken
fullofcaffeine has joined #ruby
licken is now known as lichen
chelly has quit [Quit: Connection closed for inactivity]
astrobunny has joined #ruby
weemsledeux has joined #ruby
mikeiniowa has joined #ruby
lichen is now known as ekem
arnonhongklay has joined #ruby
dminuoso has quit [Ping timeout: 240 seconds]
elenatanasoiu has quit [Ping timeout: 265 seconds]
Paradox has joined #ruby
cschneid_ has quit [Remote host closed the connection]
sai_ has quit [Read error: Connection reset by peer]
Moosashi has joined #ruby
fullofcaffeine has quit [Remote host closed the connection]
mim1k has quit [Read error: Connection reset by peer]
Rickmasta has quit [Quit: My MacBook Pro has gone to sleep. ZZZzzz…]
sai_ has joined #ruby
mim1k has joined #ruby
fullofcaffeine has joined #ruby
jrozner has quit [Ping timeout: 276 seconds]
tectonic has joined #ruby
arnonhongklay has quit [Read error: Connection reset by peer]
madgen has joined #ruby
arnonhongklay has joined #ruby
Moosashi has quit [Client Quit]
sai_ has quit [Read error: Connection reset by peer]
sai_ has joined #ruby
ramfjord has quit [Ping timeout: 244 seconds]
<al2o3-cr>
wrkrcoop: if you've been getting paid, get me a job
ramfjord has joined #ruby
johnmccabe has joined #ruby
pwnd_nsfw` has quit [Read error: Connection reset by peer]
<wrkrcoop>
al2o3-cr: why?
<al2o3-cr>
for fucks sake
agent_white has quit [Quit: backlater]
<wrkrcoop>
?
ap4y has quit [Remote host closed the connection]
UserOO7 has joined #ruby
<al2o3-cr>
wino
twistedpixels has quit [Ping timeout: 276 seconds]
<baweaver>
al2o3-cr: be nice
<wrkrcoop>
why was the interview question
pwnd_nsfw has joined #ruby
ap4y has joined #ruby
<wrkrcoop>
are you saying i suck? i wrote a split method today ;)
replay has quit [Ping timeout: 240 seconds]
twistedpixels has joined #ruby
twistedpixels has joined #ruby
twistedpixels has quit [Changing host]
<baweaver>
?offtopic
<ruby[bot]>
this seems to be off-topic. Please move your discussion to #ruby-offtopic, to keep this channel free for Ruby related problems. Thanks!
wethu has joined #ruby
<al2o3-cr>
wrkrcoop: you don't suck, i do!
jenrzzz has quit [Ping timeout: 250 seconds]
coolboy has quit [Ping timeout: 250 seconds]
wrkrcoop has left #ruby [#ruby]
therealtesseract has joined #ruby
jrozner has joined #ruby
therealtesseract is now known as tesseract
tesseract is now known as therealtesseract
herbmillerjr has quit [Quit: Konversation terminated!]
marr has quit [Ping timeout: 255 seconds]
duderonomy has joined #ruby
flying has quit []
jenrzzz has joined #ruby
blackmes1 has quit [Ping timeout: 260 seconds]
Moosashi has joined #ruby
therealtesseract has quit [Remote host closed the connection]
SteenJobs has joined #ruby
charliesome has quit [Quit: My MacBook Pro has gone to sleep. ZZZzzz…]
<eam>
jrozner: you can get #nsec out of a ruby Time object
<eam>
and yeah, don't use #to_f because base ten fractions aren't going to give you the same thing
<eam>
er, base two
elenatanasoiu has joined #ruby
<havenwood>
to_f docs: "Note that IEEE 754 double is not accurate enough to represent the number of nanoseconds since the Epoch."
<eam>
that's kinda half why
<al2o3-cr>
use rational then
<eam>
it's more like they're representing ns in a float as a fraction
<eam>
and simply by using a fractional representation you change the meaning -- because X/base isn't the same thing as an integer sequence
<eam>
the whole 0.1 in a float can't be accurately represented issue
JeanCarloMachado has joined #ruby
replay has joined #ruby
Moosashi has quit [Quit: Moosashi]
ratatine has joined #ruby
<eam>
consider: with time you might want to count each discrete nanosecond between two seconds, to step through all billion of them
jenrzzz has quit [Ping timeout: 265 seconds]
<eam>
forget about how many since epoch - just think about the billion ns in one second
hornairs has joined #ruby
* ratatine
joins the channel and has his head explode.
<ratatine>
Thanks eam.
<eam>
if you have a tuple of [sec, nsec] then you can do this
elenatanasoiu has quit [Ping timeout: 276 seconds]
<eam>
but if you have an IEEE floating point representation then you can't, because some of the discrete values can't be represented as a fractional base
<eam>
which is why the underlying system apis like gettimeofday() or clock_getime() always use an integer for the seconds component and a second integer for the ns or us component
sai_ has quit [Remote host closed the connection]
<eam>
ratatine: happy to be of service
bmurt has joined #ruby
<eam>
but anyway yeah a double can't even handle accurate ns timekeeping within a single second window
LoneHerm_ has joined #ruby
_sfiguser has quit [Ping timeout: 265 seconds]
AzureStigma has quit [Quit: My Mac has gone to sleep. ZZZzzz…]
BackEndCoder has quit [Excess Flood]
BackEndCoder has joined #ruby
mistermocha has joined #ruby
saneax-_-|AFK is now known as saneax
jenrzzz has joined #ruby
jenrzzz has joined #ruby
jenrzzz has quit [Changing host]
etetz has quit [Remote host closed the connection]
cdg has quit [Remote host closed the connection]
etetz has joined #ruby
jazzonmym111nd has joined #ruby
ledestin has quit [Ping timeout: 276 seconds]
<al2o3-cr>
0.33333 is near enough to 10/3... trust mine to stop for a shit....
jazzonmym11nd has quit [Read error: Connection reset by peer]
Rickmasta has joined #ruby
herbmillerjr has joined #ruby
<al2o3-cr>
fixed.com
Paradox has quit [Ping timeout: 244 seconds]
hfp_work has quit [Ping timeout: 244 seconds]
<al2o3-cr>
bhr is not legit
weemsledeux has quit [Ping timeout: 244 seconds]
shtirlic has quit [Ping timeout: 244 seconds]
mistermocha has quit [Ping timeout: 260 seconds]
Paradox has joined #ruby
jaequery has joined #ruby
eregon has quit [Quit: No Ping reply in 180 seconds.]
arnonhongklay has quit [Ping timeout: 265 seconds]
elenatanasoiu has quit [Ping timeout: 250 seconds]
<havenwood>
jaequery: Storing the job in Redis with disk-backing means you can turn it off and back on again and have jobs mostly still be queued.
<jaequery>
why is there no ruby libs that deals async in a fashion where the code to be ran asynchronously can be passed in as a block ?
RegulationD has joined #ruby
<jazzonmym111nd>
there is plenty of those but they don't all fit into the web paradigm
<havenwood>
jaequery: There are many!
AzureStigma has joined #ruby
<jaequery>
im turned off by Object.perform_async("some_method_to_run")
nebg has quit [Ping timeout: 265 seconds]
<jaequery>
oh, then pls tell me more!
nankyokusei has joined #ruby
ghostlight has joined #ruby
blackgoat has quit [Ping timeout: 244 seconds]
eregon has quit [Quit: No Ping reply in 180 seconds.]
<Papierkorb>
jaequery: Thread.new?
<jazzonmym111nd>
if you just do get "/foo" { Thread.new {} } then as soon as the request finishes the thread will likely die too, even if it is doing something, you'd have to call Thread#join at which point you're no longer asynchronous.
<Papierkorb>
?try
<ruby[bot]>
Why don't you try it and see for yourself?
yeticry has quit [Ping timeout: 244 seconds]
<jaequery>
ohh
blackgoat has joined #ruby
<Papierkorb>
Why should it just die?
yeticry has joined #ruby
<Papierkorb>
Another option would be #fork
<jaequery>
wow that is kind of sad
<jazzonmym111nd>
it depends on the web server you're using.
jphase has quit [Ping timeout: 250 seconds]
eregon has joined #ruby
<havenwood>
jaequery: Give the concurrent-ruby gem a good look if you're wondering generally. Then take a look at Sidekiq, Resque, DelayedJob, Sucker Punch and other worker queues and consider why you might want to use something like that that instead.
<jaequery>
im used to node.js style i guess
AzureStigma has quit [Client Quit]
nebg has joined #ruby
zz_barkerd427 has quit [Ping timeout: 250 seconds]
r4z3r has quit [Ping timeout: 250 seconds]
<Papierkorb>
jaequery: Ah for web dev stuff. Yeah, use an external worker process
<havenwood>
jaequery: Node doesn't have threading or forking so it can't really use such a strategy. You're free to used evented io in Ruby as well.
<jaequery>
was wondering if ruby had something similar, i mean i do prefer ruby's synchronous by default
<jaequery>
but sometimes i do miss node.js async nature
<jaequery>
i want something as elegant as, async do { ..... chunk of code .... }
dminuoso has joined #ruby
<havenwood>
jaequery: It seems you haven't looked at the popular Ruby concurrency libraries like concurrent-ruby and celluloid.
<jaequery>
im surprised im having such a hard time finding something like that
<jazzonmym111nd>
sidekiq is built on celluloid.
<Papierkorb>
Not anymore jazzonmym111nd
<havenwood>
jazzonmym111nd: it used to be
r4z3r has joined #ruby
<jazzonmym111nd>
oh wow. why did that change?
<havenwood>
Sucker Punch used to be as well.
jphase has joined #ruby
LuckyABA has quit [Quit: My MacBook Pro has gone to sleep. ZZZzzz…]
zz_barkerd427 has joined #ruby
<Papierkorb>
jazzonmym111nd: He wrote a blog post about it. TL;DR: No problem if you only did I/O anyway, horrible change if you did not :)