tjohnson has quit [Quit: Connection closed for inactivity]
idefine has quit [Remote host closed the connection]
idefine has joined #ruby
robbyoconnor has joined #ruby
s2013 has joined #ruby
Brklyn has quit [Ping timeout: 245 seconds]
pawnbox has joined #ruby
devgiant has quit [Quit: Leaving]
solocshaw has quit [Ping timeout: 240 seconds]
<Darmani>
Ox0dea - Bro, so the next part of my learning involves web scraping and http get/post blah blah blah..
<Ox0dea>
Darmani: Excellent!
<Darmani>
Is there like... An easy way to understand it? Or like... a tutorial you would recommend?
<Ox0dea>
Darmani: Get your toes dirty.
<Ox0dea>
Dip your hands in.
<Darmani>
Should I be using a specific gem for this stuff??
robbyoconnor has quit [Remote host closed the connection]
<Darmani>
TALK TO ME
<Ox0dea>
Go over to your browser and press F12.
<Darmani>
I don't trust you.
tildes has quit [Ping timeout: 245 seconds]
<Darmani>
What will that do? Lol
<Ox0dea>
Explosions.
tildes has joined #ruby
<Darmani>
Oh the web inspector?
<Ox0dea>
Yeah!
<Ox0dea>
That sure sounds like it might come in handy for inspecting the Web, eh?
Ishido has quit [Quit: Roads? Where We're Going We Don't Need Roads.]
<Darmani>
I guess... I want to understand the code though
<Ox0dea>
Er... what code?
<Darmani>
Ox0dea - Do you ever do web scraping? What gems do you use?
hogetaro has quit [Ping timeout: 276 seconds]
pawnbox has quit [Ping timeout: 245 seconds]
<Ox0dea>
Darmani: I scrape now and again, and the data's uniform enough that a sharp enough regex and judicious use of Ruby's massive standard library tends to suffice.
<Radar>
Darmani: Mechanize is good for that.
<Darmani>
Right... Because you're Ox0dea and you can do that. Lol
<Ox0dea>
Darmani: I wasn't born Ox0dea.
<Ox0dea>
No, wait.
<Darmani>
Radar - Thanks breh
cdg has quit [Remote host closed the connection]
<Radar>
no worries breh
<Ox0dea>
Mechanize is Dreamweaver.
firstdayonthejob has quit [Ping timeout: 256 seconds]
<Darmani>
I'll be back. I need to write out some shitt
h99h9h88 has joined #ruby
<Darmani>
I'll show it to you later
<Darmani>
if you care to see it xP
<Ox0dea>
Spare us! We don't deserve this.
<Ox0dea>
<3
<Darmani>
wat
grayjedi has joined #ruby
rikkipitt has quit [Quit: Leaving...]
RegulationD has quit [Remote host closed the connection]
RegulationD has joined #ruby
mjuszczak has joined #ruby
robbyoconnor has joined #ruby
visudo has quit [Quit: visudo]
dseitz has joined #ruby
h99h9h88 has quit [Ping timeout: 245 seconds]
cicloid has joined #ruby
RegulationD has quit [Ping timeout: 245 seconds]
TomPeed has quit [Quit: My Mac has gone to sleep. ZZZzzz…]
kirillzh has quit [Quit: My Mac has gone to sleep. ZZZzzz…]
TomPeed has joined #ruby
User458764 has quit [Quit: My iMac has gone to sleep. ZZZzzz…]
<Darmani>
Ox0dea - noob question...
idefine has quit [Remote host closed the connection]
<Darmani>
ehhhh
<Darmani>
never mind.
TomPeed has quit [Client Quit]
TomPeed has joined #ruby
kirillzh has joined #ruby
nettoweb has joined #ruby
tomchapin has quit [Quit: My Mac has gone to sleep. ZZZzzz…]
visudo has joined #ruby
s2013 has quit [Quit: My Mac has gone to sleep. ZZZzzz…]
charliesome has joined #ruby
ElFerna has joined #ruby
visudo has quit [Client Quit]
diegoviola has joined #ruby
workmad3 has joined #ruby
ecksit_ has joined #ruby
ecksit_ has quit [Max SendQ exceeded]
TomPeed has quit [Quit: My Mac has gone to sleep. ZZZzzz…]
ecksit_ has joined #ruby
northfurr has joined #ruby
pdoherty has joined #ruby
griffindy has joined #ruby
drocsid has quit [Quit: leaving]
ecksit has quit [Ping timeout: 264 seconds]
pawnbox has joined #ruby
northfurr has quit [Client Quit]
visudo has joined #ruby
workmad3_ has joined #ruby
Musashi007 has joined #ruby
visudo has quit [Client Quit]
pawnbox has quit [Ping timeout: 264 seconds]
nerium has quit [Quit: nerium]
workmad3 has quit [Ping timeout: 272 seconds]
grayjedi has quit [Quit: WeeChat 1.4]
Ebok has quit [Quit: My Mac has gone to sleep. ZZZzzz…]
TomPeed has joined #ruby
sftrabbit has quit [Quit: sftrabbit]
symm- has joined #ruby
RegulationD has joined #ruby
TomPeed has quit [Ping timeout: 260 seconds]
kent\n has joined #ruby
triangles has quit [Read error: Connection reset by peer]
<kent\n>
Are there any good type constraint systems for ruby? I really can't seem to find anything.
<drbrain>
kent\n: no
s2013 has joined #ruby
<drbrain>
there are some projects that add it via DSL, but nothing I would consider "good"
<kent\n>
I don't need something as fancy as a DSL, I would be perfectly complacent with having to do Type::PositiveInt.assert( value ) or something as a stop-gap until some nicer syntax came around
<drbrain>
ruby 3 is supposed to have optional types
<drbrain>
yeah, there have been a few projects like that, but I'm not sure if any of those are maintained these days
<kent\n>
I found a handful referenced on Google, but they all 404'd when I followed the links :(
<drbrain>
yeah
<drbrain>
it's pretty easy to roll your own, though
AustinMatherne has quit [Remote host closed the connection]
<drbrain>
raise TypeError unless Integer === value
moeabdol1 has quit [Quit: WeeChat 1.4]
AustinMatherne has joined #ruby
SCHAAP137 has quit [Ping timeout: 264 seconds]
flughafen has quit [Ping timeout: 264 seconds]
<drbrain>
could wrap that up in a method
<kent\n>
doodle has place in its code where /passing/ a type constraint could be useful, but its currently implemented in such a way you're forced to write a "do" block for every constraint.
workmad3 has joined #ruby
moeabdol has joined #ruby
<drbrain>
You can also make an object that implements #=== to have custom types
s2013 has quit [Quit: My Mac has gone to sleep. ZZZzzz…]
<Ox0dea>
kent\n: It's the best Ruby has in this space, I'm pretty sure.
<Ox0dea>
And it's really quite good if you're hell-bent on shoehorning type safety into your Ruby code.
jgpawletko has joined #ruby
mjuszczak has quit []
snockerton has quit [Quit: Leaving.]
<kent\n>
For things like constructors and accessors, I've found that does really help a lot. I wouldn't use it literally everywhere, but knowing things are broken before the side effect of being broken occurs is *great*
kirillzh has quit [Quit: My Mac has gone to sleep. ZZZzzz…]
h99h9h88 has quit [Remote host closed the connection]
<kent\n>
x.set(y) <lots of stuff happens> x.foo() internally reads y => Bang, stack trace not of any kind of help.
Mutter has joined #ruby
<kent\n>
though mutable state does open that bag of problems on its own. >:)
<Ox0dea>
You sound like you're being forced to learn Ruby. :<
symm- has quit [Quit: Leaving...]
Sucks has joined #ruby
oivoodoo has joined #ruby
<kent\n>
More I have an unusual way of learning things. I've done ruby before and my knowledge largely rusted to the point I forgot how to write classes.
flughafen has joined #ruby
yoongkang has joined #ruby
<kent\n>
I /kinda/ am being forced to learn ruby, but I'm forcing me ;)
pawnbox has joined #ruby
B1n4r10 has quit [Ping timeout: 272 seconds]
mfb2 has quit [Remote host closed the connection]
maneco has joined #ruby
<kent\n>
but years of using Moose in Perl has lead me to see the value of this strategy in the right places, and I'm trying to port my "mental set of things that works for me" to the new context.
Snowy has quit []
Liquid-- has quit [Quit: Computer has gone to sleep.]
karapetyan has joined #ruby
maneco has quit [Client Quit]
mrsolo_ has joined #ruby
<kent\n>
but the last time I did anything serious in ruby, 2.0 was still a pipe dream that might never arrive, and _why was still active.
<kent\n>
catchup sucks :(
oivoodoo has quit [Ping timeout: 256 seconds]
RobertBirnie has quit [Quit: My MacBook Pro has gone to sleep. ZZZzzz…]
TheDracle has quit [Quit: This computer has gone to sleep]
<Ox0dea>
Welcome back. ^_^
spider-mario has quit [Remote host closed the connection]
Mutter has quit [Remote host closed the connection]
<kent\n>
Ox0dea: you don't happen to know why the "On github" links on that page all 404? :/
<Ox0dea>
kent\n: GitHub is down.
skcin7 has quit [Ping timeout: 250 seconds]
<kent\n>
OH. I guess this is a bad time to not be paying a lot of attention to the error messages. XD
<kent\n>
bad programmer, no cookie.
<Ox0dea>
?cookie kent\n
<ruby[bot]>
kent\n: here's your cookie:
<Ox0dea>
For to motivations.
<kent\n>
Ox0dea++ :)
mfb2 has joined #ruby
Ox0dea is now known as Ox0deb
skcin7 has joined #ruby
stannard has joined #ruby
jottr has quit [Ping timeout: 264 seconds]
themsay2 has joined #ruby
themsay2 has quit [Read error: Connection reset by peer]
aryaching has joined #ruby
marr has quit [Ping timeout: 250 seconds]
volty has quit [Quit: Konversation terminated!]
x77686d has quit [Quit: x77686d]
themsay has quit [Ping timeout: 272 seconds]
cschneid_ has joined #ruby
wilbert_ has quit [Ping timeout: 272 seconds]
PlasmaStar has joined #ruby
ellistaa has joined #ruby
charliesome has quit [Quit: My MacBook Pro has gone to sleep. ZZZzzz…]
baweaver has quit [Remote host closed the connection]
<ellistaa>
what approach would you use to find the most common prefix in a long string?
Emmanuel_Chanel has quit [Ping timeout: 250 seconds]
mfb2 has quit [Remote host closed the connection]
ModusPwnens has joined #ruby
h99h9h88 has joined #ruby
zeroDivisible has quit [Quit: WeeChat 1.3]
BrunoSaboia has quit [Ping timeout: 250 seconds]
<Ox0deb>
ellistaa: You might need to provide your understanding of the term.
<ModusPwnens>
If I have BigDecimal.new('100.5'), how do I convert that to a string where I require two digits after the decimal point? Is there a cleaner solution than this? http://stackoverflow.com/a/32845911
<ellistaa>
im working on a problem that says find longest prefix in an array of strings.
mfb2 has joined #ruby
<ModusPwnens>
I've read the BigDecimal docs but I can't find a way to do this without doing something wonky like the linked answer, or something equally wonky.
h99h9h88 has quit [Remote host closed the connection]
h99h9h88 has joined #ruby
atomical has joined #ruby
blackmesa has joined #ruby
jottr has joined #ruby
sakix has joined #ruby
h99h9h88 has quit [Ping timeout: 245 seconds]
atomical_ has joined #ruby
maneco has joined #ruby
Sucks has quit [Read error: Connection reset by peer]
Sucks has joined #ruby
babblebre has quit [Quit: Connection closed for inactivity]
gbgdev has quit [Remote host closed the connection]
Emmanuel_Chanel has joined #ruby
atomical has quit [Ping timeout: 245 seconds]
Sucks has quit [Remote host closed the connection]
Sucks has joined #ruby
Ebok has joined #ruby
<bnagy>
ellistaa: google 'longest common subsequence'
kent\n has quit [Remote host closed the connection]
pawnbox has joined #ruby
baweaver has joined #ruby
<bnagy>
there are a bunch of approaches of varying complexity, but it's a Hard problem
charliesome has joined #ruby
<bnagy>
although making it a prefix makes it a lot easier
charliesome has quit [Read error: Connection reset by peer]
<Ox0deb>
ModusPwnens: Looks like there's nothin' doin'. :<
<Ox0deb>
I think it makes sense for BigDecimal's formatting to be more focused on digit clusters, frankly.
<ModusPwnens>
I'm not familiar with that expression..
<drbrain>
ModusPwnens: it seems the accepted answer plus the comments underneath it are the best way
<Ox0deb>
It'd be wonky to support both digit clustering and precision in BigDecimal#to_s, and it seems they favored the more appropriate use case.
pawnbox has quit [Ping timeout: 250 seconds]
kirillzh has joined #ruby
ElFerna has quit [Ping timeout: 264 seconds]
ziyadb has quit [Quit: Connection closed for inactivity]
<ModusPwnens>
That's unsatisfying. I really wish there was a better way. It makes me nervous to do something like this for a financial application.
charliesome has joined #ruby
<Ox0deb>
Store currency in the lowest denomination; no units is best units.
ElFerna has joined #ruby
Ebok has quit [Quit: My Mac has gone to sleep. ZZZzzz…]
yqt has quit [Ping timeout: 260 seconds]
snguyen has joined #ruby
ellistaa has quit [Quit: ellistaa]
<eam>
ModusPwnens: it seems like exactly what you want -- to avoid math in base 2
Musashi007 has quit [Quit: Musashi007]
<eam>
fwiw this issue is not unique to ruby
dfockler has joined #ruby
ellistaa has joined #ruby
Ebok has joined #ruby
<Ox0deb>
ModusPwnens: Kudos to you for having reservations here, but then why not take that all the way and prefer 10050 over BigDecimal.new('100.5')?
<mg^>
The Klass.inherited(Subclass) hook appears to be called before everything in class << self...end is evaluated in Subclass. Am I correct?
B1n4r10 has joined #ruby
<ModusPwnens>
Ox0deb: Can't you also represent currency correctly using decimals? I know you're gonna have a bad time if you try to use floats to store currency, but can't you use both decimals and integers to handle currency properly?
<ellistaa>
bnagy: yeah my solution is like n^2
dstarh has joined #ruby
<Ox0deb>
ModusPwnens: Certainly, but I trust the simplicity of the powers of 10 slightly more than all the fanciness going on under the hood to support arbitrary precision.
devbug has quit [Ping timeout: 260 seconds]
<Ox0deb>
mg^: Put `TracePoint.new { |tp| p tp }.enable` at the top of your script. :)
<bnagy>
I think it's worth clearly separating two problems -> "make the string "4.2" into "4.20"" and "handle currency correctly"
<bnagy>
because 4.20 as a number is nonsense
<mg^>
I'll write that down and do it tomorrow
IronD has joined #ruby
Ebok has quit [Quit: My Mac has gone to sleep. ZZZzzz…]
hxegon has quit [Ping timeout: 250 seconds]
solocshaw has joined #ruby
IronDicideth has quit [Ping timeout: 265 seconds]
Ebok has joined #ruby
<ModusPwnens>
bnagy: Why is that nonsense?
mrdomino has left #ruby [#ruby]
<bnagy>
because the number is 4.2
<ModusPwnens>
Ox0deb: And yes. But to answer your question, the reason that I'm not representing it as an integer is because this is a client and our services represent them using BigDecimals.
<bnagy>
right padding with zeros is to make columns line up, it has nothing to do with arithmetic
Guest86744 is now known as saneax
<ModusPwnens>
bnagy: Agreed that it has nothing to do with arithmetic, but why does that make it nonsense?
joonty has joined #ruby
<bnagy>
as a number it is nonsense. It is like calling 000 a number
<ModusPwnens>
bnagy: I suppose that's true, but I want '4.20' which is a string, so as a string it's not nonsense. :/
<bnagy>
and conflating presentation with values leads to pain
<eam>
well, the real problem here is that 4.2 is presentation as well
<Ox0deb>
>> c = 10050; '%d.%02d' % c.divmod(100) # Just throwing this out there.
<bnagy>
because there will always be fractional units in anything but the most trivial system
pipework has joined #ruby
<Ox0deb>
bnagy: How do you divide a US penny?
<bnagy>
don't be dim
<eam>
if you use a base-2 fractional value there will be some base 10 non-repeating values which cannot be represented (because they form repeating values in the other base)
joonty has quit [Ping timeout: 272 seconds]
<eam>
for example the base 10 value 0.1 cannot be accurately represented in base 2
<ModusPwnens>
eam: Yeah, I'm familiar with the problems of floats. I just wish BigDecimal would preserve precision when calling to_s.
<eam>
ModusPwnens: what you need is a string formatter that operates on BigDecimal natively
<Ox0deb>
Which BigDecimal#to_s does.
<Ox0deb>
It just does digit grouping instead of precision.
<bnagy>
there's no difference in precision between 4.2 and 4.20 only in string length
Sucks has quit [Remote host closed the connection]
nettoweb has quit [Quit: My MacBook Pro has gone to sleep. ZZZzzz…]
visudo has joined #ruby
ModusPwnens_ has joined #ruby
<ModusPwnens_>
lame. I got kicked.
<ModusPwnens_>
or something.
<craysiii>
rvm vs rbenv
<bnagy>
chruby
<eam>
Ox0deb: but to_s "F" converts to Float
<eam>
(or, is that true? does it?)
<ModusPwnens_>
eam: what? to_s("f") converts to float?
usershell has joined #ruby
<eam>
nevermind, to_s "F" should be fine
Sucks has joined #ruby
<Ox0deb>
bnagy: You're right that "precision" isn't quite the right term, but it's become the standard as pertains formatting numbers. That can't be helped.
ellistaa has quit [Quit: ellistaa]
ModusPwnens has quit [Ping timeout: 252 seconds]
<eam>
well, there is a difference in precision between 4.2 and 4.20 in some math contexts
rkazak has joined #ruby
RobertBirnie has joined #ruby
RobertBirnie has quit [Remote host closed the connection]
<hololeap>
i've got a string that is a bunch of 2-digit hex representations of chars like "0a3f2d44". i'm using `hex.scan(/.{2}/).map {|s| s.to_i(16).chr }.join` to convert it to raw data. does anyone know how to accomplish this with String#unpack ?
<hololeap>
but tshark wants to output it as ASCII hex instead of raw data
duderonomy has joined #ruby
<drbrain>
hololeap: ah, yeah, this is exactly what pack/unpack is for
pawnbox has joined #ruby
maletor has joined #ruby
<Ox0deb>
hololeap: Ah, well, there's https://github.com/dmendel/bindata if you're willing to pay the cost of declaring your interface to let the library work its magic.
Jardayn has quit [Quit: Leaving]
ModusPwnens_ has quit [Ping timeout: 252 seconds]
dexter-tzu has joined #ruby
<Ox0deb>
Never mind. Missed that you basically only need H*.
maletor has quit [Read error: Connection reset by peer]
<hololeap>
i doubt i will get it to work since i don't know the encoding format and there aren't any mp3/wav/etc headers
Spleeze has joined #ruby
<hololeap>
but its worth a shot
UtkarshRay has quit [Remote host closed the connection]
<Ox0deb>
$ dd if=/dev/urandom of=/dev/dsp
<Ox0deb>
Great songs on that station.
Azure has joined #ruby
casadei has joined #ruby
<hololeap>
lol
<toretore>
that's how dubstep is made
pawnbox has quit [Ping timeout: 264 seconds]
<hololeap>
its pretty sick. just needs lowpass + reverb
UtkarshRay has joined #ruby
mrsolo_ has quit [Quit: This computer has gone to sleep]
maletor has joined #ruby
colegatron_origi has joined #ruby
s00pcan has quit [Read error: No route to host]
s00pcan_ has joined #ruby
x77686d has joined #ruby
<Darmani>
Ox0dea - Bro, you said the Ruby standard library has all the stuff you need to make a web scraper right? What are those libraries that I should study?
gbgdev has joined #ruby
s00pcan_ has quit [Remote host closed the connection]
<Darmani>
hololeap - Those are in the standard library?
<hololeap>
Darmani: no those are all gems, most of them have docs/wiki on github
jam_ has quit [Remote host closed the connection]
baweaver has quit [Remote host closed the connection]
<Darmani>
hololeap - Ah, okay. Thanks man ^^
<hololeap>
Darmani: the ruby standard library has all the pieces you need, but frankly you'd be re-inventing the wheel a bit
<Darmani>
hololeap - Oh yeah I know. But I'm pretty new to web scraping and I wanted to practice my Ruby skills so I felt it would be a good exercise.
Regulati_ has joined #ruby
symbol_ has joined #ruby
rsc___ has quit [Remote host closed the connection]
ESpiney has joined #ruby
hxegon has quit [Ping timeout: 245 seconds]
_djbkd has joined #ruby
RegulationD has quit [Ping timeout: 240 seconds]
rakm has quit [Quit: My MacBook Pro has gone to sleep. ZZZzzz…]
<hololeap>
Darmani: it depends on how you want to do it, but you will likely need timers/events to throttle your scraper, and the best library i have found for that is celluloid. however, it basically forces you to understand and implement the Actor model which requires studying and outside-the-box thinking
<Darmani>
hololeap - Oh this is my first web scraper... I'm sure I can eventually add more functionality to it. But for now I just want it to work you know? Haha
Bloomer has joined #ruby
<Darmani>
Just like a simple one that finds some data and returns a boolean? Or like a number depending on what I'm searching for lol
<Ox0deb>
So you're just scraping to be scraping...?
<hololeap>
Darmani: mechanize uses nokogiri to parse the html, so that's a good place to start
jackjackdripper1 has quit [Quit: Leaving.]
<Darmani>
Ox0dea - To practice and eventually get better... jerk ._.
<hololeap>
Darmani: you can use xpaths/css paths to navigate and parse the html
<Nilium>
Anyway, don't want to actually get into the haha-you-use-windows-man-you-should-switch thing
idefine has joined #ruby
<Ox0deb>
We wouldn't have to if people didn't.
<Nilium>
I'm in the "you can suffer on your own" camp
skade has joined #ruby
<Nilium>
I don't need to tell them what to do
colegatron_origi has joined #ruby
DarkElement has joined #ruby
<Darmani>
Ox0deb - This is a version of Linux... I think?
<Ox0deb>
Darmani: Slackware? Yeah, but don't actually do that.
<Ox0deb>
Gentoo and Slackware are distros for masochists.
emilford has quit [Ping timeout: 245 seconds]
<DarkElement>
I have a ruby program that spawns child processes to do all it's stuff. How can I detect when they are all completed, i.e. no more ruby processes running on my machine?
<Nilium>
Gentoo and Slackware are for people like me
<Nilium>
Don't be people like me
<Darmani>
Ox0deb - So what am I supposed to do then.....
<Darmani>
Im so confused...
chouhoulis has quit [Remote host closed the connection]
<Ox0deb>
Darmani: Are you married to Windows in any meaningful way?
<Ox0deb>
Office being a hard requirement for something or something?
<Darmani>
No?
f00dMonsta has joined #ruby
<Darmani>
No...
<Nilium>
I'm going to wager the problem is not Windows in this case but you being new to Ruby?
<Ox0deb>
he doesn't have the development tools necessary to install a gem.
<Ox0deb>
He needs Cygwin or the like.
<Nilium>
Ah.
JDiPierro has joined #ruby
<Nilium>
So it's got a shared library in there.
<Ox0deb>
Oui.
<Ox0deb>
Or, well, it wants to build one.
<Darmani>
...
Synthead has quit [Read error: Connection reset by peer]
<Nilium>
Yeah. That's sort of a Windows problem, actually.
Synthead has joined #ruby
<Nilium>
Like, you can get around it, Darmani, but it's a world of pain.
jbrhbr has quit [Quit: Leaving.]
<Nilium>
Considered using an HTTP client that doesn't want a shared library?
Synthead has quit [Max SendQ exceeded]
<Darmani>
wat
Synthead has joined #ruby
emilford has joined #ruby
ElFerna has joined #ruby
<Nilium>
Is the gem you're trying to use required or just one you picked out because of the name?
<DarkElement>
How can I get all ruby processes in terminal
<Nilium>
How do you mean?
<Darmani>
Nilium - It's not required. I'm going through a tutorial on web scraping and it was the one being used in the tutorial and I was trying to follow along...
<Darmani>
And then I ran into the problem I'm faced with now
* Darmani
sighs
<Nilium>
K, you probably need to find a different one.
Ebok has quit [Quit: My Mac has gone to sleep. ZZZzzz…]
underplank has quit [Quit: underplank]
<Nilium>
The one you're trying to use needs to be able to build a shared library (DLL), and very few people writing gems with C extensions assume you're on Windows
skade has quit [Ping timeout: 264 seconds]
<Nilium>
The alternative is that you can just go ahead and grab VirtualBox, run Linux in it, and follow the tutorial there.
<Darmani>
Nilium - Okay... I guess I need to find another gem that does the same thing. But I don't even know what the restclient is for so I need to find out what that does first...
<Nilium>
It's an HTTP client.
<Nilium>
Maybe with some weird special feature
<Darmani>
Nilium - Lol I need to read up on what an http client is.
<Darmani>
Forgive my noobishness T.T
<Nilium>
Look at a URL in your browser
<Nilium>
It probably starts with https:// or http://. HTTP is a protocol.
JDiPierro has quit [Ping timeout: 276 seconds]
ElFerna has quit [Ping timeout: 240 seconds]
skade has joined #ruby
<Darmani>
a protocol...
<Nilium>
Your browser is an HTTP client, it just does things with what it downloads.
<Darmani>
:O
<Darmani>
Really? That's what an HTTP client is?
<Nilium>
An HTTP client is a thing that can send HTTP requests and maybe read HTTP responses
emilford has quit [Ping timeout: 265 seconds]
<Darmani>
That's so cool. I had no idea.
<Nilium>
The browser just does things with the response.
<Nilium>
Which is simplifying a very, very complicated thing.
<Darmani>
So the "restclient" is just like a parser for a code-based http client?
<Darmani>
Ox0deb - I'll use whatever you guys suggest
lessless has joined #ruby
<Radar>
Darmani: Yes it is really easy to setup.
yfeldblum has joined #ruby
* Nilium
won't suggest anything because he's a mean trickster god.
<Nilium>
Ask Nil for advice, boom: you're running plan 9
<Ox0deb>
Where *everything* is a file.
<Nilium>
Which is not a thing I'm opposed to
<Ox0deb>
Plan 9 : files :: Ruby : objects
<Nilium>
But Plan 9 is also very much not happening anymore so I'll just wait for someone else to do it.
<Darmani>
Radar - Well it's downloading... I guess I need an disc-mounter and it should install on it's own?
<Ox0deb>
Darmani: You're gonna have to boot into it.
<Radar>
^
<Ox0deb>
This is the hardest part.
<Nilium>
Darmani: Do you have any other computers?
braincrash has joined #ruby
braincrash is now known as braincras
<Darmani>
like 7 or 8...
dseitz has joined #ruby
<Ox0deb>
Darmani: Do you own an Android phone?
<Darmani>
yeah.
s2013 has joined #ruby
<Nilium>
Probably install it on a different computer than you main one at first.
<Ox0deb>
Darmani: Use DriveDroid.
<Nilium>
Just so you can run through it, 'cause you're probably going to end up wiping your hard drive in the process.
<Ox0deb>
Stop listening to these people.
sakix has quit [Ping timeout: 245 seconds]
<Darmani>
??????????????/
s2013 has quit [Max SendQ exceeded]
<Darmani>
Too many people
<Ox0deb>
You can boot Ubuntu from your phone.
<Darmani>
talking.
Napear has quit [Changing host]
Napear has joined #ruby
<Darmani>
So... boot it from my phone? Ox0deb?
<Ox0deb>
No.
<Radar>
?popcorn
<ruby[bot]>
It's popcorn time!
<lessless>
hello folks! looking for most elegant solution for the following problem: there is a hash {"description"=>"Amazing stuff", "grand_prize"=>"Pinguin's King Crown", "location"=>"North Pole"}, which keys are supposed to be a RoR model attributes (Other class methods). And the task is to gather current values of those attributes which is pretty simple with Hash[*new_values.keys.flat_map { |attr| [attr, draft.public_send(attr)] }] except some keys are not str
<lessless>
ictly mapped to the method names
skade has quit [Ping timeout: 240 seconds]
<Radar>
lessless: input + expected output please.
<lessless>
for example grand_prize should be prize_details
<Nilium>
Also, strike "elegant" and just pick pragmatic.
<Nilium>
Map of keys to method names and just define all of them?
User458764 has quit [Quit: My iMac has gone to sleep. ZZZzzz…]
<Darmani>
Maybe I'll just ask my dad when he gets home. He works for Oracle he should know...
Napear has quit [Quit: leaving]
<Nilium>
You are a terrifying person.
Napear has joined #ruby
<lessless>
Haha, that was good :)
maneco has quit [Quit: maneco]
workmad3 has quit [Ping timeout: 240 seconds]
<Radar>
Darmani comes in tomorrow "Why can't I run Ruby on this Sun system that my dad setup?"
usershel_ has joined #ruby
<hololeap>
jruby
<drbrain>
I don't think there is a solaris maintainer, but maybe for a 1.8 release?
<Ox0deb>
Ha.
<drbrain>
AIX, on the other hand, does have an active maintainer
<Ox0deb>
I've noticed that.
<Darmani>
Radar - Sun system? No I was gonna ask him to help me boot into that Ubuntu download o.o
<drbrain>
so they may just need a better dad
usershell has quit [Ping timeout: 276 seconds]
<drbrain>
I have gathered there's a Japanese company that runs ruby on AIX for doing something rather important
<arup_r>
lessless: Why that big expression, something like model.attributes.slice(attr_names) wouldn't work for you.
<arup_r>
?
zast has left #ruby [#ruby]
<Ox0deb>
Darmani: You just download the ISO, put it on your phone, tell DriveDroid to host it, plug your phone into your computer, reboot, press whatever key to get into your BIOS, tell it to boot from your phone, and you're golden.
<Nilium>
I want a SPARC machine.
<Nilium>
Is that wrong?
<Darmani>
Alrightt. I'm done for today. I'm tired. I'm
<Nilium>
I think it's wrong.
<Darmani>
whoops.
workmad3 has joined #ruby
<Darmani>
Ox0deb - Okay sirr. I will do that tomorrow.
<Darmani>
Goodnight you beautiful people.
<Ox0deb>
Roger, dodger.
<Ox0deb>
<3
<Darmani>
<33
Darmani has quit [Quit: Page closed]
<Nilium>
Ox0deb: So was that just you talking to yourself?
<Ox0deb>
When was that?
<Nilium>
Nothing.
* Nilium
ponders how he could get a SPARC system.
B1n4r10 has quit [Ping timeout: 264 seconds]
jbrhbr has joined #ruby
usershel_ has quit [Remote host closed the connection]
<lessless>
arup_r, some of them are hidden via store_accessors
<lessless>
but thank you for the tip
<lessless>
*hidden behind
rsc___ has quit [Quit: rsc___]
jam_ has joined #ruby
kp666 has joined #ruby
DLSteve has joined #ruby
baweaver has joined #ruby
baweaver has quit [Remote host closed the connection]
<Ox0deb>
drbrain: `hash[*keys] = *values` is pretty much a non-starter, yeah?
baweaver has joined #ruby
<Ox0deb>
It'd be really nice, but Ruby's "lack" of Perl's contexts does seem to make it impossible to get right in the general case.
<drbrain>
yeah, because Hash#[] only takes two arguments
Musashi007 has quit [Quit: Musashi007]
<drbrain>
err, []=
arup_r has quit []
<Ox0deb>
Sure, I was talking about fixing that. :)
jbrhbr has quit [Ping timeout: 260 seconds]
jbrhbr1 has joined #ruby
douglass_ has quit [Ping timeout: 265 seconds]
dcunit3d has joined #ruby
Brklyn has quit [Ping timeout: 265 seconds]
workmad3 has quit [Ping timeout: 240 seconds]
<droptone>
Question: Is there any technology available for porting my Centos-based Ruby 2.2.x code to run on Windows 10?
<droptone>
The web is undecided on a stock solution.
<pantato>
hololeap: that yields "Could not locate Gemfile or .bundle/ directory"
<hololeap>
pantato: just a guess
emilford has quit [Ping timeout: 276 seconds]
youch has quit [Ping timeout: 272 seconds]
<cscheib_>
so... I've got a new environment I need to test my ssh login(s) for, and don't know which login goes with which client... I wanna do a big loop and use net-ssh, try each user/password combo, and return the results as CSV. I'm trying specifically to figure out how to fail a session immediately if the password fails (i.e. only try once) - it keeps popping up a password dialogue instead... anyone know how to ensure auth is only attempted once and then fails
<pantato>
Ox0deb: right gist. i get this if i try installing it
cschneid_ has quit [Remote host closed the connection]
renderfu_ has joined #ruby
<cscheib_>
hololeap: think I may have a solution, but I'll have to track it down a bit further. Looks like openssh has a "batchmode" parameter that I should hopefully be able to pass it
<hololeap>
cscheib_: you could also use a brute-forcing tool like medusa
<lessless>
Guys, another one: give an AR model Location with attributes `region` and `country`, what is the most pragmatic way to return either "#{main_location.region}/#{main_location.country}" if both of them are present or just the one that is isn't nil in other case?
<Radar>
pantato: There we goooo. That's the step you misse.d
<Radar>
pantato: Create one and put this content in it: ruby-2.2.3
<Radar>
then restart your terminal again and I think it might work
<pantato>
what do you mean "put this content in it" ?
workmad3 has quit [Ping timeout: 250 seconds]
<pantato>
like touch .ruby-version/ruby-2.2.3 ?
emilford has joined #ruby
<pantato>
erm
<pantato>
nvm
<harly>
echo 'ruby-2.2.3' > .ruby-version
<pantato>
right.
<pantato>
brain fart
<pantato>
ofmg it's installing it
<pantato>
it's gonna work
<pantato>
sadnasdjklnhj
<Radar>
pantato: Did it work?
<pantato>
yeah but rspec isn't installed yet :P
<pantato>
it did <3 <3 <3
maletor has quit [Quit: Computer has gone to sleep.]
<harly>
progress!
<Radar>
great :)
Puffball has quit [Remote host closed the connection]
<pantato>
IT'S ALIVE!!!
joonty has quit [Ping timeout: 245 seconds]
<Radar>
Another convert to the church of chruby.
<harly>
all praise postmodern
<Radar>
may he live forever (to maintain the project into eternity)
Puffball has joined #ruby
karapetyan has joined #ruby
emilford has quit [Ping timeout: 264 seconds]
<Radar>
Updated that post for 2.3.0 now.
<Radar>
2.2.3 will work just fine.
<havenwood>
Radar: an update to ruby-install 0.6.0 would give it some longevity with versions with: ruby-install --latest ruby
sdothum has quit [Quit: ZNC - 1.6.0 - http://znc.in]
<Radar>
havenwood: oooh
sdothum has joined #ruby
<Radar>
TBH I am totally not offended that these have not become the official guides on how to install on Ubuntu + Mac.
terminalrecluse has quit [Quit: My Mac has gone to sleep. ZZZzzz…]
emilford has joined #ruby
<Radar>
it is done
yoongkang has joined #ruby
anisha_ has joined #ruby
emilford has quit [Ping timeout: 260 seconds]
yoongkang has quit [Ping timeout: 256 seconds]
<hololeap>
i keep telling this kid that he should learn ruby as his first language, but he insists on learning php because there's "more jobs"
karapetyan has quit [Remote host closed the connection]
<baweaver>
Sometimes you let them fall off their cliff, wait for the splat, and yell after them:
<baweaver>
I tooooooooold you soooooooo
emilford has joined #ruby
sdothum has quit [Quit: ZNC - 1.6.0 - http://znc.in]
<hololeap>
or they learn bad programming and never recover
<baweaver>
no language will precent that
<baweaver>
prevent*
Napear has quit [Quit: leaving]
sigurding has quit [Quit: sigurding]
emilford has quit [Ping timeout: 265 seconds]
yfeldblum has quit [Remote host closed the connection]
dasboot has joined #ruby
paradisaeidae has quit [Quit: ChatZilla 0.9.92 [Firefox 44.0/20160123151951]]
<hololeap>
ruby as a first language can teach some bad habits, but not as many as php
wldcordeiro has quit [Ping timeout: 276 seconds]
emilford has joined #ruby
<baweaver>
The only surefire way to teach them right is to have someone with more experience guide them
<baweaver>
past that, they're going to learn bad habits, and that's ok
<hololeap>
yeah
<baweaver>
look back at code you wrote last year
<baweaver>
you'll probably cringe
<hololeap>
i wonder how i would of fared if i had learned haskell as my first language...
<baweaver>
heck, for me it takes maybe a week.
<baweaver>
I was bored once, so I tried an experiment
<baweaver>
I taught various people different starting languages
<baweaver>
Haskell, Java, C#, Ruby, Python, and Scala
<baweaver>
The Java person quit within a day, the C# not long after
<baweaver>
Ruby and Python were decent programmers by the end of it
<baweaver>
Haskell though, that one took off like you wouldn't believe
ur5us has quit [Remote host closed the connection]
<baweaver>
then again he was already a genius so any language I picked would have done the same
<baweaver>
Though I find Java and C# tend to scare people off
<baweaver>
C++ and C as well
<hololeap>
i think that functional programming matches real-life better than imperative programming, but if you start out with imperative it takes some effort to switch your way of thinking
<baweaver>
anyways, long story short it didn't matter the language they started on. If they were good they were good.
emilford has quit [Ping timeout: 240 seconds]
usershell has quit [Remote host closed the connection]
karapetyan has joined #ruby
<baweaver>
Ruby happens to be in the middle so I tend towards it a lot for intros
<hololeap>
java and c# suck as starter languages because it's hard to make something simple without running into cryptic compiler errors
<hololeap>
it kind of scares you off from the get-go
lurch_ has joined #ruby
karapetyan has quit [Remote host closed the connection]
karapetyan has joined #ruby
maletor has joined #ruby
<hololeap>
that's cool though, how did the scala one fare?
<baweaver>
I think he's a data scientist now
<hololeap>
nice
* baweaver
checks
<baweaver>
yep, looks like it
emilford has joined #ruby
lektrik has quit [Ping timeout: 256 seconds]
duper has quit [Ping timeout: 265 seconds]
ElSif has quit [Read error: Connection reset by peer]
<hololeap>
sometimes i feel like ruby's metaprogramming hurts more than it helps
<hololeap>
since its hard to document dynamically-created methods and the like
<hololeap>
looking at the rails code base hurts my brain most of the time
skcin7 has quit [Max SendQ exceeded]
oivoodoo has quit [Remote host closed the connection]
<baweaver>
I tend to tell newbies to avoid it
emilford has quit [Ping timeout: 276 seconds]
amclain has quit [Quit: Leaving]
<baweaver>
you can't think of something in a meta-sense until you understand it in a normal one first
skcin7 has joined #ruby
arup_r has quit []
treaki has joined #ruby
oivoodoo has joined #ruby
solars has joined #ruby
yfeldblum has joined #ruby
weemsledeux has joined #ruby
sakix has quit [Ping timeout: 265 seconds]
<hololeap>
i have yet to find a difinitive guide on metaprogramming best-practices
<hololeap>
but i guess there could be quite a few different schools of thought on that topic
emilford has joined #ruby
akem has joined #ruby
blackgoat has quit [Quit: WeeChat 1.3]
<baweaver>
my definitive guide so far: don't
GinoManWorks_ has joined #ruby
<baweaver>
there's almost always a cleaner, simpler, and easier to understand way of doing it.
<hololeap>
that's pretty much what i learned
janoti has quit [Ping timeout: 240 seconds]
wldcordeiro has joined #ruby
GinoManWorks has quit [Ping timeout: 265 seconds]
emilford has quit [Ping timeout: 250 seconds]
dcunit3d has quit [Quit: WeeChat 1.3]
amoeba has quit [Quit: Leaving]
blackgoat has joined #ruby
<hololeap>
any word on when ruby 3.0 will come out?
kalopsian has quit [Ping timeout: 245 seconds]
ramfjord has quit [Ping timeout: 250 seconds]
<hololeap>
i like that they are making strings immutable by default
scepticulous has joined #ruby
emilford has joined #ruby
BSaboia has joined #ruby
solocshaw has quit [Ping timeout: 245 seconds]
workmad3 has joined #ruby
<baweaver>
Not a clue
<baweaver>
Lot of talk, little followup
idefine has quit [Remote host closed the connection]
<havenwood>
hololeap: 2020
rsc___ has quit [Quit: rsc___]
oivoodoo has quit [Remote host closed the connection]
_ht has joined #ruby
usershell has joined #ruby
<baweaver>
they want to have a clear vision of ruby first
idefine has joined #ruby
idefine has quit [Remote host closed the connection]
emilford has quit [Ping timeout: 240 seconds]
olspookishmagus has quit [Quit: All for nothing]
UtkarshRay has joined #ruby
scepticulous has quit [Remote host closed the connection]
graphettion has quit [Ping timeout: 256 seconds]
emilford has joined #ruby
scepticulous has joined #ruby
stevemackinnon has quit [Remote host closed the connection]
devbug has joined #ruby
chipotle has quit [Read error: Connection reset by peer]
SOLDIERz has joined #ruby
Mia has joined #ruby
Mia has quit [Changing host]
Mia has joined #ruby
emilford has quit [Ping timeout: 245 seconds]
chipotle has joined #ruby
akem has quit [Remote host closed the connection]
persistence has quit [Ping timeout: 240 seconds]
jgpawletko has quit [Ping timeout: 256 seconds]
scepticulous has quit [Read error: Connection reset by peer]
scepticulous has joined #ruby
akem has joined #ruby
yoongkang has joined #ruby
akem has quit [Remote host closed the connection]
devbug has quit [Ping timeout: 250 seconds]
emilford has joined #ruby
visudo has quit [Quit: visudo]
skade has quit [Ping timeout: 276 seconds]
mytrile has joined #ruby
mytrile has left #ruby [#ruby]
ramfjord has joined #ruby
akem has joined #ruby
yoongkang has quit [Ping timeout: 265 seconds]
tvw has joined #ruby
skade has joined #ruby
joonty has joined #ruby
elifoster has joined #ruby
emilford has quit [Ping timeout: 272 seconds]
maletor has quit [Quit: Computer has gone to sleep.]
skade has quit [Client Quit]
PedramT has joined #ruby
kennyfrc has quit [Ping timeout: 250 seconds]
kerunaru has joined #ruby
Waheedi has quit [Quit: Waheedi]
Cohedrin has quit [Quit: My Mac has gone to sleep. ZZZzzz…]
DarkElement has quit [Remote host closed the connection]
montagne_goat has joined #ruby
Cohedrin has joined #ruby
haraoka has joined #ruby
emilford has joined #ruby
ropeney has quit [Quit: My Mac has gone to sleep. ZZZzzz…]
Abrin2 has quit [Ping timeout: 250 seconds]
Abrin has joined #ruby
duncannz has joined #ruby
arup_r has joined #ruby
workmad3 has quit [Ping timeout: 265 seconds]
piotrj has joined #ruby
emilford has quit [Ping timeout: 240 seconds]
darkf has joined #ruby
workmad3 has joined #ruby
pawnbox has quit [Remote host closed the connection]
Abrin has quit [Ping timeout: 240 seconds]
pawnbox has joined #ruby
yfeldblum has quit [Ping timeout: 260 seconds]
scepticulous has quit [Ping timeout: 240 seconds]
Guest50255 has quit [Ping timeout: 265 seconds]
emilford has joined #ruby
avenj has joined #ruby
avenj has quit [Changing host]
avenj has joined #ruby
aganov has joined #ruby
charliesome has quit [Quit: My MacBook Pro has gone to sleep. ZZZzzz…]
duncannz has quit [Remote host closed the connection]
rsc___ has joined #ruby
bahar has quit [Ping timeout: 272 seconds]
duncannz has joined #ruby
sandstrom has joined #ruby
piotrj_ has joined #ruby
emilford has quit [Ping timeout: 276 seconds]
piotrj has quit [Read error: Connection reset by peer]
piotrj_ has quit [Read error: Connection reset by peer]
piotrj has joined #ruby
Burgestrand has joined #ruby
<solars>
quick question, I've got a problem with html I'm fetching with nokogiri, if I output it with .to_html, UTF8 is not properly encoced, I only get these ?? suddenly. doc.to_html(encoding: 'UTF-8').force_encoding("UTF-8") also does not work.. does anyone know what causes this?
ohaibbq has joined #ruby
mdw has joined #ruby
emilford has joined #ruby
firstdayonthejob has joined #ruby
sakix has joined #ruby
rsc___ has quit [Quit: rsc___]
Abrin has joined #ruby
devbug has joined #ruby
andikr has joined #ruby
rsc___ has joined #ruby
emilford has quit [Ping timeout: 240 seconds]
BSaboia has quit [Quit: Leaving]
mfb2 has joined #ruby
dexter_ has quit [Ping timeout: 245 seconds]
sakix has quit [Ping timeout: 272 seconds]
govg has joined #ruby
solars has quit [Ping timeout: 250 seconds]
codecop has joined #ruby
RegulationD has quit [Ping timeout: 272 seconds]
PedramT has quit [Remote host closed the connection]
emilford has joined #ruby
PedramT has joined #ruby
pawnbox has quit [Remote host closed the connection]
PedramT has quit [Remote host closed the connection]
pawnbox has joined #ruby
PedramT has joined #ruby
mfb2 has quit [Ping timeout: 276 seconds]
dexter_ has joined #ruby
jbrhbr has joined #ruby
howdoi has joined #ruby
Brklyn has joined #ruby
dionysus69 has joined #ruby
xsdg_ is now known as xsdg
emilford has quit [Ping timeout: 250 seconds]
montagne_goat has quit [Quit: Leaving...]
juddey has quit [Ping timeout: 260 seconds]
postmodern has joined #ruby
joonty has quit [Ping timeout: 272 seconds]
john has joined #ruby
<john>
i need some help regarding ruby threading.
Brklyn has quit [Ping timeout: 250 seconds]
emilford has joined #ruby
john is now known as Guest77742
_djbkd has quit [Quit: My people need me...]
vondruch has joined #ruby
gbgdev has joined #ruby
<Guest77742>
I have a shared variable which is written in one thread, while read in the other thread. Do I still need to have Mutex when this variable is accessed?
G is now known as Nigel
gagrio_ has joined #ruby
LoganG has quit [Ping timeout: 250 seconds]
govg has quit [Ping timeout: 256 seconds]
mdw has quit [Ping timeout: 245 seconds]
x77686d has quit [Quit: x77686d]
elifoster has quit [Ping timeout: 250 seconds]
emilford has quit [Ping timeout: 245 seconds]
solars has joined #ruby
gbgdev has quit [Ping timeout: 264 seconds]
mdw has joined #ruby
emilford has joined #ruby
Cohedrin has quit [Quit: My Mac has gone to sleep. ZZZzzz…]
charliesome has joined #ruby
jam_ has quit [Remote host closed the connection]
aufi has joined #ruby
<hololeap>
Guest77742: yes, that is the primary use for mutexes
vondruch has quit [Remote host closed the connection]
TomyWork has joined #ruby
mdw has quit [Client Quit]
baweaver has quit [Remote host closed the connection]
<hololeap>
unless there is no chance that it is being read while the other thread is writing it (e.g. it is written before the other thread exists)
Ebok has joined #ruby
Xeago has joined #ruby
<Guest77742>
hololeap: i thought it would be needed only when writes are happening from two threads. I am coming from c++ background
harly_ has joined #ruby
carella_ has joined #ruby
<hololeap>
you might be able to get away with it
ta has joined #ruby
emilford has quit [Ping timeout: 250 seconds]
aryaching has quit [Ping timeout: 250 seconds]
workmad3_ has joined #ruby
<hololeap>
if there's no chance of a race condition then i guess you don't need it
sandstrom has quit [Quit: My computer has gone to sleep.]
Dimik has quit [Ping timeout: 264 seconds]
<Guest77742>
hololeap: Can race condition happen when 1 read and 1 write are happening?. I understand that there will be race condition if there are mulitple writes
PedramT has quit [Remote host closed the connection]
workmad3 has quit [Ping timeout: 240 seconds]
ICantCook has quit [Ping timeout: 240 seconds]
carella has quit [Ping timeout: 240 seconds]
harly has quit [Ping timeout: 240 seconds]
ta_ has quit [Ping timeout: 240 seconds]
camilasan has quit [Ping timeout: 240 seconds]
PedramT has joined #ruby
gagrio_ has quit [Ping timeout: 240 seconds]
pengus has quit [Ping timeout: 240 seconds]
<hololeap>
i doubt it but i'm not 100% sure
ICantCook has joined #ruby
emilford has joined #ruby
<hololeap>
probably best to wait for someone else to chime in
gagrio_ has joined #ruby
jgpawletko has joined #ruby
devbug_ has quit [Read error: Connection reset by peer]
syk has joined #ruby
camilasan has joined #ruby
scepticulous has joined #ruby
tonini has joined #ruby
emilford has quit [Ping timeout: 240 seconds]
<Cork>
i want to localize a variable for a small part of a function so it doesn't exist later
toretore has quit [Ping timeout: 245 seconds]
<Cork>
is there a good way to do that except creating a lambda?
<hololeap>
Cork: can you give an example?
skcin7 has quit [Quit: My Mac has gone to sleep. ZZZzzz…]
karapetyan has quit [Remote host closed the connection]
karapetyan has joined #ruby
fbandov has joined #ruby
weemsledeux has quit [Quit: My Mac has gone to sleep. ZZZzzz…]
<Cork>
the point is i don't want s to be laying around for the rest of the function
karapetyan has quit [Remote host closed the connection]
govg has joined #ruby
emilford has joined #ruby
arup_r has quit [Remote host closed the connection]
DoubleMalt has joined #ruby
<Cork>
so i would have liked to have it "local" for the first two rows
arup_r has joined #ruby
arup_r has quit [Client Quit]
scepticulous has quit [Ping timeout: 260 seconds]
ziyadb has joined #ruby
scepticulous has joined #ruby
yoongkang has joined #ruby
nettoweb has joined #ruby
einarj has joined #ruby
<hololeap>
Cork: there's no harm in it existing for the rest of the function. the GC will clean it up regardless... but if the prepare method took a block you could do something like @db.prepare("SQL") {|s| s.execute(user[:address], user[:email]) }
<hololeap>
then it would only exist inside that block
<Cork>
hololeap: ya, i'm looking for a way in the language to isolate variables
dcunit3d has joined #ruby
dionysus69 has quit [Ping timeout: 245 seconds]
<Cork>
i know -() {}.call and lambda{}.call is an option
<Cork>
but i was wondering if there was a "better" solution
<Cork>
*->()
<hololeap>
using your example, did you write the prepare method or is that from a library?
Guest77742 has quit [Ping timeout: 252 seconds]
vondruch has joined #ruby
emilford has quit [Ping timeout: 240 seconds]
<hololeap>
because you could re-write it so that it doesn't return s, but yields s instead
<hololeap>
or use block_given? to allow both
yoongkang has quit [Ping timeout: 272 seconds]
<hololeap>
using blocks to narrow down the scope is pretty common and helps keep the code clean
emilford has joined #ruby
EasyCo has joined #ruby
firstdayonthejob has quit [Ping timeout: 245 seconds]
<hololeap>
Cork: but if the method is from a library and doesn't take a block, there's no point in arbitrarily wrapping the whole thing in a lambda
tjbiddle has joined #ruby
nofxx has quit [Ping timeout: 264 seconds]
<Cork>
hololeap: well except you don't risk using the variable content later
syk has quit [Quit: My Mac has gone to sleep. ZZZzzz…]
<Cork>
that is why i want the variable to go away
SCHAAP137 has joined #ruby
Xeago has quit [Ping timeout: 250 seconds]
<EasyCo>
Hey guys, I'm trying to use Refinements but the redefined setter method "number" never gets called in the refinement. Am I missing something? https://gist.github.com/trev/b5529ef5fc716c3f89f9
<Cork>
this code is quite sensitive
sandstrom has joined #ruby
dionysus69 has joined #ruby
emilford has quit [Ping timeout: 245 seconds]
<hololeap>
that's another matter. if you're passing a mutable object to a method, it's best to call .dup on it first so the method gets a copy and doesn't do anything destructive to the original
sesquipedalian has quit [Ping timeout: 240 seconds]
<EasyCo>
Nevermind my question. It's a scoping issue.
blur3d has joined #ruby
<hololeap>
Cork: could you explain what scenario you are trying to avoid?
syk has joined #ruby
<Cork>
hololeap: the content of the variables defined in this section have to not ever by mistake be used later
janoti has joined #ruby
<Cork>
cause the consequences would be bad
piotrj has quit [Read error: Connection reset by peer]
<hololeap>
Cork: if the object is being created inside the method and never leaves it (i.e. isn't returned) then it will get trashed when the method ends
sakix has joined #ruby
<manveru>
unless you assign it to an instance variable like you do :)
Burgestrand has quit [Quit: My Mac has gone to sleep. ZZZzzz…]
piotrj_ has joined #ruby
Burgestrand has joined #ruby
dexter_ has quit [Ping timeout: 265 seconds]
emilford has joined #ruby
<hololeap>
it doesn't matter if it's assigned to an instance variable
<hololeap>
the variable name gets trashed too
<manveru>
it does matter if the object lives on
<hololeap>
it won't unless it somehow leaves the scope of the methodd
Abrin has quit [Ping timeout: 240 seconds]
<hololeap>
that's what the garbage collector is for
SCHAAP137 has quit [Remote host closed the connection]
<manveru>
instance variables are assigned on the instance, local variables are assigned to the scope, if the method ends, the instance variable lives as long as the instance it's stored in, while the local variable is lost
yfeldblum has joined #ruby
<hololeap>
oh, derp sorry i was getting instance and local mixed up
<hololeap>
its late
<manveru>
np :)
<manveru>
i know the difference man, i've been doing ruby for over 10 years
Burgestrand has quit [Client Quit]
tvw has quit [Remote host closed the connection]
<manveru>
even with locals there is no guarantee that the number is GC'd immediately, it might still show up in ObjectSpace after
sakix has quit [Ping timeout: 264 seconds]
<hololeap>
anyway, he's talking about the local variable s from his example, which isn't returned
mikecmpbll has quit [Quit: My Mac has gone to sleep. ZZZzzz…]
<hololeap>
but it's nothing to worry about
<manveru>
what you can do is: def do_sensitive_shit(number); do_stuff(number); number.replace(''); end
emilford has quit [Ping timeout: 250 seconds]
<manveru>
at that point you might somehow be able to find it in gdb, but otherwise it should be gone
<hololeap>
manveru: its usually not a good idea to call destructive methods on a object passed as a parameter
stan has joined #ruby
<manveru>
how is this bad in this example?
ohaibbq has quit [Remote host closed the connection]
<manveru>
he wants to never be able to use the string again, if you replace it, even if you somehow by a cosmic ray end up reusing it, it's not containing sensitive data anymore
Burgestrand has joined #ruby
<manveru>
i assume that also means he wants it to be unusable from the parent scope
mark2 has joined #ruby
bahar has joined #ruby
emilford has joined #ruby
<ljarvis>
good morning awkward activerecord race condition
PedramT has quit [Remote host closed the connection]
Xeago has joined #ruby
<manveru>
is it this time of day again?
<hololeap>
that's not what i gathered from his example
<ljarvis>
apparently so
<manveru>
"i want to localize a variable for a small part of a function so it doesn't exist later"
Xeago has quit [Remote host closed the connection]
<hololeap>
<Cork> the point is i don't want s to be laying around for the rest of the function
charliesome has quit [Quit: My MacBook Pro has gone to sleep. ZZZzzz…]
burbus has quit [Ping timeout: 256 seconds]
mondok has quit [Ping timeout: 260 seconds]
<manveru>
well, i was looking at the wrong example ^^;
chussenot has joined #ruby
<hololeap>
Cork: do you need the data to be immediately destroyed for some security reason, or are you worried about it hanging around and wasting memory?
<manveru>
Cork: you want the sql connection to be scoped?
<manveru>
there's nothing else in the lambda
PedramT has joined #ruby
<manveru>
the user variable is outside of it already
Burgestrand has quit [Quit: My Mac has gone to sleep. ZZZzzz…]
emilford has quit [Ping timeout: 276 seconds]
Burgestrand has joined #ruby
<manveru>
i'm confused now
<hololeap>
Cork you don't need the lambda, the GC will get rid of local variabe s and the object it references at some point soon after the method ends
<hololeap>
the only difference is if it gets garbage collected before or after the `Mailer.deliver_welcome(user[:email])`, and i don't see how that would matter unless you're working with crazy memory constraints
chthon has joined #ruby
elaptics`away is now known as elaptics
sandstrom has quit [Client Quit]
Burgestrand has quit [Quit: My Mac has gone to sleep. ZZZzzz…]
sftrabbit has joined #ruby
BlkDynmt has left #ruby [#ruby]
PedramT has quit [Ping timeout: 245 seconds]
blackgoat has quit [Quit: WeeChat 1.3]
mfb2 has joined #ruby
<hololeap>
if you gave us more details we might be able to help more
sftrabbit has quit [Client Quit]
sftrabbit has joined #ruby
dcunit3d has quit [Quit: WeeChat 1.3]
emilford has quit [Ping timeout: 240 seconds]
dcunit3d has joined #ruby
mondok has joined #ruby
drptbl has joined #ruby
mfb2 has quit [Ping timeout: 240 seconds]
mdw has quit [Quit: Sleeping Zzzzz]
burbus has joined #ruby
sandstrom has joined #ruby
baweaver has joined #ruby
emilford has joined #ruby
mdw has joined #ruby
ss_much has quit [Quit: Connection closed for inactivity]
baweaver has quit [Ping timeout: 240 seconds]
emilford has quit [Ping timeout: 250 seconds]
jespada has joined #ruby
emilford has joined #ruby
Burgestrand has joined #ruby
<shevy>
if it is a legit problem :)
blaxter has joined #ruby
yoongkang has joined #ruby
aeontech has quit [Quit: aeontech]
hayden_ has joined #ruby
workmad3_ has quit [Ping timeout: 265 seconds]
workmad3 has joined #ruby
aeontech has joined #ruby
aeontech has quit [Client Quit]
emilford has quit [Ping timeout: 264 seconds]
graphettion has joined #ruby
graphettion has quit [Read error: Connection reset by peer]
karapetyan has joined #ruby
last_staff has joined #ruby
platzhirsch has joined #ruby
zerg_lurker has joined #ruby
emilford has joined #ruby
<zerg_lurker>
Ello, I'm working on the pragmatic programmers book for rails, and i'm starting to wonder if its bad practice that i'm using ruby 1.9.3 and rails 3.2.0. Is this book too outdated?
workmad3 has quit [Ping timeout: 264 seconds]
karapetyan has quit [Ping timeout: 245 seconds]
gagrio_ has quit [Quit: Leaving...]
chussenot has quit [Quit: chussenot]
dexter_ has joined #ruby
emilford has quit [Ping timeout: 250 seconds]
<apeiros>
zerg_lurker: most probably still applies. but there's probably little to no reason to use ruby 2.3.0 and at least the newest version of rails 3.2.
<apeiros>
you can try to use ruby 4.2 and see how much will work, and if it doesn't, you can check what changed.
<apeiros>
*rails 4.2
<zerg_lurker>
Thanks! I've had a hell of a hard time getting rails to run, so i'll try to upgrade it and pray to the programming gods that nothing breaks.
<apeiros>
zerg_lurker: btw., rails is:
<apeiros>
?rails zerg_lurker
<ruby[bot]>
zerg_lurker: Please join #RubyOnRails for Rails questions. You need to be identified with NickServ, see /msg NickServ HELP
chussenot has joined #ruby
<zerg_lurker>
So noted
emilford has joined #ruby
gbgdev has joined #ruby
<apeiros>
oh dear, just noticed I wrote the opposite of what I wanted to say :D
User458764 has joined #ruby
<apeiros>
zerg_lurker: there's probably little to no reason NOT to use ruby 2.3.0 and at least the newest version of rails 3.2. i.e. -> use ruby 2.3 and newest rails 3.2 ;-)
<apeiros>
sorry for the mishap
chussenot has quit [Client Quit]
the_drow has joined #ruby
PedramT_ has quit [Remote host closed the connection]
gbgdev has quit [Remote host closed the connection]
<the_drow>
Sanity check, ruby releases the GIL when writing to stdout right?
<the_drow>
So if I write to stdout in one thread code should be executed in the other
emilford has quit [Ping timeout: 250 seconds]
skcin7 has joined #ruby
<apeiros>
yes, IO generally allows other threads to run
sakix has joined #ruby
kirillzh has quit [Quit: My Mac has gone to sleep. ZZZzzz…]
bruce_lee has quit [Remote host closed the connection]
skcin7 has joined #ruby
duncannz has quit [Remote host closed the connection]
hmsimha_ has joined #ruby
hmsimha_ has quit [Read error: Connection reset by peer]
nodejunkie has joined #ruby
dlitvak has quit [Remote host closed the connection]
emilford has joined #ruby
ldnunes has joined #ruby
chussenot has quit [Quit: chussenot]
chipotle has quit [Quit: cheerio]
UtkarshRay has quit [Remote host closed the connection]
mikecmpbll has quit [Ping timeout: 272 seconds]
emilford has quit [Ping timeout: 245 seconds]
colli5ion has joined #ruby
chussenot has joined #ruby
charliesome has joined #ruby
karapetyan has joined #ruby
skade has joined #ruby
conta has joined #ruby
wottam has joined #ruby
James1 has joined #ruby
PedramT has quit [Remote host closed the connection]
PedramT has joined #ruby
emilford has joined #ruby
karapetyan has quit [Ping timeout: 245 seconds]
arup_r has joined #ruby
dwfait has joined #ruby
gbgdev has joined #ruby
gbgdev has quit [Read error: Connection reset by peer]
gbgdev has joined #ruby
emilford has quit [Ping timeout: 272 seconds]
mondok has quit [Read error: Connection reset by peer]
last_staff has quit [Quit: last_staff]
evidex has joined #ruby
govg has quit [Ping timeout: 264 seconds]
devbug has quit [Ping timeout: 245 seconds]
tomphp has quit [Ping timeout: 240 seconds]
tomphp_ has joined #ruby
phlegx has joined #ruby
emilford has joined #ruby
CloCkWeRX has joined #ruby
skade has quit [Read error: Connection reset by peer]
fahrradflucht has joined #ruby
oivoodoo has joined #ruby
rsc___ has quit [Quit: rsc___]
<phlegx>
Hi! I want to transform a BigDecimal number to scientific notation. I have a problem with the rounding using sprintf.
sandstrom has quit [Quit: My computer has gone to sleep.]
<phlegx>
e.g. n = BigDecimal.new("1.2345678901234568")
rsc___ has joined #ruby
<phlegx>
with n.to_s('e') I get 0.12345678901234568E1
emilford has quit [Ping timeout: 264 seconds]
<phlegx>
But if I use '%.16e' %n.to_s i get 1.2345678901234567e+00
<phlegx>
he result is round down! Why?
skade has joined #ruby
lee-jon has joined #ruby
emilford has joined #ruby
govg has joined #ruby
oivoodoo has quit [Remote host closed the connection]
Bloomer has quit [Remote host closed the connection]
skade has quit [Ping timeout: 256 seconds]
Marsupermammal has joined #ruby
piotrj has quit [Remote host closed the connection]
piotrj has joined #ruby
Diabolik has quit [Excess Flood]
emilford has quit [Ping timeout: 240 seconds]
Diabolik has joined #ruby
EasyCo has quit [Quit: Connection closed for inactivity]
baweaver has joined #ruby
rsc___ has quit [Quit: rsc___]
Burgestrand has quit [Quit: My Mac has gone to sleep. ZZZzzz…]
dc1 has joined #ruby
MartyG_ has joined #ruby
hololeap has quit [Ping timeout: 264 seconds]
tjbiddle has quit [Quit: tjbiddle]
emilford has joined #ruby
sadman99 has joined #ruby
baweaver has quit [Ping timeout: 245 seconds]
<sadman99>
hi
<sadman99>
hey thete any one can help
<Ox0deb>
phlegx: BigDecimal only patches String to add the #to_d method. It doesn't modify #sprintf to properly handle BigDecimal arguments.
ledestin has quit [Quit: My Mac has gone to sleep. ZZZzzz…]
emilford has quit [Ping timeout: 250 seconds]
FooMunki has joined #ruby
<phlegx>
Ox0deb, thx. But why "1.2345678901234568".to_f is 1.2345678901234567
sadman99 has quit []
<Ox0deb>
phlegx: Because the former simply cannot be accurately represented in IEEE 754.
swarm_lurker has joined #ruby
Outlastsheep has quit [Ping timeout: 240 seconds]
<Ox0deb>
Er, no. This is just a case of rounding, I guess.
mfb2 has joined #ruby
<Ox0deb>
Regular-old floating-point numbers (like the ones you get from String#f) don't have arbitrary precision.
lee-jon has quit [Quit: lee-jon]
<Ox0deb>
*String#to_f
<phlegx>
And how can I "transform" my float string in float without rounding?
zerg_lurker has quit [Ping timeout: 250 seconds]
emilford has joined #ruby
blaxter has quit [Quit: foo]
avril14th has quit [Remote host closed the connection]
mfb2 has quit [Ping timeout: 250 seconds]
<Ox0deb>
phlegx: I'm pretty sure you want `n.to_s('F')`.
lee-jon has joined #ruby
<canton7>
phlegx, are you aware that floats have limited precision?
dlitvak has joined #ruby
slackbotgz has joined #ruby
<phlegx>
canton7, yes
<phlegx>
16 right?
usershell has quit [Remote host closed the connection]
<canton7>
ok, so you're aware that "And how can I "transform" my float string in float without rounding?" doesn't make sense? "How do I transform my arbitrary-precision string into a limited-precision float while still keeping arbitrary precision?"
<canton7>
... you can't, because floats have limited precision, as you just told me
c355e3b has joined #ruby
emilford has quit [Ping timeout: 265 seconds]
<phlegx>
canton7, thx your right
Burgestrand has joined #ruby
hololeap has joined #ruby
Ebok has quit [Quit: My Mac has gone to sleep. ZZZzzz…]
skcin7 has quit [Ping timeout: 276 seconds]
skcin7_ has joined #ruby
<phlegx>
ok, so what I want to do is show a BigDecimal in scientific notation, but when i do n.to_s('E') I get this format 0.1234567890123456E1, but i want format like with sprintf 1.234567890123456e+01
tvw has joined #ruby
Ebok has joined #ruby
FooMunki has quit [Quit: FooMunki]
emilford has joined #ruby
<Ox0deb>
phlegx: BigDecimal uses "engineering notation" and there's no telling it otherwise.
whiteline has joined #ruby
<Ox0deb>
>> s = '0.1234567890123456E1'; s['E'] = 'e+0'; s # Maybe this is okay?
User458764 has quit [Quit: My iMac has gone to sleep. ZZZzzz…]
sakix has quit [Ping timeout: 264 seconds]
piotrj has quit [Remote host closed the connection]
Shaboum has joined #ruby
piotrj has joined #ruby
emilford has quit [Ping timeout: 265 seconds]
drptbl has quit [Quit: My MAC has gone to sleep. zZz..]
Snowy has quit [Remote host closed the connection]
skcin7_ has quit [Quit: My Mac has gone to sleep. ZZZzzz…]
emilford has joined #ruby
Snowy has joined #ruby
ElFerna has joined #ruby
pawnbox has quit [Remote host closed the connection]
shadoi has quit [Quit: Leaving.]
nodejunkie has quit [Ping timeout: 265 seconds]
Ebok has quit [Quit: My Mac has gone to sleep. ZZZzzz…]
shadoi has joined #ruby
UtkarshRay has joined #ruby
PedramT has quit [Ping timeout: 256 seconds]
emilford has quit [Ping timeout: 250 seconds]
PedramT has joined #ruby
swarm_lurker has quit [Ping timeout: 240 seconds]
oivoodoo has joined #ruby
emilford has joined #ruby
lindistock has joined #ruby
drptbl has joined #ruby
oivoodoo has quit [Remote host closed the connection]
oivoodoo has joined #ruby
jottr_ has quit [Ping timeout: 250 seconds]
govg has quit [Ping timeout: 240 seconds]
pawnbox has joined #ruby
<atmosx>
hightower3: that sounds evil (there too many really)
sandstrom has joined #ruby
pawnbox has quit [Remote host closed the connection]
pawnbox has joined #ruby
ropeney has joined #ruby
astrobun_ has quit [Remote host closed the connection]
dlitvak_ has joined #ruby
jam_ has joined #ruby
ropeney has quit [Client Quit]
<Ox0deb>
hightower3: Do you solemnly swear that you're up to no good?
<atmosx>
the dinosaur thing
<atmosx>
err
ItSANgo has quit [Quit: Leaving...]
dlitvak has quit [Ping timeout: 272 seconds]
Burgestrand has joined #ruby
xpt has quit [Ping timeout: 250 seconds]
usershell has joined #ruby
jam_ has quit [Ping timeout: 260 seconds]
Xeago has quit [Remote host closed the connection]
karapetyan has joined #ruby
usershell has quit [Ping timeout: 264 seconds]
mdw has quit [Ping timeout: 260 seconds]
sftrabbit has quit [Quit: sftrabbit]
<apeiros>
atmosx: that sounds more like a box with multiple interfaces and a connection where the source matters :)
arlek has quit [Ping timeout: 250 seconds]
ItSANgo has joined #ruby
karapetyan has quit [Ping timeout: 245 seconds]
<atmosx>
apeiros: interesting use case, I wouldn't have thought that. Isn't that usually done at packet-filter level?
<apeiros>
I have no idea what the usual solution is
<apeiros>
we solved it by having a proxy for all connections where source matters
<atmosx>
a proxy per interface?
mdw has joined #ruby
<atmosx>
that's even cleaner/easier
PedramT has quit [Remote host closed the connection]
tvw has quit []
tvw has joined #ruby
Brklyn has joined #ruby
mdw has quit [Client Quit]
anisha_ has quit [Quit: Leaving]
dstarh has quit [Quit: My Mac has gone to sleep. ZZZzzz…]
xpt has joined #ruby
<apeiros>
no, not a proxy per interface. a proxy which acts as the "registered source" (e.g. for vpn connections), and our services just need to know the proxy and the other side too only needs to register one proxy instead of N machines..
dpollen has joined #ruby
workmad3_ has joined #ruby
sftrabbit has joined #ruby
aupadhye has joined #ruby
dpollen has quit [Client Quit]
Ebok has joined #ruby
workmad3 has quit [Ping timeout: 240 seconds]
skade has joined #ruby
bahar has quit [Changing host]
bahar has joined #ruby
Brklyn has quit [Ping timeout: 272 seconds]
govg has joined #ruby
tvw has quit [Ping timeout: 272 seconds]
kp666 has quit [Ping timeout: 250 seconds]
skade has quit [Quit: Computer has gone to sleep.]
dwfait has quit [Remote host closed the connection]
workmad3_ has quit [Ping timeout: 265 seconds]
Xeago has joined #ruby
ta has quit [Remote host closed the connection]
jaiks has joined #ruby
conta has quit [Quit: Leaving]
duckpuppy has joined #ruby
kerunaru has quit [Ping timeout: 250 seconds]
dwfait has joined #ruby
shadoi has quit [Quit: Leaving.]
emilford has quit [Read error: Connection reset by peer]
kerunaru has joined #ruby
emilford has joined #ruby
<atmosx>
I see
drptbl has quit [Quit: My MAC has gone to sleep. zZz..]
<ruby[bot]>
sky_grill: it seems like you are asking for a specific solution to a problem, instead of asking about your problem. This often leads to bad solutions and increases frustration for you and those trying to help you. More: http://meta.stackexchange.com/a/66378
Rickmasta has quit [Quit: My MacBook Pro has gone to sleep. ZZZzzz…]
<jhass>
for example describe why you have a string "formatted" that way in the first place
<sky_grill>
i'm not. thanks for your concern though
gbgdev has joined #ruby
freerobby has joined #ruby
blackmes1 has quit [Ping timeout: 272 seconds]
Brklyn has joined #ruby
Rickmasta has joined #ruby
<jhass>
so why that serialization instead of a proper one?
phlegx has quit [Quit: Leaving]
scepticulous has quit [Ping timeout: 264 seconds]
zz_denym_ has joined #ruby
BTRE has joined #ruby
aswen has joined #ruby
kerunaru has joined #ruby
Burgestrand has quit [Quit: My Mac has gone to sleep. ZZZzzz…]
<Ox0deb>
Because unspeakably good reasons, apparently.
Brklyn has quit [Ping timeout: 240 seconds]
<jhass>
yup, thought so
scepticulous has joined #ruby
<NotFullOfTrouble>
I have a question about the internals of Ruby. Ruby's garbage collector is mostly a set of linked lists. A value is removed from the heap list and placed on a free list. I am trying to figureout how this could be thread safe (I am not arguing that it isn't, rather trying to understand what mechanics are in play here that I don't see).
<NotFullOfTrouble>
What I mean is that there is no locking anywhere in the garbage collector, and there doesn't appear to be any locking in the set/get variable methods either (including for global variables). So if a value is being set (in one thread), while the garbage collector is running in another, you have two threads trying to modify the same linked list with
<NotFullOfTrouble>
no locks. Obviously it works, but I am at a loss to explain why. Anyone have intimate knowledge of this?
gbgdev has quit [Ping timeout: 276 seconds]
sergey_makagon has joined #ruby
<NotFullOfTrouble>
Dont know why there is so many lines between my two paragraphs there...
<NotFullOfTrouble>
What I mean is that there is no locking anywhere in the garbage collector, and there doesn't appear to be any locking in the set/get variable methods either (including for global variables). So if a value is being set (in one thread), while the garbage collector is running in another, you have two threads trying to modify the same linked list with
<NotFullOfTrouble>
no locks. Obviously it works, but I am at a loss to explain why. Anyone have intimate knowledge of this?
puria has quit [Ping timeout: 250 seconds]
emilford has joined #ruby
milan has quit [Ping timeout: 252 seconds]
treaki__ has joined #ruby
<jhass>
isn't MRI's GC still world-stop?
<NotFullOfTrouble>
How would it stop the world without mutual exclusion?
<jhass>
I'd imagine at the entry point, I didn't look at the code at all there
<jhass>
maybe it pauses other threads instead of a lock or something?
ramortegui has joined #ruby
<NotFullOfTrouble>
The entry point for GC is when a new value is created and there is no more free list, no locks there. You can't just pause a thread, it would be nice if you could. There is no such functionality called during a gc_collect()
sakix has joined #ruby
duckpuppy has quit [Ping timeout: 272 seconds]
<NotFullOfTrouble>
The only way to pause a thread that I am aware of (native thread speaking, not green threads, so 1.9 and higher) is to have each thread constantly poll to see if it should pause. I am not the authority on this though and would LOVE to be surprised and find some magic trick, thats what I am looking for
scepticulous has quit [Ping timeout: 240 seconds]
scepticulous has joined #ruby
lee-jon has joined #ruby
pdoherty has quit [Ping timeout: 240 seconds]
<Ox0deb>
NotFullOfTrouble: GET_THREAD() is called all over the place before performing various actions.
<Ox0deb>
That's the GIL, essentially.
dstarh has joined #ruby
<Ox0deb>
Where it matters, the VM grabs hold of the current thread and uses that as a reference point before proceeding.
sakix has quit [Ping timeout: 240 seconds]
Ebok has quit [Quit: My Mac has gone to sleep. ZZZzzz…]
<Ox0deb>
Locks around the garbage collector aren't strictly necessary by dint of the fact that MRI doesn't support real concurrency. :/
<NotFullOfTrouble>
So its not thread safe in the traditional manner, but the GIL prevents multiple threads from accessing the set/gc at the same time?
<Ox0deb>
In a nutshell.
<Ox0deb>
That's not to say that it's not within your power to write very bad threaded code. :P
Ebok has joined #ruby
sdothum has quit [Quit: ZNC - 1.6.0 - http://znc.in]
<NotFullOfTrouble>
Of course, I was just surprised when I peeked at the code and could not trace it back to any locking mechanism. I know its "thread safe" in that the gc isnt going to clobber a variable setting, I have used it enough to be sure of that, but I just couldnt see it.
chthon has quit [Ping timeout: 245 seconds]
AlexJakeGreen has joined #ruby
duckpuppy has joined #ruby
<Ox0deb>
trunk $ ag GET_THREAD | wc -l
<Ox0deb>
248
<Ox0deb>
Found it!
sdothum has joined #ruby
nettoweb has quit [Quit: My MacBook Pro has gone to sleep. ZZZzzz…]
newbie22 has quit [Quit: Leaving]
<NotFullOfTrouble>
Thanks for your help, I will follow that thread, no pun intended.
newbie22 has joined #ruby
stannard has joined #ruby
<Ox0deb>
Hue hue hue.
<Ox0deb>
Sure thing.
<sky_grill>
uh. why would File.readlines not read all lines in a file?
workmad3 has joined #ruby
cdg has joined #ruby
gbgdev has joined #ruby
newbie22 has quit [Client Quit]
freerobby has quit [Quit: Leaving.]
newbie22 has joined #ruby
Ebok has quit [Quit: My Mac has gone to sleep. ZZZzzz…]
atomical_ has joined #ruby
robbyoconnor has joined #ruby
blur3d has quit [Quit: blur3d]
lektrik has joined #ruby
charliesome has quit [Quit: My MacBook Pro has gone to sleep. ZZZzzz…]
atomical has quit [Ping timeout: 240 seconds]
william3 has joined #ruby
gbgdev has quit [Ping timeout: 264 seconds]
<sky_grill>
i have this 30 line file and only two lines are being read
charliesome has joined #ruby
kerunaru has quit [Ping timeout: 272 seconds]
hlegius has joined #ruby
blackgoat has quit [Quit: WeeChat 1.3]
mfb2 has joined #ruby
govg has quit [Quit: leaving]
Hammy_Work has joined #ruby
govg has joined #ruby
krobzaur has joined #ruby
chthon has joined #ruby
jam_ has joined #ruby
griffindy has joined #ruby
scepticulous has quit [Quit: Konversation terminated!]
gbgdev has joined #ruby
<Ox0deb>
sky_grill: Post code.
synthroid has quit [Remote host closed the connection]
mfb2 has quit [Ping timeout: 250 seconds]
sdothum has quit [Quit: ZNC - 1.6.0 - http://znc.in]
hlegius has quit [Quit: My Mac has gone to sleep. ZZZzzz…]
gregf_ has joined #ruby
newdan has joined #ruby
mahk has joined #ruby
synthroid has joined #ruby
weemsledeux has joined #ruby
hlegius has joined #ruby
oddjob has joined #ruby
<AlexJakeGreen>
Or specify separator File.readlines 'file1', "\r"
aupadhye has quit [Ping timeout: 250 seconds]
TomPeed has quit [Quit: My Mac has gone to sleep. ZZZzzz…]
blackmes1 has quit [Ping timeout: 256 seconds]
<flughafen>
grrrrrrr
charliesome has quit [Quit: My MacBook Pro has gone to sleep. ZZZzzz…]
<oddjob>
morning. question: how come when i run IO.copy_stream(open('some_site_some_file'), 'some_destination') I get back a LoadError - cannot load such file. But the file still downloads
TomPeed has joined #ruby
volty has joined #ruby
chthon has quit [Ping timeout: 245 seconds]
ta has joined #ruby
colegatron_origi has quit [Ping timeout: 264 seconds]
colegatron_origi has joined #ruby
decoponio has joined #ruby
Xeago has quit [Remote host closed the connection]
sakix has joined #ruby
sgambino has joined #ruby
usershell has joined #ruby
dtordable has quit [Quit: leaving]
<shevy>
that is not the error
<oddjob>
shevy: what do you mean?
<shevy>
here is how LoadError looks
<shevy>
LoadError: cannot load such file -- foo
<oddjob>
Exception `LoadError' at C:/Program Files/Puppet Labs/Puppet/sys/ruby/lib/ruby/2.0.0/rubygems.rb:1096 - cannot load such file -- rubygems/defaults/ruby
<shevy>
ok
Mon_Ouie has joined #ruby
<oddjob>
sorries
aupadhye has joined #ruby
aupadhye has quit [Client Quit]
aupadhye has joined #ruby
hiyosi has joined #ruby
platzhirsch has joined #ruby
<shevy>
hmm rubygems.rb pulls in defaults.rb
<shevy>
I am not sure what tries to pull in rubygems/defaults/ruby.rb
<shevy>
is that a custom addon?
<oddjob>
well. its puppet bundle, so likely
tuxillo has joined #ruby
<tuxillo>
hello
<tuxillo>
what's the best way to communicate two different ruby processes?
<tuxillo>
(one is a sinatra app, the other one a daemonized ruby program)
atomical has joined #ruby
<shevy>
oddjob weird, I do not have any defaults/ directory at all... I think this must be a custom addon
<tuxillo>
IPC?
<oddjob>
shevy: ok. well. its a single line, and it works, so Ill just ignore the error
sakix has quit [Ping timeout: 272 seconds]
<jhass>
tuxillo: IPC is just a generic term for communicating between two processes
<jhass>
?best
<ruby[bot]>
"better" and "best" depend entirely on your context. Try to describe what quality would make one thing better than the other.
<jhass>
describe what kind of communication you want and why
JDiPierro has quit [Remote host closed the connection]
<tuxillo>
jhass: the sinatra app will send a command, the ruby program obeys. just one way
chipotle has joined #ruby
<jhass>
tuxillo: still vague
<oddjob>
anyhow. thanks. im not too concerned on fixing it
<shevy>
oddjob aha... so I assume that the main purpose of that file is to do: require 'devkit'
<volty>
tuxillo: drb
aganov has quit [Remote host closed the connection]
<oddjob>
shevy: looks like it ya
<pantato>
quit
<tuxillo>
jhass: sure it is vague, I don't know what I'm going to do just yet
atomical_ has joined #ruby
<tuxillo>
volty: oh interesting, thx
<jhass>
tuxillo: so you're looking for a solution to a problem you don't actually have yet? that's hard to believe tbh
<volty>
tuxillo: start with it. It will clear your ideas too.
<tuxillo>
jhass: is it not the case for most starts?
<tuxillo>
volty: k
<jhass>
uh no, at least I learn technologies to investigate whether they solve my problem
<AlexJakeGreen>
tuxillo, you can keep queue in db. sinatra puts a task into queue, daemon reads from db and sets status
<tuxillo>
is that easier?
Shaboum has quit [Quit: WeeChat 1.4]
baweaver has joined #ruby
<jhass>
depends on your context
<AlexJakeGreen>
it depends
chthon has joined #ruby
<jhass>
there's a shitload of ready made solutions for queue systems
<volty>
jhass: try to be more abstract :), ppl know that can communicate but, not having tried yet, have pretty abstract ideas about
<jhass>
whether a queue system is what you need, who knows
atomical has quit [Ping timeout: 240 seconds]
<tuxillo>
well, the high level problem is. one sinatra app receives a GET or POST and it has to inform a daemon of the parameters (json file)
<volty>
better with drb, you can queue on the fly
<jhass>
tuxillo: _why_?
<jhass>
what's to be done?
<tuxillo>
update some files at OS level
nettoweb has joined #ruby
<jhass>
why can't it happen inside the request cycle? permission issues? taking too long?
Toledo|gone has joined #ruby
oivoodoo_ has joined #ruby
<jhass>
what's "OS level"?
<tuxillo>
I don't want to run the sinatra app as root
<tuxillo>
and it's gotta be root to change those files
troulouliou_div2 has joined #ruby
sandstrom has quit [Quit: My computer has gone to sleep.]
<tuxillo>
but isn't all this out of the scope of "communicate two processes" ?
Brklyn has joined #ruby
<jhass>
"communicate two processes" is still the solution you think you need, I'm trying to get through to you actual problem
<jhass>
*your
gnudon has quit [Remote host closed the connection]
<tuxillo>
ok, there you have it then
emilford has quit [Ping timeout: 240 seconds]
<jhass>
why can't the files be made writable by the sinatra app?
baweaver has quit [Ping timeout: 272 seconds]
<tuxillo>
change files in the filesystem where only root can write via http methods
<AlexJakeGreen>
if filenames are known, you can just give permission to modify them by sinatra's user. for example, sudo
<tuxillo>
I better don't do that
<jhass>
because?
<apeiros>
hi jhass
<volty>
my problem is: 1) I want to send whatever I want to a daemon 2) I want to do whatever I want in the daemon
<jhass>
apeiros: hey ;)
Toledo|gone is now known as croberts
<jhass>
did I missed anything?
<volty>
nice to clear else's ideas, bad to interrogate like a police officer
<tuxillo>
they are /etc files, I just don't want to change permissions
<jhass>
volty: my recommendation would then be: do it however you want
oivoodoo has quit [Ping timeout: 260 seconds]
dionysus69 has quit [Ping timeout: 240 seconds]
Sucks has joined #ruby
<volty>
jhass: nm, do not take me too serious :)
dtordable has joined #ruby
<jhass>
tuxillo: making a couple of files writable doesn't make the entire directory writable. Heck you don't even need the execute bit on the parent directories if you know the paths
frem has joined #ruby
<jhass>
aside from that, you probably also can let whatever reads those files read them from elsewhere
<volty>
jhass: I'm happy if you (or we) find another, simpler, solution to tuxillo's problems. Imho it's better he starts to serve a command dispatcher (or queue) with drb — could be he himself finds another solution; for sure he will learn something useful
emilford has joined #ruby
<tuxillo>
writeable by who? are we talking about ACLs?
rippa has joined #ruby
<jhass>
the sinatra app
diegoviola has joined #ruby
<tuxillo>
the sinatra app will run as an unprivileged user. what would be my options here? I add this user to a group and set only write permissions to that group in that particular file(s) ?
BlkDynmt has joined #ruby
dhollinger has joined #ruby
<jhass>
why I'm still going: I would consider having another ruby process run as root that gets arbitrary user input forwarded only marginally better than having the sinatra app be able to write the files directly (without running as root itself), most likely not worth the extra effort and resources
<jhass>
tuxillo: for example, yes
<volty>
tuxillo: can't you simply run, for that purpose, suid script?
<volty>
a suid script ?
<AlexJakeGreen>
or edit /etc/sudoers and run sudo
Xeago has joined #ruby
emilford has quit [Ping timeout: 245 seconds]
<tuxillo>
sudo and changing permissions require work from the unix team and I don't want to count on that. with regards to "arbitrary user input" you are assuming it's going to be an user and not another application the one feeding the sinatra app this input
lindistock has quit [Remote host closed the connection]
oivoodoo_ has quit [Remote host closed the connection]
Pande has quit [Ping timeout: 264 seconds]
<volty>
Whichever way it could be done, to me tuxillo's idea seems nice. A solution that you can learn from.
<tuxillo>
absolutely.
<apeiros>
tuxillo: any input on an application is user-input, even if it's not a human ;-)
griffindy has joined #ruby
<jhass>
stuff that comes in via the network is better considered user input
<apeiros>
and user-input is never to be trusted
<tuxillo>
I understand the problems of having a daemon running as root in the background
<apeiros>
that simple rule makes a ton of a difference in application stability and security.
<tuxillo>
ok, then user-input but via a template from another app
<volty>
it's filtered user input.
<tuxillo>
another option would be a helper suid program only and not a daemon. it would just get some file and copy it over, leaving a backup of the previous one
<volty>
or better: mapped
JDiPierro has joined #ruby
huyderman has quit [Read error: Connection reset by peer]
<tuxillo>
so you just use it when doing whatever you're doing
hlegius has quit [Quit: My Mac has gone to sleep. ZZZzzz…]
<tuxillo>
(in this copy updating a config file in /etc)
<tuxillo>
*in this case
emilford has joined #ruby
nettoweb has quit [Quit: My MacBook Pro has gone to sleep. ZZZzzz…]
skullcrasher_ is now known as skullcrasher
oddjob has quit [Ping timeout: 252 seconds]
<volty>
I like daemons. They let you centralize
bodi has joined #ruby
<tuxillo>
me too :)
<volty>
And less mess respect to on-fly scripts
skade has joined #ruby
JDiPierro has quit [Remote host closed the connection]
bigkevmcd has quit [Quit: Outta here...]
<tuxillo>
with regards to communicating the app that sends the data to the other sinatra app I was thinking in something like oauth
<tuxillo>
client-id and client secret
asccigcc has joined #ruby
<tuxillo>
so it only accepts that
JDiPierr_ has joined #ruby
<tuxillo>
not sure how that's done tho
sandstrom has joined #ruby
krz has quit [Ping timeout: 260 seconds]
emilford has quit [Ping timeout: 265 seconds]
rodfersou is now known as rodfersou|lunch
<volty>
Think it out yourself, just start tweaking with drb. You'll find it useful & amusing to inject authorization code into the object Drb is going to serve. imho
asccigcc has quit [Ping timeout: 260 seconds]
Bloomer has joined #ruby
oivoodoo has joined #ruby
blackmes1 has joined #ruby
emilford has joined #ruby
JDiPierr_ has quit [Remote host closed the connection]
<volty>
On the desktop I have a growsing ruby (qt) app that funcs as a daemon. Till now it receives & sends through dbus. But probably going to extend it with drb.
oivoodoo has quit [Remote host closed the connection]
tvw has quit [Read error: Connection reset by peer]
tvw has joined #ruby
dml337ira has joined #ruby
BlkDynmt has quit [Quit: BlkDynmt]
dml337ira has quit [Max SendQ exceeded]
JDiPierro has quit [Remote host closed the connection]
emilford has quit [Ping timeout: 260 seconds]
dlitvak_ has quit [Ping timeout: 245 seconds]
uri_ has joined #ruby
dionysus69 has joined #ruby
oivoodoo has quit [Ping timeout: 260 seconds]
blackmes1 has quit [Ping timeout: 276 seconds]
sankaber has joined #ruby
Liquid-- has joined #ruby
bigkevmcd has joined #ruby
bigkevmcd has quit [Excess Flood]
emilford has joined #ruby
bigkevmcd has joined #ruby
ElFerna has quit [Ping timeout: 250 seconds]
bigkevmcd has quit [Excess Flood]
idefine has joined #ruby
bigkevmcd has joined #ruby
kies^ has joined #ruby
sankaber has quit [Remote host closed the connection]
sankaber has joined #ruby
<alem0lars>
I want to make the rake task 'test' to depend upon another task, however 'test' isn't defined manually but with 'Rake::TestTask' instead. How can I add a dependency to 'task'?
<tuxillo>
ok thanks guys
<alem0lars>
This is because when I run 'rake test' I need to always run 'rake build' before, so I need to make 'test' depend upon 'build'
emilford has quit [Ping timeout: 240 seconds]
sftrabbit has quit [Quit: sftrabbit]
<jhass>
alem0lars: let's take a look at Rake::TestTask's docs then!
casadei has quit [Remote host closed the connection]
idefine has quit [Read error: Connection reset by peer]
<manveru>
if that doesn't work, i'll have to actually check :P
jbrhbr has quit [Quit: Leaving.]
centrx has joined #ruby
<jhass>
interesting, indeed no option there, so ^
<jhass>
reopen the task and add the dependency
skade has quit [Quit: Computer has gone to sleep.]
emilford has joined #ruby
sasasekaric has joined #ruby
Rickmasta has joined #ruby
RegulationD has joined #ruby
uri_ has quit [Read error: Connection reset by peer]
idefine has joined #ruby
workmad3 has quit [Ping timeout: 276 seconds]
devbug has joined #ruby
tulak has joined #ruby
weemsledeux has quit [Quit: My Mac has gone to sleep. ZZZzzz…]
yoongkang has quit [Remote host closed the connection]
emilford has quit [Ping timeout: 264 seconds]
sasasekaric has quit [Quit: sasasekaric]
sakix has joined #ruby
James1 has quit [Quit: WeeChat 1.4]
tulak has quit [Remote host closed the connection]
Xeago has quit [Remote host closed the connection]
devbug has quit [Ping timeout: 260 seconds]
emilford has joined #ruby
Abrin has joined #ruby
Xeago has joined #ruby
idefine has quit [Remote host closed the connection]
kies^ has quit [Ping timeout: 265 seconds]
Ishido has quit [Remote host closed the connection]
casadei has joined #ruby
sakix has quit [Ping timeout: 276 seconds]
aufi has quit [Quit: Konversation terminated!]
tjbiddle has quit [Quit: tjbiddle]
idefine has joined #ruby
Ishido has joined #ruby
mary5030 has joined #ruby
mary5030 has quit [Remote host closed the connection]
mary5030 has joined #ruby
lxsameer has quit [Quit: Leaving]
RegulationD has quit [Remote host closed the connection]
RegulationD has joined #ruby
<c355e3b>
anyone ever turn a gem into a osx install package?
<c355e3b>
i know that omnibus can do it, but i rather not go that route
JDiPierro has joined #ruby
mfb2 has joined #ruby
mdw has quit [Quit: Sleeping Zzzzz]
babblebre has joined #ruby
sky_grill has quit [Quit: My Mac has gone to sleep. ZZZzzz…]
workmad3 has joined #ruby
RegulationD has quit [Ping timeout: 245 seconds]
Burgestrand has joined #ruby
dexter_ has quit [Ping timeout: 250 seconds]
sftrabbit has joined #ruby
JDiPierro has quit [Ping timeout: 240 seconds]
sergey_makagon has quit [Remote host closed the connection]
tvw has quit [Ping timeout: 276 seconds]
ljames has joined #ruby
sftrabbit has quit [Client Quit]
piotrj has quit [Remote host closed the connection]
sftrabbit has joined #ruby
idefine has quit [Remote host closed the connection]
sftrabbit has quit [Client Quit]
sftrabbit has joined #ruby
x77686d has joined #ruby
oivoodoo_ has quit [Remote host closed the connection]
<cscheib_>
c355e3b: maybe fpm?
tomchapin has joined #ruby
oivoodoo has joined #ruby
jam_ has joined #ruby
idefine has joined #ruby
zast has joined #ruby
<c355e3b>
cscheib_: ill check it out
treehug88 has joined #ruby
Limix has joined #ruby
emilford has quit [Ping timeout: 250 seconds]
moeabdol has joined #ruby
jam_ has quit [Ping timeout: 256 seconds]
visudo has joined #ruby
dwfait has quit [Remote host closed the connection]
emilford has joined #ruby
<tuxillo>
laters
tuxillo has left #ruby [#ruby]
centrx has quit [Quit: If you meet the Buddha on the road, kill him.]
chussenot has quit [Quit: chussenot]
benoror has joined #ruby
dwfait has joined #ruby
pdoherty has joined #ruby
treehug88 has quit [Read error: Connection reset by peer]
kies^ has joined #ruby
toretore has joined #ruby
mfb2 has quit [Remote host closed the connection]
asccigcc has joined #ruby
moeabdol has quit [Client Quit]
skade has joined #ruby
chouhoulis has joined #ruby
<carella_>
TIL 1..(1/0.0)
carella_ is now known as carella
Meow-J has joined #ruby
tulak has joined #ruby
<lucasb>
someone opened issue #12029 that is related to the Enumerable block arguments I talked about yesterday. But it is already closed, so I guess I'll get no further explanation on that. :(
TheHodge has quit [Quit: Connection closed for inactivity]
rodfersou|lunch is now known as rodfersou
mdw has joined #ruby
synthroid has quit [Remote host closed the connection]
<AlexJakeGreen>
initialize your variables in constructor
<dudedudeman>
^ bah! lemme do that
sftrabbit has joined #ruby
arup_r has quit [Ping timeout: 272 seconds]
pwnd_nsfw has quit [Ping timeout: 240 seconds]
<dudedudeman>
jhass: can you elaborate?
yoongkang has joined #ruby
sgambino has quit [Quit: My Mac has gone to sleep. ZZZzzz…]
Jackneill has joined #ruby
karapetyan has quit [Remote host closed the connection]
william3 has joined #ruby
sakix has joined #ruby
underplank has joined #ruby
<jhass>
well, saying more than that the @foo inside and outside a method definition are belonging to entirely different instances would go into explaining that classes are objects which too have singleton classes and stuff
<jhass>
not sure you want that at this point
dopamean_ has joined #ruby
<dudedudeman>
i’m not sure i know what i want
rzs has joined #ruby
idefine has quit [Read error: Connection reset by peer]
sgambino has joined #ruby
karapetyan has joined #ruby
kirun has joined #ruby
agentmeerkat has joined #ruby
SCHAAP137 has quit [Remote host closed the connection]
zambini has joined #ruby
idefine has joined #ruby
<dudedudeman>
i honestly think i’m over complicating this for myself
solars has quit [Ping timeout: 250 seconds]
<dudedudeman>
i just want to parse that url, and then have it return the output of one of the json bits
sakix has quit [Ping timeout: 264 seconds]
yoongkang has quit [Ping timeout: 260 seconds]
huQeQwdpu47q has quit [Ping timeout: 256 seconds]
<rzs>
Im using the celluloid/zmq gem to use ZeroMQ in my ruby application. I came across a weird issue and to demonstrate that i have created a sample server and two clients that connect to the server using push-pull
dwfait has quit [Remote host closed the connection]
robbyoconnor has quit [Quit: Konversation terminated!]
robbyoconnor has joined #ruby
dudedudeman has quit [Client Quit]
AlexJakeGreen has quit [Quit: Leaving]
<rzs>
i notice that when i call a method in my cellulid actor from a separate class, then that method is executed synchronously. is that the way it is supposed to work ?
PaperSoldier has left #ruby [#ruby]
grill has joined #ruby
<adam12>
Any HN diehards remember seeing a gem released by a visible company (Pinterest, Etsy, etc) a few months ago that would clone production database data and anonymize it, allowing you to safely use it in staging / dev environments? I can't seem to find it :\
pec has quit [Remote host closed the connection]
dlitvak has quit [Remote host closed the connection]
rakm has joined #ruby
<shevy>
lol
idefine has quit [Read error: Connection reset by peer]
wldcordeiro has joined #ruby
Guest38 has joined #ruby
binaryplease has joined #ruby
huQeQwdpu47q has joined #ruby
c0ncealed has quit [Remote host closed the connection]
sneakerhax has joined #ruby
andikr has quit [Read error: Connection reset by peer]
idefine has joined #ruby
c0ncealed has joined #ruby
baweaver has quit [Remote host closed the connection]
ElFerna has joined #ruby
sgambino has quit [Quit: My Mac has gone to sleep. ZZZzzz…]
sgambino has joined #ruby
oddjob has joined #ruby
fbandov has quit [Quit: My Mac has gone to sleep. ZZZzzz…]
<oddjob>
is there a way to use a require later on in a script? say the first part of the script actually downloads and installs the gem, and THEN I need to require it once its there
<zambini>
Does a Gemfile not solve your problem? Or do you _have_ to download it at runtime?
idefine has quit [Read error: Connection reset by peer]
<oddjob>
unfortunately i am handcuffed at downloading it at run_time - due to how the other system its going in to allows ruby to run
usershell has quit [Remote host closed the connection]
<oddjob>
and because it evaluates the require first, it never runs because the directory doesnt exist yet
elifoster has joined #ruby
oivoodoo_ has joined #ruby
ElFerna has quit [Ping timeout: 240 seconds]
oivoodoo_ has quit [Remote host closed the connection]
RegulationD has joined #ruby
newbie22 has quit [Quit: Leaving]
william3 has quit [Ping timeout: 250 seconds]
oivoodoo_ has joined #ruby
idefine has joined #ruby
dudedudeman has joined #ruby
shinnya has joined #ruby
saneax is now known as saneax_AFK
drptbl has quit [Quit: My MAC has gone to sleep. zZz..]
oivoodoo has quit [Ping timeout: 250 seconds]
<jhass>
oddjob: should work, require is just a method call. Worst case you have to burst a few caches inside rubygems
cyclonis has joined #ruby
lee-jon has left #ruby [#ruby]
<cyclonis>
python is awesomeeeeeeeeeeeeeeeeeeeee
karmatr0n has joined #ruby
symm- has joined #ruby
mjuszczak has joined #ruby
ccaffeini has quit [Remote host closed the connection]
dudedudeman has quit [Quit: dudedudeman]
william3 has joined #ruby
chthon has quit [Quit: Ex-Chat]
nettoweb has joined #ruby
<oddjob>
jhass: k. thanks. I figured that was the next step
<oddjob>
I think the server that calls the rb file actually attempts to check all requires first. since if any gems it requires are missing, it stops before it even runs
Waheedi has joined #ruby
sgambino has quit [Quit: My Mac has gone to sleep. ZZZzzz…]
saneax_AFK is now known as saneax
einarj has quit [Remote host closed the connection]
<jhass>
seems unlikely but if you say so
dwfait has joined #ruby
<toretore>
doesn't bundler do that?
dfockler has joined #ruby
jaiks has quit [Ping timeout: 240 seconds]
Bloomer has quit [Remote host closed the connection]
creat has joined #ruby
ccaffeini has joined #ruby
TomPeed has quit [Quit: My Mac has gone to sleep. ZZZzzz…]
robbyoconnor has quit [Read error: Connection reset by peer]
robbyoconnor has joined #ruby
rzs has quit [Quit: Page closed]
codecop has quit [Remote host closed the connection]
idefine has quit [Remote host closed the connection]
Cohedrin has joined #ruby
devbug has quit [Ping timeout: 240 seconds]
casadei has quit [Remote host closed the connection]
Waheedi has joined #ruby
baweaver has joined #ruby
sh1rt has joined #ruby
<sh1rt>
Hello, I am not so familiar with Ruby, I am trying to run 'bundle install' within the directory of the project I pulled from git. Should I make a user to do this, as it says do not run as root
tvw has quit [Ping timeout: 265 seconds]
<newdan>
Sh1rt: are you currently logged in as root?
<sh1rt>
newdan: yes
sakix has joined #ruby
srenatus has quit [Quit: Connection closed for inactivity]
sgambino_ has joined #ruby
<newdan>
Sh1rt: Then yeah
sgambino has quit [Ping timeout: 265 seconds]
yoongkang has joined #ruby
<newdan>
Sh1rt: You're sure you're just not in an "administrator" account? The "whoami" says root?
joonty has quit [Ping timeout: 240 seconds]
<newdan>
*whoami command
maasha has quit [Quit: Page closed]
_djbkd has joined #ruby
skcin7 has joined #ruby
<pantato>
can someone explain to me like i'm 5 the difference between running a .rb script with the ruby command vs rspec?
felixal has joined #ruby
spider-mario has joined #ruby
sgambino_ has quit [Read error: Connection reset by peer]
sgambino has joined #ruby
<sh1rt>
newdan no, I always su to root do to work, as my user account doesn't have sudo privledge on this box
<sh1rt>
newdan: would it be okay to do something like this su -c "bundle install" -s /bin/sh apache
phantummm has joined #ruby
<slash_nick>
tjohnson: what do you mean? that's the expected behavior... you rescue StopIteration and move on...
<lucasb>
did you meant to raise StandardError or StopIteration?
<tjohnson>
slash_nick: i `break` on StopIteration
<tjohnson>
lucasb: i mean StandardError
<slash_nick>
yeah... you break out of your loop, i see that... tjohnson i don't understand your question
hobodave_ has joined #ruby
<slash_nick>
(no idea what you want to do)
yfeldblum has quit [Ping timeout: 240 seconds]
<tjohnson>
slash_nick: given some Enumerable that is doing something like `items.lazy.map { |blah| some_logic(blah) }`, what should I do if sometimes `#some_logic` throws an error
[Butch]_ has joined #ruby
<newdan>
Sh1rt: At this point you'd know better than me. I only work as a non-root user and use sudo
<newdan>
Sh1rt: Not sure about how the su command works, etc.
<tjohnson>
slash_nick: ideally I'd like to handle the error and move to the next item
<Ox0deb>
tjohnson: So you want the result to be [1,2,4,5]?
<Ox0deb>
Repeating, of course.
codecop has quit [Remote host closed the connection]
<tjohnson>
Ox0deb: yes; with the `break` line, not repeating
<Ox0deb>
tjohnson: Then why the confusing `take(100)`?
<sh1rt>
ah, i gave my user sudo priv, but when run 'sudo bundle install' I get bundle: command not found..
[Butch] has quit [Ping timeout: 245 seconds]
[Butch]_ is now known as [Butch]
<tjohnson>
Ox0deb: the `take(100)` is just to demonstrate what actually happens
hobodave has quit [Ping timeout: 264 seconds]
<tjohnson>
i.e. it seems odd to me that catching the exception and calling `my_enum#next` rewinds and starts fressh
<tjohnson>
worst case, I'd expect `#next` after the catch to be an error
pdoherty has quit [Remote host closed the connection]
idefine has quit [Remote host closed the connection]
yalue has quit [Quit: return 0;]
astrofog has joined #ruby
sh1rt has quit [Ping timeout: 260 seconds]
workmad3 has quit [Ping timeout: 240 seconds]
rdark has quit [Ping timeout: 256 seconds]
<tjohnson>
anyway, I'm guessing this is a dead end and Enumerators that don't handle their own errors aren't usable. :/
Shaboum has quit [Quit: WeeChat 1.4]
<tjohnson>
I probably can work around it, was just hoping I was missing something obvious
saneax_AFK is now known as saneax
<slash_nick>
tjohnson: yeah i'm toying with it... will you report back if you work around it?
piotrj has quit [Remote host closed the connection]
<tjohnson>
slash_nick: +1
atomical has joined #ruby
podman has joined #ruby
workmad3 has joined #ruby
sigurding has quit [Quit: sigurding]
<lucasb>
yeah, I'm curious too why the enumerator is getting rewind on errors. there must be some explanation
atomical_ has quit [Ping timeout: 260 seconds]
dcunit3d has joined #ruby
<slash_nick>
lucasb: i don't see it talked about anywhere...
cdg has joined #ruby
_ht has quit [Quit: Konversation terminated!]
atomical_ has joined #ruby
sh1rt has joined #ruby
sh1rt has quit [Changing host]
sh1rt has joined #ruby
Domaldel is now known as Domaldel
Rickmasta has joined #ruby
<TomyLobo>
Why do people commit Gemfile.lock to version control?
mdw has quit [Quit: Sleeping Zzzzz]
<tubbo>
TomyLobo: in a rails app it makes it easer to know what gem versions are being shipped with the app
<TomyLobo>
but isnt the Gemfile supposed to do that?
<TomyLobo>
or is it just committed for informational purposes?
<tubbo>
TomyLobo: the "right" way to use bundler is to define open-ended version constraints in Gemfile, and use Gemfile.lock to store the actual full gem versions. that way, when you `bundle` after i've already created Gemfile.lock, you get the same versions of all the gems that I installed...even if newer versions have been released. that's why you have to `bundle update` when a gem is updated, instead of just
<tubbo>
re-running `bundle`.
atomical has quit [Ping timeout: 240 seconds]
<tubbo>
Gemfile.lock can be thought of as a human-readable database of gem dependencies, and it's actually what is read by Bundler when you are installing gems.
<newdan>
TomyLobo: it tells you exactly what versions are in use. So there's no question what dependencies are where
bithon has joined #ruby
<tubbo>
`bundle install` is a max 3-step process: 1.) figure out what gems to install, 2.) write all gems to Gemfile.lock, 3.) install all of the gems written in Gemfile.lock
<TomyLobo>
down to the deepest leaf, even... i see
<tubbo>
if you already have a Gemfile.lock, `bundle install` skips to step 3.
blackgoat has joined #ruby
gbgdev has quit [Remote host closed the connection]
<newdan>
TomyLobo: My job when I first came here didn't commit Gemfile.lock and they used deploys from source-control. So it was anyone's guess what server had what version of what at any given time
ElFerna_ has quit [Ping timeout: 240 seconds]
dcunit3d has quit [Ping timeout: 250 seconds]
<tubbo>
hah
yoongkang has quit [Remote host closed the connection]
<tubbo>
TomyLobo: one caveat to this, committing Gemfile.lock is useless when developing a gem (or Rails plugin)
<tubbo>
because it's actually using `gemspec`.
<tubbo>
and your gem should be able to handle the version constraints it has defined in gemspec, if it can't it's time to update the version constraint or fix your gem.
gbgdev has joined #ruby
<TomyLobo>
i havent looked into developing gems yet
<newdan>
ASTP001: I'm pretty sure something else is wrong. I don't even understand how "-if (false)?" works, tbh
joonty has joined #ruby
krobzaur_ has quit [Ping timeout: 256 seconds]
<ASTP001>
hmm
<newdan>
ASTP001: If I use that, I get a syntax error
<ASTP001>
yeah i did too
<newdan>
Also I can take out the else branch and that works as well
<ASTP001>
is the tab nessecary?
<newdan>
ASTP001: Yes, indentation is significant in haml
<ASTP001>
hmm ok
<ASTP001>
thanks for your help!
<ASTP001>
i have to get going
saneax is now known as saneax_AFK
elifoster has joined #ruby
puria_ has joined #ruby
<adaedra>
Ox0dec: that was a creative use of unicode_snowman.
ESpiney has quit [Ping timeout: 240 seconds]
ElFerna_ has quit [Ping timeout: 250 seconds]
<Ox0dec>
adaedra: It was the first thing that came to mind. :)
jaiks has quit [Quit: Leaving]
<Ox0dec>
Really good smoke test.
joonty has quit [Ping timeout: 264 seconds]
idlederp has joined #ruby
[Butch] has quit [Quit: I'm out . . .]
idlederp is now known as lianj
lianj has quit [Changing host]
lianj has joined #ruby
soLucien has joined #ruby
kalopsian has quit [Ping timeout: 250 seconds]
aswen has quit [Quit: WeeChat 1.4]
Pumukel has quit [Ping timeout: 256 seconds]
<soLucien>
hello guys! Does any of you have a "cheatsheet" for Ruby synthax that i could use to get up to speed with all the language features and synthax ? it's a bit odd
karapetyan has quit [Remote host closed the connection]
tau has left #ruby [#ruby]
car54 has left #ruby [#ruby]
<soLucien>
is name "somename" the same as name("somename") in the case i have posted
<soLucien>
?
devbug has quit [Ping timeout: 260 seconds]
car54 has joined #ruby
chussenot has quit [Quit: chussenot]
<Ox0dec>
soLucien: Yes, parentheses are optional for method invocation.
<soLucien>
cool , makes sense now .. And it this case, name is called on the Class right ?
<Ox0dec>
Insufficient data for meaningful answer.
<Ox0dec>
Oh, you posted code.
<soLucien>
i posted a screen clipping from a book
skade has quit [Quit: Computer has gone to sleep.]
<soLucien>
that's all there is to it
<Ox0dec>
Yes, it's being called on the class, since you're not inside a method definition.
<Mon_Ouie>
Ox0dec: Why did you increment?
<Ox0dec>
Mon_Ouie: I didn't do it!
<Mon_Ouie>
Oh, I see, someone else did
<Ox0dec>
Twice, even.
<Ox0dec>
Different people, though.
car54 has left #ruby [#ruby]
<shevy>
lol
devbug has joined #ruby
<shevy>
I just realized that the nick was different
<Mon_Ouie>
I would find it inconvenient if variables actually changed their names after I tried to increment their values
emilford has quit [Ping timeout: 272 seconds]
<Ox0dec>
For me, the name is the value.
<Ox0dec>
Because that's how numbers work.
Aviio has joined #ruby
jgpawletko has quit [Quit: jgpawletko]
missingn0 has joined #ruby
missingn0 has left #ruby [#ruby]
SCHAAP137 has quit [Ping timeout: 260 seconds]
joonty has joined #ruby
<Ox0dec>
tjohnson was one of my incrementers; in addition to modifying my identity in-place, he's nerd-sniped me into figuring out how to make an Enumerator's Fiber's death not cause the Enumerator to #rewind.
emilford has joined #ruby
pawnbox has joined #ruby
cschneid_ has quit [Remote host closed the connection]