<matthewd>
It does seem like there's a "Vagrant API" effect going on there, though
GodFather has quit [Ping timeout: 240 seconds]
mim1k has quit [Ping timeout: 244 seconds]
<soLucien>
wrote thousands and thousands of lines of code, clean separation of concerns
<matthewd>
Syntactic details aside, I'm not sure how this would be a measurably different shape in Python, say
<soLucien>
however, this is what i ended up with
<soLucien>
when i did a (pretty easy thing) in Ruby ..
<matthewd>
"Manipulate a big mess of hashes" is rarely pretty, in any language, IME
<soLucien>
that is what Vagrant is about
<soLucien>
env is a huge hash
<soLucien>
then you move around it and change shit in different states
<matthewd>
I think it would be fair to say that Vagrant is... not representative of ruby in general
<matthewd>
(see also: Puppet)
<soLucien>
i use Puppet as well
<soLucien>
these are actually the only 2 things i use from Ruby
<baweaver>
see also: Chef Mash
<soLucien>
and i hate them.
<soLucien>
Well i hate Vagrant a LOT more than i do for Puppet
<soLucien>
at least Puppet has docs, and you get to understand where it's coming from after some frustrations
<matthewd>
soLucien: The general theme is that they were developed by people who are not primarily ruby developers
<soLucien>
but Vagrant .. pure pain
mim1k has joined #ruby
<matthewd>
Either new-to-ruby, or more sysadminy focus on the maintainability of the system over the piece of software, or both
<matthewd>
(is my personal impression)
<soLucien>
idk, evrything i did seems totally unmaintainable
<matthewd>
.. which is not necessarily Bad, but influences which things are priorities
b3atr has left #ruby ["WeeChat 1.5"]
jeanlinux has joined #ruby
Elvin has joined #ruby
<soLucien>
"write tests to make it maintainable " .. Great advice but totally useless
<soLucien>
with Vagrant and Puppet
<soLucien>
the whole point of the thing i'm writing is bridging 2-3-4-5 different technologies. All tests i would have to write would be integration tests
<soLucien>
and at that point my tests are the code i'm writing
<baweaver>
>> a = nil; a ||= 5; a # soLucien, noticed you did a lot of `a = val if a.nil?`
<soLucien>
also i have this huge complaint about ruby .. no difference between functions and variables
<jazzonmym111nd>
linebreaks don't make code any better or worse, small methods that don't require linebreaks is better code imo
<baweaver>
incremental steps
RegulationD has quit [Ping timeout: 265 seconds]
hays_ has joined #ruby
<baweaver>
in general though, yes
leea has quit [Quit: My Mac has gone to sleep. ZZZzzz…]
jackjackdripper has quit [Quit: Leaving.]
<soLucien>
i have to constantly ctrl-f fore words to see what they are in the context
<soLucien>
are they vars? functions ? i can never know unless i go to the implementation
<soLucien>
at which point i've read the same code for the 5th time
<soLucien>
and i get tired
youch has joined #ruby
<soLucien>
it's so useful to have the do_something (with_parameter)
hays has quit [Ping timeout: 244 seconds]
<soLucien>
instead of do_something with_parameter, and_somethingelse , etc
<soLucien>
makes stuff extremely tiresome for me
<baweaver>
A lot of your issue in this code is that you've coupled everything together in such a way that it's hard to break it apart.
nankyokusei has quit [Ping timeout: 244 seconds]
<baweaver>
Almost all the collections rely on manipulations happening in order.
<jgnagy>
so as much as I enjoy criticism on things I like, what kind of help are you actually asking for?
Limix has quit [Ping timeout: 252 seconds]
<soLucien>
no help, it's 4 am and i'm ranting.
<soLucien>
any help is appreciated
<soLucien>
as to what i am doing wrong
<soLucien>
but other than that, i was just highlighting how bad i am with Ruby in comparison to other stuff i do
<jgnagy>
it seems obvious we aren't going to convince you to like ruby (and that's ok), but ranting on the ruby channel about ruby is not the friendliest way to ask for things ;-)
<jgnagy>
yeah, everything has a learning curve
jgt3 has joined #ruby
<jgnagy>
I've found that ruby is great for teaching OOP
<jgnagy>
but yes, most of what's been said here is spot on... Vagrant and what you're doing probably wouldn't be fun in most any language
hays_ has quit [Remote host closed the connection]
<baweaver>
Not sure if it'll work, but close enough to debug later.
jgt3 has quit [Ping timeout: 260 seconds]
<jgnagy>
exactly the direction I was going to suggest, baweaver
<baweaver>
I would suggest heavily that you read through books on OO like Practical Object Oriented Development in Ruby by Metz
<baweaver>
Most of your issue is not the language, but knowing the responsibilities a single object or method should have.
<jgnagy>
you say there isn't a difference between functions and methods in ruby, but I'm not sure how that stops you from using smaller methods to break apart those huge ones
<baweaver>
most of it is finding out what to name them honestly.
<jgnagy>
+1
<baweaver>
then not getting _too_ crazy on it
heelpmeplz has quit [Ping timeout: 250 seconds]
<soLucien>
yes that is what i was saying earlier
<soLucien>
i didn;t know how to name them
<soLucien>
:D
heelpmeplz has joined #ruby
ponga has joined #ruby
pokalyis has quit [Read error: Connection reset by peer]
<baweaver>
I've been inclined to slap people before that have compulsive urges to have everything in small methods without first thinking if it's the right abstraction
<baweaver>
makes it way harder to deal with later
<baweaver>
probably one of those premature optimization issues.
pokalyis has joined #ruby
<soLucien>
well this is really cool , thanks a lot for the effort, bamweaver
<jgnagy>
true, but that clearly screamed out for it
Limix has joined #ruby
<baweaver>
anyways, white nerd needs food badly, out I go.
<soLucien>
enjoy
<baweaver>
yeah, but there are some that take those to extremes jgnagy :P
<soLucien>
saved me 3 hours of beating my head against the wall
<baweaver>
soLucien: just make sure to test that, as I'm coding blind there.
<soLucien>
it's a matter of preference .. if i look up Java code i didi 3 years ago, i'm able to easily get back into it
<soLucien>
sure, i will test it , but it is a great suggestion
<baweaver>
If I look at Java code I did 3 years ago I have an urge to build a time machine to slap myself
<soLucien>
as to what the structure/shape should be
<soLucien>
of course
<soLucien>
but i can refactor it in notime
<baweaver>
noted that I tend to do some things that some rubyists don't like
<soLucien>
but it takes me 3 hours to refactor this .. that was my point ..
<baweaver>
like: collection.find { |x| x.conditions } or raise 'error'
<baweaver>
I'll sometimes use english operators for flow control.
<jgnagy>
it does make the code easier to read
<jgnagy>
aloud even
<jgnagy>
:)
KINGSABRI___ has quit [Ping timeout: 276 seconds]
<Nilium>
Didn't the 'and' / 'or' keywords have different precedence from && and ||?
<Nilium>
Maybe thinking of a different language
KINGSABRI_ has joined #ruby
hays has joined #ruby
<matthewd>
Nilium: Yes, they do
<jgnagy>
they do, but those so rarely bite you in practice that the occasional "and" instead of "&&" won't matter
<matthewd>
(because they're for flow control)
c355e3b has quit [Quit: Connection closed for inactivity]
<Nilium>
I figure if all you've got is the operator between two exprs then it doesn't really matter and it's obvious what's going on. Just couldn't remember if it was Ruby or something else.
<Zarthus>
this will be automatically generated code, so the ideal scenario covers possible edge cases and backwards compatibility issues
<Zarthus>
it's just an example shown to the user on how they *could* use their inserted text
flashpoint9 has joined #ruby
Pumukel has joined #ruby
<ninjaaron>
probably a stupid question, but does ruby compile regex literals before runtime?
<apeiros>
given that there's an //o flag, I'd assume so. never checked, though.
ych has quit [Quit: My Mac has gone to sleep. ZZZzzz…]
Pumukel has quit [Ping timeout: 260 seconds]
TheWhip has quit [Remote host closed the connection]
<ninjaaron>
apeiros: and, like, why wouldn't it?
<apeiros>
Don't know. Additional work required?
<ninjaaron>
This is one of the things in python that always makes me look at other scripting languages: no builtin regex type means you have to compile every regex you want to use in a loop (or, alternatively, have a slow program).
<ninjaaron>
*manually compile
<apeiros>
IME regex are relatively fast in ruby.
<apeiros>
but that may just be due to ruby itself being relatively slow in general ;-)
<ninjaaron>
I think most dynamic languages are all using the same pcre libray under the covers.
<minimalism>
Has anyone here run a ruby app using hiredis gem on a FreeBSD machine? It has that error building mentioning extconf.rb and was wondering if anyone had a recommended workaround.
<apeiros>
ninjaaron: you're mistaken :)
<ninjaaron>
:(
claudiuinberlin has quit [Remote host closed the connection]
<apeiros>
old ruby used a patched/souped up version of emacs regex lib iirc, as of 1.9, it used oniguruma, and I think as of 2.0 it uses a fork of oniguruma (forgot the name of the fork, something like onigo)
<apeiros>
given that onigiruma was specifically developed for ruby, I doubt that too many other languages use it
jaruga___ has joined #ruby
frozengeek has quit [Quit: frozengeek]
<heftig>
python regex aren't pcre, either
sdothum has joined #ruby
sdothum has quit [Client Quit]
TheWhip has joined #ruby
tyang has joined #ruby
johnmilton has joined #ruby
jaruga___ has quit [Remote host closed the connection]
jaruga___ has joined #ruby
lxsameer__ has quit [Quit: WeeChat 1.5]
IanMalcolm has joined #ruby
sdothum has joined #ruby
tyang has quit [Client Quit]
rileyy has quit [Ping timeout: 244 seconds]
PalaHO has quit [Ping timeout: 258 seconds]
Pumukel has joined #ruby
Rodya_ has joined #ruby
ta_ has joined #ruby
johnmilton has quit [Ping timeout: 250 seconds]
johnmilton has joined #ruby
Pumukel has quit [Ping timeout: 264 seconds]
<manveru>
the only other thing that uses oniguruma that i know of is textmate
Tusskan has joined #ruby
ta_ has quit [Ping timeout: 258 seconds]
vdamewood has joined #ruby
jobat has joined #ruby
stamina has quit [Quit: WeeChat 1.5]
Rodya_ has quit [Ping timeout: 250 seconds]
jeanlinux has joined #ruby
nankyokusei has joined #ruby
the_rhizo3 has joined #ruby
tectonic has quit []
Pumukel has joined #ruby
LoneHermit has joined #ruby
beilabs_ has quit [Remote host closed the connection]
nankyokusei has quit [Ping timeout: 265 seconds]
statelesscode_ has joined #ruby
<plantfood>
is ruby more popular in japan, than python ?
statelesscode has quit [Ping timeout: 276 seconds]
phredus has quit [Read error: Connection reset by peer]
<dminuoso>
Bish: Is your code IO bound or CPU bound?
<dminuoso>
If it's CPU bound you are basically out of luck unless you can move it into a native extension.
<apeiros>
Bish: you can use jruby, it has parallel concurrency
<dminuoso>
Or that.
dhinojosa has joined #ruby
<dminuoso>
It also has a brilliant VM warmup, that makes you choke for 2 seconds every time you start your application.
<dminuoso>
:|
<apeiros>
aren't there ways around that?
Pumukel has quit [Ping timeout: 264 seconds]
phredus has joined #ruby
<apeiros>
at least I thought there were tools providing warm VMs on standby
badeball_ is now known as badeball
pokalyis has joined #ruby
<dminuoso>
apeiros: Not that I know of. The best you can do is write your software to lazy load classes.
blackmesa has joined #ruby
PalaHO has joined #ruby
tyang has joined #ruby
<dminuoso>
apeiros: Though it's not as bad as the JIT warmup when running jruby/truffle
doublemalt_ has quit [Remote host closed the connection]
gnufied has joined #ruby
TheWhip has quit [Remote host closed the connection]
jkhl has joined #ruby
Pumukel has joined #ruby
blackmesa has quit [Ping timeout: 250 seconds]
Snowy has joined #ruby
claudiuinberlin has joined #ruby
ninjaaron has quit [Quit: WeeChat 1.5]
Rodya_ has joined #ruby
<Bish>
dminuoso: IO bound, otherwise i wouldn't ask, and code wouldn't act differently on 2 servers
<Bish>
apeiros: yeah i am using too many c extensions in that code :(
last_staff has quit [Quit: last_staff]
Pumukel has quit [Ping timeout: 264 seconds]
<dminuoso>
Bish: Those C extensions could be problematic.
pokalyis has quit [Quit: My Mac has gone to sleep. ZZZzzz…]
<Bish>
hows that?
beilabs has joined #ruby
<dminuoso>
Bish: In general IO should not lock the GVL.
Burgestrand has quit [Ping timeout: 244 seconds]
Burgestrand has joined #ruby
jeanlinux has quit [Read error: Connection timed out]
<Bish>
i know about that, but as i said, it works on other instances
<Bish>
but on this servers threads act ridiculous
<dminuoso>
Bish: Ruby versions of all servers (down to minor), which Kernels on all servers?
<dminuoso>
And also, are you using Bundler?
jeanlinux has joined #ruby
AzureStigma has joined #ruby
<dminuoso>
(If so, do you have a shared Gemfile.lock?)
workmad3 has joined #ruby
ramortegui has joined #ruby
<Bish>
i am running 2.3.1 on all of them, they're all current ubuntus(blergh), the problematic server is a debian
pokalyis has joined #ruby
fmcgeough_ has joined #ruby
<dminuoso>
Bish: Are you sure that Debian is also running 2.3.1, and not some old 1.8 with green threads?
<Bish>
yes
fmcgeough has quit [Ping timeout: 240 seconds]
fmcgeough_ is now known as fmcgeough
<Bish>
i hacked them in there
crystal77 has joined #ruby
<dminuoso>
Bish: Do you still have the config log from building Ruby? If so, gist it please.
<apeiros>
!unban ghostlight
<dminuoso>
(Im curious about a few things, for example which thread model it was built with)
<Bish>
dminuoso: i did what ruby-install did
tyang has quit [Ping timeout: 276 seconds]
ghostlight has joined #ruby
spiette has quit [Quit: :qa!]
<dminuoso>
Bish: Without any information it's hard to debug really. Could be some native extension that misbehaves (and not properly unlocks the GVL in the right spots)
<Bish>
well, the extensions i talked about, are not in the problematic daemon
<Bish>
so i doubt that :(
Asher has quit [Quit: Leaving.]
synthroid has joined #ruby
<apeiros>
they're not in the daemon but they're the reason you can't use jruby? :D
Tusskan has quit [Quit: Leaving]
cdg has joined #ruby
tyang has joined #ruby
thejoecarroll has quit [Ping timeout: 240 seconds]
<Bish>
well, you want me to use 2 different ruby versions/vm kinds
<Bish>
for the same project, using the same models?
<apeiros>
I don't want anything
<Bish>
yeah, but i answered your question i think
<apeiros>
not really :)
Asher has joined #ruby
<apeiros>
but not really my problem either, so - no need to.
<Bish>
well, you don't need to respond either
<Bish>
yet you do it
<apeiros>
what? are you annoyed that I pointed out that what you said was contradictory?
<dminuoso>
Would this be a great moment to talk about the four-sides model by Friedemann Schulz von Thun?
<dminuoso>
:o
meth has joined #ruby
<Bish>
no, but your answer to my rhetorical question, which explained that you didn't point it out, was "i don't care" in context
Fly77 has joined #ruby
OTORelic3 has quit [Ping timeout: 258 seconds]
Pumukel has joined #ruby
tsia has quit [Quit: tsia]
<Bish>
ruby threading itself seems to be fine...
<Bish>
i can do (0..50000).map { Thread.new{1}.value}
<Bish>
and it finishes quite fast.. but as soon i use sockets on it.. it gets really slow
<dminuoso>
?testcase
<ruby[bot]>
dminuoso: I don't know anything about testcase
workmad3 has quit [Ping timeout: 240 seconds]
<dminuoso>
ruby[bot]: screw you.
<mikecmpbll>
haha
DoubleMalt has joined #ruby
<Bish>
while the same code, on my pc(which is much slower than the debian server) is way faster.
<Bish>
same ruby version, just a sane distribution
<Bish>
really weird, the performance of that server sucks in general, too, while CPU/RAM/HDD are fine
Coldblackice has quit [Ping timeout: 240 seconds]
Pumukel has quit [Ping timeout: 244 seconds]
<dminuoso>
Bish: Are you sure it's a concurrency problem?
<Bish>
well, it's a mailer daemon
<Bish>
mail.deliver always takes long on ruby, so i threaded it, which works fine on the other servers
<Bish>
since the delivering of the mail is what takes long ( IO )
Pumukel has joined #ruby
<Bish>
it's working, everywhere
<Bish>
but on this server, at first i thought it's the local smtp server.. until i tried extern ones, which had the same problem
<Bish>
while if i connect from my offices connection.. it works fine
eljimbo has joined #ruby
<Bish>
so it has to do something with IO/RUBY/threading
blackgoat has quit [Quit: WeeChat 1.5]
<dminuoso>
Bish: Or perhaps you are using blocking IO?
<Bish>
i even wrote a crazy connection SMTP pool, which made sending mails 100x times faster
<Bish>
but no effect on the shitty server
claw has quit [Remote host closed the connection]
<Bish>
dminuoso: how would i use blocking IO without knowing it?
<Bish>
serious question.. since it acts like blocking IO
Pumukel has quit [Ping timeout: 264 seconds]
<dminuoso>
Bish: I dont know how to tell you how to know what you are doing without knowing what you are doing, other than to figure out what you are doing.
claw has joined #ruby
<dminuoso>
That question is a bit pointless. :p
<Bish>
as i said, it's simple as
<Bish>
100.times { Thread.new { mail.deliver} } while mail is the Mail gem.
Didac has quit [Max SendQ exceeded]
auzty has quit [Quit: Leaving]
pwnd_nsfw has quit [Read error: Connection reset by peer]
crystal77 has quit [Quit: My Mac has gone to sleep. ZZZzzz…]
pwnd_nsfw has joined #ruby
ta__ has quit [Remote host closed the connection]
etehtsea has quit [Ping timeout: 240 seconds]
<dminuoso>
Bish: Are you using the same exact Mail gem?
Vingador has quit [Remote host closed the connection]
<dminuoso>
Bish: Can you actually tcpdump to be sure? Because then we could look at a culprit.
pwnd_nsfw` has joined #ruby
<dminuoso>
Or did you see the plain mail in strace?
<dminuoso>
Bish: If that doesn't help, gist your loaded features.
PalaHO has quit [Ping timeout: 258 seconds]
hahuang65 has joined #ruby
mostlybadfly has quit [Quit: Connection closed for inactivity]
pwnd_nsfw has quit [Ping timeout: 250 seconds]
CloCkWeRX has quit [Quit: Leaving.]
Pumukel has quit [Ping timeout: 264 seconds]
monoprotic has joined #ruby
<Bish>
dminuoso: i saw the plain mail, yes
<Bish>
my loaded features?
Hyuk has joined #ruby
matp has quit [Remote host closed the connection]
blankpaper has joined #ruby
<blankpaper>
Is an insert into a Hash O(1)?
Hyuk has quit [Max SendQ exceeded]
Fly77 has quit [Ping timeout: 260 seconds]
diprotic has quit [Ping timeout: 250 seconds]
GodFather has quit [Ping timeout: 258 seconds]
hahuang65 has quit [Ping timeout: 260 seconds]
anisha_ has quit [Quit: This computer has gone to sleep]
dhinojosa has quit [Ping timeout: 276 seconds]
<Mon_Ouie>
Assuming you have a good hashing function, it is amortized O(1)
lightheaded has quit [Remote host closed the connection]
Pumukel has joined #ruby
lightheaded has joined #ruby
<blankpaper>
Mon_Ouie: Good hashing function? As in something like my_hash[new_key] = 1?
<Mon_Ouie>
The implementation of new_key.hash needs to have a good distribution. That should be a reasonable assumption for most built-in types and data set.
karmatr0n has joined #ruby
ukk has quit [Quit: WeeChat 1.5]
youch has joined #ruby
<blankpaper>
Cool - was confused by what http://bigocheatsheet.com/ has for hash tables...but I assume that's for rolling your own.
karmatr0_ has joined #ruby
lightheaded has quit [Ping timeout: 244 seconds]
Pumukel has quit [Ping timeout: 260 seconds]
yeticry has joined #ruby
* Bish
never tried to use builtin ruby of debian let's see.
<Mon_Ouie>
No, the worst case is also O(n) in Ruby. O(1) is the typical case though.
karmatr0n has quit [Ping timeout: 240 seconds]
qguv has quit [Quit: bye]
KaliLinuxGR has quit [Remote host closed the connection]
sharkman has joined #ruby
<sharkman>
im using mechanize on a site. i can log in to the site. and navigate to certain pages. but when i try to click a certain checkbox an continue, it logs me out, and says my cookies arent valid. any thoughts?
pabloh has joined #ruby
Pumukel has joined #ruby
eljimbo has quit [Quit: This computer has gone to sleep]
ule has quit [Ping timeout: 250 seconds]
ule has joined #ruby
KaliLinuxGR has joined #ruby
am55 has joined #ruby
<blankpaper>
Oh, yeah it is O(n)...I'm just tired.
etehtsea has joined #ruby
ule has quit [Changing host]
ule has joined #ruby
TheWhip has joined #ruby
<Bish>
bleh RubyVM does not exist in 2.1?
c0mrad3 has quit [Quit: Connection closed for inactivity]
blankpaper has quit [Quit: Page closed]
<dminuoso>
Bish: yes, your loaded features
<Bish>
dminuoso: what does that mean?
Pumukel has quit [Ping timeout: 250 seconds]
coolboy has joined #ruby
f4cl3y has quit [Ping timeout: 276 seconds]
<dminuoso>
Bish: Personally I would just SIGSEGV the process and then look at all the loaded features. Im sure Mon_Ouie has a more elegant solution.
<dminuoso>
As usual.
<Bish>
would you tell me, what a "loaded feature" is?
<Bish>
this sends emails 283472347234x faster, but not with the shitty server
<dminuoso>
Works for me.
<Bish>
on all other servers, it works like a charm
<dminuoso>
Bish: compare loaded features.
plantfood has quit [Client Quit]
matp has joined #ruby
bkxd has joined #ruby
<Bish>
while sending an email with this on other servers takes <0.01 secs, it needs >1sec on the shitty server
<Bish>
dminuoso: i don't know what that is
<Bish>
still.
<matthewd>
dminuoso is talking about $", aka $LOADED_FEATURES
plantfood has joined #ruby
Pumukel has joined #ruby
<dminuoso>
matthewd: That one. :)
<Bish>
woohoo
<Bish>
>> $LOADED_FEATURES
<Bish>
>> $LOADED_FEATURES
<dminuoso>
matthewd: Thanks, now I dont have to Process.kill(:SIGBUS, $$) anymore!
<ruby[bot]>
Bish: # => ["enumerator.so", "thread.rb", "rational.so", "complex.so", "/execpad/interpreters/ruby-2.3.0/lib/ru ...check link for more (https://eval.in/627007)
<dminuoso>
:o)
plantfood has quit [Client Quit]
<Bish>
what should be in there?
f4cl3y has joined #ruby
<dminuoso>
Stuff.
Weavel has joined #ruby
plantfood has joined #ruby
tsia has joined #ruby
eljimbo has joined #ruby
tyang has quit [Ping timeout: 260 seconds]
<Bish>
yeah i mean, i cannot see something missing
plantfood has quit [Client Quit]
tsia has quit [Client Quit]
l4v2 has joined #ruby
tyang has joined #ruby
plantfood has joined #ruby
JeanCarloMachado has quit [Ping timeout: 240 seconds]
JeanCarl1Machado has joined #ruby
Pumukel has quit [Ping timeout: 264 seconds]
<Bish>
bleh this fucks me up
Pumukel has joined #ruby
plantfood has quit [Client Quit]
<matthewd>
Have you determined whether something is blocking, or it's just being slow?
<Bish>
it feels like blocking, by why would it / how would i check?
<ruby[bot]>
apeiros: # => comparison of Array with Array failed (ArgumentError) ...check link for more (https://eval.in/627014)
<apeiros>
thadtheman: this means you're comparing an array which contains values which can't be compared.
<matthewd>
I'd start with the lazy option, of sprinkling putses around your pooling
<apeiros>
such as in my example nil & "foo"
RegulationD has joined #ruby
ych has joined #ruby
<thadtheman>
apeiros: actually it turns out there is an empty array in there. I'm trying to figure out why and see if that fixes things.
plantfood has quit [Client Quit]
plantfood has joined #ruby
<apeiros>
yeah, sure. empty array means a[0] is nil, and `nil <=> anything` usually fails.
plantfood has quit [Read error: Connection reset by peer]
machinewar has joined #ruby
Pumukel has quit [Ping timeout: 260 seconds]
tsia has joined #ruby
<machinewar>
anyone used stackprof for ruby profiling? I keep seeing that the most frequently executing function at prorilfe time is Module.caller_bindings. Anyone know what this is?
dminuoso_ has joined #ruby
johnmilton has quit [Quit: Namaste]
RegulationD has quit [Ping timeout: 240 seconds]
nankyokusei has joined #ruby
<apeiros>
probably one of the implementations of "binding of caller"
Azure has quit [Ping timeout: 250 seconds]
<apeiros>
which allows you to access the binding of the calling method
vuoto has quit [Remote host closed the connection]
vuoto has joined #ruby
Pumukel has joined #ruby
nankyokusei has quit [Ping timeout: 265 seconds]
<apeiros>
so sad, I already thought RubyVM::DebugInspector was core/stdlib :(
dminuoso_ has quit [Ping timeout: 276 seconds]
bkxd has joined #ruby
vuoto has quit [Remote host closed the connection]
pandaant has quit [Remote host closed the connection]
agent_white has joined #ruby
vuoto has joined #ruby
vuoto has quit [Remote host closed the connection]
tyang has quit [Ping timeout: 265 seconds]
vuoto has joined #ruby
dminuoso has joined #ruby
OTORelic3 has joined #ruby
Pumukel has quit [Ping timeout: 264 seconds]
hutch34 has joined #ruby
aries_liuxueyang has quit [Ping timeout: 250 seconds]
Burgestrand has quit [Quit: My Mac has gone to sleep. ZZZzzz…]
haraigo has quit [Ping timeout: 260 seconds]
submitnine has quit [Read error: Connection reset by peer]
TvL2386 has joined #ruby
giz|work has quit [Ping timeout: 276 seconds]
lightheaded has joined #ruby
agit0 has joined #ruby
rodfersou is now known as rodfersou|lunch
ramortegui has quit [Quit: Ex-Chat]
mtkd has quit [Ping timeout: 252 seconds]
Pumukel has joined #ruby
<Bish>
the problem seems much less severe with the debian default-ruby
<Bish>
but still present
heelpmeplz has quit [Ping timeout: 250 seconds]
mtkd has joined #ruby
sharkman has quit [Ping timeout: 240 seconds]
heelpmeplz has joined #ruby
sharkman has joined #ruby
blackwell has quit [Max SendQ exceeded]
<matthewd>
Bish: Have you confirmed multiple threads are making it into the inner sendmail call at the same time?
aries_liuxueyang has joined #ruby
<matthewd>
Obviously not the sort of thing you'd expect to differ environmentally, but it's easy to check, so I'd just make sure
rippa has joined #ruby
blackwell has joined #ruby
<Bish>
matthewd: well i implemented the SMTPpool after the problem occured, it was supposed to be a fix
tyang has joined #ruby
<Bish>
so even if that was the case.. it wouldn't be the cause of the problem, i guess
<matthewd>
Ah okay, this server is where the original symptom started?
<Bish>
yes
<Bish>
being slow with Thread.new { Mail.deliver }
<Bish>
it takes seconds to do that, if a few threads get spawned
ChiefAlexander has joined #ruby
tdy has quit [Quit: tdy]
Pumukel has quit [Ping timeout: 264 seconds]
<matthewd>
It has the same behaviour talking to any SMTP server?
<Bish>
that was my first guess, but it happens with extern smtp servers too
<Bish>
and bonus: i created a ssh tunnel to an extern smtp server
tkbsnn has joined #ruby
<Bish>
and had the very same code on my office computer, having send emails THROUGH the tunnel
Pumukel has joined #ruby
<Bish>
348248234 times faster
aries_liuxueyang has quit [Ping timeout: 240 seconds]
<Bish>
it has to be ruby multithreading shit, or the server sucks, or debian sucks
johnmilton has joined #ruby
LoneHerm_ has quit [Remote host closed the connection]
aganov has quit [Remote host closed the connection]
tvw has quit [Ping timeout: 250 seconds]
kobain has joined #ruby
Pumukel has quit [Ping timeout: 264 seconds]
polishdub has joined #ruby
<dminuoso>
Bish: Dodge the Mail gem, and do some manual socketry.
pabloh has quit [Remote host closed the connection]
<dminuoso>
Bish: See if the problem still applies.
thejoecarroll has joined #ruby
<Bish>
i measured time mail gem needs to create a mail, which is fine, but i will try to send the resulting email as a string
<Bish>
wish me luck
SteenJobs has joined #ruby
heelpmeplz has quit [Read error: Connection reset by peer]
ych has quit [Quit: My Mac has gone to sleep. ZZZzzz…]
heelpmeplz has joined #ruby
dminuoso has quit [Remote host closed the connection]
jeanlinux has quit []
RegulationD has joined #ruby
conta has quit [Ping timeout: 264 seconds]
Pumukel has joined #ruby
ChiefAlexander has quit [Remote host closed the connection]
tdy has joined #ruby
stamina has joined #ruby
eljimbo has quit [Quit: This computer has gone to sleep]
TvL2386 has quit [Remote host closed the connection]
flashpoint9 has quit [Remote host closed the connection]
Limix has joined #ruby
eljimbo has joined #ruby
flashpoint9 has joined #ruby
machinewar has quit [Remote host closed the connection]
Pumukel has quit [Ping timeout: 264 seconds]
skweek has joined #ruby
sp__ has joined #ruby
jooni has joined #ruby
flashpoint9 has quit [Ping timeout: 250 seconds]
synthroid has quit [Remote host closed the connection]
aries_liuxueyang has joined #ruby
<Bish>
but after point where only a string gets sent, it's still pretty slow
ta_ has joined #ruby
PalaHO has joined #ruby
spiette has joined #ruby
Pumukel has joined #ruby
programmerq has joined #ruby
rubie has joined #ruby
tyang has quit [Ping timeout: 258 seconds]
saneax is now known as saneax-_-|AFK
flashpoint9 has joined #ruby
arthurl has joined #ruby
hahuang65 has joined #ruby
<arthurl>
hi guys- i'm trying to install a gem (using rbenv) on a centos 6.7 box- seeing a 'failed to build gem native extension' error- not sure what my options are here:
<arthurl>
having read some theads online people make mention of ruby-devel package- i tried to run a yum install ruby-devel.x86_64 command- but it comes back with 'Package ruby-devel-1.8.7.374-4.el6_6.x86_64 already installed and latest version'
Pumukel has quit [Ping timeout: 250 seconds]
blaxter has joined #ruby
rubie has quit [Ping timeout: 252 seconds]
hutch34 has quit [Ping timeout: 276 seconds]
Derperperd has quit [Quit: Derperperd]
IanMalcolm has quit [Quit: My Mac has gone to sleep. ZZZzzz…]
andrewvos has joined #ruby
banisterfiend has joined #ruby
Derperperd has joined #ruby
Derperperd has quit [Client Quit]
hahuang65 has quit [Ping timeout: 250 seconds]
tyang has joined #ruby
<matthewd>
Bish: If you have it down to that, you should be able to manually telnet from the server to the SMTP server, paste things in, and watch it be slow there too
Pumukel has joined #ruby
tdw has joined #ruby
jhack has joined #ruby
ChiefAlexander has joined #ruby
araujo has quit [Ping timeout: 244 seconds]
Couch has quit [Ping timeout: 252 seconds]
araujo has joined #ruby
Hobogrammer has quit [Quit: WeeChat 0.4.2]
antgel has quit [Ping timeout: 252 seconds]
flashpoint9 has quit [Remote host closed the connection]
bkxd has quit [Ping timeout: 244 seconds]
Pumukel has quit [Ping timeout: 260 seconds]
flashpoint9 has joined #ruby
Lucky_ABA has joined #ruby
sepp2k has quit [Quit: Leaving.]
sepp2k has joined #ruby
flashpoint9 has quit [Ping timeout: 250 seconds]
Apocalypse has quit [Ping timeout: 250 seconds]
vuoto has quit [Quit: Lost terminal]
Pumukel has joined #ruby
vuoto has joined #ruby
<atom_>
arthurl: you might need the development tools (general tools) installed as well
vuoto has quit [Remote host closed the connection]
vuoto has joined #ruby
<arthurl>
atom_ thanks- installed development tools- unfortunately still seeing the same error when attempting to install that passenger gem
bluOxigen has joined #ruby
Pumukel has quit [Ping timeout: 244 seconds]
elementaru has joined #ruby
TheWhip has quit [Remote host closed the connection]
Pumukel has joined #ruby
Guest38_ has joined #ruby
agit0 has quit [Quit: zzzZZZ….]
<matthewd>
arthurl: fastthread is... old.
<arthurl>
matthewd yeah trying to support an internal legacy app here... :)
<arthurl>
:(
<matthewd>
Might be easier to go with a correspondingly legacy ruby version
Pumukel has quit [Ping timeout: 264 seconds]
stamina has quit [Ping timeout: 250 seconds]
axsuul has joined #ruby
ta_ has quit [Remote host closed the connection]
synthroid has joined #ruby
Snowy has quit [Remote host closed the connection]
rodferso1|lunch has joined #ruby
j416 has quit [Ping timeout: 276 seconds]
flashpoint9 has joined #ruby
Rodya_ has quit [Remote host closed the connection]
Rodya_ has joined #ruby
Cohedrin has joined #ruby
LoneHerm_ has joined #ruby
rodfersou|lunch has quit [Ping timeout: 265 seconds]
amclain has joined #ruby
marxarelli has joined #ruby
jgnagy has joined #ruby
giz|work has joined #ruby
edwinvdgraaf has quit [Ping timeout: 260 seconds]
xMopxShell has quit [Ping timeout: 240 seconds]
giz|work has quit [Remote host closed the connection]
hirvi has quit [Ping timeout: 240 seconds]
aries_liuxueyang has quit [Read error: Connection reset by peer]
hirvi has joined #ruby
airdisa has joined #ruby
LoneHerm_ has quit [Ping timeout: 264 seconds]
ghr has quit [Ping timeout: 240 seconds]
isomorphismes has quit [Ping timeout: 240 seconds]
tabakhase has quit [Ping timeout: 240 seconds]
shtirlic has quit [Ping timeout: 240 seconds]
parus has quit [Ping timeout: 240 seconds]
nitric has joined #ruby
tyang has quit [Ping timeout: 258 seconds]
CustosLimen has quit [Ping timeout: 240 seconds]
aries_liuxueyang has joined #ruby
thorgi_ has quit [Ping timeout: 240 seconds]
go|dfish has quit [Ping timeout: 240 seconds]
joevandyk has quit [Ping timeout: 240 seconds]
kloeri has quit [Remote host closed the connection]
ghostlight has quit [Ping timeout: 240 seconds]
Platini has quit [Ping timeout: 240 seconds]
[spoiler] has quit [Ping timeout: 240 seconds]
fold4 has quit [Ping timeout: 240 seconds]
tabakhase has joined #ruby
n8o has quit [Excess Flood]
parus has joined #ruby
joevandyk has joined #ruby
kloeri has joined #ruby
M-Technic has quit [Ping timeout: 240 seconds]
shtirlic has joined #ruby
xMopxShell has joined #ruby
n8o has joined #ruby
isomorphismes has joined #ruby
[spoiler] has joined #ruby
thorgi has joined #ruby
zzxc has quit [Ping timeout: 240 seconds]
M-Technic has joined #ruby
cpruitt has joined #ruby
headius_ is now known as headius
CustosLimen has joined #ruby
zzxc has joined #ruby
TheWhip has joined #ruby
pwnd_nsfw` has quit [Read error: Network is unreachable]
Miron has quit [Quit: bye]
tyang has joined #ruby
tabakhase has quit [Ping timeout: 240 seconds]
Lucky_ABA has quit [Ping timeout: 240 seconds]
Platini has joined #ruby
ghostlight has joined #ruby
ghostlight has quit [Max SendQ exceeded]
pwnd_nsfw` has joined #ruby
ghostlight has joined #ruby
ghostlight has quit [Max SendQ exceeded]
hogetaro has quit [Ping timeout: 240 seconds]
ghostlight has joined #ruby
ghostlight has quit [Max SendQ exceeded]
Miron has joined #ruby
ghr has joined #ruby
go|dfish has joined #ruby
ghostlight has joined #ruby
ghostlight has quit [Max SendQ exceeded]
umdstu has joined #ruby
ghostlight has joined #ruby
ghostlight has quit [Max SendQ exceeded]
hogetaro has joined #ruby
dkphenom has quit [Quit: My MacBook Pro has gone to sleep. ZZZzzz…]
tvon has joined #ruby
tabakhase has joined #ruby
ghostlight has joined #ruby
ghostlight has quit [Max SendQ exceeded]
spudowiar has joined #ruby
<umdstu>
is there a way to force ruby to not attempt to convert asci-8bit looking text into utf8? i have a value, ‘\x45’ for example that I want to be read as just that, but i always get invalid byte sequence errors
ghostlight has joined #ruby
ghostlight has quit [Max SendQ exceeded]
ghostlight has joined #ruby
ghostlight has quit [Max SendQ exceeded]
byteflame has joined #ruby
vuoto has quit [Remote host closed the connection]
<Mon_Ouie>
You should probably use ENV.has_key? instead
<drbrain>
↑
<drbrain>
defined? is syntax, so its behavior is unusual
blackmesa has joined #ruby
<TheFarmingBunny>
oh wow
<TheFarmingBunny>
didn't find env.has_key?
<TheFarmingBunny>
thanks, thats just what i need
rodferso1|lunch is now known as rodfersou
<drbrain>
if possible use methods, const_defined? method_defined? instance_variable_defined?
hutch34 has joined #ruby
<TheFarmingBunny>
Thanks, I'm pretty new to ruby and this is my first gem
jhack has quit [Quit: jhack]
mistym has quit [Ping timeout: 276 seconds]
giz|work has quit [Ping timeout: 250 seconds]
hutch34 has quit [Quit: WeeChat 1.5]
mtkd has quit [Ping timeout: 250 seconds]
Pumukel has joined #ruby
jobat has quit [Quit: Page closed]
hutch34 has joined #ruby
claudiuinberlin has joined #ruby
xrlabs has quit [Quit: Connection closed for inactivity]
mistym has joined #ruby
mistym has quit [Changing host]
mistym has joined #ruby
bluOxigen has quit [Ping timeout: 240 seconds]
bluOxigen has joined #ruby
mtkd has joined #ruby
ziyadb has quit [Quit: Connection closed for inactivity]
Pumukel has quit [Ping timeout: 264 seconds]
Zelest has joined #ruby
<jgnagy>
I usually just use ENV.key?('UNDEFINED_ENV_VARIABLE')
<Zelest>
i'm trying to install the dnssd gem and it fails.. it complains about not finding dns_sd.h even though I have it on my system.. how can i tell gem where to look for it? (ruby 2.3 and dnssd-3.0.1)
dreamyspell_ is now known as dreamyspell
ponga has quit [Quit: Connection closed for inactivity]
RegulationD has quit [Remote host closed the connection]
blackwell has quit [Max SendQ exceeded]
blackwell has joined #ruby
SteenJobs has quit [Quit: SteenJobs]
Limix has joined #ruby
replay has joined #ruby
slappy16 has joined #ruby
miqlas-H has joined #ruby
JeanCarloMachado has joined #ruby
ych has joined #ruby
async_prince has quit [Ping timeout: 240 seconds]
blackwell has quit [Max SendQ exceeded]
zacts has joined #ruby
blackwell has joined #ruby
justinweiss has quit [Quit: Connection closed for inactivity]
David27 has joined #ruby
IanMalcolm has quit [Quit: My Mac has gone to sleep. ZZZzzz…]
fold4 has joined #ruby
joelwallis has joined #ruby
Derperperd has quit [Read error: Connection reset by peer]
l4v2 has joined #ruby
alfiemax has joined #ruby
reisei has joined #ruby
zacts has quit [Quit: WeeChat 1.5]
redpants has quit [Ping timeout: 250 seconds]
Vingador has joined #ruby
JeanCarloMachado has quit [Ping timeout: 265 seconds]
ec0 has joined #ruby
ta_ has joined #ruby
TPug has joined #ruby
tyang has joined #ruby
aazsdk has quit [Quit: aazsdk]
Derperperd has joined #ruby
Ishido has joined #ruby
jhack has joined #ruby
GodFather has quit [Ping timeout: 258 seconds]
nitric has joined #ruby
wugy has quit []
jhack has quit [Client Quit]
nitric_ has quit [Ping timeout: 264 seconds]
bocaneri has quit [Remote host closed the connection]
elifoster has joined #ruby
jhack has joined #ruby
ramfjord has joined #ruby
coolboy has joined #ruby
spudowiar has quit [Quit: Leaving.]
RegulationD has joined #ruby
JeanCarloMachado has joined #ruby
mrgrieve1 has joined #ruby
joelwallis has quit [Quit: Leaving]
IanMalcolm has joined #ruby
hutch34 has quit [Quit: WeeChat 1.5]
IanMalcolm has quit [Client Quit]
jhack has quit [Quit: jhack]
jhack has joined #ruby
RegulationD has quit [Ping timeout: 265 seconds]
<reisei>
hello! I have question: how can I find tabultion symbol in file? I tried line[/\t */].size but it return "undefined method `size' for nil:NilClass (NoMethodError)"
nankyokusei has joined #ruby
<jgnagy>
you want to know how many tabs are in the entire file? or just if any exist?
Lucky_ABA has joined #ruby
JeanCarl1Machado has joined #ruby
mikecmpbll has quit [Quit: inabit. zz.]
<reisei>
jgnagy: I try to count tabs in the beginning of the line.
<jgnagy>
I assume your `line` object there is within a block on some File read operation, correct?
ramfjord has quit [Ping timeout: 244 seconds]
<reisei>
jgnagy: yes, that's right.
atmosx has joined #ruby
Baffoon has quit [Ping timeout: 264 seconds]
aazsdk has joined #ruby
crystal77 has joined #ruby
jaequery has joined #ruby
<jgnagy>
I would make a variable called "tab_count", set it to 0
<jgnagy>
then add the number of tabs that match to that variable
vuoto has joined #ruby
nankyokusei has quit [Ping timeout: 260 seconds]
<jgnagy>
let me make a gist for you
zacts has joined #ruby
sharkman has joined #ruby
<reisei>
jgnagy: but I cannot find any tabs with regex.
<atmosx>
Hello, I'm playing with project Euler exercises. That's my take on the second one, but my MBA is swapping, I wonder if there are more efficient ways of finding the magic number. I'll run the same code on my iMac (maxed-out i7) later but out of curiosity... https://gist.github.com/atmosx/8cb1a8d3d8ac05ed5a90bdb255e93eb9 the code.
binaryplease1 has joined #ruby
cdg has quit [Remote host closed the connection]
<atmosx>
reisei: what? /\t/ <-- tab
<reisei>
atmosx: yes, i found that, but it didn't work.
haraigo has joined #ruby
<atmosx>
reisei: do you have a sample text upon which the tab regex didn't work?
<reisei>
atmosx: it's just a word with the tab in the beginning.
<reisei>
jgnagy: thanks!
whathappens has quit [Read error: Connection reset by peer]
whathappens has joined #ruby
iamdevnul has quit [Ping timeout: 250 seconds]
vuoto has quit [Read error: Connection reset by peer]
ych has quit [Quit: My Mac has gone to sleep. ZZZzzz…]
aazsdk has quit [Ping timeout: 240 seconds]
haraigoshi has joined #ruby
iamdevnul has joined #ruby
loechel has joined #ruby
aazsdk has joined #ruby
David27 has quit [Quit: Going offline, see ya! (www.adiirc.com)]
polysics has joined #ruby
<jgnagy>
updated the gist with some comments to explain what it does
Es0teric has joined #ruby
Pumukel has quit [Ping timeout: 260 seconds]
jhack has left #ruby [#ruby]
jhack has joined #ruby
<reisei>
thank you very much
haraigo has quit [Ping timeout: 260 seconds]
<jgnagy>
tab_count will contain the number of tabs added together, which is probably not what you want, but should give you a starting point
binaryplease1 is now known as binaryplease
braincrash has quit [Ping timeout: 240 seconds]
mikecmpbll has joined #ruby
<jgnagy>
atmosx: you're looking for a better way to get a value based on its sequence index in the fibonacci sequence?
aryaching_ has quit []
<atmosx>
Not exactly. I'm looking for a more efficient way to get the sum of all the even numbers that appear in a 4 million fibonacci sequence
aryaching has joined #ruby
<jgnagy>
ah, I see
<jgnagy>
doing the fibonacci sequence purely recursively is not going to do it for you
jhack has quit [Quit: jhack]
<atmosx>
My first approach was keeping an index, it was kind of easier (more natural) for me to keep an index and current + fibonacci_array[-2], but that almost crashed my macbook air heh. I was actually keeping two indices, and I'm guessing they quickly started eating RAM.
jhack has joined #ruby
KCmetro has joined #ruby
<jgnagy>
I've tried a cached approach before, but that breaks after a while too
<atmosx>
Yes, I know that too. I'll write a C implementation of this too, just to benchmark the diff.
<atmosx>
how would a cached approach work?
<matthewd>
atmosx: You might want to re-read the question
<jgnagy>
memoization
<atmosx>
matthewd: > By considering the terms in the Fibonacci sequence whose values do not exceed four million, find the sum of the even-valued terms. ... what I'm not getting?
<matthewd>
atmosx: Now in your own words, describe your loop / stop condition
<matthewd>
atmosx: Well actually, you already did: > I'm looking for a more efficient way to get the sum of all the even numbers that appear in a 4 million fibonacci sequence
ramfjord has joined #ruby
<matthewd>
atmosx: One of these things is not like the other
RegulationD has joined #ruby
dsf has joined #ruby
pulgolino has joined #ruby
braincrash has joined #ruby
<atmosx>
matthewd: I'm not following, do I have a semantic error in the code snippet?
<matthewd>
atmosx: I think you have a semantic error in your understanding of the search space (which is then also present in your code)
<matthewd>
atmosx: The problem says "the terms in the Fibonacci sequence whose values do not exceed four million"; you are searching "a 4 million fibonacci sequence"
coolboy has quit [Ping timeout: 244 seconds]
<atmosx>
aaah
<atmosx>
omg
<matthewd>
atmosx: Given there are 34 terms in the Fibonacci sequence with a value less than 4 million, this is a.. substantial difference in problem magnitude ;)
claudiuinberlin has quit [Remote host closed the connection]
coolboy has joined #ruby
<atmosx>
okay, I knew that something was wrong hehe. Thanks matthewd
claudiuinberlin has joined #ruby
ta__ has joined #ruby
beilabs_ has quit [Remote host closed the connection]
beilabs has joined #ruby
<jgnagy>
very true
<jgnagy>
I think the fastest way is to use arithmetic rather than any kind of recursion too
chee is now known as snes
<jgnagy>
>> def fib(n); ((((1+Math.sqrt(5))/2)**n)/Math.sqrt(5)+0.5).floor; end
dsf has quit [Ping timeout: 265 seconds]
JeanCarl1Machado has quit [Ping timeout: 276 seconds]
howdoi has quit [Quit: Connection closed for inactivity]
Limix has quit [Client Quit]
<vulc4n>
afternoon guys -- I'm currently using the workflow gem (https://github.com/geekq/workflow), but I'm not sure how to require that any transitions occur via an event.
<vulc4n>
In other words, I want to protect the workflow_state property in my AR model so that ti can't be changed without calling a transition event from Workflow.
d5sx43 has joined #ruby
mwlang has joined #ruby
<TheFarmingBunny>
This is probably a stupid question but how do I install my gems executables with bundle
moneylotion has quit [Quit: ZNC 1.6.3 - http://znc.in]
<jgnagy>
vulc4n: not familiar with that gem but it looks interesting
whathappens has quit [Remote host closed the connection]
futilegames has quit [Ping timeout: 244 seconds]
<jgnagy>
TheFarmingBunny: I'm not sure what you mean... when you install a gem that has executables, they should be placed in your PATH if your gems bin/ is in your PATH
whathappens has joined #ruby
moneylotion has joined #ruby
<jgnagy>
shouldn't matter if you install a gem via bundler or not
futilegames has joined #ruby
whathappens has quit [Remote host closed the connection]
the_rhizo3 has quit [Ping timeout: 240 seconds]
braincrash has joined #ruby
<TheFarmingBunny>
I'm making a gem using bundle to install it during development and when i try to install its giving me this message:
whathappens has joined #ruby
<TheFarmingBunny>
Using accolades 0.0.2 (was 0.0.1) from source at `.`
tyang has joined #ruby
TheFarmingBunny has left #ruby ["Leaving"]
TheFarmingBunny has joined #ruby
TheFarmingBunny has left #ruby ["Leaving"]
zenguy_pc has quit [Ping timeout: 276 seconds]
zenguy_pc has joined #ruby
whathappens has quit [Ping timeout: 240 seconds]
d5sx43 has quit [Quit: Leaving...]
beilabs has joined #ruby
Lucky_ABA has quit [Quit: My MacBook Pro has gone to sleep. ZZZzzz…]
jackjackdripper has joined #ruby
sp__ has joined #ruby
Limix has joined #ruby
claudiuinberlin has quit [Remote host closed the connection]
capitainIsh has joined #ruby
sp__ has quit [Client Quit]
s2013 has joined #ruby
beilabs has quit [Ping timeout: 240 seconds]
claudiuinberlin has joined #ruby
futilegames has left #ruby [#ruby]
karmatr0_ has quit [Ping timeout: 276 seconds]
capitainIsh has quit [Max SendQ exceeded]
galeido has quit [Quit: leaving]
qba73 has joined #ruby
fierycatnet has joined #ruby
vulc4n has quit [Ping timeout: 264 seconds]
zacts has quit [Ping timeout: 250 seconds]
Haui has joined #ruby
claudiuinberlin has quit [Ping timeout: 265 seconds]
elastix has joined #ruby
LoneHermit has joined #ruby
TheWhip has quit [Remote host closed the connection]
hutch34 has joined #ruby
<elastix>
hi guys how can I write a small Ruby based script/app that will get HTTP response times over 5 minutes from your location to mysite.com?
blackmes1 has joined #ruby
GinoManWorks has joined #ruby
TheWhip has joined #ruby
karmatr0n has joined #ruby
russt has quit [Quit: That's all, folks!]
lxsameer has joined #ruby
lxsameer has quit [Changing host]
lxsameer has joined #ruby
Lucky_ABA has joined #ruby
CSWookie has joined #ruby
blackmesa has quit [Ping timeout: 276 seconds]
jgt3 has joined #ruby
<CSWookie>
Hey folks, is there a library that rubistae use to parse command-line arguments? In Python, I use argparse, but I'm not familiar with the Ruby standard libraries.
LoneHermit has quit [Ping timeout: 250 seconds]
<elastix>
what is the ruby interactive shell in linux?
<bougyman>
irb officially, pry if you don't want it to suck.
<havenwood>
elastix: irb ships with Ruby
<havenwood>
?pry
<ruby[bot]>
Pry, the better IRB, provides easy object inspection `ls`, `history`, viewing docs `?`, viewing source `$`, syntax highlighting and other features (see `help` for more). Put `binding.pry` in your source code for easy debugging. Install Pry (https://pryrepl.org/): gem install pry pry-doc
<elastix>
thanks
<havenwood>
elastix: and yes, you can!
TheWhip has quit [Ping timeout: 258 seconds]
<elastix>
I can what?
<havenwood>
elastix: write a small Ruby-based thing to compare response times
blackwind_123 has joined #ruby
<havenwood>
CSWookie: There are also gems like Slop that have a bit nicer interface.
Baffoon has joined #ruby
Baffoon has quit [Excess Flood]
<xpt>
havenwood: there was *how* before "can I write"
fierycatnet has quit [Read error: Connection reset by peer]
<havenwood>
xpt: aha!
zacts has joined #ruby
Baffoon has joined #ruby
Macaveli has joined #ruby
d5sx43 has joined #ruby
Baffoon has quit [Client Quit]
<elastix>
I'm very newbie :) what does it mean : that will get HTTP response times over 5 minutes?
the_rhizo3 has joined #ruby
<CSWookie>
This says it's a shell. I'm not sure that's what I'm wanting. I'm just wanting to be able to say "myprog --somearg=foo --otherarg=bar" and have the library spit my out a hash like {"somearg": "foo", "otherarg": "bar}
<elastix>
the script has to give as output the response time?
<arthurl>
and we definitely have an application_controller.rb w/ an ApplicationController class defined in Sip/app/controllers/
PalaHO has joined #ruby
<arthurl>
i guess it's also important to note that i had to install 1.8.7 on this centos 6.7 box via RUBY_CONFIGURE_OPTS="--without-openssl" rbenv install 1.8.7-p374 (would error out without the RUBY_CONFIGURE_OPTS bit)
Es0teric has quit [Quit: Computer has gone to sleep.]
elifoster has joined #ruby
miqlas-H has quit [Quit: Vision[0.9.7-H-20140108]: i've been blurred!]
<marahin>
Has anyone had a problem where gem install works fine, but then in IRB or PRY loading it causes an loaderror (not found)? I built a hello-world gem (just fine), installed it just fine, but when I try to require it - it fails.
<marahin>
I'm using rbenv, but rbenv-doctor says everything is fine.
<marahin>
Is this possibly a common issue?
reisei has quit [Quit: leaving]
<havenwood>
arthurl: With such an old Ruby you might want to use CentOS 5 and just live in the past package-wise.
<havenwood>
marahin: Have you tried the rbenv stuff like rehashing the shims?: rbenv rehash
<havenwood>
?rbenv
<ruby[bot]>
Missing command under rbenv? Did you try `rbenv rehash`?
<havenwood>
marahin: Or switch to chruby if it starts to bother you. :-)
mrgrieve1 has quit [Ping timeout: 244 seconds]
<marahin>
havenwood, honestly I used rvmio for a year, lately I switched to rbenv and it works marvelously
<marahin>
it's first time I'm trying to create my own gem
jaruga___ has quit [Quit: jaruga___]
<marahin>
rehashing brings no help; however lurking through stack overflow, I stepped upon an answer that suggests checking gem environment and looking for installation directory
<marahin>
havenwood, oops, some untested changes broke, one moment again.
Fernando-Basso has quit [Quit: Leaving]
galeido has joined #ruby
hahuang65 has joined #ruby
blackgoat has joined #ruby
KCmetro has quit [Remote host closed the connection]
<arthurl>
havenwood thanks- i'm starting to think that's really my only option...
jenrzzz has quit [Ping timeout: 264 seconds]
KCmetro has joined #ruby
KCmetro has quit [Client Quit]
KCmetro has joined #ruby
<marahin>
havenwood, haha. You're magical! Somehow it works now. I believe that something was wrong with the path; in the meantime I restarted the PC, so that could have been it.
<marahin>
havenwood, sorry for bothering you for nothing! And thank you for your time and advices.
ziyadb has quit [Quit: Connection closed for inactivity]
the_rhizo3 has quit [Ping timeout: 244 seconds]
futilegames has joined #ruby
wrkrcoop has joined #ruby
futilegames has quit [Client Quit]
the_rhizo3 has joined #ruby
arashb has quit [Ping timeout: 250 seconds]
<wrkrcoop>
Im trying to hit this endpoint, and they expect my post request to have a field called inputJson … and its value is a string which is actually a hash …
<wrkrcoop>
they expect the value to use double quotes and all the internal keys to use double quotes, but when i call .to_json on the data it adds many lines …
coolboy has quit [Ping timeout: 250 seconds]
doublemalt_ has joined #ruby
the_rhizo3 has quit [Ping timeout: 240 seconds]
<wrkrcoop>
is there a way to get the hash to be a json string without having extra backslashes
moonythedwarf_ has quit [Ping timeout: 258 seconds]
<apeiros>
yeah, sometimes I wonder what's wrong with such people.
<CuriousMind>
When importing classes in ruby using `require <filename>`, How do I import the instances of that class?
pawnbox has quit [Read error: Connection reset by peer]
<jgnagy>
CuriousMind: what do you mean by "the instances of that class"?
moonythedwarf_ has joined #ruby
<CuriousMind>
I made objects from the class in the file I want to `require` jgnagy
<jgnagy>
any classes defined in that file (or anything it includes) will be available to you
<apeiros>
CuriousMind: you don't really import classes with require
<apeiros>
all require does is execute a piece of code in a file identified by require
<CuriousMind>
Ohhh ok apeiros
<apeiros>
and you can do the same things you can do in the file where you require
<apeiros>
but what you probably stumble over is that local variables are, well, *local* :)
aazsdk has quit [Ping timeout: 250 seconds]
<CuriousMind>
I want like the instance objects created from the class to be available in the file I am trying to import it to apeiros
<apeiros>
i.e. a local variable from toplevel of b.rb will not appear in a.rb when you require it
arashb has joined #ruby
<apeiros>
so all you have to do is: assign those instances to a variable which is visible in the requiring file. e.g. a constant.
<CuriousMind>
apeiros: Trying to understand this
<SeepingN>
$global = "value"
* apeiros
hits SeepingN with a broomstick for mentioning globals :-p
<apeiros>
srsly
<jgnagy>
don't use globals
wrkrcoop has quit [Quit: wrkrcoop]
<havenwood>
don't set globals
<CuriousMind>
Ok so make the objects variable names to CONSTANT in the file I want to import? apeiros
<jgnagy>
if you need something to truly be global, use a constant
<CuriousMind>
I am confused, continue please
<apeiros>
CuriousMind: yes. try it.
<jgnagy>
if you need to modify a constant, use a singleton instead
<apeiros>
e.g. in foo.rb: `class Foo; …definitions…; InstanceA = new(…); end`, and then in app.rb: `require 'foo'; Foo::InstanceA`
<jgnagy>
those are for SeepingN, btw
<CuriousMind>
apeiros: So there's no way to import instances of a class to my file UNLESS setting those object variable names to global variables? apeiros jgnagy
<CuriousMind>
I don't know all this singleton is, please explain jgnagy
<apeiros>
CuriousMind: not just globals. any visible variable.
<jgnagy>
those weren't for you, CuriousMind, don't worry
<apeiros>
CuriousMind: and the preferred places are either constants or a constant with accessors.
<apeiros>
CuriousMind: see above example.
ElFerna has quit [Quit: My Mac has gone to sleep. ZZZzzz…]
<jgnagy>
CuriousMind: what you're trying to do sounds unusual, can you give us your use case / why you're doing this? that might help us help you
<apeiros>
IMO not that unusual
<CuriousMind>
Trying to comprehend all this, give me a minute please
<apeiros>
though most often it's something which is clearly associated so storing it in the class itself is often self-evident.
<jgnagy>
well, you might be right apeiros, but I can't say until I know what CuriousMind is trying to accomplish
<apeiros>
e.g. things like MimeType.all_types # => [#<MimeType>, …]
elastix has quit [Quit: elastix]
<CuriousMind>
I want to import objects from my other file to the current file im working with
<CuriousMind>
afk 5 m one sec
<jgnagy>
to clarify, for someone struggling to understand how requiring files works, it is probably unusual
<apeiros>
true
<jgnagy>
but that's ok, we'll get them sorted out
<SeepingN>
5 min, 1 sec
denny has quit [Quit: So long, and thanks for all the trout.]
<SeepingN>
this is how poorly we humans understand time
<apeiros>
CuriousMind: when you're back, I suggest you put your current code on gist.github.com
OTORelic3 has quit [Ping timeout: 260 seconds]
<jgnagy>
yes, that ^
ta_ has quit [Ping timeout: 250 seconds]
madgen has joined #ruby
KaliLinuxGR has joined #ruby
<jgnagy>
SeepingN: maybe there was need for the precision of 5 minutes and 1 sec
KaliLinuxGR has quit [Read error: Connection reset by peer]
KaliLinuxGR has joined #ruby
<madgen>
Heyya, I created a Tempfile and am trying to pass its path as an argument to an external program to read/write but the outside program complains that it doesn't exist. Can anyone think of why?
<SeepingN>
heh
<SeepingN>
madgen: is there a space anywhere in the path?
<jgnagy>
madgen: did you create the Tempfile and use a block with it?
<apeiros>
madgen: tempfiles are deleted immediately
<SeepingN>
or a missing / at the beginning or end
<jgnagy>
tempfiles are, well... temporary after all
<apeiros>
at least that's how they usually are implemented on *nix systems
<madgen>
I am within the block as a blocking call is made to outside so the file should not be deleted at that point
<apeiros>
and your app can still read/write because it maintains a hardlink
<SeepingN>
what is the call to the 3rd party app?
ixti has joined #ruby
<madgen>
SeepingN: no there is no space I retrieve it by the block file object's path method
<CuriousMind>
apeiros: Will do will do
<SeepingN>
remember that exac kills your script
lxsameer has quit [Quit: Leaving]
* apeiros
shrugs
christinaent has joined #ruby
christinaent has quit [Client Quit]
<madgen>
SeepingN: I first write some C source I generate to it and then pass it to CLANG as an argument but that is not the problem because even if I call UNIX file command on it (while still in the block) it complains
christinaent has joined #ruby
<SeepingN>
right. are you using exec?
<madgen>
backtick backtick
<SeepingN>
or system, or `backticks`
<SeepingN>
hmm
<apeiros>
madgen: you got an explanation. but hey, you don't have to believe me.
<CuriousMind>
There you go, the question is in the gist description
<madgen>
apeiros: sorry, maybe I missed it but how can tempfiles be deleted immediately as I am in a Tempfile.open block?
moeabdol1 has quit [Ping timeout: 258 seconds]
Immune has quit [Ping timeout: 244 seconds]
<apeiros>
hm, though, it seems Tempfile actually doesn't do that by itself. it only ensures that the file is deleted, but they recommend you do it immediately.
<apeiros>
and: use arrays instead of variables with numbers at the end.
<jgnagy>
that's what I'm getting at, so yes, that would work
<SeepingN>
wait how does that help madgen if they are NOT already calling file.unlink?
<jgnagy>
but more idiomatic ruby / OOP would be to define your classes, then use them, rather than both at the same time, at least for this purpose
KnownSyntax has joined #ruby
<CuriousMind>
jgnagy: class in one file, class in another file, third file is uhh requiring data from both?
<apeiros>
SeepingN: it was the explanation to "how can it work when you delete". if they don't actually do that, this isn't the explanation for the behavior they see.
<CuriousMind>
apeiros: I'm reading your input
* apeiros
thinks jgnagy got this @ CuriousMind, I'm off :) have fun
<SeepingN>
ohh ok gotcha now
<CuriousMind>
Wait apeiros
<jgnagy>
CuriousMind: third is creating instances of the classes defined in the first two
<CuriousMind>
No please I want your advice as well I'm looking at all angles please apeiros
<apeiros>
CuriousMind: don't worry, jgnagy is fully capable of giving you the advice you need ;-)
<jgnagy>
thank you for the vote of confidence there :)
<CuriousMind>
apeiros: aw ok thank you
<jgnagy>
CuriousMind: let me throw together a gist for you
<CuriousMind>
someone had did Foo:Apartment idk, ok sure jgnagy
<CuriousMind>
Thank you
neanderslob has quit [Ping timeout: 244 seconds]
splargle has joined #ruby
splargle has quit [Read error: Connection reset by peer]
ElFerna has quit [Quit: My Mac has gone to sleep. ZZZzzz…]
<madgen>
apeiros: yeap and I am back. Tempfile.open does not unlink the file immediately, sooooo the behaviour is still weird
<madgen>
anyone has a guess?
ddffg has quit [Quit: Leaving]
<SeepingN>
paste the line of code that attempts to open that file in the other program
<CuriousMind>
jgnagy: Didn't notice, but I'll check this one out. Thank you so much
<jgnagy>
no problem
<jgnagy>
CuriousMind: now, like apeiros was saying, there are ways to do what you were asking, but it will lead the next person to read your code to wonder where those Tenants are defined
blackwind_123 has quit [Ping timeout: 276 seconds]
jenrzzz has quit [Ping timeout: 264 seconds]
blackwind_123 has joined #ruby
<jgnagy>
madgen: what OS are you running and what version of ruby?
<CuriousMind>
jgnagy: the tenants objects are defined after I write the class s
<madgen>
SeepingN: no need for condescension, of course I have done that and as I said I tried a single Tempfile with read utility which states the path is empty
davedev24 has quit [Remote host closed the connection]
ta_ has quit [Ping timeout: 265 seconds]
cibs has quit [Ping timeout: 240 seconds]
dandaman has joined #ruby
<dandaman>
so are blocks essentially the equivalent of callback functions from javascript?
cdg has quit [Remote host closed the connection]
<chrisseaton>
dandaman: Yes - but they close over self, which JavaScript callback functions don't
cibs has joined #ruby
karmatr0n has quit [Read error: Connection reset by peer]
<dandaman>
chrisseaton: what do you mean they close over self?
bad_ip has quit [Ping timeout: 240 seconds]
<chrisseaton>
dandaman: 'self' will be the same in the block as outside it, where in JavaScript 'this' will be different. We call this 'closing over' a variable.
<dandaman>
ohh you mean the scope
<chrisseaton>
Yeah
<dandaman>
got it!
<dandaman>
thanks
<dandaman>
yay learning
unreal has quit [Read error: Connection reset by peer]
firstdayonthejob has quit [Ping timeout: 258 seconds]
colegatron has joined #ruby
unreal has joined #ruby
<CuriousMind>
Going to d/c, thank you everyone for the help! I'll be on another time!!
<CuriousMind>
apeiros: THANK YOU
ElFerna has quit [Quit: My Mac has gone to sleep. ZZZzzz…]
jaequery has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
polysics has quit [Remote host closed the connection]
dandaman has quit [Quit: Leaving.]
<SeepingN>
built a hash and convert?
jgt3 has quit [Ping timeout: 258 seconds]
[Butch] has quit [Quit: I'm out . . .]
<wrkrcoop>
SeepingN: no this is a special case
<wrkrcoop>
where the value of inputJson has to be surrounded by double quotes and can’t ahve more than \ escape character
<wrkrcoop>
they built a terrible endpoint and i have to kinda hack it
minimalism has joined #ruby
edwardly has quit [Max SendQ exceeded]
edwardly has joined #ruby
edwardly has quit [Changing host]
edwardly has joined #ruby
hahuang61 has quit [Ping timeout: 250 seconds]
craysiii has joined #ruby
brack9 has quit [Ping timeout: 264 seconds]
loechel has quit [Remote host closed the connection]
<baweaver>
...looks like normal JSON
bad_ip has joined #ruby
bad_ip has joined #ruby
bad_ip has quit [Changing host]
wrkrcoop_ has joined #ruby
wrkrcoop has quit [Ping timeout: 250 seconds]
wrkrcoop_ is now known as wrkrcoop
coolboy has quit [Ping timeout: 265 seconds]
Pumukel has joined #ruby
boadie has joined #ruby
boadie has quit [Remote host closed the connection]
<jgnagy>
I see what wrkrcoop is asking from the previous comments
<jgnagy>
in a double-quoted sting, you escape a double-quote with a backslash
gix has quit [Ping timeout: 258 seconds]
<jgnagy>
"\"" is the same as '"'
<jgnagy>
to escape the backslash, you use two most backslashes
<wrkrcoop>
jgnagy: yeah so when i to_json it creats like 3 backslashes so when i parse it it becomes \ backslash and thats causing problems
ChiefAlexander has quit [Remote host closed the connection]
<havenwood>
wrkrcoop: The value corresponding with that key is a Hash not a String. Do you know how to convert the Hash that's returned to the String you want? Why do you want a String? What are you using it for? What would the String look like?
<jgnagy>
>> puts "\\\""
<wrkrcoop>
havenwood: the stupid endpoint actually is expecting a string
<wrkrcoop>
which is diriving me insane
<wrkrcoop>
so im trying to just manually create the string … but i can’t parse this: "{\"inputJSON\": \"{\"followUpReq\":\"false\",\"fName\":\"Harry\",\"lName\":\"Potter\",\"systemName\":\"PREVIOUS_VERSIONS\",\"email\":\"harry.potter1@ssttest.net\",\"subscriptionNumber\":\"343-25578259\",\"productName\":\"Building Design Suite Premium\",\"serialNumber\":\"380-26229219\",\"release\":\"2014\",\"caseLanguage\":\"English\",\"subject\":\"Autodesk Home
<wrkrcoop>
Use\",\"description\":\"Home Use Request\"}\"}"
<jgnagy>
correct
<jgnagy>
everywhere within the value of "inputJSON", you need to escape the escapes
<jgnagy>
or if you're just manually creating the string, use single quotes for the outer string
<wrkrcoop>
hmm ok
jobewan has quit [Ping timeout: 260 seconds]
s2013 has quit [Quit: My Mac has gone to sleep. ZZZzzz…]
<wrkrcoop>
if i use single quotes inside do i not need to escape characters?
<havenwood>
wrkrcoop: How might you convert the Hash that's returned to the String you want? What needs to happen to the Hash for it to become that String?
<jgnagy>
'{"inputJSON": "{\"followUpReq\":' and so on
banisterfiend has joined #ruby
<wrkrcoop>
ok ill try that
<jgnagy>
well, you'll need to leave the escapes for things you want JSON to escape, not ruby
<jgnagy>
or, construct the hash yourself
dandaman has joined #ruby
<jgnagy>
data = { inputJSON: '{"followUpReq": "false"}' }
<jgnagy>
data.to_json
<jgnagy>
should give you the string you're looking for
<ElderFain>
I guess fixing it in Ruby would mean fixing it in C huh?
async_prince has joined #ruby
<SeepingN>
don't use ' if you need things to be evaluated. wrap with %q() type quotes
<Radar>
ElderFain: First of all: what's the bug?
ta_ has joined #ruby
<Radar>
ElderFain: Secondly, the CSV library is written in Ruby afaik so you
<Radar>
you'd be fixing the bug in the Ruby code for that lib.
<ElderFain>
Radar: when you you the header_converters => :symbols and one of you header symbols is "# Blah", it converts to :_Blah, but "# Blah".to_sym converts to :"# Blah"
Pumukel has quit [Ping timeout: 244 seconds]
<ElderFain>
I would expect the # to be preserved
<ElderFain>
wow I butchered that sentence. when you USE.. and one of YOUR ... sheesh.
solocshaw has joined #ruby
<SeepingN>
I woudln't expect # to be valid or a desired character to use
<ElderFain>
Radar: I would expect non word characters would just force the symbol to be enclosed in ""
<SeepingN>
that's a goddamn ridiculous thing to do
<Radar>
ElderFain: Yes, I agree too.
ta_ has quit [Ping timeout: 260 seconds]
<SeepingN>
:"my symbol" ?? do people really do that just to use spaces?
<ElderFain>
meh. but then if you did that, you get :blah_blah for some input and :"blah # blah"
<Radar>
SeepingN: Welcome to Ruby where the syntax is made up and the points don't matter.
<SeepingN>
hehehe
<SeepingN>
better than PHP
koooge has joined #ruby
<ElderFain>
for other input. thats not great because sometimes your spaces are _ and sometimes they are actually spaces
<SeepingN>
keep taht in mind
<ElderFain>
SeepingN: I don't always control my inputs. I was just surprised in ruby when my inputs had information missing
<SeepingN>
you'r elucky you have headers. my data usually doesn't..!
<ElderFain>
Radar: thats a compatibility breaking change if its fixed
<Radar>
ElderFain: yup, that's right.
<Radar>
ElderFain: So alternatively, you can add your own converter.
hahuang61 has joined #ruby
<SeepingN>
the question is, why it .to_sym not using the same code that 'header_converters => :symbols' is?
<ElderFain>
SeepingN: thats easy, csv.rb is a stand alone implementation
<ElderFain>
and .to_sym fails on some inputs
Pumukel has quit [Ping timeout: 264 seconds]
<ElderFain>
sorry scratch that last one, I think
<ElderFain>
SeepingN: I'd argue that header_converters SHOULD be just calling ".to_sym"
polysics has joined #ruby
<ElderFain>
but I think h.encode might be doing some more work
<Radar>
"Should" and how it was implemented 11 years ago are two different things
<SeepingN>
right
<SeepingN>
even if it's "broken" or "weird", at least they should be consistent
<ElderFain>
Radar: right, I mean its trivial for me to fix *locally*
asdffff has joined #ruby
<ElderFain>
Radar: does ruby have link on or after type checks ? If you were on Ruby 2.1 give you the old legacy behavior, new code goes to a new behavior (call .to_sym)
<Radar>
"link on or after type checks" ?
<Radar>
What.
<ElderFain>
worlds crossing =)
<ElderFain>
sorry I'm thinking in compiled langauges
<ElderFain>
that have SDKs and so on
RegulationD has quit [Remote host closed the connection]
<ElderFain>
(where its "linked" during compilation)
<Radar>
We don't have that in Ruby-land.
hahuang61 has quit [Ping timeout: 250 seconds]
<ElderFain>
yeah was just trying to think of how to keep compatibility.
<ElderFain>
Radar: Okay so, pretending like I'm silly enough to open a ... ticket/pull request, is there a way to move forward ?
FernandoBasso has quit [Quit: Leaving]
<Radar>
Better off just writing your own converter.
moonythedwarf_ has quit [Ping timeout: 265 seconds]