<jazzonmym111nd>
Thread.new {}, fork {}. they're part of ruby but they're unlikely to be what you want in a webapp.
dminuoso has quit [Ping timeout: 240 seconds]
ramfjord has quit [Ping timeout: 265 seconds]
<jaequery>
Celluloid, i think i need to modify my class to include the Celluloid library
NetSage has quit [Remote host closed the connection]
<jaequery>
which i dont want to do, i want the async to just work anywhere like a helper utility
<jaequery>
so, am i asking for too much? wanting an async library that works for webapp, in a fashion like, async do { .... code .... } ?
<Papierkorb>
jaequery: Use fork{} if you're using a forking webserver or Thread.new{} if you're using a threading webserver. If unsure, fork.
<jaequery>
im using passenger phusion
<Papierkorb>
jaequery: What are you trying to do? For what?
Rickmasta has quit [Quit: My MacBook Pro has gone to sleep. ZZZzzz…]
<jazzonmym111nd>
it forks, and you're gonna collect zombies unless you use Process.wait() at which point you're not async anymore.
<Papierkorb>
Most likely, you'll want to have a worker process outside the webapp anyway.
<jaequery>
just send out emails without blocking the page
NetSage has joined #ruby
<jazzonmym111nd>
in webapps people use sidekiq most of the time.
<jaequery>
yeah i understand sidekiq is what most uses, it's just i wanted something that works in the fashion i described above
<jaequery>
i know im picky but i have a lot of other node.js guys with me asking for same thing
<Papierkorb>
jaequery: What you described above won't work with an external worker
<Papierkorb>
Which is common place to have in Ruby-webdev-land
<eam>
jazzonmym111nd: you can always call wait non-blocking
etetz has joined #ruby
jphase has quit [Remote host closed the connection]
<jaequery>
so, what i asked above is not possible? even for my use case?
zeroDi has quit [Quit: WeeChat 1.5]
jphase has joined #ruby
BrianJ has joined #ruby
<Papierkorb>
jaequery, jazzonmym111nd you can also use Process.detach() to not accumulate zombies
solocshaw has joined #ruby
<jazzonmym111nd>
eam: maybe, i think it will always depend on what the web server will do.
<eam>
or just fork { fork { } }
<Papierkorb>
jaequery: You can fork{}. If you're sure you know about the consequences
elenatanasoiu has joined #ruby
<Papierkorb>
Having a track record of all async jobs ran in a database is actually really nice
RegulationD has quit [Ping timeout: 248 seconds]
<jaequery>
i dont know basedd on what you guys said, im a bit weary on using forks
<Papierkorb>
huh?
<jazzonmym111nd>
fork isn't a good idea imo, especially in a rails app but if your application is small and the web server doesn't kill the fork, it could work. it'd be a shabby solution tbh.
<Papierkorb>
Well, you may have to fix stuff like database connections (if you need that) after forking
<Papierkorb>
jazzonmym111nd: The wanted solution is already shabby anyway
<eam>
any time you fork, flip a coin and maybe your objects with shared state will all get jacked up
JakFrist has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
<jaequery>
so, if i were to use sidekiq, do you think its possible for me to create a helper utility method to do what i want? def async &block ?
JoshS has joined #ruby
<jazzonmym111nd>
yes it's possible.
rcvalle has quit [Quit: rcvalle]
<Papierkorb>
jaequery: No. How do you think would the code inside the block be sent to the worker process?
etetz has quit [Ping timeout: 255 seconds]
<lupine>
well :D
RedNifre_ has joined #ruby
<jazzonmym111nd>
def aysnc(&block); Class.new { include Sidekiq::Worker; def perform(*args); block.call(*args); end; } something like that *might* work.
jphase has quit [Ping timeout: 248 seconds]
<Papierkorb>
Except for completely insane RubyVM::InstructionSequence hacks
<lupine>
or just eval
<lupine>
or, um, what's it called
<Papierkorb>
jazzonmym111nd: Nope.
<lupine>
that insane remote ruby thing
<al2o3-cr>
Frankel
<Papierkorb>
lupine: drb
<lupine>
yeah, that piece of insanity
<Papierkorb>
lupine: But that does RPC, not code distribution
<Papierkorb>
So kinda like JSON-RPC
elenatanasoiu has quit [Ping timeout: 265 seconds]
<lupine>
expect it uses Marshal under the hood, at least from memory
<lupine>
except*
arnonhongklay has quit [Read error: Connection reset by peer]
jshjsh has quit [Ping timeout: 260 seconds]
RedNifre has quit [Ping timeout: 240 seconds]
Rickmasta has joined #ruby
blackmes1 has joined #ruby
solocshaw has quit [Remote host closed the connection]
jenrzzz has quit [Ping timeout: 265 seconds]
<jaequery>
sorry guys, so what was the verdict? was it possible to do or , not possible to do
<jaequery>
i need to head out in a bit so just wanna get some quick closure to this if possible
ninja007 has joined #ruby
jrafanie has joined #ruby
<ninja007>
Hi
<ninja007>
I’m new to Ruby language,
<jazzonmym111nd>
welcome
<ninja007>
and some inherited legacy code here for help:
<ninja007>
if ( name[0] != ?_) ....
arnonhongklay has joined #ruby
<ninja007>
what the ‘?_’ mean?
<ninja007>
should it be something like ‘_’ the single char underbar?
tmtwd has joined #ruby
jenrzzz has joined #ruby
<jazzonmym111nd>
was that code written for ruby 1.8?
<ninja007>
I can guess that it compares the first letter of name variable to underbar char.
arnonhongklay has quit [Remote host closed the connection]
<lupine>
could be rewritten as if name[0] != '_' in ruby1.9
<jaequery>
@jazz, so i take it , what you described is not doable? as per papierkorb said?
<ninja007>
then what does ? in ruby 1.8 mean?
<lupine>
in ruby1.8, anystring[x] returned a fixnum
panpainter has quit [Remote host closed the connection]
JeanCarloMachado has quit [Quit: leaving]
tdy has joined #ruby
JeanCarloMachado has joined #ruby
<lupine>
and ?<anychar> returned a fixnum
<lupine>
those were the bad old days
<jazzonmym111nd>
jaequery: yeah it wouldn't work, because a job class is initialized in a different process responsible for running jobs.
<ninja007>
oh, in 1.8, then name[0] retruns a fixnum instead of char?
<lupine>
yep
<raldu>
is ?<char> construct outdated now? this is the first time I am seeing it, and I couldn't find anything related in the v2 docs.
<lupine>
yeah, I wouldn't use it these days
<lupine>
not least because it confuses new rubyists in a way '_'.ord would not
<ninja007>
and also the ?<char> returns a fixnum too, so the above compare is compare two fixnum,
<jaequery>
oh that is a bummer :(
elenatanasoiu has joined #ruby
jblack has quit [Ping timeout: 265 seconds]
<ninja007>
instead of a real char to char compare, right? :)
nitric has quit [Ping timeout: 272 seconds]
<jazzonmym111nd>
ninja007: right.
<jaequery>
okay, i guess i'll just try sucker punch then
<ninja007>
I’m on a Centos 6 box, and the ruby is still 1.8.7
<jazzonmym111nd>
if you're running on >1.8 now you can just say name[0] == '_'.
<ninja007>
Got it.
arnonhongklay has quit [Ping timeout: 244 seconds]
<ninja007>
the question mark puzzle me — not easy to google it. Thanks a lot to all.
<jazzonmym111nd>
yw
dsea has joined #ruby
<lupine>
only in ruby < 1.9
<lupine>
in modern ruby, ?_ would return '_' it seems
<lupine>
and '_foo'[0] would return '_'
<lupine>
so it still works, just for different reasons
elephants has joined #ruby
<lupine>
is it a perl operator?
AzureStigma has joined #ruby
toretore has quit [Ping timeout: 240 seconds]
UserOO7 has quit [Remote host closed the connection]
elenatanasoiu has quit [Ping timeout: 240 seconds]
gp has quit [Quit: Leaving]
wldcordeiro has quit [Ping timeout: 272 seconds]
LuckyABA has joined #ruby
redpants has joined #ruby
UserOO7 has joined #ruby
nando293921 has joined #ruby
AzureStigma has quit [Client Quit]
astrobunny has quit [Remote host closed the connection]
newbie1 has quit [Ping timeout: 248 seconds]
ruby_ has quit [Remote host closed the connection]
jshjsh has joined #ruby
stamina has joined #ruby
panpainter has joined #ruby
JoshS has quit [Ping timeout: 264 seconds]
duderonomy has quit [Ping timeout: 272 seconds]
dunj3 has quit [Ping timeout: 260 seconds]
ramfjord has joined #ruby
chouhoulis has quit [Ping timeout: 265 seconds]
dunj3 has joined #ruby
ixti has quit [Quit: WeeChat 1.5]
mistermocha has joined #ruby
panpainter has quit [Ping timeout: 255 seconds]
AzureStigma has joined #ruby
Rickmasta has quit [Quit: My MacBook Pro has gone to sleep. ZZZzzz…]
blackmes1 has quit [Ping timeout: 248 seconds]
meinside has joined #ruby
skweek has quit [Ping timeout: 250 seconds]
AzureStigma has quit [Client Quit]
mistermocha has quit [Ping timeout: 255 seconds]
neanderslob has quit [Remote host closed the connection]
mtkd has quit [Ping timeout: 272 seconds]
shinnya has joined #ruby
skweek has joined #ruby
_djbkd has quit [Quit: My people need me...]
Rasi has quit [Ping timeout: 250 seconds]
mtkd has joined #ruby
<havenwood>
lupine: maybe from Smalltalk's $ char literal?
Rasi has joined #ruby
<lupine>
mm, doesn't seem to be a direct perl copy
<ratatine>
Is there a way to do string interpolation referencing a nested hash? Like puts "Value: %{w}" % { a: { w: "one", x: "two"}} ?
Rickmasta has joined #ruby
stamina has quit [Ping timeout: 240 seconds]
LoneHermit has joined #ruby
Moosashi has joined #ruby
solocshaw has joined #ruby
jblack has joined #ruby
<jazzonmym111nd>
ratatine: dont think so. why cant you just say "%{w}" % hash[:a] ?
LoneHermit has quit [Ping timeout: 260 seconds]
dminuoso has joined #ruby
jblack has quit [Ping timeout: 265 seconds]
<ratatine>
jazzonmym111nd, I have a nested hash coming from a rest API. I want to display a form of a subset of the data, grabbing fields from multiple levels. I thought I'd create the form with formtemplate = <<-eos ... and put in all the fields where I want them and just pass the hash to it.
<ratatine>
Would be about the most slick way of rendering out the data in a human readable output.
<jazzonmym111nd>
you could just use pretty print
<ratatine>
Everywhere else I turn people are all "oh use awesome print" but that just does what pp does.
<ratatine>
ugh
<ratatine>
Not you too. ;)
<ratatine>
I don't want to display the whole json document. Jut subsets.
<ratatine>
And I'd like to do so without a massive list of puts statements formatting each line individually and a bunch of each clauses parsing out the nests.
<jazzonmym111nd>
well, String#% won't work with nested hashes like that, unless you are explicit about which subset you want. pretty print works well if you just supply subsets too.
Wolland has quit [Remote host closed the connection]
tubuliferous_ has quit [Ping timeout: 244 seconds]
biberu has joined #ruby
Wolland has joined #ruby
mwlang has quit [Quit: mwlang]
ta_ has joined #ruby
aufi has joined #ruby
claudiuinberlin has joined #ruby
dionysus69 has joined #ruby
tomphp has joined #ruby
rsampaio_ has quit [Ping timeout: 248 seconds]
edwinvdgraaf has joined #ruby
chwbacca has joined #ruby
chwbacca has quit [Client Quit]
yokel has quit [Ping timeout: 240 seconds]
ule has quit [Remote host closed the connection]
arthurnn has quit [Ping timeout: 265 seconds]
tubuliferous_ has joined #ruby
arthurnn has joined #ruby
sai_ has quit [Read error: Connection reset by peer]
sai__ has joined #ruby
antgel has joined #ruby
jblack has joined #ruby
last_staff has quit [Quit: bbl]
priodev has quit [Ping timeout: 265 seconds]
cibs has quit [Ping timeout: 268 seconds]
pawnbox has quit [Remote host closed the connection]
pawnbox has joined #ruby
jblack has quit [Ping timeout: 248 seconds]
Vivekananda has quit [Read error: Connection timed out]
priodev has joined #ruby
panpainter has joined #ruby
pharaoh2 has joined #ruby
Vivekananda has joined #ruby
pawnbox has quit [Ping timeout: 255 seconds]
cibs has joined #ruby
panpainter has quit [Ping timeout: 250 seconds]
pharaoh2 has left #ruby [#ruby]
lyjwdu has joined #ruby
mistermocha has joined #ruby
sai_ has joined #ruby
sai__ has quit [Read error: Connection reset by peer]
blackmes1 has joined #ruby
LoneHerm_ has joined #ruby
Burgestrand has joined #ruby
DoubleMalt has quit [Ping timeout: 264 seconds]
mistermocha has quit [Ping timeout: 265 seconds]
flying has joined #ruby
nofxx has quit [Ping timeout: 244 seconds]
grh has quit [Remote host closed the connection]
nofxx has joined #ruby
blackmes1 has quit [Ping timeout: 265 seconds]
RegulationD has joined #ruby
LoneHerm_ has quit [Ping timeout: 260 seconds]
grh has joined #ruby
RegulationD has quit [Ping timeout: 255 seconds]
nankyokusei has joined #ruby
blackmes1 has joined #ruby
priodev has quit [Ping timeout: 276 seconds]
sai_ has quit [Read error: Connection reset by peer]
sai_ has joined #ruby
priodev has joined #ruby
rgon91 has joined #ruby
tomphp has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
marr has joined #ruby
nankyokusei has quit [Ping timeout: 276 seconds]
andikr has joined #ruby
ocbtec has joined #ruby
koma has joined #ruby
jaequery has joined #ruby
f4cl3y has joined #ruby
sai_ has quit [Read error: Connection reset by peer]
sai__ has joined #ruby
pandaant has joined #ruby
Cohedrin has quit [Quit: My Mac has gone to sleep. ZZZzzz…]
jackjackdripper has quit [Quit: Leaving.]
<naviaa>
Hi all, as a starting programmer i'm interested in pair programming. What resources/articles are a "must-read"? How do I get started?
salut has joined #ruby
ta__ has joined #ruby
ule has joined #ruby
pandaant has quit [Ping timeout: 264 seconds]
err_ok has joined #ruby
ARCADIVS has quit [Quit: ARCADIVS]
<Burgestrand>
naviaa Oh, that's an interesting one. I worked for a company for 5 years that did (almost) exclusively pair program, but unfortunately I'm not aware of any resources around it. I'm assuming you're googling around by yourself, so a keyword that you could expand your search with is "mob programming". It's probably going to give you even more questions though. :)
pandaant has joined #ruby
jaequery has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
<Burgestrand>
naviaa (and frankly this channel is for ruby questions, so it's possible this is a bit off-topic)
<dminuoso>
Burgestrand: I consider programming methodologies to be within the scope of this channel.
ta_ has quit [Ping timeout: 276 seconds]
evidex has joined #ruby
jaequery has joined #ruby
<Burgestrand>
dminuoso Arguably they could be within the scope of all programming channels, or none, I don't make the rules so I'm trying to communicate my uncertainty!
<Burgestrand>
dminuoso But that is good to know. :)
<naviaa>
Burgestrand: thanks for that keyword, never connected that to pair programming :) Is there a channel for pair programming?
ule has quit [Ping timeout: 265 seconds]
<dminuoso>
Burgestrand: As long as you stop discussing "slightly" off-topic stuff when someone brings up a ruby question it doesn't really matter.
<dminuoso>
It's normal in this channel.
<Burgestrand>
dminuoso Yeah, I agree, a programming-related discussion is no worse than a quiet channel.
<Burgestrand>
(and a programming-related meta-discussion, haha)
<apeiros>
your discussion of what's ontopic is offtopic, please move it
<apeiros>
j/k ;-)
<Burgestrand>
;)
ur5us has joined #ruby
<Burgestrand>
naviaa I don't know one! I guess this channel is as good as any. :)
madgen has joined #ruby
griff has joined #ruby
<Burgestrand>
naviaa Thinking on it a bit, I think the best resource I had was practice. Are you searching for resources because you want to pair program with somebody, or just to educate yourself?
robfrawl1y has quit [Ping timeout: 276 seconds]
yokel has joined #ruby
habitullence has joined #ruby
<naviaa>
Burgestrand: both actually. From what i read, pair programming is a wonderful way of exchanging experience. I'd like to try it, but i don't know if i'm good enough, what programs ppl use to engage in pp, and how/where to start.
robfrawley has joined #ruby
ferr has joined #ruby
robfrawley is now known as Guest31347
ule has joined #ruby
sevenfourk has left #ruby [#ruby]
shortCircuit__ has joined #ruby
<shortCircuit__>
hi
pawnbox has joined #ruby
gingray has joined #ruby
f4cl3y has quit [Ping timeout: 272 seconds]
wldcordeiro has quit [Ping timeout: 244 seconds]
pawnbox has quit [Remote host closed the connection]
jaequery has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
pawnbox has joined #ruby
<shortCircuit__>
I have a question, presently, I have an api, which returns a json and the json contains a link to the next page .. now when I had nodejs, I had a promisified method, which would take the page_index as parameter . then after the first call I would have [0..page_num].map(callApi) .. In ruby how do I do this recursive retrival without recursion ? just the same thing , but that everything will be synchronous and no promise
edwinvdgraaf has quit [Ping timeout: 244 seconds]
DoubleMalt has joined #ruby
<apeiros>
shortCircuit__: what do you have so far?
Fire-Dragon-DoL has quit [Ping timeout: 265 seconds]
habitullence_ has joined #ruby
Technodrome has joined #ruby
habitullence has quit [Ping timeout: 265 seconds]
habitullence_ is now known as habitullence
joes has quit [Ping timeout: 265 seconds]
joes has joined #ruby
<Burgestrand>
naviaa It can definitely be a wonderful way of exchanging experience, and there's no experience requirement or "you must know this" part of it. Most people do some form of pair-something in school from working on assignments and whatnot, it's not that much different so it can be quite natural even for the first time.
<rafadc>
naviaa, there is no such thing as good enough for pair programming. We pair some time in our job and the best approach IMHO is getting rid of al those "I'm worthy", "He think's I'm stupid"... as soon as possible :D
<rafadc>
That is just getting in the middle of getting something done
<rafadc>
If you want to self critizice yourself, believe me, you will find a readon.
Fire-Dragon-DoL has joined #ruby
<rafadc>
(reason)
elenatanasoiu has joined #ruby
<Burgestrand>
naviaa It's completely OK to grab a friend, sit yourself behind a computer together and work on a problem without anybody telling you how to work correctly. :)
<Burgestrand>
s/yourself/yourselves/
tomphp has joined #ruby
<naviaa>
Thanks for the encouraging words :) I don't work in an environment where can (pair) program. Is there a site where ppl go to start or coordinate to pair program?
f4cl3y has joined #ruby
ohcibi has quit [Remote host closed the connection]
edwinvdgraaf has joined #ruby
ohcibi has joined #ruby
habitullence_ has joined #ruby
<naviaa>
i.e. i don't have friends which whom i can pair-program.
habitullence has quit [Ping timeout: 244 seconds]
habitullence_ is now known as habitullence
<Burgestrand>
naviaa I'd recommend programming meetups, if there are any in your city, you ought to be able to find somebody there that don't mind pairing.
jaiks has joined #ruby
<Burgestrand>
There's probably online tools for pairing too, but frankly I'm not too keen on remote pairing. To me the communication part about it is very important, and in-person communication has less friction than remote
<Burgestrand>
(you can very much still pair program online if you want to, that last part is a very subjective personal preference)
CloCkWeRX has quit [Ping timeout: 272 seconds]
mistermocha has joined #ruby
habitullence_ has joined #ruby
madgen has quit [Ping timeout: 265 seconds]
habitullence has quit [Ping timeout: 264 seconds]
habitullence_ is now known as habitullence
johnmccabe has quit [Quit: My Mac has gone to sleep. ZZZzzz…]
<naviaa>
Burgestrand: I think i'll try it nevertheless, thanks for the warning though. The easiest way to share a dev environment i know of is a shared tmux/dtach session over ssh. Is that the preferred way in your experience?
madgen has joined #ruby
etetz has joined #ruby
edwinvdgraaf has quit [Read error: Connection reset by peer]
stamina has joined #ruby
edwinvdgraaf has joined #ruby
LoneHermit has joined #ruby
mistermocha has quit [Ping timeout: 248 seconds]
claudiuinberlin has quit []
habitullence has quit [Ping timeout: 244 seconds]
jaiks has quit [Ping timeout: 255 seconds]
habitullence has joined #ruby
<Burgestrand>
naviaa Yeah, that'd probably do just fine, and then have some way of audio/video communication in a side-channel (e.g. Skype, Google Hangouts, Discord). Remote pairing does have increased risk of both people accidentally trying to type at the same time :)
Burgestrand has quit [Quit: My Mac has gone to sleep. ZZZzzz…]
etetz has quit [Ping timeout: 240 seconds]
slackbotgz has joined #ruby
LoneHermit has quit [Ping timeout: 248 seconds]
<naviaa>
thanks for the pointers and encouraging words, i hope to dip my feet in the pp pool soon.
jaiks has joined #ruby
jaiks has quit [Remote host closed the connection]
zacstewart has quit [Read error: Connection reset by peer]
zacstewart has joined #ruby
Dimik has quit [Ping timeout: 240 seconds]
<rafadc>
shaed tmux is nice but I found the learning curve very steep for a lot of people. To be honest in my company we just share screen using hangouts and don't switch to much from driver to copilot
<rafadc>
(to much/ too much)
jaiks has joined #ruby
madgen has quit [Ping timeout: 240 seconds]
<naviaa>
rafadc: does that mean you git push/pull everytime you do switch?
TomyWork has joined #ruby
madgen has joined #ruby
Burgestrand has joined #ruby
evidex has quit [Remote host closed the connection]
evidex has joined #ruby
braincras has quit [Ping timeout: 250 seconds]
ropeney has quit [Ping timeout: 265 seconds]
jaruga___ has joined #ruby
jaruga___ is now known as jaruga_____
jaiks has quit [Ping timeout: 255 seconds]
sandelius has joined #ruby
sonikspin has joined #ruby
sandelius has quit [Client Quit]
serard has joined #ruby
sai__ has quit [Read error: Connection reset by peer]
<serard>
Hello
sai_ has joined #ruby
jblack has joined #ruby
braincrash has joined #ruby
nadir has quit [Quit: Connection closed for inactivity]
astrobunny has quit [Remote host closed the connection]
bauruine has joined #ruby
jblack has quit [Ping timeout: 264 seconds]
braincrash has quit [Ping timeout: 265 seconds]
slackbotgz has quit [Remote host closed the connection]
jaiks has joined #ruby
braincrash has joined #ruby
dminuoso_ has joined #ruby
dminuoso has quit [Ping timeout: 250 seconds]
JeanCarloMachado has joined #ruby
blackmes1 has quit [Ping timeout: 265 seconds]
<rafadc>
no, just when we change. that is why we don't do it so often. We rebase our branches before merging to master to keep story readable so a couple of commits there make no harm
* shortCircuit__
is back
<shortCircuit__>
apeiros I will write and get back
aurelien has joined #ruby
ledestin has joined #ruby
nikivi has joined #ruby
koooge has quit [Quit: Leaving...]
postmodern has quit [Quit: Leaving]
panpainter has joined #ruby
rgon910 has joined #ruby
rgon91 has quit [Quit: Page closed]
olblak has quit [Ping timeout: 250 seconds]
rgon910 is now known as rgon91
braincrash has quit [Ping timeout: 248 seconds]
lifeai has joined #ruby
braincrash has joined #ruby
panpainter has quit [Ping timeout: 248 seconds]
mistermocha has joined #ruby
nofxx has quit [Remote host closed the connection]
panpainter has joined #ruby
nikivi has quit [Quit: irc]
Hyuk has joined #ruby
mistermocha has quit [Ping timeout: 248 seconds]
evidex has quit [Remote host closed the connection]
panpainter has quit [Ping timeout: 250 seconds]
evidex has joined #ruby
claudiuinberlin has joined #ruby
RegulationD has joined #ruby
serard has quit [Read error: Connection reset by peer]
ur5us has quit [Read error: Connection reset by peer]
olblak has joined #ruby
toretore has joined #ruby
RegulationD has quit [Ping timeout: 265 seconds]
nankyokusei has joined #ruby
braincrash has quit [Ping timeout: 244 seconds]
braincrash has joined #ruby
madgen_ has joined #ruby
madgen has quit [Ping timeout: 244 seconds]
connor_goodwolf has quit [Ping timeout: 244 seconds]
rtl has quit [Ping timeout: 244 seconds]
connor_goodwolf has joined #ruby
Liothen has quit [Ping timeout: 244 seconds]
Liothen has joined #ruby
nankyokusei has quit [Ping timeout: 250 seconds]
rtl has joined #ruby
sepp2k has joined #ruby
zacstewart has quit [Read error: Connection reset by peer]
zacstewart has joined #ruby
madgen_ has quit [Ping timeout: 276 seconds]
craigp has quit [Ping timeout: 240 seconds]
madgen has joined #ruby
jazzonmym111nd has quit [Ping timeout: 276 seconds]
claudiuinberlin has quit [Remote host closed the connection]
claudiuinberlin has joined #ruby
Guest49142 has joined #ruby
<Guest49142>
hi
drbrain has quit [Ping timeout: 240 seconds]
cdown has quit [Remote host closed the connection]
<Guest49142>
i have arr = [ {}, {}, {a,"b"=>["1","2"]}....{}] how do i access all hashesd where "b"[0] => "1"
<apeiros>
Guest49142: arr.select { |hash| …test your hash here… }
duncannz has quit [Remote host closed the connection]
drbrain has joined #ruby
drbrain has quit [Changing host]
drbrain has joined #ruby
blackgoat has joined #ruby
claudiuinberlin has quit [Remote host closed the connection]
blackmes1 has joined #ruby
<Guest49142>
apeiros: yeah. my question is more about how do i check "first" element of "b" ??
<Guest49142>
that specific part only?
<Guest49142>
i am doing this for google map api json["results"][0]["address_components"].select { |x| x["types"][0] == ["administrative_area_level_1"]} which do not work
<Guest49142>
that x["types"][0] is wrong.
<apeiros>
how do you figure that that's the part which is wrong?
<shortCircuit__>
I don't think ruby does any tail call optimization .. not sure
<dminuoso_>
shortCircuit__: Ruby has the capability, and it can be enabled.
<dminuoso_>
shortCircuit__: Look at RubyVM::InstructionSequence.compile_option
<shortCircuit__>
ow .. ok . but can it be done without that .. and will tail call optimization be helpful in this case
erlingur has joined #ruby
<mobile>
lazy stuff?
<shortCircuit__>
yeah lazy stuff
<dminuoso_>
shortCircuit__: Word of advice, use public_send over send every time.
<mobile>
instead of recursion
<shortCircuit__>
ok
<shortCircuit__>
the @config is an openstruct
Puffball has quit [Remote host closed the connection]
<shortCircuit__>
mobile , I understand, but how
<mobile>
I don't know further. i just started to learn ruby
<shortCircuit__>
ah .. same here
<shortCircuit__>
:D
<mobile>
maybe there's lazy thing.
<dminuoso_>
shortCircuit__: The thing about send is that it lets you call private/protected methods and thus breaking encapsulation. You should never want this, so by using public_send you sign the class invariant contract.
<dminuoso_>
shortCircuit__: And prove that you are not peaking into a classes implementation.
jazzonmym111nd has quit [Ping timeout: 272 seconds]
johnmilton has quit [Remote host closed the connection]
Guest49142 has quit [Quit: leaving]
madgen has quit [Ping timeout: 240 seconds]
Macaveli has joined #ruby
madgen has joined #ruby
giz|work has quit [Ping timeout: 250 seconds]
jblack has quit [Ping timeout: 265 seconds]
braincrash has quit [Ping timeout: 244 seconds]
sai_ has quit [Read error: Connection reset by peer]
raeoks has joined #ruby
sai_ has joined #ruby
claudiuinberlin has quit [Remote host closed the connection]
AndrewIsHere has quit [Ping timeout: 250 seconds]
spectrum has joined #ruby
arnonhon_ has quit [Remote host closed the connection]
Burgestrand has quit [Quit: My Mac has gone to sleep. ZZZzzz…]
gnufied has quit [Ping timeout: 250 seconds]
Hyuk has joined #ruby
Wolland has quit []
phone_ has quit [Quit: Leaving]
ichkv1 has quit [Remote host closed the connection]
Chair has joined #ruby
raeoks has quit [Ping timeout: 276 seconds]
hanmac has joined #ruby
Chair is now known as Couch
Snowy has quit [Remote host closed the connection]
panpainter has joined #ruby
dviola has joined #ruby
panpainter has quit [Ping timeout: 244 seconds]
matp has quit [Remote host closed the connection]
matp has joined #ruby
madgen_ has joined #ruby
binaryplease has joined #ruby
<shmulik>
hi guys, who know 3des encryption ?
nuck has quit [Ping timeout: 264 seconds]
madgen has quit [Ping timeout: 265 seconds]
<shmulik>
i need to change padding method from pcks5 to iso9797-1
singleorigin has joined #ruby
<elomatreb>
shmulik: Why are you using 3DES anyway?
d10n-work has joined #ruby
singleorigin has quit [Client Quit]
marchelzo has joined #ruby
<marchelzo>
hello
incog has joined #ruby
braincrash has joined #ruby
Tempesta has joined #ruby
nuck has joined #ruby
nuck is now known as Guest29441
<shmulik>
for encrypt user data in gsm ota message
<shmulik>
elomatreb for encrypt user data in gsm ota message
lifeai has quit [Ping timeout: 248 seconds]
incog has quit [Changing host]
incog has joined #ruby
<marchelzo>
say you have an array of paths, some of which may refer to non-existing files. how do you get an array of strings containing the contents of all of the existing files?
<marchelzo>
without filtering the array by checking whether the files exist
saneax is now known as saneax-_-|AFK
jsrn__ has joined #ruby
braincrash has quit [Ping timeout: 250 seconds]
<marchelzo>
no ruby rockstars around?
<elomatreb>
marchelzo: array_of_paths.map {|p| File.open(p).read } or something in that nature
jsrn_ has quit [Ping timeout: 248 seconds]
<marchelzo>
elomatreb: won't that throw an exception if one of the files doesn't exist?
<elomatreb>
Probably. You could use a guarding rescue clause to handle that
<marchelzo>
what would that look like
<elomatreb>
So: array_of_paths.map {|p| File.open(p).read rescue WhateverExceptionThisThrows }
<elomatreb>
The array would then contain nil for those paths where the files do not exist
<marchelzo>
now what happens if it throws?
<marchelzo>
oh
<marchelzo>
is rescue used a lot in idiomatic ruby code?
<elomatreb>
Rescue yes, guarding rescue (with the rescue after the code) not so much, because you can't to proper handling
<marchelzo>
is non-guarding rescue just like 'catch' is other languages?
jshjsh has joined #ruby
<elomatreb>
Basically yes. begin ... <some code> ... rescue ExceptionClass => e ... <handle e> ... end
mistermocha has joined #ruby
<elomatreb>
A guarding rescue is equivalent to this, with the "handle e" part just returning nil
braincrash has joined #ruby
<marchelzo>
i see
Tempesta has quit [Quit: See ya!]
gingray has quit [Ping timeout: 272 seconds]
Dysp has joined #ruby
JoshS has quit [Ping timeout: 265 seconds]
<Dysp>
Hi there.
<marchelzo>
elomatreb: how do you when it's appropriate to return nil vs. throwing an exception
<marchelzo>
e.g., [1, 2, 3][100] yields nil, as does 'test'[100], but it would seem equally logical for them to throw.
<Dysp>
I need some advice on how to overcome a problem. I need to do a rolling average. How would you guys do that? I cannot wrap my head around it.
<marchelzo>
whats a rolling average?
<elomatreb>
marchelzo: A generally accepted rule of thumb is to only raise exceptions if it actually is an error condition, whereas nil is used where it is an acceptable value indicating nothing
<marchelzo>
why do you have 5 numbers but end up with 3?
yeticry has quit [Ping timeout: 265 seconds]
<Dysp>
elomatreb: Beautiful!
johnmilton has joined #ruby
<elomatreb>
Enumerable is a really nice module, actually worth reading the docs for it just for methods like this one
<Dysp>
marchelzo: If you have a big array of data and you want to find the highest data point, you could just do array.max. But what if the data range contains invalid data points where there is an abnormal high max value? To assess this you can do a rolling average over maybe 10 numbers.
yeticry has joined #ruby
rafadc_ has joined #ruby
<Dysp>
In that case you 'normalize' the fluctation and can easier find a proper max value.
<Dysp>
Did that make sense?
cdown has quit [Ping timeout: 265 seconds]
<marchelzo>
and then you take the max of the rolling averages?
Hyuk has quit [Ping timeout: 265 seconds]
<Dysp>
Exactly
RegulationD has quit [Ping timeout: 240 seconds]
<Dysp>
:)
<marchelzo>
ok, sure.
<marchelzo>
so in your first example, you omitted the 4.5 (i guess it was part of the "etc.")
pwnd_nsfw` has joined #ruby
<marchelzo>
its omission confused me, but i see what you mean now
<marchelzo>
each_cons is very neat. i'm going to steal it.
ropeney has joined #ruby
ropeney has quit [Client Quit]
nankyokusei has joined #ruby
<Dysp>
Yeah.
<Dysp>
Steal away!
<marchelzo>
elomatreb: do you ever wish that something that returns nil threw an exception or vice versa?
sai_ has quit [Read error: Connection reset by peer]
sai__ has joined #ruby
rafadc has quit [Ping timeout: 272 seconds]
nadir has joined #ruby
pwnd_nsfw has quit [Ping timeout: 250 seconds]
sai__ has quit [Read error: Connection reset by peer]
<elomatreb>
marchelzo: Me personally not too often, but I'm reasonably sure it's definitely a thing that happens
ctp has joined #ruby
ctp has quit [Client Quit]
sai_ has joined #ruby
<marchelzo>
i'm working on a programming language, and i'm really unsure of how to design the built-in functions and standard library interfaces
<marchelzo>
exceptions vs. nil vs. some kind of sum type like Some(x)/None
nankyokusei has quit [Ping timeout: 244 seconds]
<marchelzo>
having everything return Optional values is super cumbersome when you know that it won't fail, but makes it easier to chain potentially-failing operations together
<elomatreb>
An example from ActiveRecord (Rails) for the Ruby conventions (not rules!) is the `find` method. Regular find just returns nil if there is no match, whereas `find!` will raise
redpants has joined #ruby
blackmes1 has joined #ruby
evidex has quit [Ping timeout: 255 seconds]
<marchelzo>
interesting
negatifze has quit [Quit: negatifze]
jazzonmym111nd has joined #ruby
erlingur has quit [Quit: WeeChat 1.5]
erlingur has joined #ruby
claudiuinberlin has joined #ruby
newbie1 has joined #ruby
blackmes1 has quit [Ping timeout: 264 seconds]
jeffreylevesque_ has quit [Ping timeout: 265 seconds]
claudiui_ has joined #ruby
claudiuinberlin has quit [Read error: Connection reset by peer]
jazzonmym111nd has quit [Ping timeout: 265 seconds]
gnufied has joined #ruby
p0p0pr37_ has joined #ruby
<incog>
freenode is spying on you: Head over to #antispammeta @ freenode & type ;investigate & your usual nick to see a snitchbot spam your info
erlingur has quit [Quit: WeeChat 1.5]
erlingur has joined #ruby
p0p0pr37 has quit [Ping timeout: 265 seconds]
p0p0pr37_ is now known as p0p0pr37
erlingur has quit [Client Quit]
erlingur has joined #ruby
GinoManWorks has joined #ruby
fmcgeough has joined #ruby
hakunin has joined #ruby
hakunin has quit [Remote host closed the connection]
jmignault has joined #ruby
hakunin has joined #ruby
blackmes1 has joined #ruby
Silthias has quit [Ping timeout: 255 seconds]
rafadc_ has quit [Remote host closed the connection]
incog has quit [K-Lined]
erlingur has quit [Client Quit]
petercooper has joined #ruby
hakunin_ has joined #ruby
erlingur has joined #ruby
tectonic has joined #ruby
hakunin has quit [Ping timeout: 240 seconds]
lncog has joined #ruby
lncog has quit [K-Lined]
lncog has joined #ruby
dsea11 has joined #ruby
lncog has quit [K-Lined]
DoubleMalt has quit [Ping timeout: 248 seconds]
hakunin_ has quit [Ping timeout: 248 seconds]
jeffreylevesque has joined #ruby
Robtop__ has joined #ruby
dsea has quit [Ping timeout: 248 seconds]
Silthias has joined #ruby
tyang has joined #ruby
binaryplease has quit [Ping timeout: 276 seconds]
JoshS has joined #ruby
bsrd has quit [Quit: WeeChat 1.5]
bsrd has joined #ruby
DoubleMalt has joined #ruby
madgen_ has quit [Ping timeout: 244 seconds]
pwnd_nsfw` has quit [Ping timeout: 272 seconds]
jshjsh has quit [Ping timeout: 255 seconds]
SteenJobs has joined #ruby
sepp2k has quit [Quit: Leaving.]
chouhoulis has joined #ruby
blackmes1 has quit [Ping timeout: 240 seconds]
pavshn has joined #ruby
erlingur has quit [Quit: WeeChat 1.5]
sai__ has joined #ruby
last_staff has quit [Quit: makes like a tree]
soulisson has joined #ruby
soulisson has quit [Quit: Quitte]
sai_ has quit [Read error: Connection reset by peer]
tlaxkit has quit [Read error: Connection reset by peer]
cdown has joined #ruby
chouhoulis has quit [Remote host closed the connection]
pavshn has quit [Client Quit]
tlaxkit has joined #ruby
chouhoulis has joined #ruby
eljimmy has joined #ruby
Zamyatin has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
wethu has quit [Quit: This computer has gone to sleep]
mistermocha has joined #ruby
the_drow has quit [Quit: Leaving]
pragmaticus has joined #ruby
tyang has quit [Ping timeout: 255 seconds]
arnonhongklay has joined #ruby
tlaxkit has quit [Remote host closed the connection]
tlaxkit has joined #ruby
the_drow has joined #ruby
SteenJobs has quit [Quit: SteenJobs]
LoneHermit has joined #ruby
mistermocha has quit [Ping timeout: 248 seconds]
alfiemax has quit [Ping timeout: 240 seconds]
csk has joined #ruby
newbie1 has quit [Ping timeout: 255 seconds]
hmnhf has joined #ruby
xemehc has joined #ruby
LoneHermit has quit [Ping timeout: 240 seconds]
jshjsh has joined #ruby
jblack has joined #ruby
synthroid has joined #ruby
tubuliferous_ has quit [Ping timeout: 248 seconds]
newbie1 has joined #ruby
JoshS has quit [Ping timeout: 255 seconds]
blackgoat has quit [Quit: WeeChat 1.5]
fredlinhares1 has joined #ruby
<apeiros>
marchelzo: it doesn't look like ruby?
jblack has quit [Ping timeout: 265 seconds]
wlanboy has quit [Ping timeout: 264 seconds]
<dminuoso_>
apeiros: It doesn't even parse in Ruby.
bsrd has quit [Quit: WeeChat 1.5]
marchelzo has quit [Ping timeout: 255 seconds]
<gener1c>
how do i do continuose unit testing in ruby?
<gener1c>
i wanna tdd a little
JakFrist has joined #ruby
renger has joined #ruby
<gener1c>
do i use rspec or unit/test and what do i run em with?
redpants has quit [Ping timeout: 244 seconds]
renger has left #ruby [#ruby]
<gener1c>
test/unit*
<dminuoso_>
gener1c: An example could be github/travis
<gener1c>
yeah well travis is online
<gener1c>
i want to tdd
wlanboy has joined #ruby
<gener1c>
or test before i push
<gener1c>
if you want
<gener1c>
i can just run watch rubyscript
marchelzo has joined #ruby
<gener1c>
for the test/unit
<gener1c>
but i assume there is something more fitting than my homebrew hack
<elomatreb>
apeiros, dminuoso_: marchelzo said earlier they were designing their own language and wanted to take some inspiration from Ruby
<canton7>
gener1c, then follow tdd. Have a test suite. When writing a unit, write the test first. Run it. Make sure it fails. Write the unit. Make sure the test passes. Commit
<canton7>
doesn't really matter what unit test framework you use
<dminuoso_>
elomatreb: Ah.
<gener1c>
and waht about a watchdog
<gener1c>
so the test will run only on something i have changed and not the whole thing canton7
<dminuoso_>
gener1c: travis ci lets you automate build/tests on each commit.
<gener1c>
yeah but thats server side i mean dev side
cdg has joined #ruby
<gener1c>
i can write a commit hook
<canton7>
gener1c, why would you need that? you should be able to run your whole test suite in a few seconds, or you can usually specify a particular class of tests to run
shinnya has joined #ruby
AndrewIsHere has joined #ruby
<apeiros>
elomatreb: aha
<canton7>
having the test suite run automatically sounds like a PITA - it'll run when you're in the middle of changing something, and see a syntax error (because you haven't finished typing) as a test failure
<gener1c>
canton7: because i want to focus on the unit im developing canton7 and not the whole class
<dminuoso_>
gener1c: You can also use branches properly then.
<canton7>
gener1c, tell your test runner to just run that unit's tests, then
<dminuoso_>
gener1c: keep a development branch where you push (and let travis ci integration do its magic)
<dminuoso_>
gener1c: and then rebase/merge into a master/release branch
symm- has joined #ruby
<canton7>
gener1c, but a bunch of passing tests is fine - your test suite will give details about failures (which you care about), and passes (which you don't, really)
<canton7>
so having a bunch of passes for other units isn't an issue
JeanCarloMachado has quit [Ping timeout: 260 seconds]
antgel has quit [Ping timeout: 260 seconds]
<dminuoso>
In a Ruby world without public/protected/private inheritance, it's probably better to hide away a Base classes internals anyway..
<dminuoso>
What do you think?
mistermocha has quit [Ping timeout: 260 seconds]
<dminuoso>
Though the moment add is called, then @foo is defined even for Derived.
bjmllr has quit [Client Quit]
RegulationD has joined #ruby
bjmllr has joined #ruby
coolboy has joined #ruby
arnonhongklay has quit [Read error: Connection reset by peer]
arnonhongklay has joined #ruby
madgen_ has quit [Ping timeout: 265 seconds]
madgen has joined #ruby
sandelius has joined #ruby
lifted has joined #ruby
jsrn__ has quit [Quit: Leaving]
nankyokusei has joined #ruby
tlaxkit has quit [Quit: tlaxkit]
newbie1 has quit [Ping timeout: 240 seconds]
sai__ has joined #ruby
tubuliferous_ has joined #ruby
Zingo has joined #ruby
karmatr0n has quit [Ping timeout: 260 seconds]
nankyokusei has quit [Ping timeout: 244 seconds]
blackmes1 has quit [Ping timeout: 255 seconds]
marchelzo has quit [Ping timeout: 265 seconds]
Zingo has quit [Client Quit]
sandelius has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
hakunin has quit [Remote host closed the connection]
bmurt has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
hakunin has joined #ruby
hakunin has quit [Ping timeout: 244 seconds]
JoshS has quit [Ping timeout: 240 seconds]
JeanCarloMachado has joined #ruby
cdg has joined #ruby
jphase is now known as jphase-werk
polishdub has joined #ruby
arnonhongklay has quit [Ping timeout: 244 seconds]
Snowy has quit [Read error: Connection reset by peer]
tomphp has quit [Ping timeout: 248 seconds]
uwjbvg has quit [Read error: Connection reset by peer]
jenrzzz has joined #ruby
jenrzzz has joined #ruby
jenrzzz has quit [Changing host]
Snowy has joined #ruby
arnonhongklay has joined #ruby
dinoangelov has quit [Quit: (null)]
fly5566 has quit [Ping timeout: 244 seconds]
tyang has joined #ruby
aegis3121 has quit [Ping timeout: 272 seconds]
danielius has joined #ruby
tyang has quit [Read error: Connection reset by peer]
tubuliferous_ has quit [Ping timeout: 265 seconds]
Couch has quit [Ping timeout: 240 seconds]
karmatr0n has joined #ruby
pwnd_nsfw` has joined #ruby
lifted has quit [Ping timeout: 265 seconds]
f4cl3y has quit [Ping timeout: 272 seconds]
JeanCarloMachado has quit [Quit: leaving]
JeanCarloMachado has joined #ruby
SteenJobs has quit [Quit: SteenJobs]
madgen has quit [Read error: Connection reset by peer]
jrozner has joined #ruby
Robtop__ has quit [Ping timeout: 248 seconds]
ledestin has quit [Quit: My Mac has gone to sleep. ZZZzzz…]
jphase-werk is now known as jphase
lifted has joined #ruby
claudiui_ has quit []
rodfersou is now known as rodfersou|lunch
Sashimi has joined #ruby
DroidBurgundy has joined #ruby
blaxter has quit [Quit: foo]
Macaveli has joined #ruby
madgen has joined #ruby
arnonhongklay has quit [Read error: Connection reset by peer]
arnonhon_ has joined #ruby
h0ffmann has joined #ruby
saneax is now known as saneax-_-|AFK
johnmccabe has quit [Ping timeout: 250 seconds]
tyang has joined #ruby
<jokke>
hello
madgen has quit [Ping timeout: 240 seconds]
xemehc has quit [Quit: ZZZzzz…]
<jokke>
can someone help me out with yard? i tried the @!macro definition and i think it's very cool but i miss being able to customize the output of the macro sometimes. is this at all possible?
madgen has joined #ruby
jenrzzz has quit [Ping timeout: 265 seconds]
ninja007 has quit [Quit: ninja007]
pwnd_nsfw has joined #ruby
stamina has quit [Ping timeout: 244 seconds]
pwnd_nsfw` has quit [Ping timeout: 250 seconds]
jaruga_____ has quit [Quit: jaruga_____]
JoshS has joined #ruby
finisherr has quit [Quit: finisherr]
jenrzzz has joined #ruby
jenrzzz has quit [Changing host]
jenrzzz has joined #ruby
madgen_ has joined #ruby
bjh13 has joined #ruby
SteenJobs has joined #ruby
danielius has quit [Ping timeout: 260 seconds]
madgen has quit [Ping timeout: 240 seconds]
<salut>
clear
<salut>
sorry
JoshS has quit [Ping timeout: 265 seconds]
hakunin has joined #ruby
jrozner has quit [Ping timeout: 244 seconds]
pwnd_nsfw` has joined #ruby
grul has joined #ruby
Pumukel has quit [Remote host closed the connection]
hk238 has joined #ruby
jrozner has joined #ruby
sarkis has joined #ruby
pwnd_nsfw has quit [Ping timeout: 250 seconds]
mistermocha has joined #ruby
Zamyatin has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
arnonhon_ has quit [Ping timeout: 244 seconds]
grul has left #ruby ["Leaving"]
cdown has quit [Ping timeout: 265 seconds]
arnonhongklay has joined #ruby
zacstewart has quit [Read error: Connection reset by peer]
aegis3121 has joined #ruby
grh has joined #ruby
blackmes1 has joined #ruby
the_drow has quit [Quit: This computer has gone to sleep]
panpainter has quit []
mtkd has quit [Ping timeout: 244 seconds]
LoneHermit has joined #ruby
RedNifre has quit [Ping timeout: 260 seconds]
mistermocha has quit [Ping timeout: 248 seconds]
mtkd has joined #ruby
flying has quit []
RedNifre has joined #ruby
Snowy has quit [Quit: ragequit]
nitric has joined #ruby
marchelzo has joined #ruby
FastJack has quit [Read error: Connection reset by peer]
LoneHermit has quit [Ping timeout: 244 seconds]
FastJack has joined #ruby
cdg has quit [Remote host closed the connection]
DaniG2k has joined #ruby
cdown has joined #ruby
<DaniG2k>
hello all. I'm trying to make a really simple gem but am getting an error when trying to require it from irb
<DaniG2k>
LoadError: cannot load such file -- korean_name
<DaniG2k>
its a super simple gem right now, just trying to get it up and running
hakunin has quit [Remote host closed the connection]
<DaniG2k>
i ran bundle install, I have a korean_name.gemspec file and a korean_name-0.1.0.gem file
nettoweb has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
blackwind_123 has quit [Quit: Easy as 3.14159265358979323846...]
<chris2>
or use :_ or something
<bmurt>
hey ya'll, question for ya.. im using the aws ruby sdk (specifically ec2's describe_key_pairs and create_key_pair, but when a key isn't found in the query or if there's a duplicate key, i get one of two exceptions: Aws::EC2::Errors::InvalidKeyPairNotFound and Aws::EC2::Errors::InvalidKeyPairDuplicate respectively. how can i get this to "retry" vs hit the exception and exit
<kx>
yeah, probably better to avoid future wtfs
nettoweb has joined #ruby
Guest40_ has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
johnmilton has joined #ruby
nettoweb has quit [Max SendQ exceeded]
SteenJobs has quit [Quit: SteenJobs]
<JeanCarloMachado>
cler
<JeanCarloMachado>
sorry :P
nettoweb has joined #ruby
ta_ has quit [Remote host closed the connection]
jmignault has joined #ruby
nettoweb has quit [Max SendQ exceeded]
marxarelli is now known as marxarelli|afk
negatifze has quit [Quit: negatifze]
marxarelli|afk is now known as marxarelli
JoshS has joined #ruby
negatifze has joined #ruby
nettoweb has joined #ruby
claudiuinberlin has joined #ruby
cdown_ has joined #ruby
ramfjord has joined #ruby
Xiti has joined #ruby
cdown_ has quit [Remote host closed the connection]
hakunin has joined #ruby
elastix has joined #ruby
anisha has quit [Quit: This computer has gone to sleep]
babblebre has joined #ruby
Vingador has joined #ruby
marxarelli has quit [Quit: My Mac has gone to sleep. ZZZzzz…]
Nahra` has quit [Quit: ERC (IRC client for Emacs 24.5.1)]
chouhoulis has joined #ruby
mistermocha has joined #ruby
JeanCarloMachado has quit [Ping timeout: 240 seconds]
<baweaver>
If you use a Hash instead you can treat it like an array and intercept anything that returns :* to return an object with == defined that'll always be true.
ramfjord has quit [Ping timeout: 240 seconds]
fmcgeough has quit [Quit: fmcgeough]
<baweaver>
Hashes are really freakishly powerful, especially when you combine with lambdas
<dminuoso>
Don't see a way how I could use the safe navigation operator to get rid off that ||
<baweaver>
I'll change it up a bit later to be like a deep select instead
<baweaver>
but the gist of it is that it abuses the fact that lambdas can be called with :[]
sai_ has quit [Remote host closed the connection]
postmodern has joined #ruby
blackgoat has joined #ruby
tomphp has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
<arup_r>
I am writing a little wrapper of Stripe for my own project use. https://gist.github.com/aruprakshit/c38182c1861dd03bdf7d3b3122e40026 So what I don't like is `_load` . I have to do it like that, because there is a 2 way we can stripe subscription object with subscription_id or without ( when it is the first one ). Any idea how can I improve the Subscription class?
_djbkd has quit [Remote host closed the connection]
_djbkd has joined #ruby
<baweaver>
Just inline it in the initialize
<baweaver>
also customer.customer?
<arup_r>
ok, but I need to comment on the code to tell others how it works. Is that fine?
<baweaver>
Yeah
<baweaver>
that's a good reason to use comments
lel has joined #ruby
negatifze has quit [Quit: negatifze]
<baweaver>
anything that's not immediately apparent should probably have a comment explaining so
<arup_r>
hm. ok feels like I becoming a programmer .. thanks baweaver :D
indefiniteloop has joined #ruby
<baweaver>
all things in time arup_r
<arup_r>
hmm customer.customer i didn't notice.. that is ugly too
<baweaver>
Might call it something like stripe_customer instead
fullofca_ has quit [Remote host closed the connection]
<baweaver>
it's a bit towards Hungarian notation, but I find it nice to be able to quickly find what's mine and what's not.
tubuliferous_ has quit [Ping timeout: 248 seconds]
gizmore has joined #ruby
<arup_r>
you mean the local variable or the attr_reader?
<dminuoso>
arup_r: also remove that silly underscore :)
blackgoat has quit [Quit: WeeChat 1.5]
_djbkd has quit [Ping timeout: 244 seconds]
pawnbox has quit [Remote host closed the connection]
<dminuoso>
arup_r: It's private, people can't call it anyway without intentionally breaking encapsulation.
<baweaver>
Anything that references a literal stripe customer object
<baweaver>
but send is so much fun :D
jeffreylevesque has quit [Ping timeout: 260 seconds]
elephants has quit [Quit: Leaving...]
ninja007 has quit [Quit: ninja007]
hightower2 has quit [Ping timeout: 276 seconds]
claudiuinberlin has joined #ruby
<baweaver>
anyways, the reason I'd do that is so whenever errors come in it's pretty clear that it's a stripe_customer object that's causing the error instead of my implementation of it.
Biciato has quit [Ping timeout: 240 seconds]
<baweaver>
Though this may also be a good use for SimpleDelegator or Forwardable
<baweaver>
that way it can just pass through all methods to the stripe object by default except for what you override in the class.
hutch34 has quit [Ping timeout: 265 seconds]
<arup_r>
yeah, I can see what you mean. So should I rewrite ? :)
<JackMc>
Hey, I'm trying to decrypt a Blowfish string with an IV, key, and some ciphertext. I have not much knowledge about this text other than that I have some Python code that can decrypt it.
fullofcaffeine has joined #ruby
<JackMc>
I want to get it working in Ruby, but the OpenSSL module with a shit ton of different settings doesn't seem to work.
<ruby[bot]>
JackMc: we in #ruby do not like irccloud.com, it has no syntax highlighting, distracting formatting and loads slowly for most. Please use https://gist.github.com
<baweaver>
naggy bot is naggy
<adam12>
lol
<JackMc>
It does have syntax highlighting though mr bot
claw has quit [Quit: No Ping reply in 180 seconds.]
fullofcaffeine has quit [Ping timeout: 272 seconds]
last_staff has quit [Quit: last_staff]
bousquet has joined #ruby
claw has joined #ruby
claudiuinberlin has joined #ruby
miqlas-H has joined #ruby
Moosashi has quit [Quit: Moosashi]
ur5us has quit [Read error: Connection reset by peer]
ur5us has joined #ruby
Dimik has joined #ruby
<dminuoso>
JackMc: So before we start chasing different problems. What problems did you experience?
nando293921 has joined #ruby
dionysus69 has quit [Ping timeout: 265 seconds]
LoneHerm_ has joined #ruby
ur5us_ has joined #ruby
ur5us has quit [Read error: Connection reset by peer]
fullofcaffeine has joined #ruby
Lildirt has quit [Quit: Leb wohl, meine Freunde. Ich wünsche Ihnen das beste von Tagen.]
<JackMc>
dminuoso: tried things like encoding everything and combinations thereof into ASCII ("data size not multiple of block size"), change padding to 0 (garbage output), running stuff like .pack("H*") on the data (misaligns it), reconverting to Unicode at the end (no change)
Lildirt has joined #ruby
chouhoulis has joined #ruby
fredlinhares1 has quit [Quit: WeeChat 1.4]
<dminuoso>
JackMc: Alright. So let's start with the data you have.
Lildirt has quit [Client Quit]
<dminuoso>
JackMc: Im seeing URI parsing and forced encodings, and after 8 hours you've probably arrived at the "I'll just try things until this works" - so I'm curious about the original form of the data.
LoneHerm_ has quit [Ping timeout: 240 seconds]
gizmore has quit [Remote host closed the connection]
fullofca_ has quit [Ping timeout: 260 seconds]
chouhoul_ has quit [Ping timeout: 244 seconds]
<JackMc>
The URI parsing is cause this stuff actually comes from a web app - but I feed the output of that URI parse into the python and it succeeds
Moosashi has joined #ruby
indefiniteloop has quit [Remote host closed the connection]
_djbkd has joined #ruby
<JackMc>
But the person gave me three numbers: an IV (12345678), a key (16 characters) and after receiving output from the app it gave me a blowfish encrypted blob
chouhoulis has quit [Ping timeout: 240 seconds]
<dminuoso>
JackMc: Alright.
<dminuoso>
JackMc: Im curious, how do you set the key?
<JackMc>
The unencrypted data looks like IP=blah USER=blah2 OTHERINFO=blah3
<dminuoso>
Sad panda, I was more hoping for your credit card details.
<dminuoso>
But fine.
xemehc has quit [Quit: ZZZzzz…]
<JackMc>
The cipher.key = "notthekey" above is doing that I think
<dminuoso>
JackMc: Curious because I'm getting exceptions on the key length there.
jmignault has joined #ruby
<dminuoso>
JackMc: Though based on your snippets, you naughty. You forgot to initialize your cipher as a decrypt cipher!
<dminuoso>
22:48 < JackMc> Oh plus irb(main):011:0> cipher = OpenSSL::Cipher.new('bf-cbc')
skweek has joined #ruby
<dminuoso>
It should be cipher = OpenSSL::Cipher.new('bf-cbc').decrypt
<JackMc>
Yeah it's actually a 16 character string. I can DM it to you cause the resultant data isn't actually sensitive (a UUID and an IP)
ur5us_ has quit [Read error: Connection reset by peer]
<dminuoso>
That explains it. :-)
<JackMc>
Yeah I did that in my actual code unfortunately:(
<dminuoso>
JackMc: You can send it to me via DM if you like.
stamina has quit [Ping timeout: 244 seconds]
ur5us has joined #ruby
teclator has quit [Ping timeout: 240 seconds]
miqlas-H has quit [Quit: Vision[0.9.7-H-20140108]: i've been blurred!]
BLuEGoD has quit [Ping timeout: 265 seconds]
teclator has joined #ruby
xemehc has joined #ruby
Guest26977 has quit [Quit: Page closed]
ngscheurich has quit [Quit: WeeChat 1.2]
h0ffmann has quit [Ping timeout: 255 seconds]
aesthetikx has joined #ruby
jenrzzz has quit [Ping timeout: 265 seconds]
malconis has quit [Quit: My MacBook Pro has gone to sleep. ZZZzzz…]
madgen_ has quit [Quit: Lost terminal]
<dminuoso>
JackMc: Let's get some things out of the way:
<dminuoso>
JackMc: force endocing these first two strings to ascii is not necessary
<dminuoso>
The reason is even though they are UTF8 strings, they are using the ascii compatible set, so their codepoints will be ascii codepoints still.
flying has quit []
ledestin has joined #ruby
incog has quit [Remote host closed the connection]
KlinedByAVirgin has joined #ruby
KlinedByAVirgin has quit [Client Quit]
ramortegui has quit [Quit: Ex-Chat]
ur5us_ has joined #ruby
theOneWho has joined #ruby
ur5us has quit [Read error: Connection reset by peer]
ChiefAlexander has quit [Quit: Leaving...]
marciol has quit [Ping timeout: 244 seconds]
filtered has joined #ruby
[Butch] has quit [Quit: I'm out . . .]
xemehc has quit [Quit: ZZZzzz…]
aryaching has quit [Ping timeout: 265 seconds]
ur5us_ has quit [Client Quit]
claudiuinberlin has quit []
filtered has quit [Read error: Connection reset by peer]
blackgoat has joined #ruby
filtered has joined #ruby
fullofcaffeine has quit [Read error: Connection reset by peer]
<dminuoso>
JackMc: Im really unsure where the problem is. IV could be wrong, key could be wrong, or the data is not interpreted correctly here
bmurt has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
allcentury has quit [Ping timeout: 255 seconds]
arnonhongklay has joined #ruby
toretore has quit [Ping timeout: 265 seconds]
aesthetikx has quit [Quit: WeeChat 1.4]
ninja007 has joined #ruby
cloaked1 has joined #ruby
cloaked1 has quit [Changing host]
cloaked1 has joined #ruby
arnonhongklay has quit [Remote host closed the connection]
lucast has quit [Ping timeout: 240 seconds]
lucast has joined #ruby
sonikspin has quit [Ping timeout: 250 seconds]
gdonald has joined #ruby
kirun has quit [Quit: Konversation terminated!]
Blaguvest has quit [Read error: Connection reset by peer]
xemehc has joined #ruby
Renich has quit [Quit: leaving]
domgetter has joined #ruby
nofxx has joined #ruby
genpaku has quit [Ping timeout: 255 seconds]
domgetter has quit [Client Quit]
solocshaw has joined #ruby
ninja007 has quit [Quit: ninja007]
whathappens has quit [Remote host closed the connection]
whathappens has joined #ruby
gdonald has quit []
wldcordeiro has quit [Ping timeout: 276 seconds]
ninja007 has joined #ruby
whathappens has quit [Read error: Connection reset by peer]
whathappens has joined #ruby
xemehc has quit [Quit: ZZZzzz…]
ta_ has quit [Remote host closed the connection]
arnonhongklay has joined #ruby
marxarelli is now known as marxarelli|afk
pragmaticus has quit [Remote host closed the connection]
arnonhongklay has quit [Remote host closed the connection]
Guest40 has joined #ruby
Guest40 has quit [Client Quit]
d10n-work has quit [Quit: Connection closed for inactivity]
arnonhongklay has joined #ruby
sarkis has quit [Quit: WeeChat 1.5]
Guest40 has joined #ruby
mistermocha has joined #ruby
tomphp has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
LemonJuice has quit [Quit: Leaving]
LoneHermit has joined #ruby
xemehc has joined #ruby
bodgix has joined #ruby
mistermocha has quit [Ping timeout: 250 seconds]
NetSage has joined #ruby
allcentu1 has quit [Ping timeout: 255 seconds]
<JackMc>
Thanks so much for your help dminuoso <3
<JackMc>
Sorry I had to dip out - family called
arnonhongklay has quit [Ping timeout: 276 seconds]
<bodgix>
Hi. I'm testing the main/entry script with rspec. How can I stub a global method? I've tried expect(Module).to receive and expect_any_instance_of(Module).to receive but they didn't work
skweek has quit [Ping timeout: 248 seconds]
<baweaver>
define global method
pragmaticus has joined #ruby
<baweaver>
you could always do a `p self.class` to see where it's binding.
nankyokusei has joined #ruby
LoneHermit has quit [Ping timeout: 240 seconds]
dminuoso has quit [Ping timeout: 264 seconds]
moei has joined #ruby
weaksauce has joined #ruby
biberu has quit []
ur5us has quit [Read error: Connection reset by peer]
ur5us has joined #ruby
coolboy has quit [Ping timeout: 248 seconds]
Ishido has quit [Quit: Roads? Where We're Going We Don't Need Roads.]
loincloth has quit [Remote host closed the connection]
arnonhongklay has joined #ruby
_sfiguser has quit [Ping timeout: 250 seconds]
nankyokusei has quit [Ping timeout: 240 seconds]
justinweiss has quit [Quit: Connection closed for inactivity]
<bodgix>
global as in defined outside of all modules with def in the script.rb file
xemehc has quit [Quit: ZZZzzz…]
<baweaver>
probably Kernel then
jphase has quit [Ping timeout: 240 seconds]
blackgoat has quit [Quit: WeeChat 1.5]
<baweaver>
do the self.class thing from above to be sure.
loincloth has joined #ruby
<bodgix>
tried expect(Kernel) and expect_any_instance_of(Kernel) but didn't work
<bodgix>
fwiw I could stub puts in the same spec file by expect_any_instance_ok(Kernel).to receive(:puts)
JeanCarloMachado has quit [Ping timeout: 240 seconds]
<baweaver>
self.class
<baweaver>
find that
Ebok has joined #ruby
loincloth has quit [Remote host closed the connection]
<bodgix>
good point.: Object
arnonhongklay has quit [Ping timeout: 265 seconds]
wethu has joined #ruby
<baweaver>
Try that then
grh has quit [Ping timeout: 272 seconds]
<bodgix>
thanks baweaver. It worked
<bodgix>
Don't know why I thought it was a Module. Seemed to make more sense
* baweaver
shrugs
<baweaver>
who knows.
jeffreylevesque has joined #ruby
ninja007 has quit [Quit: ninja007]
claw has quit [Ping timeout: 244 seconds]
ninja007 has joined #ruby
nikivi has joined #ruby
aryaching has joined #ruby
claw has joined #ruby
incog has quit [Read error: Connection reset by peer]
hightower2 has joined #ruby
aesthetikx has joined #ruby
jmignault has quit [Ping timeout: 265 seconds]
_sfiguser has joined #ruby
unreal has joined #ruby
SteenJobs has quit [Quit: SteenJobs]
wldcordeiro has joined #ruby
solocshaw has quit [Remote host closed the connection]
patrick99e99 has joined #ruby
LuckyABA has quit [Quit: My MacBook Pro has gone to sleep. ZZZzzz…]
LuckyABA has joined #ruby
<patrick99e99>
hey everyone.. I am trying to install 2.2.5 via rvm, but I keep getting dyld: Symbol not found: _clock_gettime
<patrick99e99>
it also says Libraries missing for ruby-2.2.5: /usr/local/opt/gmp/lib/libgmp.10.dylib. Refer to your system manual for installing libraries
aegis3121 has quit [Ping timeout: 255 seconds]
<havenwood>
patrick99e99: which OS/distro?
<patrick99e99>
mac os x, 10.11.6
Xeago has quit [Ping timeout: 265 seconds]
elenatanasoiu has quit [Ping timeout: 276 seconds]
cloaked1 has quit [Quit: leaving]
<havenwood>
patrick99e99: try?: brew install gmp
<patrick99e99>
havenwood: ahh.. thank you! works now.
<ruby-lang873>
O great Ruby wizards - I pose a hopefully simple Ruby question which your 'umble narrator cannot solve thus far.
<ruby-lang873>
The method is: # Determine the percent byte usage # def percent_bytes(fs_info) (100.0 - (100.0 * fs_info.bytes_free / fs_info.bytes_total)).round(2) end
loincloth has quit [Ping timeout: 264 seconds]
elenatanasoiu has quit [Ping timeout: 244 seconds]
<ruby-lang873>
It always returns a fractional part. I want to truncate it. If I replace the round(2) with trunc, I get NaN "not-a-number" errors. Help O Great Ruby gurus.
arnonhongklay has quit [Remote host closed the connection]
nettoweb has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
marr has quit [Ping timeout: 272 seconds]
babblebre has quit [Quit: Connection closed for inactivity]
whathappens has quit [Quit: Leaving...]
ruby-lang873 has quit [Ping timeout: 240 seconds]
jeffreylevesque has joined #ruby
BackEndCoder has quit [Excess Flood]
BackEndCoder has joined #ruby
theOneWho has quit [Read error: Connection reset by peer]
nikivi has quit [Quit: irc]
theOneWho has joined #ruby
grill has joined #ruby
<grill>
is this a hash or an array? {:level=>"1", :stardust_cost=>"200", :candy_cost=>"1", :total_powerups=>"1", :total_stardust=>"200", :total_candy=>"1"}