apeiros has quit [Remote host closed the connection]
k610 has quit [Ping timeout: 256 seconds]
hotovson has joined #ruby
jgarvey has quit [Quit: Leaving]
sailias has quit [Quit: Leaving.]
nat2610 has joined #ruby
segmond has joined #ruby
horofox has joined #ruby
TechZombie has joined #ruby
Michael_ has quit [Remote host closed the connection]
swarley has joined #ruby
robertotauille has joined #ruby
hackerdude has quit [Remote host closed the connection]
stopbit has quit [Quit: Leaving]
butblack has quit [Quit: butblack]
statarb3 has quit [Quit: Leaving]
geggam has quit [Remote host closed the connection]
etcetera has quit [Quit: Computer has gone to sleep.]
vitor-br has joined #ruby
hackerdude has joined #ruby
jxf has joined #ruby
Xeago has quit [Remote host closed the connection]
jonathanwallace has quit [Remote host closed the connection]
Maoz has quit [Ping timeout: 240 seconds]
<swarley>
Hi
hsbt_away is now known as hsbt
kevinfish has joined #ruby
nari_ has quit [Ping timeout: 265 seconds]
<kevinfish>
Hi, I'm not a ruby programmer but I'm trying to get a program (taskjuggler) to run and I'm getting: /usr/bin/ruby18: no such file to load -- auto_gem (LoadError)
qwerxy has joined #ruby
<kevinfish>
I tried unsetting RUBYOPT and it says: /usr/local/bin/tj3:9:in `require': no such file to load -- rubygems (LoadError)
<kevinfish>
from /usr/local/bin/tj3:9
<kevinfish>
How do I fix?
havenn has joined #ruby
qwerxy has quit [Client Quit]
rmcafee has joined #ruby
rmcafee has quit [Client Quit]
chrisbolton has quit [Quit: chrisbolton]
CaptainJet has quit []
clj_newb has quit [Ping timeout: 252 seconds]
jonathanwallace has joined #ruby
<atmosx>
kevinfish: what platform you on? which ruby version do you use?
jrajav has joined #ruby
t-mart has joined #ruby
t-mart has joined #ruby
t-mart has quit [Changing host]
reinaldob has joined #ruby
rudolf_ has quit [Ping timeout: 245 seconds]
<kevinfish>
atmosx: I'm on sabayon X and I've tried it with 18 and 19. When I switch to 18 w/eselect, it says: It appears you do not have RubyGems installed for this profile.
<kevinfish>
If you need RubyGems, emerge dev-ruby/rubygems with the appropriate RUBY_TARGETS setting
hackerdude has quit [Remote host closed the connection]
<kevinfish>
but idk what to set RUBY_TARGETS to, however it behaves the same under both versions
<atmosx>
kevinfish: use rvm and ruby 1.9
DarthGandalf has joined #ruby
hackerdude has joined #ruby
<atmosx>
don't use portage for ruby management
<atmosx>
just leave portage install ruby if it needs to for third party packages
<atmosx>
but use rvm for ruby programming
dmiller has quit [Remote host closed the connection]
robbyoconnor has joined #ruby
reinaldob has quit [Remote host closed the connection]
<atmosx>
bb4
<atmosx>
gnite
axl_ has quit [Quit: axl_]
<swarley>
Ruby doesn't play we'll with package managers
<swarley>
It's better to just install from official source
werdnativ has joined #ruby
<swarley>
Or use rvm
jenrzzz has quit [Ping timeout: 245 seconds]
binarypl2 has joined #ruby
hackerdude has quit [Ping timeout: 240 seconds]
<yaymukund>
is there a difference between `raise BlahError, 'message'` and `raise BlahError.new('message')`?
Juul has quit [Quit: fell off the server in amazement]
<Elico>
kevinfish: what is the problem? can you use pastebin to reveal more?
<Sou|cutter>
gah, I'm working with somebody who sprinkles Gemfiles with gem 'foo', :path => '../foo' if File.exists?('../foo')
bricker has quit [Read error: Connection reset by peer]
tomsthumb has quit [Quit: Leaving.]
binaryplease has quit [Ping timeout: 252 seconds]
<werdnativ>
What's a clean way to strip 2 lines from the start of a string? So far, I have: str.sub(/(^.*\n){2}/, '')
lenovodroid has quit [Ping timeout: 276 seconds]
<swarley>
Why do that?...
J-_-L has quit [Quit: Leaving.]
<swarley>
Not you I mean the gemfile thing
<Sou|cutter>
so he can hack on gems locally
darthdeus has quit [Quit: Leaving...]
<swarley>
Ah
tomsthumb has joined #ruby
<Sou|cutter>
I feel like it's sloppy. One day he's going to get something working and forget to share his local modifications
rellin has quit [Ping timeout: 240 seconds]
jonathanwallace has quit [Remote host closed the connection]
<werdnativ>
Sou|cutter: there's a bundler option for config.local to take care of that instead of hard-coding it into Gemfile...
bricker has joined #ruby
<swarley>
str.sub(/(^.+?$){2}/s)
ndrei has quit [Ping timeout: 255 seconds]
<swarley>
Or whatever the suffix for \n match for .
<Eiam>
worse, it was working fine when implemented in javascript, when i re-implemented it in ruby it stopped working. but I totally thought it was my fault not rubys ha
<werdnativ>
swarley: yeah, I thought there might be a cleaner way using String#lines or such.
<Eiam>
I never assume my hammer is broken, I just assume I'm using it wrong. afterall, how often to hammers break??
<Sou|cutter>
swarley: trying to look it up.. how does that work?
bigmcq77 has quit [Quit: Computer has gone to sleep.]
CaptainJet has joined #ruby
somazero has quit [Read error: Connection reset by peer]
jonathanwallace has joined #ruby
cakehero has quit [Quit: Computer has gone to sleep.]
cdehaan has quit [Quit: Textual IRC Client]
Paradox has joined #ruby
krawchyk has joined #ruby
gabrielrotbart has quit [Read error: Connection reset by peer]
u89 has quit [Remote host closed the connection]
gabrielrotbart has joined #ruby
cakehero has joined #ruby
tomsthumb has joined #ruby
daniel_- has quit [Quit: WeeChat 0.3.9]
tomsthumb has quit [Client Quit]
shtirlic has quit []
shtirlic has joined #ruby
shanemook has joined #ruby
wroathe has joined #ruby
_alejandro has joined #ruby
iamjarvo has quit [Quit: Computer has gone to sleep.]
roadt has joined #ruby
butblack has joined #ruby
Grieg has joined #ruby
Grieg has quit [Changing host]
Grieg has joined #ruby
Grieg has quit [Client Quit]
Grieg has joined #ruby
Grieg has quit [Changing host]
Grieg has joined #ruby
gmci has joined #ruby
gmci is now known as Guest46770
Guest46770 has quit [Client Quit]
Bosma has quit [Quit: leaving]
aata has joined #ruby
h4mz1d has quit [Ping timeout: 246 seconds]
<aata>
is it possible to to create a has_one relationship only if a certain condition is true, or does the relationship have to exist for every instance of a class
trevortwining has quit [Quit: trevortwining]
apok_ has joined #ruby
joeycarmello has quit [Remote host closed the connection]
apok has quit [Read error: Operation timed out]
apok_ is now known as apok
swex has quit [Ping timeout: 268 seconds]
gabrielrotbart has quit [Remote host closed the connection]
dmiller has quit [Remote host closed the connection]
aata has quit [Quit: Page closed]
jenrzzz has joined #ruby
maletor has quit [Quit: Computer has gone to sleep.]
ttt has joined #ruby
sn0wb1rd has quit [Quit: sn0wb1rd]
kuzushi has quit [Ping timeout: 245 seconds]
osirisx11 has joined #ruby
caleb_io has quit [Quit: caleb_io]
banjara has quit [Quit: Leaving.]
nari_ has joined #ruby
pu22l3r has joined #ruby
tjbiddle has joined #ruby
steffes has joined #ruby
osirisx11 has left #ruby [#ruby]
jgrevich_ has joined #ruby
jenrzzz has quit [Ping timeout: 240 seconds]
tehlulz has joined #ruby
jgrevich has quit [Ping timeout: 268 seconds]
jgrevich_ is now known as jgrevich
pac1 has quit [Quit: I got it one line of code at a time]
Synthead has quit [Ping timeout: 260 seconds]
dubz has quit [Remote host closed the connection]
Michael_ has joined #ruby
bigmcq77 has joined #ruby
Juul has joined #ruby
fumduq has quit [Ping timeout: 264 seconds]
sepp2k1 has quit [Remote host closed the connection]
Michael_ has quit [Remote host closed the connection]
ksaw123 has joined #ruby
Michael_ has joined #ruby
linoj has joined #ruby
Michael_ has quit [Remote host closed the connection]
Michael_ has joined #ruby
<ksaw123>
can someone check my code to check what is wrong. It is a code to determine whether a number is prime or not, if it is it displays preceding primes. The prime and preceding portion works, but I tried to add a simple loop to the method to only allow numbers. Ex. a user can enter (7) but can't enter rubyrocks as a number. However, since I added it I can't seem to get the loop to end if a user types a number. it just repeated "enter a number" e
jonathanwallace has quit [Remote host closed the connection]
tbrock has quit [Quit: Computer has gone to sleep.]
<jrajav>
No problem
charliesome has joined #ruby
Michael_ has quit [Read error: Connection reset by peer]
freakazoid0223 has quit [Quit: Leaving]
Michael_ has joined #ruby
<t0rc>
why do I need the commented out part to access the variable :a? does attr_accessor make instance only variables? guess that would make sense since it is attr
<Xeago>
it is unlikely it will be what you calculate, cpu timing issues, background processes
<atmosx>
Xeago: I'm doing some mistake because the numbers I get are not even close to reality :-P probably some math mistake. But what I'm thinkin of, is that ... depends on the loop really
<Xeago>
network activity
<atmosx>
well approx
<atmosx>
you should be able to predict
<Xeago>
atmosx: at the level you will need to count, there is too much error for noise
<Xeago>
you are best off calculating it by doing a massive benchmark
dmiller has joined #ruby
x0F has quit [Read error: Connection reset by peer]
<atmosx>
what do you mean 'massive' ?
<Xeago>
2^60
<atmosx>
uh
<Xeago>
depends on your wished accuracy
<atmosx>
yeah got it
<rippa>
Xeago: look at his code
<Xeago>
looking at your code, iter_calc is not relevant?
<t-mart>
I'm trying to find the smaller of 2 array[0] elements. More detail here: http://pastebin.com/NLMuwgCg This seems really longwinded; anyone got any pointers on reducing this up?
x0F has joined #ruby
<rippa>
I think he assumes than any iteration takes same amount of time
<rippa>
be it 'count+=1'
<atmosx>
I do
<rippa>
or some calculation
<rippa>
well, it doesn't
<atmosx>
true, that what I was questioning up
<atmosx>
exactly
<atmosx>
so is there any way to approach this by hmmm maybe using the each loop but still
<atmosx>
comparing words is one thing and counting is another
<atmosx>
hmm
<Xeago>
atmosx: what is the purpose of iter_calc?
<atmosx>
Xeago: to give a value to 'iteration per second' on a given hardware
<atmosx>
but as rippa says, I think the approach id deeply flawed
<Xeago>
those are different iterations than what you want
<atmosx>
hmm
<Xeago>
those measurements only apply to the while loop
<Xeago>
not to anything else
<atmosx>
to while loop and numbers
<atmosx>
I see
dmiller has quit [Ping timeout: 240 seconds]
<Xeago>
and you should remove the database call from your benchmark
<Xeago>
and make sure it is fetched and not lazily fetched
mahmoudimus has quit [Quit: Computer has gone to sleep.]
shiin has quit [Ping timeout: 244 seconds]
shiin has joined #ruby
<atmosx>
lazily fetched?
<Xeago>
the error you are having is that 'while count < 10...end is not representative of oklist.each do ... end
rafter has quit [Read error: Connection reset by peer]
<Xeago>
lazily fetched => only actually fetches when you require the desired records
emergion has quit [Quit: Computer has gone to sleep.]
<Xeago>
I don't know your @db
jimeh has quit [Quit: Bye.]
<Xeago>
ranking = entry[3].to_i
<Xeago>
select just that field
jimeh has joined #ruby
<Xeago>
instead of select *
manizzle has quit [Ping timeout: 255 seconds]
prezioso has joined #ruby
vlad_starkov has quit [Remote host closed the connection]
jimeh has quit [Client Quit]
jimeh has joined #ruby
<atmosx>
Xeago: okay :-)
noxoc has joined #ruby
captain_al has joined #ruby
k611 has joined #ruby
Monie has quit [Read error: No buffer space available]
shtirlic has quit [Read error: No buffer space available]
shtirlic_ has joined #ruby
Monie has joined #ruby
chussenot_ has joined #ruby
maxer has joined #ruby
tchebb has quit [Quit: Leaving.]
sepp2k has joined #ruby
morf has joined #ruby
k610 has quit [Ping timeout: 249 seconds]
rafter has joined #ruby
punkrawkR has quit [Ping timeout: 240 seconds]
chussenot has quit [Ping timeout: 240 seconds]
chussenot_ is now known as chussenot
adambeynon has joined #ruby
punkrawkR has joined #ruby
pcarrier has quit []
<atmosx>
thanks for the pointers Xeago rippa
davehimself has joined #ruby
claymore has joined #ruby
Takehiro has quit [Read error: Connection reset by peer]
samphippen has quit [Quit: Computer has gone to sleep.]
<Xeago>
I'd prefer teasers instead of find out how I got involved into bla, or connect with me to derp
<Xeago>
show an exceprt of your latest post
<Xeago>
a verys hort intro in about me
cj3kim has quit [Ping timeout: 276 seconds]
polymar has joined #ruby
<Hanmac>
Xeago & workmad3 i make you guys a table
<Hanmac>
method argument { } treats argument as an method
<Hanmac>
method1 method2(argument) { .. } method2 gets the block
<Hanmac>
method1 method2 argument do;end method1 gets the block
<Hanmac>
method argument do; end treats argument as an parameter
<Jdubs_>
Xeago: I see... So "blah blah blah...." (click to continue) something like that?
RandyInLA has quit [Quit: RandyInLA]
<workmad3>
Hanmac: right, so do;end has a different binding
<Xeago>
Jdubs_: ish
rippa has quit [Quit: {#`%${%&`+'${`%&NO CARRIER]
<Xeago>
don't make unnecessary pages/clicks
<workmad3>
Hanmac: which you can make clear with more explicit parens :) method1(method2(argument)) {...}
<Xeago>
that is 70's
<Jdubs_>
Yeah, I'm trying to learn this whole web 2.0 stuff lol
<Jdubs_>
I haven't made a page since the 90s
<Jdubs_>
lol
<Xeago>
take a look at bootstrap, especially what they call 'hero'
cakehero has quit [Quit: Computer has gone to sleep.]
cj3kim has joined #ruby
<Xeago>
Hanmac/workmad3 by any chance you running homebrew
<workmad3>
Jdubs_: I'd probably go for a very simple, less blocky, less 'harsh' layout that simply had a link for blog, current projects (e.g. github account), social media links and an 'about me' section
17SAB3J77 has quit [Quit: Leaving]
<workmad3>
Jdubs_: take a google around 'portfolio sites' for some really nice, clean, elegant styles :)
filipe has joined #ruby
<Jdubs_>
Hmmm
<Jdubs_>
I'm really bad at web design lol
<Jdubs_>
But I need a page I feel
<workmad3>
Jdubs_: same :)
<Jdubs_>
Do you have a page?
<Xeago>
I do, blog.xeago.nl
elaptics is now known as elaptics`away
<workmad3>
Jdubs_: workmad3.com
elaptics`away is now known as elaptics
<workmad3>
Jdubs_: I just shoved an octopress page on github for that though :)
<Jdubs_>
What do you guys think of my logo bar at least?
<Jdubs_>
I like that part
<workmad3>
so it's really a blog with some fairly poor static pages... nothing great
<Xeago>
it is big, takes up most of your screen away from content
<workmad3>
Jdubs_: seems a bit stalinesque, IMHO
<bpfh>
Hanmac, good synthesis
<workmad3>
Xeago: I'm using homebrew, yes
<Jdubs_>
So it would be good if I cut the size down a bit do you think? or should I scrap everything and start over? I spent all morning on this design heh
pcarrier has joined #ruby
<Xeago>
after trying to brew ugrade today, I have 4 files in Library/ENV/pkgconfig/libcurl.pc marked as ?? by git
<workmad3>
heh :) no idea
<bpfh>
Hanmac, but could you explain to me why functions aren't first class in ruby? why such design decision?
banjara1 has quit [Quit: Leaving.]
<Xeago>
you experiencing something similar?
banjara has joined #ruby
dmiller has joined #ruby
<workmad3>
bpfh: how are they not first-class objects?
banjara has quit [Client Quit]
pabloh has quit [Ping timeout: 245 seconds]
maasha has joined #ruby
RubyPanther has joined #ruby
<workmad3>
Jdubs_: I dunno... it's all about how you want to look tbh... and in all honesty, most programmers sites look a bit poor :)
* maasha
is messing with javascript
<bpfh>
if you define a function with the def operator it returns a null and you can't pass a function as an argument like you do in javascript
<maasha>
javascript syntax is so ugly compared to ruby.
<workmad3>
bpfh: sure you can, you just need to grab it differently
duked has joined #ruby
<Jdubs_>
workmad3: that makes me feel better! maybe I should just use a premade like you lol
margle has quit [Ping timeout: 252 seconds]
<workmad3>
bpfh: and sure 'def' is a keyword for defining methods, it doesn't return a bound method object (hell, most of the time you use it, it can't return a bound method object, because it has nothing to be bound to)
<bpfh>
sure... in javascript you can have a function with a free this that will make a reference to whatever function binds it to, so you can share the same function between many prototypes
<workmad3>
bpfh: you can unbind a method and bind it to a different object
duked has quit [Ping timeout: 245 seconds]
<Banistergalaxy>
Bpfh use instance_exec
<workmad3>
bpfh: and besides, that's a side-effect of the prototype inheritance more than anything else, on top of which you can share the same method between many objects using modules
beiter has joined #ruby
<workmad3>
bpfh: plus what Banistergalaxy just said :)
F1skr has joined #ruby
cj3kim has quit [Ping timeout: 276 seconds]
cj3kim has joined #ruby
<bpfh>
just a moment, let me read about instance_exec lol
fantazo has quit [Remote host closed the connection]
atmosx has quit [Remote host closed the connection]
<workmad3>
bpfh: instance_eval a block, and it changes the context of 'self' to the target of the instance_eval call, e.g. 'some_obj.instance_eval(&some_block)' will change the context of 'self' to 'some_obj' while calling 'some_block'
greenarrow has quit [Read error: Connection reset by peer]
greenarrow has joined #ruby
greenarrow has quit [Client Quit]
kirun has joined #ruby
<Xeago>
wjats the difference between instance_eval and instance_exec?
<bpfh>
ok but here you're talking about a block
<workmad3>
bpfh: by 'block' it's a callable
<workmad3>
bpfh: which includes blocks, procs, lambdas and method objects
<Hanmac>
bpfh where instance_method is useful: Object.instance_method(:to_s).bind([]).call => "#<Array:0x000000009f3300>"
ianfleeton has joined #ruby
<workmad3>
bpfh: it sounds more like you're complaining that the way ruby does things isn't the same as the way javascript does things :P
xpen has quit [Remote host closed the connection]
rohit has quit [Quit: Leaving]
hamed_r has quit [Ping timeout: 245 seconds]
<bpfh>
workmad3, it's not that, workmad3, I have to see in more detail the unbinding capability that ruby provides, maybe it turns out to be truly an equivalent to javascript functions
<bpfh>
what I'm talking about is the programming practice of passing around functions by name that's very common in javascript and not in ruby
<workmad3>
bpfh: yeah, that *style* isn't common
<bpfh>
and see that I'm not complaining, I just asked why
<workmad3>
bpfh: because ruby makes it more difficult to do, as opposed to just using blocks
<workmad3>
bpfh: however, it's not because methods aren't first-class (they are), they're just more awkward to get a handle on and use
<workmad3>
bpfh: that accepted answer conflates implementation detail with conceptual model, IMO
Virunga has quit [Remote host closed the connection]
sejo has joined #ruby
emergion has joined #ruby
Peter-W has joined #ruby
maasha has left #ruby [#ruby]
Peter-W has left #ruby [#ruby]
derekm has quit [Remote host closed the connection]
Solnse has quit [Ping timeout: 240 seconds]
<bpfh>
well, I share their opinion that methods are not first class constructs
<bpfh>
but see that I'm not complaining, it's just a design decision and I wanted to know more about it
cousine has joined #ruby
<workmad3>
bpfh: js - get a function object, bind it to a target, call it with arguments (all in one method - some_function.call(target, arguments) ), ruby - get a method object, bind it to a target, call it with arguments ( Object.instance_method(:to_s).bind(target).call(arguments) )
dagnachew has joined #ruby
VolodymyrB has joined #ruby
<workmad3>
bpfh: methods are as first-class as any other object in ruby
<workmad3>
bpfh: just more awkward to grab than in JS
<bpfh>
workmad3, in my opinion this sounds more like a composition than a first class method but it's ok, I really got your point and my intention is not to discuss semantics
<workmad3>
bpfh: it's all about semantics though ;)
MrSamuel has joined #ruby
<dagnachew>
hello everyone
<workmad3>
bpfh: I admit I don't think of methods as objects very often in ruby (certainly not as often as I think of procs as objects, etc). And the process of getting them is more convoluted
Edward_ has joined #ruby
<dagnachew>
anyone one any idea on concurrency in ruby 2.0 ?
cousine has quit [Remote host closed the connection]
kil0byte has quit [Remote host closed the connection]
carloslopes has joined #ruby
<bpfh>
workmad3, neither do I :)
katherinem13 has quit [Ping timeout: 246 seconds]
cousine has joined #ruby
<Hanmac>
VolodymyrB from that i could see it does an instance_eval for the object that the service method generated internal ... so the supports function is called on this object and not at the main object
postmodern has quit [Quit: Leaving]
<workmad3>
bpfh: I just find the implementation optimisation of 'methods get wrapped into objects when requested' more convoluted and needlessly complicated than 'methods are objects, I can grab them with method(:name)'
<workmad3>
bpfh: similar to the implementation distinction between procs and blocks that is needlessly complicated (unless you're writing something like pry :P )
<workmad3>
bpfh: it's a great complication, but conceptually unimportant in most circumstances :)
chussenot has quit [Quit: chussenot]
<VolodymyrB>
Hanmac: thanks
<workmad3>
s/complication/optimisation
<workmad3>
dunno how the hell I managed that :/
jds has quit [Ping timeout: 268 seconds]
jds has joined #ruby
<Banistergalaxy>
Bpfh I don't think of methods as objects, they are the messages passed between objects, not objects themselves
<Xeago>
you throw an object a message containing an object?
<Xeago>
like an attachment?:)
<Banistergalaxy>
It's result of message passing OO system
bier has quit [Ping timeout: 240 seconds]
jds_ has joined #ruby
<Banistergalaxy>
bpfh lamdas and procs are our first class functions
jrajav has joined #ruby
bier_ has quit [Ping timeout: 268 seconds]
<bpfh>
Banistergalaxy, I agree with you
vlad_starkov has joined #ruby
<bpfh>
and this is an important design decision that must have a strong rationale behind it
jds_ has quit [Read error: Connection reset by peer]
jds_ has joined #ruby
jds has quit [Ping timeout: 256 seconds]
rippa has joined #ruby
u89 has joined #ruby
philcrissman has joined #ruby
koshii_ has joined #ruby
RudyValencia has quit [Quit: Hacked By Chinese!]
jenrzzz has joined #ruby
wreckimnaked has quit [Read error: Operation timed out]
baroquebobcat has quit [Quit: baroquebobcat]
darthdeus has joined #ruby
<Banistergalaxy>
Bpfh I think smalltalk is the same. And it kinda works, I rarely desire method objects, blocks are usually good enough
jds_ has quit [Read error: Connection reset by peer]
youconsulting has joined #ruby
jds has joined #ruby
Edward_ has quit [Ping timeout: 264 seconds]
shevy has joined #ruby
Michael__ has quit [Remote host closed the connection]
<youconsulting>
I have a controller 'logout_controller' with a method index and a view in my routes file i have the following: match 'logout', :to => 'logout#index' now i wanna link to this page but I can't get it to work:<%= link_to 'Logout', logout %>
<bpfh>
Banistergalaxy, yeah it leads to a distinctive style of programming
kil0byte has joined #ruby
jds has quit [Read error: Connection reset by peer]
jds has joined #ruby
bier has joined #ruby
bier_ has joined #ruby
jds has quit [Remote host closed the connection]
dmiller has joined #ruby
jds has joined #ruby
philcrissman has quit [Remote host closed the connection]
larissa has joined #ruby
lolmaus has joined #ruby
samphippen has quit [Quit: Computer has gone to sleep.]
<bpfh>
Banistergalaxy, in my opinion it makes the language more static and therefore more clear and easy to understand
<bpfh>
but at the same time some programming practices like closures sound more awkward and unnatural
baroquebobcat has joined #ruby
claymore has quit [Quit: Leaving]
dmiller has quit [Ping timeout: 260 seconds]
kil0byte_ has joined #ruby
vlad_starkov has quit [Read error: Connection reset by peer]
jds has quit [Read error: No route to host]
jds has joined #ruby
vlad_starkov has joined #ruby
dagnachew has quit [Remote host closed the connection]
equus has joined #ruby
<equus>
bpfh: it also speaks to encapsulation, since objects can only communicate via message sends, they can't access eachothers internal state directly
kil0byte has quit [Ping timeout: 256 seconds]
cascalheira has quit [Ping timeout: 244 seconds]
<workmad3>
equus: can't you keep with one name? :(
<equus>
bpfh: unlike say in python
<equus>
workmad3: phone vs laptop, phone connection is good, laptop connection is bad :)
d3vic3 has joined #ruby
prezioso has joined #ruby
<workmad3>
equus: what's wrong with the traditional Banister_? :P
equus is now known as banisterfiend
<banisterfiend>
workmad3: just like to mix it up
<banisterfiend>
hehe
<workmad3>
:)
emergion has quit [Quit: Computer has gone to sleep.]
<banisterfiend>
bbl
Virunga has joined #ruby
hamed_r has joined #ruby
ananthakumaran has quit [Ping timeout: 252 seconds]
ananthakumaran has joined #ruby
u89 has quit [Remote host closed the connection]
whitedawg has joined #ruby
greenarrow has joined #ruby
vlad_starkov has quit [Read error: Connection reset by peer]
Drakevr has quit [Read error: error:1408F10B:SSL routines:SSL3_GET_RECORD:wrong version number]
darthdeus has quit [Quit: Leaving...]
vlad_starkov has joined #ruby
cj3kim has quit [Ping timeout: 276 seconds]
cakehero has joined #ruby
cj3kim has joined #ruby
mmitchell has joined #ruby
t-mart has quit [Ping timeout: 245 seconds]
sawsaw has joined #ruby
<sawsaw>
Hi, is there and easy way to extract geo point info from images with ruby?
vickaita has joined #ruby
youconsulting has quit [Quit: Page closed]
<JonnieCache>
sawsaw: do you mean the gps data thats embedded in the file?
<kalleth>
i've done extraction of photo metadata (exif) with ruby
<kalleth>
and mogrify
<kalleth>
not specifically geo data, but
banisterfiend has quit [Ping timeout: 240 seconds]
<workmad3>
shevy: bit of a negative opinion... and I take it you base this on your deep knowledge of the problems that bundler tackles and how it attempts to solve them?
<shevy>
what deep knowledge? it never worked
<shevy>
but go help frytaz1 workmad3
Cakey has joined #ruby
<workmad3>
shevy: rather than your usual stance of 'I don't understand bundler! it must be bad!' :P
<food>
Hi, I would like to create a new hash, it should be a merge of two existing hashes based on a 'filename', add all their 'weights' (and skip 'frequency') : http://pastebin.com/26jabTH5
<shevy>
if it would be great, why would people come with their problems here?
<workmad3>
shevy: oh, by the same extension ruby must be bad because some people have problems?
<shevy>
workmad3: of course not. ruby is great, 95% of the problems that people have can be solved quite quickly
brunchpoems has quit [Quit: leaving]
schickung has joined #ruby
vickaita has quit [Ping timeout: 245 seconds]
<workmad3>
shevy: and scrolling up, frytaz1's issue looks like a barfed up linux environment :P
JustinCampbell has joined #ruby
<workmad3>
shevy: with multiple versions installed and no way to specify which one to use
<shevy>
food: you want to count up the value for "weight" ?
elaptics is now known as elaptics`away
<food>
yep
<shevy>
workmad3: I am not defending the linux environment. I used gobolinux for years, appdirs beat the crap out of FHS. the FHS is unable to deal with multiple versions installed side by side, that is why debian uses pseudo-versioning like /usr/bin/ruby1.8 which is a worse solution than appdirs
<shevy>
or gentoo uses that eselect crap
<shevy>
food: ok
<shevy>
"frequency" is discarded?
elsifaka has quit [Quit: Veloma e!]
<shevy>
well
<workmad3>
shevy: just seems that every time an issue comes up that even mentions bundler you jump on your favorite topic of 'bundler must be crap, lets beat on it'
<shevy>
let's assume you only require "weight"
<shevy>
bundler is crap :)
<workmad3>
shevy: which gets kinda annoying :P
<workmad3>
shevy: again, I ask on what you base that opinion?
elaptics`away is now known as elaptics
<shevy>
workmad3: on the base that the official rails tutorial, which mandated to use bundler, exploded into my face
<workmad3>
shevy: right, so because an update got through that caused an issue on your machine (and might have been a doc bug and since been solved) over a year ago, the tool is permanently and completely broken to you
ananthakumaran has joined #ruby
jds has joined #ruby
<shevy>
food: are these 4 separate hashes? or available in some container? because if so, it would be quite easy to use .select
itchyouch has joined #ruby
<shevy>
workmad3: perhaps it will get better
<shevy>
workmad3: perhaps not :)
vickaita has joined #ruby
<shevy>
it's becoming more and more important however
answer_42 has joined #ruby
<workmad3>
shevy: incidentally, 16 months ago is before bundler had even gotten to version 1
<workmad3>
or was it just at version 1?
<food>
shevy: hashes are in an array
<workmad3>
something like that anyway
<shevy>
food: ok
<Cork>
is there a "value" you can pass as a function argument to make it become the default value?
<shevy>
food: well, if it is an array, you could actually iterate through it via .each and just sum up the value of hash["weight"]
<shevy>
hmm probably via .inject, lemme see
<workmad3>
shevy: incidentally, bundler v0.9 - bundler v1 caused issues (because they addressed some things that needed breaking changes), so a doc that may not have been updated to v1 could easily explode, on top of which, I can tell you that I've been using bundler since 0.9, backported it onto older projects and while I've encountered some issues the tool has been mostly damn solid, well engineered and solved issues that caused *major* headach
iamjarvo has joined #ruby
<Cork>
ex. so you can set name and options but leave value in this one => def example(name, enabled=true,options={})
havenn has quit [Remote host closed the connection]
<apeiros_>
Cork: sadly, no, there is no such value
bluOxigen has joined #ruby
<Cork>
ouch
<food>
shevy: i have to count up weights for pages with the same filename (in my example they all have the same filename, but sometimes I could have filename3.html)
<workmad3>
shevy: so you constantly screaming about bundler being crap from one experience gets kinda annoying considering I've now had 2 years of generally good experience out of it :P
<Cork>
apeiros_: thx
<apeiros_>
if you're lucky, the method is implemented in a way to replace e.g. nil with a default value
heruka has joined #ruby
<apeiros_>
but it's up to the method implementor to do that
<apeiros_>
all you can do is look up the current default value for that argument and pass that
wchun has quit [Read error: Operation timed out]
<shevy>
food: well ok let's do one thing at a time
<shevy>
and from these then you need to sum up the "weight" values
<shevy>
food: this would work http://pastie.org/5371602 which you could put into a method that does the calculation, however it also has about 5 lines unnecessary...
<mohanmcgeek>
seriously, I find myself to be the no-technology-duck here..
<shevy>
"ruby-build is an rbenv plugin"
<shevy>
:( requires rbenv
<Xeago>
can be run without rbenv
<mohanmcgeek>
why not rvm>>>
<Xeago>
shevy: see the standalone section
<shevy>
I think the rbenv author does not like rvm
<shevy>
:)
linoj has joined #ruby
<Xeago>
the rbenv author was initially a committer of rvm aswell
<nospam99>
btw, I get 404 on freenode.net/faq
<shevy>
rbenv install 1.9.3-p327
<Xeago>
freenode.net/faq.shtml — sorry
<shevy>
nospam99: did you try to run the register command already?
<nospam99>
:)
<shevy>
you'll get some status information from freenode once you try it
<shevy>
in your IRC client
<nospam99>
not yet - I like to read a bit first
<mohanmcgeek>
Are you all always like "We hate rvm", or that somehow becomes the topic everytime I enter this channel?
JustinCampbell has quit [Remote host closed the connection]
<shevy>
"Ruby versions will be installed into a directory of the same name under ~/.rbenv/versions."
<spike|spiegel>
register command already?
<spike|spiegel>
19:38 < nospam99> :)
<nospam99>
well, mohan, I can say that what little I've seen of rvm, the doc is inadequate and it does NOT work seamlessly "out of the box"
<shevy>
mohanmcgeek: who said he hates rvm?
<spike|spiegel>
oops, cat
<Xeago>
shevy: if using ruby-build alone, you have to specify a destination
<shevy>
ah ok... nospam99 does
* workmad3
uses ruby-build and rbfu
<nospam99>
but lots of serious folks love it so there must be some value add once past the birth pains
<shevy>
aha... it's a growing list now :)
<Xeago>
nospam99: lots of serious folks hate it aswell
<mohanmcgeek>
shevy: note the 'like' part.. it's like regex wildcard..
prezioso has quit [Read error: Operation timed out]
<nospam99>
<sigh> Obie Fernandez and Mike Hartl like it
<mohanmcgeek>
^ no no, nvm.. forget that.. i named it wrong.
<workmad3>
nospam99: the people I've seen have 'birth pains' with rvm are the same people that would have birth pains with rbenv :P
<shevy>
hey, he said rvm docu sucks more
<shevy>
Hanmac: this shows you that you should not forget documentation for your projects
<erichmenge>
I've gone back and forth a bit. For whatever reason rvm seems to make my shell start less slowly than rbenv
<erichmenge>
haven't tried rbfu yet
<mohanmcgeek>
nospam99: Why don't you just throw the question and see if someone in this channel can help you?.. They're all smart people.. you know..
<Xeago>
erichmenge: that would be a correct assessment, if you want total leanness and lightweight
<Xeago>
go for rbfu
<Xeago>
it is _way_ lighter than rbfu
<nospam99>
k - but first advice here WAS to get into the #rvm channel
<Xeago>
rbfu lighter than rbenv*
bbttxu has quit [Quit: bbttxu]
<mohanmcgeek>
rule 1 of irc: avoid redirects.
<Xeago>
nospam99: to get stuff for rvm
<nospam99>
I did what I think is called the single user rvm install
<workmad3>
erichmenge: well, doesn't rbenv have to write out its shims in order to activate?
<nospam99>
and now rvm fails to install a ruby
snuglepuss has quit [Remote host closed the connection]
<shevy>
rvm sucks anyway
<shevy>
:D
OldOats has joined #ruby
jonathanwallace has joined #ruby
<nospam99>
looks to me like inadequate permissions
<shevy>
AHA!
<shevy>
ARE YOU NOT THE SUPERUSER!
<mohanmcgeek>
sudo !!
<shevy>
duso!
<nospam99>
I've tried rvm before as root - worked better - but I want to be able to use it as a non-root user
<mohanmcgeek>
sudo bang bang
<nospam99>
sudo ALL .. ALL etc etc?
<mohanmcgeek>
if you install it as super user, you should still be able to use it as normal user..
<mohanmcgeek>
right?
<mohanmcgeek>
or maybe, it's just my comp that gives me weird pancakes...
<apeiros_>
wow, off for a minute and everybody argues about which screwdriver is better to drive a nail into a wall…
<Xeago>
:D
<nospam99>
i.e. do all users of rvm have to be defined in /etc/sudousers as having ALL permissions?
<workmad3>
nospam99: no
<Xeago>
nospam99: that would be a horrible thing to do
<apeiros_>
mohanmcgeek: your computer gives you pancakes? I WANT ONE!
<workmad3>
nospam99: with a multi-user rvm install, users that can install new rubies and gems just need to be in the rvm group
<mohanmcgeek>
apeiros_: Yes, Weird pancakes... ask your comp.
<nospam99>
I agree, but I've seen some config comments, especially in Ubuntu that suggest that is needed
nomenkun_ has joined #ruby
<apeiros_>
mohanmcgeek: mine doesn't give me pancakes. neither weird nor normal :(
<spike|spiegel>
rvm sucks, can we move on now please?
<nospam99>
k - what is the "rvm group"? did I miss some doc somewhere in the rvm install instructions about setting that up?
<mohanmcgeek>
apeiros_: The pancakes are only my suspicion. Might not be true.
<mohanmcgeek>
spike|spiegel: That's not the solution to the problem.
<spike|spiegel>
don't use it and problem solved?
<mohanmcgeek>
nospam99: Do you get any Error in console?
<workmad3>
nospam99: it's added as part of the install script
<workmad3>
nospam99: and the user that ran the script is added automatically
mmitchell has joined #ruby
<workmad3>
(unless they've changed things recently)
<nospam99>
hmmmm - let me see if it's already there ....
<nospam99>
meanwhile, for your reading enjoyment, the error I get is ....
<workmad3>
nospam99: you will need to log out and back in with that user
theRoUS has joined #ruby
ttt has quit [Remote host closed the connection]
<nospam99>
[dnlruby@rubyserver ~]$ rvm install 1.9.2 Fetching yaml-0.1.4.tar.gz to /usr/local/rvm/archives % Total % Received % Xferd Average Speed Time Time Time Current Dload Upload Total Spent Left Speed 0 0 0 0 0 0 0 0 --:--:-- --:--:-- --:--:-- 0Warning: Failed to create the file yaml-0.1.4.tar.gz 3 460k 3 16150 0 0 19339 0 0:00:
aquaranto has joined #ruby
nomenkun has quit [Ping timeout: 245 seconds]
mikecmpbll has joined #ruby
<nospam99>
hmmm - there is an rvm group but the user is NOT in it - should my first step be to add the user to the group?
<workmad3>
nospam99: have you logged out and back in since installing rvm?
jamesaxl has quit [Ping timeout: 255 seconds]
<nospam99>
yes - just logged back in
<nospam99>
as non-root user
<workmad3>
nospam99: and 'groups' doesn't have rvm in it in that new session?
jamesaxl has joined #ruby
<nospam99>
does NOT
Virunga has joined #ruby
<workmad3>
nospam99: right, so for some reason your user wasn't added
<workmad3>
nospam99: so yes, add your user to the rvm group and log out and back in
<nospam99>
lol --- "for some reason"
<workmad3>
nospam99: well, I don't know how you ran the script, I also don't use rvm much anymore :P
<nospam99>
k - is that something I should put on my "todo" list for all users I want to enable for rvm?
macabre has quit [Remote host closed the connection]
<workmad3>
nospam99: it's only needed for users that need to install system-wide rubies and system-wide gems
<mohanmcgeek>
you know.. I installed rvm myself and It was installed in my home directory.. PANCAKES!
<workmad3>
mohanmcgeek: that's the easiest route generally :)
<nospam99>
not installing a system-wide ruby - just a single user ruby
<workmad3>
one simple command, done...
niklasb has quit [Ping timeout: 260 seconds]
vickaita has joined #ruby
Roa has quit [Read error: Connection reset by peer]
BadLarry has quit [Ping timeout: 276 seconds]
jeffreybaird has joined #ruby
BadLarry has joined #ruby
<nospam99>
so .... if I am NOT tryinig to install a system-wide ruby, should I (yes or no) add the user to the rvm group?
<nospam99>
btw, the system-wide ruby is 1.8.7
nari has quit [Ping timeout: 245 seconds]
jackiechan0 has joined #ruby
macabre has joined #ruby
tpe11etier has joined #ruby
lolmaus has quit []
<nospam99>
I'm trying to start with one user using 1.9.2 in "isolation"
DrShoggoth has joined #ruby
<nospam99>
I hear the crickets .... time to go to #rvm?
d2dchat has joined #ruby
<OldOats>
Hello all, I was wondering what is the "ruby way" creating constant values that can be accessed within a class instance, as well as by outside classes via a helper method. Right now I am using class variables, but almost everything I read about class variables advises against using them.
tpe11etier has quit [Read error: Connection reset by peer]
greenarrow has quit [Ping timeout: 248 seconds]
ephemerian has quit [Quit: Leaving.]
<apeiros_>
OldOats: class instance variables or constants
food has quit [Ping timeout: 245 seconds]
F1skr has quit [Quit: WeeChat 0.3.9.1]
<apeiros_>
class ivars need - like all ivars - accessors to access them from outside.
binaryplease has joined #ruby
pavilionXP has quit [Quit: Forget progress by proxy. Land on your own moon.]
<OldOats>
well an example is that I am creating a class that models a server and I would like to be able to create some kind of constant in the class that can be a single point of reference for the hostname.
jackiechan0 has quit [Quit: Sto andando via]
binaryplease has quit [Client Quit]
kil0byte_ has joined #ruby
kil0byte has quit [Ping timeout: 246 seconds]
lenodroid has quit [Ping timeout: 260 seconds]
lenodroid has joined #ruby
<OldOats>
so I want to be able to access the constant from an instance of the class, but not have to create an instance if another class is referencing it. Kinda like Server.get_hostname type method.
codecaster has quit [Quit: Leaving.]
horofox has quit [Quit: horofox]
Appineer has joined #ruby
lenodroid has quit [Client Quit]
<apeiros_>
OldOats: bad design. what if you want more than one server with different host names?
Schmidt has quit [Read error: Operation timed out]
<OldOats>
instead of Server.new.get_hostname
sailias has joined #ruby
<apeiros_>
but if you still want to do that, what I said still applies
glow_nzl has quit [Quit: Leaving]
horofox has joined #ruby
A85 has joined #ruby
a_a_g has joined #ruby
kpshek has joined #ruby
Elico has joined #ruby
dekroning has quit [Read error: Connection reset by peer]
katherinem13 has joined #ruby
SCommette has joined #ruby
dekroning has joined #ruby
aflynn has quit [Quit: Ex-Chat]
nwertman has joined #ruby
<apeiros_>
hrm
<shevy>
OldOats: is the data changing? if not you could use a constant within your class, and access that via a method
<apeiros_>
"%{variable_name:f15,b0}" - instead of "\e[38;5;15;48;5;0m%{variable}\e[0m" is better, yes?
daniel_- has quit [Ping timeout: 252 seconds]
<shevy>
Yes
<apeiros_>
dunno, I'm still not very happy with my markup…
<shevy>
much shorter and less perly ;
areil_ has quit [Remote host closed the connection]
<shevy>
yeah, but there is always a limit to cosmetic surgery
<shevy>
like the late Michael Jackson !
<apeiros_>
L5 for "margin left, 5 spaces", R1 for "margin right, 1 space", P20 for "pad to 20 characters, left aligned" (-20 for right aligned)
nat2610 has joined #ruby
<OldOats>
The data would not be changing. Would that constant just be a regular variable inside of the class definition, but outside of a method definition?
<apeiros_>
${f15,b0} for just the colors, ${.} for reset (%{} resets automatically)
nwertman has quit [Client Quit]
<apeiros_>
OldOats: constants start with a capital letter
nwertman has joined #ruby
<apeiros_>
that's what makes ruby recognize it as a constant and makes it visible via e.g. Server::HostName
<apeiros_>
assuming you did `class Server; HostName = "whatever"; end`
tpe11etier has joined #ruby
<OldOats>
ok that makes sense.
centipedefarmer has joined #ruby
<shevy>
hmm style question... what is nicer. I have a bunch of constants like FOO1, FOO2, FOO3. I want to group them into a new array constants, FOO... now, what would you rather use:
jrist-mtg is now known as jrist
<shevy>
FOO = [FOO1,FOO2,FOO3]
<shevy>
FOO = [ FOO1, FOO2,FOO3 ]
<shevy>
FOO = [ FOO1, FOO2, FOO3 ]
bigmcq77 has quit [Quit: Computer has gone to sleep.]
<shevy>
sorry
<shevy>
the second one would have been:
<apeiros_>
Foo = [Foo1, Foo2, Foo3]
<shevy>
FOO = [ FOO1,FOO2,FOO3 ]
<shevy>
ok
<apeiros_>
assuming you really named them Foo#, I'd drop the Foo# constants entirely
<apeiros_>
s/assuming/if/
hackerdude has joined #ruby
jrajav has quit [Quit: I tend to be neutral about apples]
Virunga has quit [Remote host closed the connection]
workmad3_ has joined #ruby
BadLarry has quit [Ping timeout: 265 seconds]
dmiller has joined #ruby
workmad3 has quit [Ping timeout: 260 seconds]
_alejandro has quit [Remote host closed the connection]
johnjohnson has joined #ruby
a_a_g has quit [Quit: Leaving.]
<shevy>
apeiros_: well at least your system is easy to memorize... upper case L for left, R for right, P for Pad, + and - for the amount of alignment. seems simple enough
jds has quit [Remote host closed the connection]
jds has joined #ruby
Uranio has joined #ruby
hackerdude has quit [Ping timeout: 260 seconds]
horofox has quit [Quit: horofox]
punkrawkR has quit [Read error: Connection reset by peer]
freeayu has quit [Remote host closed the connection]
cousine has quit [Remote host closed the connection]
workmad3 has joined #ruby
workmad3_ has quit [Ping timeout: 260 seconds]
dmiller has quit [Ping timeout: 264 seconds]
nospam99 has left #ruby [#ruby]
<apeiros_>
shevy: thanks
<apeiros_>
I don't think I can make it any better. but I'm still not happy about it :(
samphippen has quit [Quit: Computer has gone to sleep.]
nat2610 has quit [Quit: Leaving.]
<apeiros_>
I mean… "%{name:L1,P20,R1,F15,B0,B}"
<apeiros_>
it looks so ugly :(
hackerdude has joined #ruby
darthdeus has joined #ruby
perlsyntax has joined #ruby
darthdeus has quit [Read error: Connection reset by peer]
quest88 has joined #ruby
ltsstar has quit [Quit: ltsstar]
mmitchel_ has joined #ruby
darthdeus has joined #ruby
jgarvey has joined #ruby
philcrissman has joined #ruby
<OldOats>
I know it is probably difficult to answer this not knowing the full extent of the code that I am writing, but in general would an in class constant be the be way to go about providing a constant value that can be referenced in a single place by outside entities?
prezioso has joined #ruby
mohanmcgeek has quit [Ping timeout: 246 seconds]
Guest91808 has quit [Quit: Guest91808]
stopbit has joined #ruby
x82_nicole has joined #ruby
<apeiros_>
OldOats: yes
<joofsh>
is the constant relevant to that class?
hackerdude has quit [Ping timeout: 264 seconds]
mmitchell has quit [Ping timeout: 264 seconds]
<apeiros_>
as with all such answers - more details may change the answer
BadProphet has joined #ruby
hackerdude has joined #ruby
<OldOats>
I understand about more details, Im still trying to wrap my head fully around how I want this to work, but thanks for the info.
casheew has quit [Read error: Connection reset by peer]
casheew has joined #ruby
carlyle has joined #ruby
casheew has quit [Read error: Connection reset by peer]
andre____ has joined #ruby
<shevy>
apeiros_: yeah it has a lot of information in that {}
<shevy>
OldOats: it is often easier to continue, and at a later time reconsider
hackerdude has quit [Ping timeout: 255 seconds]
<shevy>
I am rewriting my old ftp-related code right now... reshuffling things all around
nilg has quit [Remote host closed the connection]
enderx86 has joined #ruby
andre____ is now known as andrewhl
hackerdude has joined #ruby
jamesaxl has quit [Ping timeout: 260 seconds]
Rydefalk has quit [Read error: Connection reset by peer]
Rydefalk_ has joined #ruby
jamesaxl has joined #ruby
<shevy>
my three main goals: simplify whenever possible (that includes trying to remove things that are not needed), make a common simple base including console-input via (optionally) Readline, and last but not least, allow this to be used in GUIs, so I can get rid of stuff like gftp or similar
Appineer has quit [Remote host closed the connection]
Mon_Ouie has joined #ruby
Banistergalaxy has quit [Ping timeout: 260 seconds]
casheew has quit [Read error: Connection reset by peer]
savage- has joined #ruby
kil0byte has joined #ruby
volta has joined #ruby
JustinCampbell has joined #ruby
jxf has quit [Quit: Leaving]
zommi has left #ruby [#ruby]
jxf has joined #ruby
kil0byte_ has quit [Ping timeout: 248 seconds]
hackerdude has joined #ruby
casheew has joined #ruby
dnstbr has joined #ruby
Rydefalk has quit [Read error: Connection reset by peer]
gp5st has joined #ruby
Rydefalk has joined #ruby
k610 has quit [Ping timeout: 260 seconds]
GoGoGarrett has joined #ruby
jackdanger has joined #ruby
kryptek_ has quit [Remote host closed the connection]
_alejandro has joined #ruby
linoj has quit [Read error: Connection reset by peer]
linoj has joined #ruby
daniel_- has joined #ruby
k610 has joined #ruby
nwertman has quit [Ping timeout: 256 seconds]
apeiros_ has quit [Remote host closed the connection]
hackerdude has quit [Ping timeout: 260 seconds]
haxrbyte_ has quit [Ping timeout: 245 seconds]
cburyta has joined #ruby
ttt has joined #ruby
larissa has quit [Quit: Leaving]
nitti has joined #ruby
davehimself has quit [Remote host closed the connection]
Takehiro has quit [Remote host closed the connection]
yshh has joined #ruby
perlsyntax has quit [Quit: Leaving]
samphippen has quit [Quit: Computer has gone to sleep.]
Takehiro has joined #ruby
ndrei has joined #ruby
Cakey has quit [Ping timeout: 240 seconds]
tagrudev has quit [Quit: ydd]
Elico has quit [Quit: elico]
ianfleeton has quit [Quit: ianfleeton]
samphippen has joined #ruby
fyolnish has joined #ruby
ttt has quit [Ping timeout: 245 seconds]
mikepack has joined #ruby
greenarrow has joined #ruby
Roa has joined #ruby
Roa has joined #ruby
Roa has quit [Changing host]
<gp5st>
hello. i'm sorry if this is a dumb question. how can I get this to work? I've tried a couple variations including putting the data method as the first thing in the class. http://pastebin.com/NXRBKeaT
iamjarvo has quit [Quit: Computer has gone to sleep.]
tk__ has quit [Quit: ばいばい]
bapa has quit [Quit: No Ping reply in 180 seconds.]
r0bby has joined #ruby
bapa has joined #ruby
<shevy>
always include the error you get gp5st
<shevy>
also pastie.org is much nicer to read
<gp5st>
one sec then
<carloslopes>
gp5st: yes, paste the error
<shevy>
on first look I'd think that this would not work as is, because it is supposed to be an instance method or?
nateberkopec has joined #ruby
<carloslopes>
but on a overview, i think that this is a problem with the method scope
<carloslopes>
gp5st: you are creating a method for an instance of Thing
<shevy>
gp5st: yeah, the other thing could be that you tried to use it
<carloslopes>
not for a Thing class
Guest91808 has joined #ruby
<shevy>
before defining it
<shevy>
so you could put the method definition before
<shevy>
but I am sure it will still not work
<gp5st>
shevy: i tried it and it doesn't, but i'll try it with this test and see
<carloslopes>
shevy: it won't, the scope is incorrect
tbrock has joined #ruby
daccle has joined #ruby
robotmay has quit [Read error: Connection reset by peer]
<gp5st>
that was one thing i was thinking. but if i make it self.data which works and isn't surprising, but then i don't have the scope of the current class when i try to do the send also not surprising?
<shevy>
dunno, I avoid .send whenever possible
robotmay has joined #ruby
<shevy>
the way how you want to use data() seems to be aking to attr() attr_accessor() etc...
<shevy>
perhaps you want a class method? Thing.class_eval { def data; rest_hereputs "class hi!" ; end }
<shevy>
defining @data_method = nil outside any method seems also rather unclean
<gp5st>
shevy: perhaps. i want to be able to make this a mix-in for some controllers we have
<gp5st>
to try to clean up some boilerplate
<gp5st>
shevy: it's an instance variable, i shouldn't initialize them? (unnecessary, but an old habit)
cakehero has quit [Quit: Computer has gone to sleep.]
<shevy>
ruby will give a warning if uninitialized instance variables are used or queried
gauravag has joined #ruby
BadLarry has quit [Ping timeout: 245 seconds]
daccle has quit [Client Quit]
<gp5st>
shevy: like i said, unnecessary, but i find it easier to read and understand code ::shrug::
Cakey has joined #ruby
mityaz has joined #ruby
<shevy>
dunno. I always initialize instance variables in my classes
gauravag has left #ruby [#ruby]
joshman_ has quit [Quit: Computer has gone to sleep.]
mityaz has quit [Read error: Connection reset by peer]
mityaz has quit [Read error: Connection reset by peer]
Guest91808 has quit [Quit: Guest91808]
<gp5st>
interesting
pixie79 has joined #ruby
<workmad3>
shevy: you forgot to show Thing.instance_methods
<workmad3>
shevy: which shows where @data_method actually gets defined ;)
mmitchel_ has quit [Remote host closed the connection]
<pixie79>
hi - does anyone here use the ruby-cloudfiles gem, i am trying to use it on large files which i have split to be 2G in size but when they transfer over they arrive in seconds and are only 24B any ideas ?
<shevy>
hmm I dont see much from that
mmitchell has joined #ruby
dmiller has joined #ruby
LMolr has quit [Ping timeout: 265 seconds]
<workmad3>
err, Thing.instance_variables even
<workmad3>
bleh
<gp5st>
pixie79: what are those 24bytes?:-p how are you trying to transfer them? more input! need input!
<gp5st>
too much shell scripting..i'm ending blocks with done and fi
<workmad3>
gp5st: it's not too much until you start writing esac in ruby :)
<shevy>
class instance variables... class variables... instance class variables... variable class instances...
<Xeago>
need a title for yesterdays status-report
chussenot_ has joined #ruby
<Xeago>
and don't know how to spell it >.<
<shevy>
call it "The Big Secret" Xeago
<Jdubs_>
lol...
<workmad3>
Xeago: 'Daily Status Update for 12/11/2012' maybe?
<shevy>
everyone will want to find out what this secret is about
<gp5st>
workmad3: yeah, the class itself is an object that can be changed, not just some "thing" that exists only to delineate a type
<fbrn>
Jdubs_ shevy jackdanger: thank you for a very quick response. :)
<workmad3>
gp5st: yeah :)
BadLarry has quit [Ping timeout: 245 seconds]
<Xeago>
they all have non-arbitrary titles, related a bit, geeky n stuff
<shevy>
"Here I murdered my neighbour"
<workmad3>
gp5st: and when you do 'class Name; ... end;' the stuff in the ... is still just code that is being executed
Maoz has quit [Ping timeout: 256 seconds]
<Xeago>
"Daily Status Update for 12/11/2012" would be unrelated to the actual report
<shevy>
"This is my status report after I spent 5 hours in a nearby pub"
<Xeago>
werk or work
kkh has quit [Quit: Good bye!]
BadLarry has joined #ruby
<workmad3>
Xeago: I no longer know the context :P
tommyvyo_ has joined #ruby
<Xeago>
what is the usual spelling when saying "More work?"/"More werk?"
aganov has quit [Remote host closed the connection]
chussenot has quit [Ping timeout: 265 seconds]
chussenot_ is now known as chussenot
kkh has joined #ruby
<workmad3>
Xeago: well, considering that 'werk' isn't a word...
<workmad3>
Xeago: at least not in English...
<Xeago>
aight, take as context warcraft peons
<JustinCampbell>
MOAR WERK
kkh has quit [Changing host]
kkh has joined #ruby
ner0x has joined #ruby
glyytchy has quit [Quit: glyytchy]
<ner0x>
Good morning. *very* new to ruby but not text-based languages. I'm begun the beginners course etc. Are there any ways to install all gems locally?
<workmad3>
Xeago: well, the spelling would be 'work', but it might sound like 'werk' with the peon's accent... been too long since I played Warcraft too remember :(
<workmad3>
ner0x: all gems?
<ner0x>
workmad3: My terminology may be off.
<workmad3>
ner0x: do you have a crapload of hard disk space you just don't like anymore and think 'lets fill it with crap'?
<ner0x>
workmad3: Any programs I install such as rails, etc.
<ner0x>
workmad3: Like I said, terminology can be off.
<workmad3>
ner0x: 'gem install <whatever>' installs it locally
wroathe has joined #ruby
<Beoran__>
ner0x, on what operating system?
<workmad3>
ner0x: there isn't a way to do that other than locally...
<Beoran__>
yeah
<workmad3>
unless you install onto an NFS, I guess...
<Beoran__>
so look at all the gems you want and install them all
<shevy>
gem install everything
<workmad3>
shevy: :D
<shevy>
hmmmm
Monie has quit [Ping timeout: 245 seconds]
<workmad3>
shevy: oooh, should write that...
<workmad3>
ah, it already exists
<shevy>
ner0x: all gem files are .gem files which reside in the cache/ subdirectory, you can find them there and back them up
<workmad3>
but it requires everygem...
<shevy>
ERROR: While executing gem ... (Gem::DependencyError) Unable to resolve dependencies: everything requires everygem (>= 0)
<shevy>
lol
vickaita_ has joined #ruby
dakine has joined #ruby
<workmad3>
and everygem doesn't exist :(
<shevy>
aha
<workmad3>
should write everygem
<shevy>
whoever wrote that one probably hated gems
Takehiro has quit [Remote host closed the connection]
<workmad3>
with a gemspec that adds a dependency on every gem in rubygems
savage- has quit [Quit: savage-]
<shevy>
hehe
<shevy>
bad that you can not easily remove your old account from rubygems again :(
<workmad3>
shevy: if you want to destroy bundler, write that gem and include it in a Gemfile ;)
<workmad3>
shevy: you'll basically set bundler to work on attempting to resolve a valid dependency graph out of the entirety of rubygems...
j3 has joined #ruby
<shevy>
I dont think I have ever written a Gemfile... only .gemspec files... that is not the same right?
headius has joined #ruby
<workmad3>
no
vickaita has quit [Ping timeout: 240 seconds]
<workmad3>
a bundler Gemfile declares the gems you are using in a project
<shevy>
ah
<shevy>
so like several add_dependency() in .gemspec
<Jdubs_>
Xeago: do you have any suggestions for finding an opensource project to work on that's at my level?
<Xeago>
github
<workmad3>
yeah, although with a Gemfile you also specify the source(s) of the gems (e.g. source :rubygems)
<shevy>
Jdubs_: there are many!!! first, identify anything you want to solve with ruby
kkh has quit [Quit: Good bye!]
<shevy>
I see
<shevy>
as long as it is not rubyforge...
<workmad3>
shevy: :)
<j3>
hey folks - trying to run 'sudo gem install ledger_web' on mac OS X 10.8 (no xcode installed, but I have installed "command line tools for xcode" instead) - it gets to "Building native extensions. This could take a while" and it runs *forever* - xcrun? it basically will run for days. any ideas?
<shevy>
sounds as if it got stuck
elux has quit [Read error: Connection reset by peer]
joshman_ has joined #ruby
<j3>
shevy: should i look in a log file somewhere?
<shevy>
not sure, if it is stuck in a loop perhaps it will never write to any log file
matti has quit [Read error: Connection reset by peer]
roadt has quit [Ping timeout: 245 seconds]
<j3>
maybe i'll install xcode
<shevy>
find the .gem file first, then extract it, enter the directory and try to build the native extension
stetho has joined #ruby
<shevy>
on my system it is in /usr/lib/ruby/gems/1.9.1/cache/
lenovodroid has quit [Ping timeout: 246 seconds]
dmerrick has quit [Quit: dmerrick]
<shevy>
usually when I run extconf.rb or setup.rb there, I get the error directly
<shevy>
like missing file foo.h
<j3>
pg-0.14.1.gem - found it
<workmad3>
j3: also there's 'gem install ledger_web -V' for verbose output, might give you more info
<shevy>
or some symlinks to symlinks to symlinks, that don't exist, and then get repeatedly checked if and where they exist
dmerrick has joined #ruby
skcin7 has quit [Quit: Computer has gone to sleep.]
Guest91808 has joined #ruby
<j3>
workmad3: yea i have run that too - just gets to that same spot :(
<shevy>
pg? sounds like postgresql :)
<workmad3>
it is
d-egg has joined #ruby
hackerdude has joined #ruby
<j3>
crap but i already have that. or is it a library to interface with postgres
<workmad3>
j3: it's the ruby gem for interfacing with it, yes
<j3>
ok that's fine then
jgarvey has quit [Quit: Leaving]
hackerdude has quit [Read error: Connection reset by peer]
hackerdu_ has joined #ruby
r0bby is now known as robbyoconnor
kkh has joined #ruby
hackerdu_ has quit [Read error: Connection reset by peer]
hackerdude has joined #ruby
flip_digits has joined #ruby
<d-egg>
Hi, I'm doing a tutorial which is not about ruby but uses some ruby examples. I don't know ruby and I'm stuck with this
<apeiros_>
no, even when you come from both of those
* apeiros_
did ~5y perl and ~6y php
<shevy>
well
<shevy>
ner0x: apeiros wrote a 20k lines of code php webframework once
* Hanmac
feels sorry that you did php
<shevy>
lol
<apeiros_>
it was before I knew ruby. not sure it was 20k.
<ner0x>
shevy: I have a 5-6k perl one now. :)
tenmilestereo has joined #ruby
<Hanmac>
shevy "apeiros wrote a 20k lines of code php webframework once" than hanmac came and reduce them to 200 one-liners (:D)
jackdanger has quit [Quit: Leaving.]
jaygen has quit [Remote host closed the connection]
<apeiros_>
Hanmac: not php :-p
<shevy>
in php?
pskosinski has joined #ruby
<shevy>
Hanmac: did you write a webframework yet anywhere, even in C++
<shevy>
:P
<pskosinski>
If I want to run a code in fork and I first need to read that code from another file, then I need to read file and in fork block use eval(code), right? Or is there a different way?
ewag has joined #ruby
answer_42 has joined #ruby
Raimondi has left #ruby ["WeeChat 0.3.8"]
nitti has quit [Remote host closed the connection]
<Hanmac>
shevy i could write an webframework in a language of your choice ... php, ruby, C++ or C :D
<apeiros_>
pskosinski: fork { load(file) }
<Gate>
Hanmac: haskell!
pcarrier has quit []
nitti has joined #ruby
<Hanmac>
Gate haskell is not a language its "sore throat"
<ner0x>
Rails does seem to have a ton more features by default.
slainer68 has quit [Remote host closed the connection]
schickung has quit [Quit: schickung]
schickung has joined #ruby
schickung has quit [Client Quit]
<pskosinski>
apeiros_: Ok… thanks. And can I pass some argument to this program, when using load?
monkegjinni has joined #ruby
<pskosinski>
arguments *
<pskosinski>
I was trying load path, true -- but seems that it is something else
tchebb has joined #ruby
apok has quit [Quit: apok]
<apeiros_>
pskosinski: if you want to pass arguments, then use methods
jonan has joined #ruby
<pskosinski>
And kinda, vice versa… well, I want to run code in subprocess and then that child should return something. With fork {eval(code)} I can use pipes
<apeiros_>
and no, you can't pass arguments to a file. since… well… it's a file, you know?
<ner0x>
And way more testing features.
<apeiros_>
pskosinski: why tf do you want to eval?
<hderms>
yeah
<hderms>
avoid eval if at all possible
<hderms>
it's always possible to avoid it lol
volta has quit [Remote host closed the connection]
<apeiros_>
hderms: load/require are eval too…
<pskosinski>
How to use methods, what do you mean?
<apeiros_>
my point isn't about eval being evil
<hderms>
apeiros_: that's sort of irrelevant don't you think
<apeiros_>
hderms: no
<apeiros_>
if you do not understand why eval is evil, you are just cargo culting
statarb3 has joined #ruby
statarb3 has quit [Changing host]
statarb3 has joined #ruby
anachronistic has joined #ruby
<hderms>
apeiros_: it's pretty obvious why it's bad
<apeiros_>
and eval(File.read(path)) is just as evil as load(path)
<apeiros_>
which in turn is just as evil as require(path)
<hderms>
if you honestly believe that you're demented
dr_bob has quit [Quit: Leaving.]
<apeiros_>
hderms: behave, or be gone
<apeiros_>
and I won't say that twice
<pskosinski>
My point is to avoid crashing app when I am running part of code, code from an external file. But I need to pass some data to that program and then give results to main program…
jds has quit [Remote host closed the connection]
<hderms>
load and require have very clear use cases
<apeiros_>
hderms: so?
d-egg has quit []
<apeiros_>
load is *exactly* just eval(File.read(path))
<apeiros_>
+ added path resolution
<apeiros_>
there is *zero* added security
jds has joined #ruby
<hderms>
that doesn't give license to use eval freely in code
<apeiros_>
hderms: so tell me, how's eval(File.read(path)) more evil than load(path)
<hderms>
just because the language designers used it to add power
tbrock has quit [Quit: Computer has gone to sleep.]
<apeiros_>
just answer that question.
Rizzle has joined #ruby
greenarrow has quit [Read error: Connection reset by peer]
<Hanmac>
if you use load or eval, someday an Hanmac comes and crash your code
<hderms>
apeiros_: in what context
etcetera has joined #ruby
<apeiros_>
no context. all you have is eval(File.read(path)) vs. load(path)
greenarrow has joined #ruby
koshii_ has joined #ruby
<ner0x>
Where can I search for gems?
c0rn has joined #ruby
<apeiros_>
your claim is eval was inherently more evil. so… go ahead, show it. explain it.
<hderms>
it's bad design in most cases
<hderms>
cases require setting up context
<apeiros_>
hderms: you're evading. I asked about eval(File.read(path)) vs. load(path)
<hderms>
i said eval shouldn't be used if it is at all possible
<hderms>
and it's always possible to avoid it
kil0byte has joined #ruby
wreckimnaked has quit [Ping timeout: 245 seconds]
<hderms>
you could avoid using it in the vast majority of times
ViperMaul|_ has quit [Ping timeout: 252 seconds]
<ner0x>
Anyone?
<apeiros_>
18:45 apeiros_: and eval(File.read(path)) is just as evil as load(path)
<apeiros_>
18:45 apeiros_: which in turn is just as evil as require(path)
<apeiros_>
18:46 hderms: if you honestly believe that you're demented
<apeiros_>
hderms: you said more than that. ^
phux has joined #ruby
<apeiros_>
so if you feel justified to insult, you are obliged to elaborate.
<apeiros_>
otherwise stfu.
<hderms>
just because there is a particular usage for eval that is hidden via other terminology and supposed to be used in a very clear manner
<hderms>
doesn't mean that all usages of eval are evil
LMolr has joined #ruby
<apeiros_>
hderms: you're still evading.
<hderms>
nor does it mean that all are good
<apeiros_>
you not answering the question.
<hderms>
there is one case where it is supposed to be used
<hderms>
what does that change about my argument?
maesbn has joined #ruby
<apeiros_>
you DONT HAVE an argument.
<hderms>
my argument is that it should be avoided in most cases
<hderms>
you presented one case where the language designers used it
<hderms>
and advocate using it in a controlled manner
sepp2k has quit [Ping timeout: 240 seconds]
<hderms>
i don't see how that changes anything
<apeiros_>
blablabla…
<hderms>
nor does the fact that require being equivalent to eval have anything to do with using eval freely in code
sepp2k has joined #ruby
werdnativ has quit [Quit: werdnativ]
kil0byte_ has quit [Ping timeout: 265 seconds]
Virunga has quit [Remote host closed the connection]
<apeiros_>
hderms: what you said before was NOT about using eval freely.
<ner0x>
So is ExecJS a core ruby class ?
<hderms>
i think it should be avoided in the vast majority of cases because it is extremely powerful and difficult to reason about
Elhu has quit [Quit: Computer has gone to sleep.]
<apeiros_>
hderms: you're lame. insulting somebody about something you're wrong and unable to either apologize or correct your statement. sorry, no respect for you.
<hderms>
if used for its power
<apeiros_>
and then just dancing around the issue.
wroathe has quit [Ping timeout: 256 seconds]
<hderms>
i don't really think that's the case
<ner0x>
RDBI the best database connect?
u89 has quit [Remote host closed the connection]
<apeiros_>
hderms: then again, explain why eval(File.read(path)) is more evil as load(path)
<hderms>
it's used in one controlled situation for its power
<apeiros_>
*than
shtirlic_ has joined #ruby
<hderms>
apeiros_: you're posing that question and trying to draw conclusions from it
<hderms>
i don't care if it's used in one case
<ner0x>
I'd love to try ruby but the banter back and forth is only showing me the community would rather fight than help it's new members..
Prudhvi has left #ruby [#ruby]
<apeiros_>
hderms: you said I was demented if I believed it wasn't.
<apeiros_>
hderms: so your claim
LMolr has quit [Ping timeout: 245 seconds]
cezar-b has quit [Remote host closed the connection]
<apeiros_>
but you've obviously noticed that you are wrong about that claim and trying to weasel out.
<hderms>
one of them is an obvious use case the other one could be used in any context
<apeiros_>
they are *the same*
<hderms>
at the very least one is more clear as to purpose
tbrock has joined #ruby
aquaranto has joined #ruby
<hderms>
i don't think i'm wrong about it at all
<apeiros_>
and you're still not telling why it's more evil…
<hderms>
it's obvious what one should be used for
<apeiros_>
"different use case" - what's that got to do with evil… sheesh
<hderms>
so at the very least the intent is clear
<apeiros_>
lol
<apeiros_>
yeah, bye
kaneda__ has quit [Ping timeout: 248 seconds]
<hderms>
ner0x: blame apeiros_, he apparently has some kind of authority in this channel
<hderms>
i'm not representative of the ruby community in any way
joeycarmello has joined #ruby
jaygen has joined #ruby
<apeiros_>
right, I should have just kickbanned you for insult instead of giving you a chance to redeem.
matti has joined #ruby
khakimov has quit [Quit: Computer has gone to sleep.]
Virunga has joined #ruby
<ner0x>
Can you take it to privmsg so we can ask questions?
<apeiros_>
ner0x: ExecJS is not a core ruby class, no
<apeiros_>
ner0x: not sure about rdbi - are you asking for ruby dbi classes/libs?
chussenot has quit [Quit: chussenot]
<ner0x>
apeiros_: I'm getting that "You need a javascript" error that's typical of new rails apps.
<apeiros_>
ner0x: and yes, if somebody insults me, that has priority. if you don't like that, well, sorry but that'd be your problem.
<ner0x>
apeiros_: Yes, some DBI from ruby, whatever the typical norm is so I can read some docs.
Vainoharhainen has quit [Quit: Leaving...]
<apeiros_>
ner0x: Sequel is a nice DBI lib
schickung has joined #ruby
<ner0x>
apeiros_: I have no problem with holding your ground. I would too. Just realize it hurts us when we can't ask questions.
<itchyouch>
Need a simple help with syntax. Im just trying to do something like File.open("/somefile").grep(/string/) && puts "found"
<apeiros_>
can write plain sql with it, use its DSL and/or even its ORM. the orm is optional.
obryan has joined #ruby
mrsolo has quit [Quit: This computer has gone to sleep]
<apeiros_>
ner0x: yes, usually I kickban. but then people whine about being unjustly treated. so I gave him a chance to redeem. but I guess I'll go back to instakickban on insult again.
<ner0x>
apeiros_: I'm looking for something that will do automatic foreign linking for me.
cdt has quit [Ping timeout: 255 seconds]
<apeiros_>
ner0x: not sure whether sequel does automatic foreign keys. I think most DBIs put the emphasis on having logic in the app layer (not my choice for those things…)
elaptics is now known as elaptics`away
kalleth has quit [Quit: kalleth]
<ner0x>
apeiros_: I just assumed $user->company->name would be something less... language specific.
clj_newb has joined #ruby
dnstbr has quit [Quit: Computer has gone to sleep.]
<apeiros_>
ner0x: that's what an ORM does
<apeiros_>
not just DBI
linoj has quit [Quit: linoj]
<apeiros_>
and for that, there's ActiveRecord (from rails), DataMapper (ex-merb) and Sequel's own ORM
mrsolo has joined #ruby
<apeiros_>
AR is by far the most used. Can't give any recommendations as I only used AR so far.
<ner0x>
Well considering I'll be using rails, ActiveRecord seems to be the logical place to start.
<apeiros_>
itchyouch: you'll have to explain your problem if you want help…
<ner0x>
apeiros_++ # helpful
d3vic3 has quit [Ping timeout: 268 seconds]
tjbiddle_ has joined #ruby
robotmay has quit [Read error: Connection reset by peer]
Uranio has quit [Remote host closed the connection]
dnstbr has joined #ruby
aaroncm has joined #ruby
<itchyouch>
Im trying to do the following in ruby: grep -q string somefile &&
ewag has quit [Ping timeout: 260 seconds]
<apeiros_>
BSD grep?
robotmay has joined #ruby
tbrock has quit [Quit: Computer has gone to sleep.]
<itchyouch>
apeiros_: Linux grep
<apeiros_>
GNU grep then? don't know what -q does there…
<ner0x>
apeiros_: Looks like it comes with Rails. I'm liking rails so far. Not entirely sure about ruby syntax; although it doesn't look to be *that* much different.
<itchyouch>
Just working on concatening a file into another file only if the string isn't found
d3vic3 has joined #ruby
<itchyouch>
Working on a chef recipe, so im still getting the hang of ruby.
<apeiros_>
itchyouch: big files? or small files?
tjbiddle has quit [Ping timeout: 255 seconds]
tjbiddle_ is now known as tjbiddle
<itchyouch>
The -q is quiet, so it doesn't print results. Just returns true if found and false if it
<apeiros_>
if File.read(path) =~ /regex/ then …
<itchyouch>
If not*
<apeiros_>
for small files
tbrock has joined #ruby
<itchyouch>
Ahh.. Ill try that apeiros_
aaroncm has quit [Client Quit]
<apeiros_>
for big files, File.foreach(path).enum_for(:grep, /regex/).first
captain_al has quit [Quit: captain_al]
<ner0x>
Okay, really liking ActiveRecord.
<apeiros_>
slightly complex. it's to read only a line at a time and short-circuit when something is found
asteve has quit [Quit: Computer has gone to sleep.]
<itchyouch>
Thanks apeiros_. That's a lot easier
robertotauill has joined #ruby
dnstbr has quit [Client Quit]
kil0byte has quit [Remote host closed the connection]
csaunders has joined #ruby
<ner0x>
gem server is genius.
<ner0x>
export GEM_HOME is transparent.
* ner0x
approves.
robbyoconnor has quit [Ping timeout: 256 seconds]
sn0wb1rd has joined #ruby
volta has joined #ruby
chussenot has joined #ruby
Ry has joined #ruby
<k610>
is it saffer to start ruby apps by specifiying de rvm path e.g; :
<k610>
/usr/bin/rvm god
asteve has joined #ruby
coderhut has joined #ruby
<itchyouch>
apeiros_: does ruby also have !~ in addition to =~?
<itchyouch>
Nvm. It does.
<itchyouch>
Just tested it. :p
<ner0x>
Can you remove gems?
Virunga has quit [Remote host closed the connection]
<ner0x>
I guess I could wipe my custom repo and that would work.
<apeiros_>
itchyouch: yes, irb/pry to test such things ;-)
<apeiros_>
or ruby -e
<apeiros_>
ner0x: gem uninstall
<apeiros_>
also gem help ;-p
robertotauill has quit [Read error: Connection reset by peer]
vickaita_ has quit [Ping timeout: 245 seconds]
alexim has joined #ruby
<ner0x>
apeiros_: Ah, I missed that.
<ner0x>
apeiros_: Still, a good way to find deps would be removing the repo. :)
<apeiros_>
ner0x: I think there's a way to get it graphically
<apeiros_>
don't know by heart, though
<ner0x>
apeiros_: I'm actually pretty impressed so far.
<apeiros_>
also if you use bundler, the Gemfile.lock contains the dependency graph in a relatively readable way
ffranz1 has joined #ruby
robbyoconnor has joined #ruby
reset has quit [Quit: Leaving...]
timmow has quit [Ping timeout: 252 seconds]
<ner0x>
rails uses bundler, as far as I can tell.
<jds>
I'm overhauling our REST API docs. They're currently not very good, or very clever - they're manually typed by hand, not inline in code or anything etc etc.
<jds>
Is there anything I should look into to help me?
<apeiros_>
ner0x: it defaults to using it. it's not a requirement, though
tommyvyo has quit [Quit: Computer has gone to sleep.]
<apeiros_>
jds: google for steveklabnik
<ner0x>
apeiros_: I assumed as much. Just like Module::Build or Module::Install for perl.
<apeiros_>
he did lots of work with regards to REST APIs, iirc
ffranz has quit [Ping timeout: 245 seconds]
<apeiros_>
ner0x: I'm out of perl for far too long :-( no idea what those are anymore (CPAN I still remember)
<ner0x>
apeiros_: No problem. All my experience is still valid just lost all the syntax. Was still a MVC structure though. And I'm familiar with ORM and Unit testing... Transition should be pretty smooth.
<ner0x>
And lucky for you guys, I'm typically an active contributor to the OS community. :)
tommyvyo has joined #ruby
<apeiros_>
cool
<apeiros_>
nothing worse than people like me who complain all the time but never provide patches and stuff ;-)
<ner0x>
Once I know my shit of course.
fantazo has joined #ruby
Trioke has quit [Ping timeout: 264 seconds]
<ner0x>
Do you know if rails has an irc channel?
apok has joined #ruby
<Hanmac>
ner0x #rubyonrails
kalleth has joined #ruby
<ner0x>
Thank you.
kalleth has quit [Client Quit]
carlyle has quit [Remote host closed the connection]
Trioke has joined #ruby
hotovson has quit [Remote host closed the connection]
aaroncm has joined #ruby
pcarrier has joined #ruby
A85 has quit [Quit: さようなら]
mascool has joined #ruby
twinturbo has joined #ruby
jaygen has quit [Remote host closed the connection]
<invisime>
nemish: what are you trying to do with that semicolon?
perlsyntax has joined #ruby
<nemish>
i'm very new to ruby so i might be completely off
thinkdevcode has quit [Ping timeout: 260 seconds]
<nemish>
invisime: if hosted? returns true or maybe that should be "ok"?
Takehiro has quit [Ping timeout: 260 seconds]
Jdubs has joined #ruby
<Jdubs>
Hi guys
<invisime>
is "hosted?" the method you're trying to call?
<Jdubs>
Where should I start if I want to build a bot that can search through comments on Reddit and post a reply?
<Jdubs>
open-uri?
<invisime>
9gag.
<Jdubs>
or Net::HTTPS?
cousine has quit [Remote host closed the connection]
maxer has quit [Quit: maxer]
<Jdubs>
invisime: O_O
<invisime>
Jdubs: but in all seriousness, use RestClient.
pothibo has joined #ruby
<Jdubs>
I want to do it in ruby...
<nemish>
if works fine… if and else works fine too… i'm trying to create another option… so basically if image doesn't exist on s3 (AWS:S3:S3Ojbect.exists?) then try a URL… if it doesn't exist there either return the 404 default image
<invisime>
Jdubs: yep. welcome to ruby. "starting from scratch" is sort of relative. ;-)
<Jdubs>
invisime: Well, what i mean to say is, will i really learn much from doing it with the library as opposed to starting further down?
<nemish>
invisime: "wrong number of arguments (0 for 1)"
Monie has quit [Read error: Connection reset by peer]
Russell^^ has joined #ruby
<invisime>
nemish: look at the definition of the hosted? method and pass the argument it's looking for.
<invisime>
Jdubs: yes, you will.
<nemish>
invisime: like so" 37 elsif hosted? (object)"
<invisime>
nemish: probably. I don't really understand what you're trying to do. I'm just offering syntax help.
Virunga has joined #ruby
<nemish>
invisime: ok that worked for syntax issue.. but returns the 404 so it's basically saying it skipped over that… so instead of puts "ok" how do I return true or false?
<invisime>
nemish: uh, return true or return false?
Solnse has joined #ruby
alex__c2022 has quit [Quit: alex__c2022]
<nemish>
can i just replace puts "ok" with return true or should i change: elsif hosted? (object) == ok
statarb3 has joined #ruby
statarb3 has quit [Changing host]
statarb3 has joined #ruby
jds has quit [Remote host closed the connection]
jrist is now known as jrist-afk
jds has joined #ruby
mrsolo has quit [Quit: This computer has gone to sleep]
centipedefarmer has quit [Ping timeout: 255 seconds]
<shevy>
I think there is not enough sex on #ruby
jds has quit [Read error: Connection reset by peer]
a215 has joined #ruby
<jamesaxl>
nemish, yeah if is a true function
<a215>
how do i get a list of the methods that have been explicitly defined for a class?
jds has joined #ruby
<a215>
as opposed to inherited methods
tommyvyo_ has joined #ruby
mrsolo has joined #ruby
chichou_ has quit [Remote host closed the connection]
<nemish>
jamesaxl: invisime: thanks… yes I replace the "puts ok" and "puts nope" with return true and false and it worked
<nemish>
thanks
<invisime>
no sweat.
yuike has joined #ruby
<nemish>
is there an easy way to capture first character of a variable?
swex_ has joined #ruby
vickaita has joined #ruby
<invisime>
nemish: not sure.
volta has quit [Remote host closed the connection]
williamcotton has quit [Ping timeout: 246 seconds]
<nemish>
so for example if my object was "0361c1db-2057-4ce6-98a4-223aa1bbc940c" i want firstChar=0
<invisime>
err, a215: not sure.
centipedefarmer has joined #ruby
perlsyntax has quit [Quit: Leaving]
<jamesaxl>
nemish, you can use split and you take the fist item in the lisy
<invisime>
a215: depending on circumstances, you may be able to capture the methods that exist on the object before its definition and then git a list of the ones that exist after its definition and use array subtraction.
<nemish>
jamesaxl: can you give me example I'm new to ruby never used split
apeiros_ has quit [Remote host closed the connection]
codezombie has joined #ruby
apeiros_ has joined #ruby
und3f has quit [Quit: Leaving.]
zaki[] has quit [Ping timeout: 256 seconds]
coderhut has quit [Quit: Page closed]
williamcotton has joined #ruby
glyytchy has joined #ruby
apmacwrk has quit [Read error: Connection reset by peer]
jeff_sebring has joined #ruby
seanyo has joined #ruby
nat2610 has quit [Quit: Leaving.]
nat2610 has joined #ruby
Nanuq has joined #ruby
etcetera has quit [Read error: Operation timed out]
etcetera_ has joined #ruby
krisfremen has joined #ruby
dnstbr has joined #ruby
Morkel has quit [Quit: Morkel]
snearch has quit [Quit: Verlassend]
<Jdubs>
ok guys i've been theorcrafting with shevy on what i need to do to build my reddit bot that will search all the comment pages for a string, and then reply to comments with that string with a prespecified string
AndChat| has quit [Ping timeout: 245 seconds]
Appineer has quit [Remote host closed the connection]
dmerrick_ has joined #ruby
<shevy>
let's make this short
<Ry>
a215: object.methods false should give you anything non inherited
<shevy>
- we assume Jdubs already has the string he wants to post on reddit
<shevy>
How do you "send" that string to reddit as comment?
<Jdubs>
So far i've come up with, get web page, use regex to find urls from main page to build an array of addresses to search for comments...then pull comment page, usea regex to check for the string i need and comment #, and then send back a message to the reddit server in their api format to post
Banistergalaxy has joined #ruby
shtirlic_ has quit [Remote host closed the connection]
<Jdubs>
do i have the general idea right?
dmerrick has quit [Ping timeout: 245 seconds]
dmerrick_ is now known as dmerrick
<shevy>
let's advertize Jdubs
<shevy>
^^^ HERE IS AN UNSOLVABLE PROBLEM!!!
<shevy>
noone on #ruby can answer it
<Ry>
basic idea is fine, it's not really anything to do with ruby..
und3f has joined #ruby
thatdudeguy has joined #ruby
thatdudeguy has left #ruby [#ruby]
<Ry>
but i'd like to suggest if you're going to use the api to post a comment, may as well use their api for crawling if you can, bound to be faster than regexing for links and such
<Jdubs>
Ry yeah i know, i'm just trying to get the general idea right before i start tackling it
love_color_text has joined #ruby
<blazes816>
u gotz it bubba
<Ry>
prototype with curl & grep ;)
<Jdubs>
oh you mean use their search bar basically?
<blazes816>
yeah
<blazes816>
let them do the work
<blazes816>
finding your text
<Jdubs>
ooooo
<Jdubs>
neat idea
<Jdubs>
:)
<Jdubs>
I wouldn't have thought of that lol
nickmabry has joined #ruby
zaki[] has joined #ruby
artm has quit [Quit: artm]
<blazes816>
jdubs: with a problem like this, the biggest issue is finding ways to offload resource usage
<Jdubs>
oic
<blazes816>
such as getting reddit to do the searching with their backend instead of writing up something yourself which could easily take orders of magnitude longer
thinkdevcode has joined #ruby
und3f has quit [Ping timeout: 245 seconds]
koshii_ has quit [Ping timeout: 240 seconds]
Takehiro has joined #ruby
<Jdubs>
yeah definitely thanks so much :)
haxrbyte has joined #ruby
<blazes816>
np
yuike has quit [Quit: Computer has gone to sleep.]
alee has joined #ruby
senj has joined #ruby
seanyo has quit [Ping timeout: 245 seconds]
werdnativ has joined #ruby
fms has joined #ruby
nickmabry has left #ruby [#ruby]
lamba has joined #ruby
senj has quit [Client Quit]
whitedawg has quit [Quit: Leaving]
csaunders has quit [Quit: Computer has gone to sleep.]
cburyta has quit [Remote host closed the connection]
J-_-L has quit [Quit: Leaving.]
hackerdude has quit [Remote host closed the connection]
cburyta has joined #ruby
hackerdude has joined #ruby
<Jdubs>
ok i'm having trouble understanding regular expressions
<GeekOnCoffee>
Jdubs: you and the rest of the world ;)
nmabry has joined #ruby
<Jdubs>
if i wanted to search for two version of a word, let's say the string "so far" and "so-far" would it be something like /so(- far/?
<Jdubs>
it's really confusing
<Jdubs>
lol
tommyvyo_ has quit [Ping timeout: 255 seconds]
<fms>
Jdubs: /so[- ]far/
ryanf has joined #ruby
ryanf has quit [Client Quit]
<Jdubs>
hmmm
<fms>
maybe you need to quote that dash though...
<fms>
brackets are "this or this or this"
<fms>
so you are saying there "dash or space"
<lamba>
have the weirdess problem installing gems. seems to fail to connect to the gemspec file, but i dont know why ;-/
slainer68 has joined #ruby
<Jdubs>
fms: so brackets are for a single character, but multiple options in the charspace?
<ner0x>
Any different from using 'string' or "string" ?
nat2610 has quit [Quit: Leaving.]
vickaita has quit [Ping timeout: 260 seconds]
<pskosinski>
How can I destroy a object from it's method?
<pskosinski>
an object *
CodeDroid__ has joined #ruby
<pskosinski>
its *
francisfish has quit [Remote host closed the connection]
<nmabry>
pskosinski: i'm not sure what you mean exactly. do you want to have an object garbage collected by sending it a message?
linoj has quit [Quit: linoj]
<pskosinski>
I want program to stop ^^
Tania has quit [Quit: :p]
nat2610 has joined #ruby
<Ry>
exit
<pskosinski>
And will it remove everything from memory?
andrewhl has quit [Remote host closed the connection]
maletor has joined #ruby
<fms>
ner0x: the difference is that single quotes do not take escaped sequences, while double quotes do. puts "\t" ; => ; puts '\t => \t'
rcvalle has quit [Quit: Leaving]
<nmabry>
pskosinski: yep. everything will be returned to the system.
<pskosinski>
After only exit? Ok, thanks. :)
nat2610 has quit [Client Quit]
etcetera_ has quit [Quit: Computer has gone to sleep.]
<heftig>
fms: no interpolation, either. but it does accept \' and \\
andrewhl has joined #ruby
<ner0x>
fms: Explaining in terms of ruby doesn't help just yet, I'm *very* new.
Elico has quit [Remote host closed the connection]
<ner0x>
fms: Oh, I understand. Just evaluates newline, tab, variables, etc.
<ner0x>
fms: Like most other languages. Right.
<heftig>
ner0x: inside 'literals', #{foo} and most of the escape sequences (\n \t \r and so on) are not handled specially
jds has quit [Remote host closed the connection]
<ner0x>
#{variable} I assume?
IrishGringo has quit [Read error: Operation timed out]
<heftig>
actually, #{expression}
<ner0x>
I need to go through more ruby tutorials to get some of the basics.
<heftig>
"#{3 + 3} is 6" works, and there are no variables
philcrissman has quit [Remote host closed the connection]
<ner0x>
Ah, but if if it a variable it's just considered the return statement of the block?
<heftig>
what? what block?
<ner0x>
{} typical denotes block
jenrzzz has joined #ruby
<Virunga>
No, a hash.
<ner0x>
But I see the terminology overlap here.
<ner0x>
I get it now.
<heftig>
after method calls, yes. otherwise it's a hash literal. in strings, #{...} is interpolation
bricker has joined #ruby
<heftig>
it evaluates the expression inside the braces and replaces it with its string value
<ner0x>
I get it. I'll just have to write some apps to get the finer points but all-in-all pretty awesome.
<ner0x>
The :string is weird to me. lol
<nmabry>
ner0x: as a side note, to get a handle on strings and other ruby primitives I highly recommend running through the Ruby Koans: http://rubykoans.com/
<heftig>
ner0x: it's an interned string, slightly different.
<heftig>
ner0x: within a program, two instances of :foo are guaranteed to be the same object
<ner0x>
heftig: Rails uses them constantly.
<ner0x>
I was reading that everything in ruby is an object. So I'm assuming it's sort of like referencing.
<ner0x>
nmabry: Downloading "The Koans" now. Just ruby files explaining basic objects?
<heftig>
ner0x: they're also never garbage-collected, so creating them dynamically is generally a bad idea
<Virunga>
heftig: do you know if a symbol's life last as long as the program's life?
<Virunga>
:D
<Virunga>
You snswered.
<Virunga>
answered*
viktor_ has quit [Quit: This computer has gone to sleep]
<dorei>
u can always have them add more memory to the cluster :P
<heftig>
ner0x: they're exercises that show you various behaviors
<ner0x>
heftig: What are? Literals?
und3f has quit [Quit: Leaving.]
<ner0x>
heftig: I mean, never garbage collected.
carloslopes has quit [Remote host closed the connection]
<heftig>
symbols
<heftig>
the :symbols
<ner0x>
So you shouldn't use them on the fly?
<nmabry>
ner0x: sort of. but it's interactive. you run `rake koans` or something and it points you to the next failing test. You look up the test and the comments hint at how to fix it. The examples are designed to demonstrate all the basic language concepts and how they differ from other languages.
<ner0x>
nmabry: That works.
<Jdubs>
Anyone? how do I call a json method
<Jdubs>
i feel stupid
<Jdubs>
lol
und3f has joined #ruby
xorigin has joined #ruby
<Virunga>
google
<ner0x>
I assume the "RTFM" response is valid in this channel as well?
Nykolla has joined #ruby
<dorei>
json method? i thought json is a way of describing objects
und3f has quit [Client Quit]
und3f has joined #ruby
cmarques has quit [Ping timeout: 260 seconds]
francisfish has joined #ruby
susenbg has joined #ruby
<heftig>
ner0x: you should take care when creating them dynamically (as in somestring.to_sym). if you keep doing that and it creates new symbols over and over, you're gonna fill up the memory
kpshek has quit []
<Virunga>
Once my Prof. wrote RTFM on the college's forum to a student xD
horofox has joined #ruby
nmabry has quit [Read error: Connection reset by peer]
<Virunga>
That was the first time i saw it.
rippa has quit [Ping timeout: 252 seconds]
<ner0x>
heftig: Oh, that way. :symboe => "Literal" in a function is fine?
Mkman has joined #ruby
nmabry has joined #ruby
und3f has quit [Client Quit]
und3f has joined #ruby
und3f has quit [Client Quit]
Takehiro has joined #ruby
<heftig>
ner0x: sure
<ner0x>
heftig: Okay, that's what I thought you were saying.
<ner0x>
heftig: I just need to run through these examples after work.
<heftig>
what i meant was stuff like 1.upto(10000000) { |x| "foobar#{x}".to_sym }
<ner0x>
heftig: And the memory isn't cleared until restart?
kpshek has joined #ruby
<heftig>
that creates 10000000 new unique symbols that are probably never used again, yet are saved
<ner0x>
heftig: Also, no idea what |x| does yet.
Elico has joined #ruby
<ner0x>
Very interesting syntax.
<heftig>
1.upto(3) { |x| puts x }
<ddd>
think of it as a placeholder for the .up_to value
<susenbg>
how does the gem depenendency resolution work? i have a gem that when i try to install wants to install another gem in a outdated version first. but i can't find that information in the unpacked gem file. so how does 'gem install' know that a .gem requires another gem and what version?
<heftig>
outputs three lines: 1, 2 and 3
<ddd>
err upto
<heftig>
ner0x: it's the parameter list for the block, like the parameter list of a method
<ner0x>
It's equivalent to $_ in perl for ( @list ) { print $_; }
<ddd>
susenbg: from the gem's gemspec when it was created
Luceo has joined #ruby
<susenbg>
ddd: in the .gem file there is no gemspec file included
<ddd>
find the repo for the gem you're trying to install and look at its gemspec file then trace
<ddd>
i know. its used TO make the gem
<ner0x>
Oh well, sort of different than. upto sends whatever it does to local scope.
<ner0x>
|varname| scoops up the local scope variables sent?
emergion has joined #ruby
<ner0x>
1.upto(4) { |index| puts index } # Correct?
<heftig>
yes
<susenbg>
ddd: ok. can i later manually change that version constraint? does it work when i create my own gemspec file?
<ner0x>
Alright. Easy enough.
<ner0x>
heftig: That just cleared up half the questions I had while reading docs. :)
ipsifendus has joined #ruby
kirun has quit [Quit: Client exiting]
pll has joined #ruby
pll has left #ruby ["ERC Version 5.3 (IRC client for Emacs)"]
<nmabry>
Jdubs: sorry, i meant to respond when my router crashed. what exactly do you need to do with JSON?
<heftig>
ner0x: upto internally uses "yield". it calls the block attached to a method. (it also takes parameters, which the block is called with)
<Jdubs>
@nmabry i figured it out
nat2610 has joined #ruby
<nmabry>
Jdubs: sweet
J-_-L has joined #ruby
J-_-L has quit [Client Quit]
<ner0x>
heftig: The first parameter will always be equal to yield correct?
<dorei>
heftig: ruby blocks behave like anonymous functions?
<axl_>
what would be a good way to convert something like ['and', 'alter', 'antler', 'bag', 'boy', 'big', 'cat', 'cloy', 'climb'] to [['and', 'alter', 'antler'] ['bag', 'boy', 'big'], ['cat', 'cloy', 'climb']] ?
kirun has joined #ruby
<axl_>
so group them based on the first letter
<tommylommykins>
axl: is it something like enumerable#chunk?
<heftig>
dorei: pretty much. they're closures.
<dstywho>
isn't there a group_by
theRoUS has quit [Read error: Operation timed out]
nat2610 has quit [Client Quit]
<axl_>
(tomaw let me take a look
TomRone has quit [Ping timeout: 240 seconds]
<axl_>
err…
<heftig>
ner0x: no, the first parameter isn't handled any different
chichou has quit [Read error: Connection reset by peer]
<tommylommykins>
axl: maybe sort and then chunk?
<heftig>
if you just do "yield" with no arguments, the first parameter doesn't exist
clj_newb has quit [Ping timeout: 265 seconds]
<Hanmac>
axl_ arr.each_slice(3).to_a
<heftig>
ruby will just give you a 'nil' then
<Ry>
axl_: group_by { |x| x[0] }.values assuming you mean group by first letter
<axl_>
Hanmac: actually i am grouping them based on the first letter, not groups of 3
<axl_>
Ry: that looks promising
vlad_starkov has quit [Remote host closed the connection]
<ner0x>
heftig: If |input| is the current index. and yield is the current index, won't they both be the same?
wroathe has joined #ruby
<heftig>
ner0x: upto does use an argument. it loops from low to high, passing each integer via "yield i" or something similar. sorry if that was confusing
<Jdubs>
nmabry: hey i called JSON.parse and put the output into a variable...i'm having trouble getting out the data that i want from it now. any advice?
geekbri has quit [Remote host closed the connection]
<shevy>
cool
viktor is now known as Guest39958
<shevy>
looks scarier that way
<Jdubs>
Ry: I get this error connect.rb:26: warning: Hash#index is deprecated; use Hash#key
<Ry>
do..what..it..says? :P
<blazes816>
brilliant!
<blazes816>
built in error handling
nat2610 has joined #ruby
F1skr has quit [Quit: WeeChat 0.3.9.1]
<Hanmac>
shevy i did the face from the inside :D
Takehiro has joined #ruby
jrun has joined #ruby
emergion has quit [Quit: Computer has gone to sleep.]
<Jdubs>
Ry: I don't understand the error :(
csaunders has joined #ruby
<blazes816>
Jdubs: it's a deprecation warning. it's saying the index method on Hash objects should no longer be used, and you should use the key method instead
<Jdubs>
hmmm
<Ry>
Jdubs:
dangsos has joined #ruby
clj_newb has joined #ruby
<Ry>
read up what nmabry said a couple of lines ago when you asked before
<Ry>
ponder on it, you'll get there!
cascalheira has joined #ruby
Hannes3 has joined #ruby
<Jdubs>
ok it works to print it, but it's printing an empty string :/
<Jdubs>
but there is always a modhash
tommyvyo has quit [Quit: Computer has gone to sleep.]
tpe11etier has quit [Ping timeout: 240 seconds]
Tuxist has quit [Remote host closed the connection]
<Ry>
check for typos, if you're getting an empty string it means you're getting a nil result
<pskosinski>
What if TCPSocket.new will fail to connect? Would I get nil or error somewhere?
statarb3 has quit [Quit: Leaving]
<nmabry>
Jdubs: the "modhash" property is nested inside the "data" property in reddit's json. You'll have to access it as @jsondata.key("data").key("modhash") or @jsondata["data"]["mod hash"]
<Jdubs>
yeah i did the second one nmabry
k776 has joined #ruby
<Ry>
Jdubs: actually ignore what i last said, empty string is correct for the code you pasted before
jxf has joined #ruby
alexwh has joined #ruby
<Ry>
if you print @jsondata
alexwh has quit [Client Quit]
<k776>
Has anyone noticed 1.9.3 p327 uses a lot more CPU and is much slower than p194?
<k776>
After upgrading Ruby on production, cpu went from constantly <25% to constantly >50%
<Jdubs>
now i need to figure out how to log my program into reddit and keep it logged in
tommyvyo has joined #ruby
alexwh has joined #ruby
baroquebobcat has joined #ruby
<Ry>
gl&hf
<Jdubs>
Ry: thanks!
nachtwandler has quit [Remote host closed the connection]
<Ry>
k776: have you tried to profile for comparisons?
Zolrath has joined #ruby
<gbchaosmaster>
Jdubs: A POST request to /api/login/USERNAME with the params user, passwd, and api_type (make that json) will do it.
<k776>
Ry: Looks primarily like it's GC
<Jdubs>
hmmm...
<pskosinski>
Ok, I found something about rescue, ty.
<Jdubs>
but how will it distinguish between my program and my browser?
swex_ has quit [Read error: Operation timed out]
jds has quit [Remote host closed the connection]
<Jdubs>
is it not logged in by ip?
<k776>
Ry: My Rails test suite went from ~4m to ~5.5m in duration, with no changes
ffranz1 has joined #ruby
<shevy>
Hanmac, today was the first time I had to use LIBS env ... LIBS=-ldl
<gbchaosmaster>
Jdubs: Nope, it'll return some JSON with your cookie (in the data attribute) and your modhash.
remi has quit [Quit: leaving]
margle has quit [Quit: Computer has gone to sleep.]
<gbchaosmaster>
Also a zero-length json.errors, for to verification of success.
<Jdubs>
i see
<Jdubs>
so i need to save the response cookie?
<gbchaosmaster>
If invalid, you'll get nothing but a json.errors telling you what you borked.
Neomex has joined #ruby
swex has joined #ruby
<Jdubs>
and the modhash
Neomex has quit [Client Quit]
<Jdubs>
and with each new action, supply the modhash?
<Jdubs>
or i get logged out?
<Jdubs>
is that the right understasnding
maletor has quit [Quit: Computer has gone to sleep.]
CodeDroid__ has quit [Ping timeout: 252 seconds]
jrist-afk is now known as jrist
k776 has left #ruby [#ruby]
<Ry>
k776: cool potatoes, maybe you can gather some data and slap it in a pastie and someone can look into it perhaps
h4mz1d has quit [Ping timeout: 260 seconds]
<gbchaosmaster>
If you're making a client, yeah, you'd want to save that so that the user doesn't have to log in every time. And indeed. Here's the API documentation, it's pretty thorough: http://www.reddit.com/dev/api
fumduq has joined #ruby
itchyouch has joined #ruby
<Jdubs>
gbchaomaster: yeah i've been reading through that, but i'm still pretty new to programming so it's not all easy for me to understand
<Jdubs>
like i still have to figure out how to actually send a command as well lol
<Jdubs>
i'm guessing it's Net::HTTPS to send stuff?
<Ry>
Jdubs: have you read their api yet?
<Hanmac>
shevy i hope the -ldl was not my fault :D
maletor has joined #ruby
<gbchaosmaster>
net/http does a good job, yeah. Here's an API wrapper that my buddy wrote a few months back, you may find some useful code in there to help you on your way. https://github.com/andkerosine/snooby
<gbchaosmaster>
Looking through open source code is a great way to get cozy with programming.
<shevy>
Hanmac: nah, but something is odd with the linker. it does not want to include all glibc components, it also claims that libraries do not exist, but they exist right in /lib or /usr/lib
<Jdubs>
@gbchaosmaster: I'm trying to get into the programming field...I'm almost 30 and don't have a real career, trying to change that
<Jdubs>
@gbchaosmaster: I don't want to have to rejoin the military to support my fiance when we get married
<Jdubs>
@gbchaosmaster and i've always loved programming and computers since iwas little
<gbchaosmaster>
Jdubs: It's a great choice, keep it up.
<nmabry>
Jdubs: rock on
<gbchaosmaster>
Is Ruby your first serious language?
<Ry>
Jdubs: I'd suggest investing in some books, theres loads of good free ones that will help ramp you up
tyfighter has joined #ruby
OldOats has quit [Ping timeout: 245 seconds]
<Jdubs>
gbchaosmaster: I've done some C, some html and css (im bad at design though lol), and MIRC scripting, and basic
<gbchaosmaster>
Also, seeing as you're on reddit, /r/dailyprogrammer is an excellent place to practice.
<nemish>
will this work: get /:varable1/:variable2.jpg ?
glyytchy has quit [Quit: glyytchy]
<nemish>
or how do i break variable2 away from the .jpg
zaki[] has joined #ruby
<gbchaosmaster>
I have a hunch that that should work.
<Jdubs>
gbchaosmaster I'll check it out: I'm also trying to do a udacity class, do codeacademy every day, and go through rubymonk
<shevy>
Jdubs: old age stinks, but you have one advantage over the young super-fast learning 18 years old - you can make up grand plans and better timelines
<X-Jester>
is there a utility that can give you a better absolute path to an installed gem than 'gem query -l -d -n <gemname>' which only gives you the path to the gems root?
<nmabry>
gbchaosmaster: oh, cool! i've never heard of /r/dailyprogrammer
linoj has joined #ruby
<Jdubs>
@shevy, yeah I'm trying to get into the App Academy in San Fran atm
<gbchaosmaster>
nemish: "." isn't a valid character in a symbol, for obvious reasons, so it should be okay. Have you tried it?
banisterfiend has quit [Ping timeout: 256 seconds]
<Jdubs>
my main advantage is I know how to work hard, and I'm motivated, I know what I want and I'm going for it
<X-Jester>
for example, if the gem is mygem version 1.2.3, is there a way to determine what the path to /usr/lib/ruby/gems/1.9.1/gems/mygem-1.2.3 ?
<Jdubs>
I just pray that I make it through the application process
<Jdubs>
And I'm spending all my free time atm practicing programming so if i get in, I can make the most of my time there by having a lot of knowledge prior to arriving
<gbchaosmaster>
nmabry: You might also like Project Euler if you haven't heard of it, they're some pretty greuling, more math focused programming problems.
tenmilestereo has quit [Quit: Leaving]
<yxhuvud>
gbchaosmaster: . is a perfectly valid character in a symbol. You just have to use quotes when defining the symbol as the normal input method don't handle it
<nemish>
gbchaosmaster: i'm getting sinatra "doesn't know this ditty" error so I'm guessing its correct "syntax" wise… but can't figure out why its breaking… is there a debug option on rackup that would help me debug what's wrong?
<nmabry>
gbchaosmaster: i've played around with Project Euler in the past, but usually lost interest due to the strictly math focus. I like the variety I'm seeing on dailyprogrammer.
dstywho has quit [Quit: Leaving]
<gbchaosmaster>
yxhuvud: Oops, my bad there. Derp.
<Jdubs>
Anyone here happen to know any of the guys at App Academy? Help me get in! :D
Guest91808 has quit [Quit: Guest91808]
Hydroxide has joined #ruby
<nemish>
gbchaosmaster: the debug flag doesn't seem to get me enough verbose
<nemish>
i need something like sh -x where i can see the values of the variables to make sure they are set correctly
<Jdubs>
gbchaosmaster: Do you think reading a book is better than my current method of choosing projects and working on them?
<Jdubs>
Btw, Apeiros_ is pretty awesome, he's been helping me learn :)
linoj has quit [Client Quit]
pcarrier has joined #ruby
<gbchaosmaster>
Jdubs: Por que no los dos?
tommyvyo has quit [Quit: Computer has gone to sleep.]
tommyvyo_ is now known as tommyvyo
<Hydroxide>
I have a Range of objects which themselves are Comparable and support .succ but are not Enumerable (presumably my Range is). I'm trying to Set.merge them into an empty Set. Set is complaining that it can't iterate from my Comparable+succ object
bluOxigen has quit [Ping timeout: 252 seconds]
<Hydroxide>
shouldn't the Range be handling the iteration?
RandyInLA has joined #ruby
<gbchaosmaster>
Doing projects and making things is very important, but don't reject reading material. I never dug into any books, but I've spent plenty of time on blog posts/tutorials/articles on the web.
<Hydroxide>
in case it's relevant, this is Ruby 1.9.2 and it's a custom subclass of Time that does other stuff plus also implements .succ
<Jdubs>
gbchaosmaster: I'm going to guess that says, why not both?
<Jdubs>
or something similar
<Jdubs>
lol
<Hydroxide>
adding "require 'date'" doesn't fix it, so it doesn't look like a limitation in the barebones Time class
<gbchaosmaster>
Must be an older reddit joke, that Old El Paso taco commercial started it some time back when haha
<gbchaosmaster>
But yeah, it just depends how you learn.
<gbchaosmaster>
Everyone picks things up differently.
<Jdubs>
i'm more of a hands on learner
<gbchaosmaster>
Same.
<Jdubs>
that's why uni didn't work out for me
<Jdubs>
lol
ffranz1 has quit [Ping timeout: 245 seconds]
<Jdubs>
well, that's not really true
<Jdubs>
it mostly didn't work out because of all the classes that have NOTHING to do with the major...
<Hydroxide>
if my question isn't clear I can try to make a stripped down version that behaves the same way and paste a link. the exact context has too much other stuff in it
<Jdubs>
i did great in comp sci classes and math, but horrible in other classes like writing and speaking lol
<Hydroxide>
Jdubs: european unis don't work that way. US ones do.
<Jdubs>
i'm from the US
<Jdubs>
lol
<Hydroxide>
Jdubs: so am I :)
<Ry>
Hydroxide: any example code would be great
<Jdubs>
@hydroxide, oh then why did you bring that up?
<gbchaosmaster>
Here's somethin' for you to tinker with, don't give me credit for coming up with it-
<Hydroxide>
just saying, international studying is an option :) btw, I did a CS degree and am in the tech industry. I wish my speaking skills were better, and a lot of my recent self-improvement in terms of job skills has been in the area of documentation
<Ry>
he's saying you'd have had no problems in european universities
<Hydroxide>
so don't count those things out even in our industry
<Hydroxide>
Ry: sure, I'll cook some up
<Jdubs>
Hydroxide: well, i think the problem was mostly motivation...i felt 0 motivation in those classes
<Jdubs>
got A's in comp sci and math though
<Hydroxide>
sure. that I sympathize with, definitely. in uni my writing was fine when I made myself do it - it was making myself doing it that was tough :)
<Jdubs>
yeah i hated writing...so id put it off and put it off
<Jdubs>
but my programming projects id generally finish the same day i got them lol
<Hydroxide>
same. except I didn't hate writing, I hated the idea of starting writing :)
<gbchaosmaster>
Hydroxide: I share all of your pain.
<Hydroxide>
while I was doing it and hadn't get gotten distracted, it was fine...
<Jdubs>
Hydroxide me too!!!but the anticipation gave me so much anxiety i would almost have a breakdown lol
<Jdubs>
Hydroxide that's how much i hated papers
<Hydroxide>
yup. caused me major issues too
<Hydroxide>
at some point I got proper professional help and improved coping mechanisms (meds were only a small part of the solution, and not even the most important part)
F1skr has joined #ruby
<Hydroxide>
but it never got easy during my time in school
susenbg has quit [Quit: Konversation terminated!]
<shevy>
see Hanmac... ./conftest: error while loading shared libraries: libffi.so.6: cannot open shared object file: No such file or directory
bigmcq77 has joined #ruby
qwerxy has joined #ruby
<Hydroxide>
now several years later at work I don't need meds, and I can get it done more easily, but it's still not easy. probably never will be.
<Ry>
just get drunk, write a load of whimsical bullshit, correct it the evening after
<Ry>
When I worked at MS, I wrote on of my test strategies drunk because i couldn't face a blank page..
Juul has joined #ruby
pcarrier has quit []
<Ry>
one of*
tbrock has quit [Quit: Computer has gone to sleep.]
<Jdubs>
LOL
steg132 has joined #ruby
<Jdubs>
Ry: is that why working at MS is past tense?
<Jdubs>
:P
<Ry>
It would be comical, but nah :P I got bored and moved to china xD
<gbchaosmaster>
Did you enjoy that job?
<gbchaosmaster>
I haven't touched any MS software in a long time, and I think that it'd only be a hinderance if I had to again.
<Ry>
:P
<nmabry>
Ry: whoa. big move
<Jdubs>
Ry, do you work for a chinese company or telecommute?
arietis has joined #ruby
jeff_sebring has quit [Remote host closed the connection]
<Ry>
The job was fun yeah, I worked on Office stuff, which recently has been pretty decent stuff :)
<Hydroxide>
Ry: I have an example now. one moment.
<Jdubs>
Ry: you should contribute to the Open Office suite XD
<Ry>
Jdubs: nah, not working for anyone, doing individual research on random shit for no reason, and going to a load of art exhibitions for no reason.. shrug
mwillhite has joined #ruby
Takehiro has quit [Remote host closed the connection]
<mwillhite>
im sending a POST request with httparty to a redmine app…but the redmine logs are showing it has a GET request…how and why could that happen?
<Jdubs>
Ry: wow how long can you live on your savings? are you retired?
<mwillhite>
it works on my local instance of redmine…I'm not sure if its a redmine thing or an httparty thing…
<Ry>
not really, I'm just taking a break
<Ry>
I've been out of my country for about 15 months so far, could probably last another year or so if I wanted to, but heading back for 2months over the winter to sort some stuff
havenn has joined #ruby
<Hydroxide>
Ry: and the main error that gets thrown, in the s.merge(range) line, is "[/path/within/my/rvm/install/to/]set.rb:81:in `each': can't iterate from Time (TypeError)"
<nmabry>
mwillhite: Interesting, can you post some httparty example code?
<Hydroxide>
this is ruby 1.9.2p290, in case it's relevant
<gbchaosmaster>
Alright, I got two problems, one involving a piece of horrible, incredibly hacky code that I want to make a bit less hacky, and another involving some potentially awesome code.
<mwillhite>
nmabry I'm just calling .post on a class that I've mixed HTTParty into
<mwillhite>
but the redmine logs show the request (params and all) as a GET
<Jdubs>
Gbchaosmaster: I'd help you if i was skilled enough, sorry bro :(
Xeago has joined #ruby
<mwillhite>
Processing IssuesController#index to json (for 10.162.54.181 at 2012-11-13 21:31:23) [GET]
<gbchaosmaster>
Jdubs: If you want to go on to become a half decent Ruby programmer, I'd avoid that link like the plague. =P
<Jdubs>
LOL
<Jdubs>
will do
<Jdubs>
Hey Xeago o/
<gbchaosmaster>
I'm shamelessly breaking just about every good practice there, and will make it prettier later. Don't hate me, #ruby.
<Jdubs>
btw, for those who don't know : that's a wave
<gbchaosmaster>
What I'm trying to solve there is more or less a math issue, though. Something is slightly off and I can't quite brain up enough to fix it.
<Jdubs>
hmmm
Michael__ has joined #ruby
<Jdubs>
go to #math?
<nmabry>
mwillhite: after a quick experiment, a post request should definitely be sent. this seems like a redmine issue.
<nmabry>
mwillhite: and i know nothing about red mine :(
<gbchaosmaster>
Jeez, FreeNode, y u have everything?
joshman_ has quit [Ping timeout: 246 seconds]
OmegaX has left #ruby [#ruby]
mwillhite has quit [Ping timeout: 248 seconds]
Cicloid has joined #ruby
<gbchaosmaster>
Wouldn't have been surprised if that actually existed.
<gbchaosmaster>
Is there any good discussion over at #math, or is it mostly people wanting answers to their homework?
yxhuvud has quit [Ping timeout: 252 seconds]
mwillhite has joined #ruby
linoj has joined #ruby
<shevy>
hehe
RudyValencia has quit [Quit: Hacked By Chinese!]
blacktulip has quit [Remote host closed the connection]
bricker has joined #ruby
Banistergalaxy has quit [Ping timeout: 252 seconds]
jxf has quit [Ping timeout: 240 seconds]
skcin7 has joined #ruby
skcin7 has quit [Max SendQ exceeded]
sailias has quit [Ping timeout: 240 seconds]
gp5st has quit [Quit: Leaving.]
skcin7 has joined #ruby
Virunga has joined #ruby
tbrock has joined #ruby
nkts has joined #ruby
<Ry>
Hydroxide: you've got an interesting case caused by the subtraction of integers
<Ry>
it's changing the type of the object back to Time
<Ry>
rather than your new class
pyx has joined #ruby
<Ry>
so such no longer exists
prezioso has quit [Ping timeout: 248 seconds]
<Jdubs>
can anyone tell me how to fix /usr/lib/ruby/1.9.1/openssl/ssl-internal.rb:121:in `post_connection_check': hostname does not match the server certificate (OpenSSL::SSL::SSLError)
medik has joined #ruby
medik has quit [Excess Flood]
BrianJ has joined #ruby
medik has joined #ruby
Banistergalaxy has joined #ruby
caleb_io has joined #ruby
bigmcq77 has quit [Quit: Computer has gone to sleep.]
<Hydroxide>
Ry: ah... so i need to pass the result to my constructor
<Hydroxide>
i.e., to a new object
<Hydroxide>
the real initializer handles that okay
<Hydroxide>
not the toy one
<Hydroxide>
I mean, it should. it calls .to_s on the input and does stuff
<blazes816>
Jdubs: what url are you trying to request? it appears to be an ssl misconfiguration
<gbchaosmaster>
Ruby has drawn be far far away from Python, but fully functional single quoted strings are the one thing that I miss.
tommyvyo has quit [Quit: Computer has gone to sleep.]
cam` has joined #ruby
<Jdubs>
apeiros: I'm in the dev tools, where do i go now
<gbchaosmaster>
That and the slice indexing syntax.
<nmabry>
gbchaosmaster: hey, still having trouble with the map generation?
SmoothSage_ has joined #ruby
<apeiros_>
Jdubs: to "Resources"
<Ry>
Hydroxide: sorry i was away, I'll pm you
<gbchaosmaster>
Yeah, it still falls a little short without that hack in place.
<gbchaosmaster>
^ @nmabry
Takehiro has quit [Read error: Connection reset by peer]
baphled has quit [Ping timeout: 255 seconds]
joeycarmello has quit [Remote host closed the connection]
<apeiros_>
hm, moment
<apeiros_>
stupid redesigns…
Gate_ has joined #ruby
c0rn has joined #ruby
<nmabry>
gbchaosmaster: i took a look at the code, mostly because i was curious to see how it worked, and the issue is the (@world[:size] / (total / data[:weight])) calculation.
minijupe has quit [Quit: minijupe]
Takehiro has joined #ruby
SmoothSage_ has quit [Max SendQ exceeded]
jonathanwallace has quit [Remote host closed the connection]
<nmabry>
gbchaosmaster: if the @world[:size] isn't evenly divisible by the (total / data[:weight]) calculation, then you're getting a rounded down number of elements.
SmoothSage_ has joined #ruby
Maoz has joined #ruby
<shevy>
gbchaosmaster: odd. I use '' most of the time, and "" only when I want to interpolate
Maoz has quit [Client Quit]
<apeiros_>
yeah, resources, then change to "source code", and in the right sidebar there's "Request-Header"
<gbchaosmaster>
nmabry: I figured that it was that calculation. How to most nicely tweak it to fix?
passbe has joined #ruby
dmiller has quit [Remote host closed the connection]
Mkman has quit [Quit: Lost terminal]
Gate has quit [Ping timeout: 256 seconds]
SmoothSage_ has quit [Max SendQ exceeded]
c0rn has quit [Client Quit]
Wildhoney has joined #ruby
SmoothSage_ has joined #ruby
<apeiros_>
sieson: I'd need what you do, what you expect to happen and what happens instead. puzzling is fun, but not for things like that.
Gate_ has quit [Ping timeout: 260 seconds]
Gate has joined #ruby
ner0x has quit [Quit: Leaving]
<nmabry>
gbchaosmaster: I'm not sure. The approach of generating a percentage of blocks of each type will always lead to a remainder unfilled. We'd still have to fill in some missing spots at the end.
SmoothSage_ has quit [Max SendQ exceeded]
<shevy>
long live compiling! long live ruby!
<nmabry>
gbchaosmaster: If we inverted the problem, and instead selected a random block type for each available spot in the world, then we wouldn't have to worry about a remainder. But then we'd have to create a method to select a random block taking weight into account.
jenrzzz has joined #ruby
SmoothSage_ has joined #ruby
Michael__ has quit [Remote host closed the connection]
Michael_ has quit [Remote host closed the connection]
c0rn has quit [Client Quit]
SmoothSage_ has quit [Max SendQ exceeded]
t-mart has joined #ruby
answer_42 has quit [Quit: WeeChat 0.3.9]
<apeiros_>
sieson: I'm fascinated. I have no idea how you think anybody could reproduce what you do by what you just pasted.
greenarrow has quit [Read error: Connection reset by peer]
sieson has left #ruby [#ruby]
SmoothSage_ has joined #ruby
sn0wb1rd has quit [Remote host closed the connection]
<apeiros_>
sieson: anyway, the probably correct explanation is: the object where you call metadata.ssh = ssh on is not the same object where ruby complains about @ssh being nil
havenn has joined #ruby
<nmabry>
gbchaosmaster: definitely unfavorable. especially because your existing solution could potentially be boiled down to 'generate a single column and shuffle for each row'.
<apeiros_>
the alternative explanation is, that ssh - which you assign to metadata.ssh - is indeed nil
jrist is now known as jrist-dogwalk
sn0wb1rd has joined #ruby
<apeiros_>
both can be easily tested
Hannes3 has quit [Quit: Konversation terminated!]
d2dchat has quit [Remote host closed the connection]
<apeiros_>
use `p metadata: metadata.object_id, ssh: ssh` where you assign it, and get the object id of self where the exception occurs.
SmoothSage_ has quit [Max SendQ exceeded]
iamjarvo has quit [Quit: Computer has gone to sleep.]
cmarques has quit [Ping timeout: 268 seconds]
<nmabry>
gbchaosmaster: if you're okay with resolving the missing slots with random elements like you're doing, it doesn't seem like a bad approach. you would just have to replace adding a single element with adding world[:size] - selection.size elements to make it work for all weights and world sizes.
Averna has quit [Quit: Leaving.]
SmoothSage_ has joined #ruby
xorigin has quit [Quit: leaving]
SmoothSage_ has quit [Max SendQ exceeded]
JustinCampbell has quit [Remote host closed the connection]
greenarrow has joined #ruby
koshii_ has joined #ruby
AxonetBE has quit [Quit: Leaving.]
SmoothSage_ has joined #ruby
Trioke_ has quit [Ping timeout: 260 seconds]
SmoothSage_ has quit [Max SendQ exceeded]
jenrzzz has quit [Read error: Connection reset by peer]
Serial_Killer_C has quit [Read error: Connection reset by peer]
<Jdubs>
Hmmm
jenrzzz has joined #ruby
<Jdubs>
Now my program is hanging
<Jdubs>
When i run it
<Jdubs>
:/
SmoothSage_ has joined #ruby
Serial_Killer_C has joined #ruby
dnstbr has joined #ruby
rhys has joined #ruby
Debolaz has quit [Ping timeout: 264 seconds]
SmoothSage_ has quit [Max SendQ exceeded]
c0rn has joined #ruby
maesbn has quit [Remote host closed the connection]
Trioke has joined #ruby
<gbchaosmaster>
nmabry: I guess I'll go that way. Putting in an " # Hack to keep the selection at the right size. For some reason, it
<gbchaosmaster>
# falls one short every time.
<gbchaosmaster>
# TODO: Fix the math so that this isn't necessary.
<gbchaosmaster>
Well that didn't copy right.
<rhys>
a quick question, when I try to set the home environmental for net::ssh within a class, i need to make it an instance variable? @ENV['HOME'] = '/'
<gbchaosmaster>
Haha.
<gbchaosmaster>
Just ended up using an until block.
banseljaj has quit [Excess Flood]
SmoothSage_ has joined #ruby
<nmabry>
gbchaosmaster: sweet. out of curiosity, making a game?
<rhys>
Jdubs, you know you need to point out the error to get someone to help right?
<Jdubs>
I did up higher
<Jdubs>
it's hanging
SmoothSage_ has quit [Max SendQ exceeded]
<gbchaosmaster>
nmabry: A couple friends of mine are doing a simple text-based RPG in Java, I'm trying to evangelize for Ruby, so they're interested in seeing how I'd implement it in Ruby.
<Xeago>
Jdubs: that is no error description
<Jdubs>
:/
<Xeago>
exception/error/stacktrace
<Jdubs>
i don't get anything, i have to ctrl c it
<nmabry>
gbchaosmaster: cool! good luck!
<Xeago>
and code, expected behavior and actual
<gbchaosmaster>
nmabry: Thanks!
<Jdubs>
and then it gives me errors after interrupting it
SmoothSage_ has joined #ruby
<Xeago>
Jdubs: than it is probably an infinite loopt
<gbchaosmaster>
nmabry: I think you got it. I'll see if I can get this up on my machine.
cakehero has quit [Quit: Computer has gone to sleep.]
SmoothSage_ has joined #ruby
koshii_ has quit [Read error: Connection reset by peer]
<Jdubs>
nmadry haha, i bet that's the problem!
<Jdubs>
nmadry: you rock, how did you figure that out?
skcin7 has quit []
<gbchaosmaster>
GitHub Gist > all, by the way.
davidcelis has joined #ruby
<gbchaosmaster>
Pygments is your master.
pcarrier has joined #ruby
SmoothSage_ has quit [Max SendQ exceeded]
k610 has quit [Ping timeout: 276 seconds]
k610 has joined #ruby
Russell^^ has quit [Quit: Russell^^]
SmoothSage_ has joined #ruby
invisime has quit [Quit: Leaving.]
Takehiro has joined #ruby
<nmabry>
Jdubs: i checked the reddit api and noticed that login was a POST method, then looked to see if your code included any terms like POST, and then googled "open-uri post". i'm not sure if that's the answer, but it may be one reason reddit isn't responding correctly to the request.
<nmabry>
gbchaosmaster: Github Gist FTW. I love `git clone`ing a sample rather than copying and pasting into terminal. The formatting never works right.
seme has joined #ruby
cakehero has joined #ruby
francisfish has quit [Remote host closed the connection]
SmoothSage_ has quit [Max SendQ exceeded]
GoGoGarrett has quit [Remote host closed the connection]
<seme>
hey guys I'm on a mac and I'm trying to figure out how to develop a GUI that will run on windows, linux, mac... any suggestions for a toolkit?
k610 has quit [Ping timeout: 252 seconds]
<gbchaosmaster>
I usually just curl the raw and pipe that into whatever tool I need.
<blazes816>
seme: jruby+swing is pretty tried and true
joeycarmello has quit [Remote host closed the connection]
SmoothSage_ has joined #ruby
<seme>
yeah I kind of wanted to do standard ruby
banjara has quit [Read error: Connection reset by peer]
mmitchell has quit [Ping timeout: 240 seconds]
k610 has joined #ruby
banjara has joined #ruby
kirun has quit [Quit: Client exiting]
<gbchaosmaster>
gtk2?
<gbchaosmaster>
wxRuby would be nice if only it worked.
<apeiros_>
seme: so you're going for the worst of all worlds approach?
dakine has quit [Quit: Leaving]
enderx86 has quit [Remote host closed the connection]
SmoothSage_ has quit [Max SendQ exceeded]
<seme>
apeiros_: looks like it... I'm selfish and don't want to develop on each platform... I'd rather do it once
<xpen>
hi guys. what's a ppyx file ?
tommyvyo has quit [Quit: Computer has gone to sleep.]
<apeiros_>
xpen: doesn't sound like something ruby related
<xpen>
i saw a file in gevent as core.ppyx
SmoothSage_ has joined #ruby
<gbchaosmaster>
Sounds like a compiled Python artifact of sorts.
chussenot has joined #ruby
csaunders has quit [Quit: Computer has gone to sleep.]
<nmabry>
seme: i've used ruby/tk, wxruby, and jruby+swing. jruby is definitely the easiest solution. it's easily cross-platform, pretty, and has a lot of support. The other two have very small communities and not a whole lot of documentation.
<xpen>
i have no idea
<Virunga>
To me looks like a power point file.
asteve has quit [Quit: Computer has gone to sleep.]
<seme>
I was looking for Qt but it seems like it isn't looking to be supported yet
<Virunga>
To know the answer just google it.
<shevy>
qt gets bigger and bigger
<Jdubs>
Man...
cdt has quit [Ping timeout: 255 seconds]
<shevy>
I like the old days. things used to be small and lean
<Jdubs>
I'm starting to think I'm going to have to start from Net::HTTPS and build from there lol
<Jdubs>
Apeiros_ HELP MEH! :(
<xpen>
googled a lot, only can find .pyx file
SmoothSage_ has quit [Max SendQ exceeded]
<apeiros_>
Jdubs: Errno::ETOODRUNK
<nmabry>
shevy: qt is freaking amazing in C++ though. SO preferable to the alternatives.
<xpen>
oh, sorry guys, i think i'm in the wrong channels :/
johnjohnson has quit []
k610 has joined #ruby
<havenn>
xpen: Figured you meant to be in Python :P
philcrissman has quit [Remote host closed the connection]
SmoothSage_ has quit [Max SendQ exceeded]
<nmabry>
Jdubs: Net::HTTP will work, but I highly encourage you to try out more modern alternatives. Net::HTTP is a great library, but it may make you crazy trying to use it. It was discussed on a recent episode of Ruby Rogues: http://rubyrogues.com/073-rr-apis/
<xpen>
havenn: u r right
SmoothSage_ has joined #ruby
geggam has quit [Ping timeout: 240 seconds]
cakehero has quit [Quit: Computer has gone to sleep.]
<havenn>
Faraday makes Net::HTTP use sane, imho.
<nmabry>
havenn: It makes me happy
<Jdubs>
nmadry I'm afraid im going to get lost using large libraries..I've only used the standard libs so far
<Jdubs>
nmadry and won't i learn more by using less?
peregrine81 has quit [Quit: Computer sleeping.]
<reactormonk>
how do I kill all elements in a nokogiri doc that satisfy a criterion?
alanp has quit [Read error: Operation timed out]
mwillhite has quit [Ping timeout: 245 seconds]
vlad_starkov has quit [Ping timeout: 248 seconds]
<nmabry>
Jdubs: in this case, maybe not. Faraday or HTTParty are simplifications. They are much smaller, more focused libraries than Net::HTTP.
<apeiros_>
reactormonk: with fire!
Zolrath has quit [Ping timeout: 256 seconds]
<joofsh>
jdubs: httparty is really easy to use, may be good for what you're looking to do
<reactormonk>
apeiros_, blub
nari has joined #ruby
alanp has joined #ruby
<Jdubs>
joofsh does it work similar to open-uri but with a get function?
<joofsh>
jdubs: yes
jrun has quit [Quit: WeeChat 0.3.7]
k610 has quit [Ping timeout: 260 seconds]
<havenn>
nmabry: Oooh, rest-client from that Rogues link looks really nice!
<joofsh>
you can use get/put/post , has methods for all
<nmabry>
Jdubs: and more importantly, it'll have a put function to call
<nmabry>
Jdubs: oops *post
jonathanwallace has quit [Remote host closed the connection]
<nmabry>
havenn: i haven't used rest-client, but it looks slick
jonathanwallace has joined #ruby
Cultofmetatron has joined #ruby
vlad_starkov has joined #ruby
reinaldob has joined #ruby
sebastianb has quit [Read error: Connection reset by peer]
nuclearblast has joined #ruby
<havenn>
nmabry: I like simplistic. :)
joeycarmello has joined #ruby
<gbchaosmaster>
Jdubs: What's this supposed to do?
<Jdubs>
should i go through the rb files for httparty to try to understand it? or what?
<gbchaosmaster>
self.#{item.slot}=item
<reactormonk>
apeiros_, unlink apparently
<Jdubs>
ummm
<Jdubs>
which file are you in
<Jdubs>
it might be stuff i was just conceptualizing
<Jdubs>
is that Equipment file?
axl_ has quit [Quit: axl_]
<gbchaosmaster>
enemy.rb, yeah, looks like some kind of pseudoRuby. =P
<Jdubs>
oh enemy.rb lol
<Jdubs>
yeah that was like when i first started working ruby
<Jdubs>
haven't really worked on enemy file since then
<Jdubs>
look at hero file for how enemy should look
k610 has quit [Ping timeout: 245 seconds]
<joofsh>
jdubs: on github, httparty has an "examples" dir with 5 or so examples of how to use it. That's what i did to learn it
Edward_ has joined #ruby
dmiller has joined #ruby
<havenn>
Jdubs: Or scan over faraday, typhoeus, httparty, and rest-client DSLs and try using a few. Nice to know what they are each capable of. Not sure which makes the best code-read.
Serial_Killer_C has quit [Remote host closed the connection]
k610 has joined #ruby
heruka has quit [Quit: WeeChat 0.3.7]
<joofsh>
jdubs: it can be as simple as HTTParty.post(url, options)
Paradox has quit [Ping timeout: 264 seconds]
jonathanwallace has quit [Ping timeout: 240 seconds]
<apeiros_>
ah, I remember, that was the point when I noticed that I should introduce hashtables to Jdubs
francisfish has joined #ruby
<Jdubs>
apeiros_ you should really go check some of my recent additions, i think i'm doing well xD
<apeiros_>
(I think he knows them already, but tried to go a different route for experimentation)
jxf has quit [Ping timeout: 252 seconds]
<apeiros_>
Jdubs: will do
<joofsh>
so if you need to pass a param "id" => "5" it'd be... HTTParty.post("localhost:3000", body: {'id' => '5'}
<joofsh>
)
c0rn has joined #ruby
ipsifendus has quit [Quit: ipsifendus]
Cultofmetatron has quit [Remote host closed the connection]
<havenn>
Jdubs: Most have similar DSLs, RestClient.post, HTTParty.post, Faraday.post, etc.
Wildhoney has quit [Ping timeout: 255 seconds]
<Jdubs>
havenn, awesome :) I don't have time now to try to implement that today...Looks like that will be for tomorrow...maybe a good future goal would be to write a nice DSL for Net::HTTPS that does similar
jrist is now known as jrist-afk
<Jdubs>
would that be something good to have in my coding portfolio?
k610 has quit [Ping timeout: 256 seconds]
<Drewch>
I've got a question about what's popular for initializing a class in Ruby, for example, a Client to an API that takes in a consumer key and consumer secret
minijupe has joined #ruby
Paradox has joined #ruby
francisfish has quit [Remote host closed the connection]
<Drewch>
Is the popular thing to do Client.new consumer_key: '234', consumer_key_secret: '456'
<Drewch>
or just Client.new('234', '456')
k610 has joined #ruby
dangerousdave has quit [Quit: Leaving...]
<joofsh>
drwech: are you asking with or without parenthesis, which is more common?
tommyvyo has joined #ruby
<Drewch>
no, I'm asking hash or no hash
verto|off is now known as verto
<joofsh>
drewch: oh wups, missed that
<Drewch>
by Client.new '234', '456 I know it's the same as with brackets
<blazes816>
Drewch: I personally like to try and follow the 0, 1, or infinity 'rule' when writing methods. So I prefer it to take a hash of arguments. especially since it's very likely this will need to take other params sometimes
<blazes816>
s/sometimes/sometime/
verto is now known as verto|off
<Sou|cutter>
hashes for optional params, at least
<joofsh>
^ what blazes said, especially if optional
<Drewch>
Okay thanks, but if required, generally don't use hash?
<havenn>
Or jump the shark and use Ruby 2.0.0 named arguements. :P
<nmabry>
Drewch: I fall on the explicit side of the fence. I prefer Client.new ''234", "456" to the hash alternative. I tend to reserve hashes for more DSL-ish use. Otherwise I prefer to pass in regular parameters or a wrapper object. We'll see if Ruby 2 changes that.
reinaldob has quit [Remote host closed the connection]
<nmabry>
Drewch: but this is a total matter of taste area
<Drewch>
yeah I figured that
k610 has quit [Ping timeout: 260 seconds]
<Drewch>
My company just opened up an API
<Jdubs>
nmabry: define wrapper object?
<Drewch>
writing libraries for all the languages
<joofsh>
drwech: better to use def initialize consumer_info = {} . And then you can use a loop in the initialize method using the send() method to set them
<Sou|cutter>
nmabry: when you say DSL-ish, do you mean in the style Foo.new do |config| ... end ?
<Drewch>
I don't want to piss off ruby community by writing the client in a distasteful way
<blazes816>
Drewch: have a hash with the default arguments. then do something like def initialize(args={}); options = defaults.merge(args); end
<Jdubs>
Drewch: that's nice of you :)
k610 has joined #ruby
<havenn>
In Refactoring from Good to Great I think Ben Orenstein passed a custom Struct or OpenStruct object instead of Hash for two params, need to re-watch that talk: Refactoring
<blazes816>
i much prefer the hash if the goal is to allow expanding parameters without breaking the api
<nmabry>
Jdubs: by wrapper object i just meant… if a method begins to accept a bunch of related parameters, then i'll create a new class with those parameters as properties. then i'll pass in that object instead of a bunch of parameters. Ben Orenstein's talk that havenn mentioned above describes the strategy well.
<bricker>
What's the most succinct and fastest way to tell if every element in an array is in another array?
<Drewch>
blazes816: then how do they know what the symbol's for the hash are?
<Drewch>
or they have to look at an example to see how it works?
enderx86 has joined #ruby
hackerdu_ has quit [Remote host closed the connection]
riley526 has left #ruby [#ruby]
<blazes816>
Drewch: they'd need to read the documentation. how would you know what params and what order, a method takes otherwise?
dangsos has quit [Ping timeout: 245 seconds]
<Sou|cutter>
Drewch: that's definitely a downside of hash-based options
<Sou|cutter>
blazes816: if you use a configuration object you can inspect it, at least
<Jdubs>
nmabry: do you think i would understand the video?
<blazes816>
same with a default arg hash
<Drewch>
blazes816: yeah good point, I wasn't arguing I'm just curious, if someone was using Java with eclipse they could see if it's named in the Object itself
<bricker>
Like, `(b & a) == b` ? Any better solutions?
vickaita has joined #ruby
<Sou|cutter>
blazes816: how do you inspect the default arg hash?
<nmabry>
Sou|cutter: By DSL-ish I just meant cases where I'm explicitly designing for use as a third party dependency. Sometimes that seems like a good way to document intended use.
<blazes816>
Drewch: for sure, me either. true. I have no issue with using a struct, but only if the params are pretty solid
h4mz1d has quit [Ping timeout: 245 seconds]
Schmidt has quit [Ping timeout: 245 seconds]
jenrzzz has quit [Ping timeout: 240 seconds]
jeffreybaird has quit [Quit: jeffreybaird]
<Drewch>
This is basically just for their API key and API Secret Key
<Drewch>
I feel like what would make most people happy is a hash
<nmabry>
Jdubs: you'll at least understand a lot of it. and if not, who cares? in that talk you get to see a really efficient ruby developer work. that always inspires me.
<shevy>
damn python
<shevy>
gobject-introspection requires it...
kpshek has quit []
<Drewch>
but I want to make sure if I define the function as def initialize(args={})
<blazes816>
Drewch: soon they'll need to add a callback url, specify custom endpoints, etc
<shevy>
and all this python version madness isn't making things easier.
k610 has quit [Ping timeout: 268 seconds]
<Drewch>
that people will understand to put in: consumer_key: and consumer_key_url:
<Drewch>
yeah exactly, I have that in the API, but not yet using it, so that is definitely one reason to use a hash
<blazes816>
Drewch: check for their presence and raise an error if they aren't there. just like what would happen if it took explicit args
k610 has joined #ruby
<Sou|cutter>
Drewch: if you can't have a Client without a consumer key / url, I would use regular params
<blazes816>
there are obviously a large number of opinions on the matter
nemish has quit [Ping timeout: 248 seconds]
<Drewch>
yeah of course
RudyValencia has quit [Quit: Hacked By Chinese!]
<Drewch>
right now, only one of the 3 parameters is used Consumer_key, and the three are: consumer_key, consumer_key_securet, and callback_url
<Drewch>
so from what i've gathered so far
<reactormonk>
ARGH. Nokogiri fucks namespaces up.
<Drewch>
the most sense thing to do
<Drewch>
is
<havenn>
Drewch: class ConsumerKey < Struct.new(:consumer_key, consumer_key_secure, :consumer_key_url); end
<havenn>
Sou|cutter: I'm not accustomed to seeing it.
_alejandro has quit [Remote host closed the connection]
vlad_starkov has quit [Ping timeout: 245 seconds]
neiko has quit [Client Quit]
bpfh has joined #ruby
Michael_ has quit [Remote host closed the connection]
k610 has quit [Ping timeout: 260 seconds]
k610 has joined #ruby
<Drewch>
blazes816 so the most flexible is just def initialize(args={})
LMolr has joined #ruby
LMolr has quit [Client Quit]
<dagnachew>
is there a chancen that rubinuius becomes the defacto ruby implementation ?
swex has quit [Read error: Operation timed out]
<blazes816>
Drewch: yep, but at the expense of having a less self-documenting api. it's all about tradeoffs and balances. personally, that way is my preference
<dagnachew>
blazes816, the thing is 5 years or 10 years from know will ruby have a full parallelism mechanisim or it wont never remove the gil thus hindering scaling ?? thus hitting a wall once scaling issues arise hince choosing ruby ofr new projects ????
<gbchaosmaster>
How to DRY that up?
k610 has joined #ruby
C0deMaver1ck has quit [Remote host closed the connection]
<havenn>
dagnachew: Maybe Celluloid will be moved into the standard library for Ruby 3000.
amacgregor_osx has joined #ruby
<blazes816>
dagnachew: I think jruby would become the defacto ruby before rubinious. but regardless, I think mri still has a chance to figure this issue out
<Ry>
gbchaosmaster: Module Mappable def map perhaps? code looks the exact same bt that could be my 8am eyes -_-
<havenn>
dagnachew: The GIL is already gone (long live the GVL!).
<Ry>
perhaps even just define the mappable module inside enumerable and then you've only got the include in array?
<dagnachew>
havenn, blazes816 without further bothering , will ruby be fit for the heavy lifting ( big data et all) or will it be sentenced to only do "front end " ??/
k610 has quit [Ping timeout: 246 seconds]
jjang has quit [Ping timeout: 252 seconds]
k610 has joined #ruby
nmabry has left #ruby [#ruby]
Juul has quit [Ping timeout: 264 seconds]
<blazes816>
dagnachew: depends on how heavy. you may want to consider c or c++. if that's too much, then ruby would probably work fine for you. especially using celluloid or jruby/rubinious
<havenn>
dagnachew: Ruby has a bright future. Crush the snake.
<Sou|cutter>
dagnachew: I don't think ruby is going to have robust threading for a long, long time.
<Sou|cutter>
but I don't think that is the same as sentencing it to front end
<havenn>
MHTSWHT: Matz Hates Threads So We Hate Threads.
<blazes816>
many jobs simply don't require threading
<blazes816>
haha
baroquebobcat has quit [Quit: baroquebobcat]
qwerxy has quit [Quit: offski]
SCommette has quit [Quit: SCommette]
Michael_ has joined #ruby
vickaita has quit [Ping timeout: 276 seconds]
berserkr has quit [Quit: Leaving.]
<Jdubs>
haven: who is matz?
ndrei has quit [Ping timeout: 276 seconds]
<davidcelis>
lol
<davidcelis>
this guy!
<havenn>
Jdubs: Ruby's Benevolent Dictator for Life
<dagnachew>
Sou|cutter, you have this great idea for the next "big thing", prototype with ruby , continue with ruby , oups 100 000 users more in one month ! two weeks later 10 fold 1 million clients , months later 50 millions clients will you keep the technology stack with ruby ?
jjang has joined #ruby
<Sou|cutter>
not really enough information for me to say
<Sou|cutter>
but I'd probably use java if it has a really heavy workload (please don't hurt me)
<Sou|cutter>
the thing is you are lucky to have the problem of scaling
<Sou|cutter>
most people never really get to that point
jaygen_ has quit [Remote host closed the connection]
<Sou|cutter>
unless they write something in a horrendously unscalable fashion
hackerdude has joined #ruby
nari has quit [Ping timeout: 245 seconds]
<blazes816>
don't write something with the expectation that millions of users use it because it'll take you forever (probably literally) to finish and there's no reason to be able to handle millions of users if it never even gets 1
<Sou|cutter>
so I think it pays to start with using whatever technology you think will get you up and running fastest, and if you begin to hit scaling bottlenecks, measure them and decide a course of action for solving them (it may be changing parts of your stack, it may be optimizing what you have, etc)
hackerdude has quit [Read error: Connection reset by peer]
k610 has quit [Ping timeout: 252 seconds]
hackerdude has joined #ruby
Kyril has joined #ruby
<Sou|cutter>
blazes816: certain times you are guaranteed to get slammed immediately. Whenever google rolls out a product for example :P
<joofsh>
Isn't that generally the role rails takes? No one argues its the most efficient, its just the fastest getting up and running. most companies seem to eventually switch (particularly to node)
<blazes816>
okay, if you're google, you may want to plan for millions of users
x82_nicole has quit [Quit: Computer has gone to sleep.]
<Sou|cutter>
joofsh: to node? really? lol, ok
jonathanwallace has quit [Remote host closed the connection]
k610 has joined #ruby
<joofsh>
or not? it was more of a question
rellin has joined #ruby
<joofsh>
thats just the impression i get
gabrielrotbart has joined #ruby
nat2610 has quit [Quit: Leaving.]
hackerdude has quit [Read error: Connection reset by peer]
<blazes816>
from the node community
hackerdu_ has joined #ruby
<joofsh>
from hacker news. But its certainly a bias sample
<Sou|cutter>
node makes sense for a certain subset of problems, but I would argue it's the same set of problems that EventMachine covers. So I think it's silly to say to scale you are going to want to rewrite your product in eventmachine - that makes no sense.
<blazes816>
just kidding. but seriously, node is mostly hype. it's a pretty neat platform but not anywhere near the magical medicine people claim