<banisterfiend>
'wings of liberty' is a separate purchase
<davidcelis>
heart of the swarm is part 2
zph has quit [Quit: Computer has gone to sleep.]
<banisterfiend>
that's from teh blizzard site
<davidcelis>
yeah...
<davidcelis>
wings of liberty + heart of the swarm + some unannounced protoss campaign == the full SC2 experience
<banisterfiend>
oh
<banisterfiend>
i misunderstood
<banisterfiend>
the main option is buying both
<banisterfiend>
but the secondary option is buying just the first one
pskosinski has quit [Ping timeout: 248 seconds]
<banisterfiend>
that's totally backward
<banisterfiend>
i figured it would be 1. the main one 2. the optional expansion back
<reactormonk>
banisterfiend, one is (R) the other tm? ^^
artOfWar has quit [Read error: Connection reset by peer]
That-BRMatt has joined #ruby
artOfWar has joined #ruby
<banisterfiend>
davidcelis: so do you recommend i buy the full experience or just wings of liberty?
<banisterfiend>
im a noob
<davidcelis>
well heart of the swarm isn't out yet
<banisterfiend>
i have 0 experience with starcraft in any way shape or form
x82_nicole has joined #ruby
<davidcelis>
i'd probably just buy wings of liberty and see if you like it
bjeanes has quit [Ping timeout: 248 seconds]
<davidcelis>
but if you have 0 experience i'd recommend playing starcraft 1 first
ivar has left #ruby [#ruby]
<banisterfiend>
davidcelis: no, that came out in like 1997 didnt it?
baroquebobcat has quit [Ping timeout: 248 seconds]
<banisterfiend>
i cant travel that far back in time, it'll dig up old child hood memories
cantonic has quit [Ping timeout: 245 seconds]
<davidcelis>
yep and it's still awesome
s1n4 has joined #ruby
<banisterfiend>
i'll cast my manhood down in a flood of remembrance
<banisterfiend>
and weep like a child for the past
jds_ has quit [Ping timeout: 264 seconds]
breakingthings has joined #ruby
pyreal has left #ruby [#ruby]
BRMatt has quit [Ping timeout: 260 seconds]
carloslopes has quit [Remote host closed the connection]
gyre007 has quit [Remote host closed the connection]
clj_newb has joined #ruby
<plotplanexe>
starcraft 1 is better imo
<breakingthings>
Hello Gentlemens, I have an inquiry, which in entirety is as follows: How should I use rspec/a testing framework in a gem (eg. can/should I define a dependency on RSpec? Can I limit it to development?)
slainer68 has quit [Remote host closed the connection]
gyre008 has quit [Remote host closed the connection]
<Spooner>
breakingthings, use #add_development_dependency for stuff you don't need to use the gem itself.
etcetera has quit []
s1n4 has quit [Client Quit]
<breakingthings>
okay, so I was right… And should I put that in my .gemspec, or Gemfile (I came across a SO question that said Gemfile, but that seems… strange)
alx- has quit [Read error: Operation timed out]
dankest has quit [Quit: Leaving...]
karasawa has joined #ruby
<Spooner>
breakingthings, In your Gemfile, for a gem, you jsut put "gemspec" so it reads from the spec.
<Spooner>
You don't repeat the dependencies.
<breakingthings>
I let bundler initialize it so that's already there, I thought it was strange that the answer I saw on SO was saying to put it on the Gemfile.
<breakingthings>
Thanks for clarifying.
etcetera has joined #ruby
jtgiri__ has joined #ruby
jtgiri_ has quit [Read error: Connection reset by peer]
jtgiri__ is now known as jtgiri_
zastern has quit [Remote host closed the connection]
<Spooner>
You put dependencies directly in the Gemfile only for applications.
resetexistence has joined #ruby
bjeanes has joined #ruby
<Kovensky>
banisterfiend: download the SC2 trial
MattRB has quit [Quit: This computer has gone to sleep]
resetexistence has quit [Client Quit]
<Kovensky>
you can play the campaign and play with friends (as terran only)
<lectrick>
Is there any way to subtract (intersect, etc) character sets in Ruby's Regex implementation?
<Kovensky>
if you use your google-fu you can also find a tool that lets you launch player-vs-CPU skirmishes (as any race) with the trial version
<Kovensky>
then decide whether to buy it :>
karasawa has quit [Ping timeout: 256 seconds]
recycle has quit [Remote host closed the connection]
MattRB has joined #ruby
freakazoid0223 has joined #ruby
<aedornm>
I played SC2 during beta ...
jaequery has quit [Quit: Computer has gone to sleep.]
TheFuzzball has quit [Quit: Computer has gone to sleep.]
orcris has quit [Quit: Konversation terminated!]
gyre007 has joined #ruby
mockra has quit [Remote host closed the connection]
dankest has joined #ruby
gyre007 has quit [Ping timeout: 240 seconds]
bradhe has quit [Remote host closed the connection]
nari has joined #ruby
dmiller has quit [Ping timeout: 256 seconds]
khimera has joined #ruby
banisterfiend is now known as banister`sleep
nfk has quit [Quit: yawn]
Asher has quit [Ping timeout: 244 seconds]
techhelp has joined #ruby
DrShoggoth has joined #ruby
chrismhough has quit [Quit: chrismhough]
havenn has joined #ruby
jtgiri_ has quit [Quit: jtgiri_]
Asher has joined #ruby
forced_request has joined #ruby
arya_ has quit [Ping timeout: 276 seconds]
arya_ has joined #ruby
havenn has quit [Read error: Connection reset by peer]
SCommette has quit [Quit: SCommette]
havenn_ has joined #ruby
ttt_ has joined #ruby
codezombie is now known as codezombie|away
caleb_io has quit [Quit: caleb_io]
dnyy has quit [Remote host closed the connection]
sn0wb1rd has quit [Quit: sn0wb1rd]
dnyy has joined #ruby
codezombie|away is now known as codezombie
dmiller has joined #ruby
dnyy has quit [Remote host closed the connection]
ryanh has joined #ruby
havenn_ has quit [Ping timeout: 276 seconds]
dnyy has joined #ruby
ryanf has joined #ruby
zph has joined #ruby
bricker is now known as bricker`work
That-BRMatt has quit [Read error: Operation timed out]
ViPi has quit [Quit: Computer has gone to sleep.]
dnyy has quit [Remote host closed the connection]
dnyy has joined #ruby
<breakingthings>
Question for anyone around: I'm building a gem, which is more or less going to be a module that give access to some common stuff for IRC and make it easy to build a bot around it
sclarson_ has quit [Quit: sclarson_]
<breakingthings>
Cinch's way is to give you a DSL for the entire bot, but it sort of makes it weird when you're essentially writing procedural-like code to configure and start your bot.
codezombie is now known as codezombie|away
<mva3212>
breakingthings: I recommend you try #rubyonrails
megha has joined #ruby
dnyy has quit [Remote host closed the connection]
<breakingthings>
It's not really a rails question, though...
<dominikh>
breakingthings: you can use Cinch in a "procedural" style, too. There's a full proper API
ryanh has quit [Ping timeout: 252 seconds]
<dominikh>
and yeah, what the heck has that to do with rails :)
dnyy has joined #ruby
account has quit [Ping timeout: 245 seconds]
<mva3212>
oh
andrewhl has joined #ruby
<mva3212>
I was just suggesting cuz this channel is always dead
<mva3212>
lo
yacks has joined #ruby
<breakingthings>
Well, dominikh, what I mean is… I want to structure my bot in such a way that you can do the simple way that Cinch allows for but also to use it in a class that includes/extends my irc module
<breakingthings>
So I was curious how I could best accomplish that
<breakingthings>
With Cinch, almost all of the functionality is in Cinch::Bot
CreativeEmbassy has joined #ruby
<dominikh>
uhm, there's almost no functionality in the Cinch::Bot class ;)
dnyy has quit [Remote host closed the connection]
<breakingthings>
Well, that's where it all consolidates.
sclarson_ has joined #ruby
<breakingthings>
Is what I mean
<breakingthings>
Like, to use Cinch it's intended that you use Bot#new
<breakingthings>
and Bot#start
etcetera has quit []
dnyy has joined #ruby
khimera has quit [Quit: khimera]
<breakingthings>
unless I don't understand something (which is entirely possible considering my fledgling ruby understanding)
<dominikh>
mostly right, yes
sailias has joined #ruby
<breakingthings>
But I was wondering if there might be a better way to go about structuring it such that you can include the module in your own Bot class, that then has access to the functions and such
<breakingthings>
access to my module's API, I guess is what I mean
etcetera has joined #ruby
Playground has quit [Ping timeout: 248 seconds]
<breakingthings>
And if possible, maybe also allow for a little flexibility in being able to have a DSL similar to Cinch that allows for really quick small bots
jjbohn has joined #ruby
dnyy has quit [Remote host closed the connection]
<breakingthings>
so you can play it procedural-ish or OOP
slainer68 has joined #ruby
<breakingthings>
Hopefully I'm making sense. If you have any input it'd be greatly appreciated.
dnyy has joined #ruby
<dominikh>
mostly thinking with my reptile brain right now. as for including and extensibility: the only parts you could make mix-inable are generic helper functions. everything that has to deal with the actual network side kind of relis on some expected foundation
megha is now known as database
dnyy has quit [Remote host closed the connection]
<breakingthings>
What about as an extend
inokenty has quit [Remote host closed the connection]
dnyy has joined #ruby
tommyvyo has joined #ruby
<breakingthings>
which… I don't know, if I can somehow define a module method that handles the connection
<dominikh>
what exactly are you hoping to achieve? compare it to for example the plugin architecture in Cinch (which, essentially, is an include+extend of Cinch::Plugin in your own class)
dnyy has quit [Remote host closed the connection]
<breakingthings>
Well, maybe I just don't get it, but it seems weird for Cinch::Bot to be the cornerstone of, well, your own bot.
slainer68 has quit [Ping timeout: 244 seconds]
dnyy has joined #ruby
<breakingthings>
I didn't see any uses of it in a more OO manner so I'm not sure how it looks if you can do that well
<breakingthings>
I'll check the examples on their repo to see if there's one...
<dominikh>
breakingthings: what if you called it Cinch::Connection instead, would it make a difference?
mahmoudimus has quit [Quit: Computer has gone to sleep.]
arya_ has quit [Ping timeout: 248 seconds]
<dominikh>
in its essence, Cinch::Bot is a connection and message broker
<breakingthings>
dominikh: Eh, kinda. But there's something that I just don't know how to articulate that I'm wondering about
<didge>
Does anyone in the channel have experience using the gem mysql2 on MacOSX ?
dnyy has quit [Remote host closed the connection]
joofsh has joined #ruby
DrShoggoth has quit [Ping timeout: 256 seconds]
mahmoudimus has joined #ruby
<didge>
I'm getting an error message "dyld: lazy symbol binding failed: Symbol not found: _mysql_get_client_info references from mysql2.bundle
dnyy has joined #ruby
<breakingthings>
I took a look at the examples from Cinch's repo, but all of them are just procedural-like using the DSL
bradhe has joined #ruby
dnyy has quit [Remote host closed the connection]
<dominikh>
breakingthings: there are to sets of examples. one's labelled basic, one plugins
<dominikh>
one uses the sinatra-like DSL, one uses plugin classes
dnyy has joined #ruby
apok has quit [Read error: Connection reset by peer]
aytch_ is now known as aytch__
apok has joined #ruby
freakazoid0223 has quit [Quit: Leaving]
dnyy has quit [Remote host closed the connection]
<dominikh>
which one is it that you looked at?
dnyy has joined #ruby
<breakingthings>
dominikh: I had looked at all the basic and then took a look at the plugins
<breakingthings>
I don't know if that's more hassle than the DSL but I felt it might be a little better then you can built bot-specific bits outside of the plugins
<dominikh>
what would be the advantage of that? compared to, say, class MyBot < Cinch::Bot
* breakingthings
shrugs
dnyy has quit [Remote host closed the connection]
arya_ has joined #ruby
mahmoudimus has quit [Ping timeout: 255 seconds]
vervain has quit [Quit: leaving]
<breakingthings>
Well, I guess that would do too
<breakingthings>
but I just thought include/extending the module would make more sense
<breakingthings>
And then I figure I could have a DSL as well that can mimic these… or something. I dunno, I'm sorta jumping head-first into this a little.
<swarles>
I juse did include? =~
<swarles>
\n=~
generalissimo has joined #ruby
dnyy has quit [Remote host closed the connection]
asym has quit [Ping timeout: 255 seconds]
dnyy has joined #ruby
mahmoudimus has joined #ruby
<dominikh>
breakingthings: I'm really not able to wrap my head around what you're trying to achieve, sorry
dnyy has quit [Remote host closed the connection]
<breakingthings>
dominikh: It's alright, I understand I'm being a little cryptic, I can't really articulate what I'm trying to think of
<breakingthings>
thanks for trying anyway
dnyy has joined #ruby
bradhe has quit [Ping timeout: 248 seconds]
apok has quit [Quit: apok]
khimera has joined #ruby
dnyy has quit [Remote host closed the connection]
dnyy has joined #ruby
elkclone has quit [Read error: Connection reset by peer]
Michael_ has quit [Remote host closed the connection]
asym has quit [Ping timeout: 264 seconds]
dnyy has quit [Remote host closed the connection]
xnm has joined #ruby
dnyy has joined #ruby
sailias has quit [Remote host closed the connection]
havenn has joined #ruby
dnyy has quit [Remote host closed the connection]
dnyy has joined #ruby
alvaro_o has quit [Quit: Ex-Chat]
quest88 has joined #ruby
bradhe has quit [Ping timeout: 248 seconds]
dnyy has quit [Remote host closed the connection]
kold_ has joined #ruby
dnyy has joined #ruby
techhelp has quit [Quit: Leaving]
angusiguess has joined #ruby
etcetera has quit []
dnyy has quit [Remote host closed the connection]
dnyy has joined #ruby
NeRMe has joined #ruby
Zac_o_O has quit [Remote host closed the connection]
caleb_io has quit [Quit: caleb_io]
dnyy has quit [Remote host closed the connection]
mercwithamouth has joined #ruby
dnyy has joined #ruby
c0rn has quit [Quit: Computer has gone to sleep.]
syamajala has quit [Quit: leaving]
dnyy has quit [Remote host closed the connection]
Michael_ has joined #ruby
dnyy has joined #ruby
sepp2k1 has quit [Read error: Connection reset by peer]
epylinkn has joined #ruby
sailias has joined #ruby
banister`sleep is now known as banisterfiend
dnyy has quit [Remote host closed the connection]
Mokosha has joined #ruby
dnyy has joined #ruby
ForSpareParts has joined #ruby
adkron_ has joined #ruby
adkron has joined #ruby
dnyy has quit [Remote host closed the connection]
zph has quit [Quit: Computer has gone to sleep.]
<ForSpareParts>
Does anyone know why linecache19 takes so long to build, and if there's a way to do something about it?
DrShoggoth has joined #ruby
dnyy has joined #ruby
ngoldman has joined #ruby
Mokosha has quit [Read error: Connection reset by peer]
evanx has joined #ruby
francisfish has quit [Read error: Connection reset by peer]
hadees has quit [Quit: hadees]
esing has joined #ruby
francisfish has joined #ruby
dnyy has quit [Remote host closed the connection]
dnyy has joined #ruby
database has quit [Quit: WeeChat 0.3.9.2]
pu22l3r has joined #ruby
dnyy has quit [Remote host closed the connection]
NeRMe has quit [Remote host closed the connection]
dnyy has joined #ruby
tvw has quit [Remote host closed the connection]
<evanx>
Hi
mrFrog has joined #ruby
dwu1 has joined #ruby
<mrFrog>
i'm having a hard time with time zones. i have this time "1358911653 -0700" - if i do this: time = DateTime.strptime(time_raw, '%s %z') then time ends up 7 hours off (2013-01-23T03:27:33+00:00). why is that? how do i adjust for that?
dnyy has quit [Remote host closed the connection]
havenn has quit [Remote host closed the connection]
<mrFrog>
i would have thought that strptime with %z took care of the zone adjusting, maybe it's more complex than i thought?
<TTilus>
hemanth: equivalent to browser.elem(:attrib, value).visible?
huoxito has quit [Quit: Leaving]
dnyy has quit [Remote host closed the connection]
<hemanth>
TTilus, yup exactly what I was looking for
dnyy has joined #ruby
ner0x has quit [Quit: Leaving]
alexhq has joined #ruby
a_a_g has quit [Read error: Connection reset by peer]
dnyy has quit [Remote host closed the connection]
a_a_g has joined #ruby
<alexhq>
Do you know any static site generator as alternative to middleman and tilt with their worst encoding issues unresolved for years? I need just Erb layouts and templates + sprockets. Sprockets is not strictly required.
<apeiros_>
(the lol was @ zombo.com, just to be clear :-) )
tatsuya_o has joined #ruby
mikecmpbll has joined #ruby
elaptics`away is now known as elaptics
<Siavash>
thanks
snearch has joined #ruby
angusiguess has quit [Ping timeout: 256 seconds]
az7ar has joined #ruby
snearch has quit [Client Quit]
poikon has joined #ruby
arya has quit [Ping timeout: 245 seconds]
karasawa has joined #ruby
[Neurotic] has quit [Read error: Connection reset by peer]
pathou has joined #ruby
arturaz has joined #ruby
arya has joined #ruby
joeycarmello has quit [Ping timeout: 248 seconds]
clj_newb has joined #ruby
clocKwize has quit [Quit: clocKwize]
wunz has quit [Read error: Operation timed out]
joeycarmello has joined #ruby
pathou has quit [Ping timeout: 245 seconds]
pcarrier has joined #ruby
Xeago has joined #ruby
clocKwize has joined #ruby
adambeynon has joined #ruby
bradhe has joined #ruby
maxmanders has joined #ruby
pcarrier has quit [Ping timeout: 246 seconds]
aaronmacy has quit [Quit: Leaving.]
snearch has joined #ruby
pcarrier has joined #ruby
Zespre has joined #ruby
wunz has joined #ruby
fyolnish has quit [Ping timeout: 255 seconds]
bradhe has quit [Ping timeout: 276 seconds]
paolooo has joined #ruby
marr has joined #ruby
JonnieCache has quit [Quit: Reconnecting]
JonnieCache has joined #ruby
nobitanobi has joined #ruby
timmow has joined #ruby
jpfuentes2 has quit [Quit: Computer has gone to sleep.]
megha has joined #ruby
clj_newb has quit [Ping timeout: 276 seconds]
<nobitanobi>
Given a particular date, how can I find the previous date which day is "17" and the next date which day is "19" - So if I am in the 16th of January of 2013, I would like to get -> 17 of December of 2012 and 19th of January of 2013 - How can I do that with date?
hack has quit [Ping timeout: 264 seconds]
<hoelzro>
nobitanobi: a naive but working solution would be to create a before date and after date object
<hoelzro>
init before to yesterday, and after to tomorrow
arya has quit [Ping timeout: 255 seconds]
<hoelzro>
decrement before by a day while its day is != 17
<hoelzro>
and increment after by a day while its day is != 19
tPl0ch_ has joined #ruby
<nobitanobi>
hoelzro: that's exactly how I am doing it :P
banisterfiend has quit [Remote host closed the connection]
<nobitanobi>
thanks hoelzro..
<hoelzro>
nobitanobi: so stick with it =)
<hoelzro>
there are definitely more intelligent ways of doing it
mjbamford has joined #ruby
<hoelzro>
but this approach is simple, clean, and most importantly, it works
dwu1 has quit [Quit: Leaving.]
hamed_r has joined #ruby
jenrzzz has quit [Ping timeout: 248 seconds]
<apeiros_>
Date#+ and Date#-
<apeiros_>
date = Date.today; yesterday = date-1; tomorrow = date+1
<apeiros_>
@ nobitanobi & hoelzro
<apeiros_>
oh, or did I misunderstand the question?
<apeiros_>
hm, think so
<nobitanobi>
apeiros_: yup :)
tPl0ch has quit [Ping timeout: 248 seconds]
<Xeago>
apeiros_: I don't understand the question at all, hoelzro made it more vagye for me xD
<hoelzro>
he wants the most recent date before today that has the day of the month == 16
<apeiros_>
I'd use partial construction
<hoelzro>
and the nearest date in the future after today that has hte day of the month == 19
beliveyourdream has quit [Ping timeout: 255 seconds]
snearch has quit [Quit: Verlassend]
<apeiros_>
before, after = Date.civil(date.year, date.month, 17), Date.civil(date.year, date.month, 19)
<apeiros_>
before << 1 if before > date; after >> 1 if after < date
yshh_ has quit [Remote host closed the connection]
<JonnieCache>
hmm
<JonnieCache>
you know its a good day when youve broken out wireshark before half 10 am
arya has joined #ruby
<apeiros_>
<</>> subtracts/adds 1 month
<hoelzro>
ugh
<hoelzro>
apeiros_: that's a good solution
<nobitanobi>
jesus
<nobitanobi>
nice apeiros_
<hoelzro>
I just don't like overriding <</>>
<hoelzro>
;)
<apeiros_>
?
<apeiros_>
there's no overriding of <</>> involved…
workmad3 has joined #ruby
nkr has joined #ruby
gyre007 has joined #ruby
<hoelzro>
apeiros_: what I meant to say is I don't care for when classes override <</>>
<hoelzro>
Array, Date, etc
<apeiros_>
I'm even more confused now :D
<hoelzro>
(maybe a better choice of words would be "define")
<hoelzro>
when I see <<, I think "bit shift"
<hoelzro>
I don't like it to mean anything else
<apeiros_>
aha
<hoelzro>
it's a personal taste thing, forget I mentioned it =)
<apeiros_>
think of months as binary numbers then ;-p
<nobitanobi>
apeiros_: what would be "date" in your construction?
<apeiros_>
nobitanobi: your original date
yshh has joined #ruby
<apeiros_>
the one from which you want the relative dates you mentioned
b1rkh0ff has joined #ruby
arya has quit [Ping timeout: 244 seconds]
daniel_- has joined #ruby
baphled has joined #ruby
tPl0ch_ is now known as tPl0ch
<nobitanobi>
apeiros_: thanks :)
yacks has quit [Remote host closed the connection]
beliveyourdream has joined #ruby
kjellski has joined #ruby
<JonnieCache>
hoelzro: surely you dont mind `[] << :foo`
karasawa has quit [Ping timeout: 252 seconds]
<JonnieCache>
so neat and clear
<hoelzro>
I do
<JonnieCache>
youre a monster
samuel02 has quit [Remote host closed the connection]
* JonnieCache
thinks he should do more bitwise programming so he can look down on people more effectively
<hoelzro>
I prefer named methods =)
arya has joined #ruby
samuel02 has joined #ruby
<JonnieCache>
how about [1,2,3] += [4,5] does that upset you
<JonnieCache>
or is it just binary operators
<hoelzro>
JonnieCache: + is a binary operator ;)
<Xeago>
hoelzro: not in the case of carry
<nobitanobi>
apeiros_: the solution you gave actually doesn't do what I am looking for…If I give the today's date (23rd of January) it should give 17th of January and 19th of February. It gives both in January.
<hoelzro>
Xeago: hmm?
<Xeago>
binary operators don't do carry or overflow
<ninegrid>
do people prefer heterogenous array instances or instances of multiple arrays? what are some common patterns for dealing with heterogenous arrays?
<JonnieCache>
what exactly do you mean by hetrogenous here?
<hoelzro>
JonnieCache: + for Arrays and Strings bug me, but method names are often too lengthy for String concatentation, and I don't think there's a method alternative for Array#+ (but I could very well be wrong)
<JonnieCache>
all elements the same type?
<ninegrid>
JonnieCache: elements of different type
<hoelzro>
Xeago: are you referring to + here?
<JonnieCache>
hoelzro: [].concat [] does the same as [] += [] assuming youre not concerned about object identity
<Xeago>
hoelzro: yup
<hoelzro>
JonnieCache: right, but array.concat new_array modifies array
<JonnieCache>
hoelzro: thats what i said ;)
<hoelzro>
whereas array + new_array does not, right?
<apeiros_>
nobitanobi: right, made a mistake. dates are immutable.
<apeiros_>
need to change the 2nd line to before <<= 1 if before > date; after >>= 1 if after < date
<Xeago>
if overflow/carry is ignored it is a binary operation
samuel02 has quit [Ping timeout: 240 seconds]
<JonnieCache>
ninegrid: in ruby it doesnt really matter if you mix types in an array
<hoelzro>
Xeago: when I say "binary operator", I refer to operators that operate on two operands
az7ar has quit [Quit: Leaving]
<JonnieCache>
ninegrid: can you be more specific about your problem?
<apeiros_>
ninegrid: common pattern in ruby says "class doesn't matter, behavior does"
<Xeago>
ah, I was thinking on a lower level :)
<ninegrid>
JonnieCache: I understand that, but what are the common practices when dealing with elements of differing type... other than using shared method names
<nobitanobi>
apeiros_: awesome.
<ninegrid>
JonnieCache: I don't have a specific problem, just trying to gain some understanding...
<nobitanobi>
So, taking advantage of this case, what is a good way to return two elements in a method? I usually use hashes
<apeiros_>
ninegrid: and if by heterogenous you don't just refer to type/class, but also behavior relevant for your case, then I'd say: wtf? why?
<JonnieCache>
ninegrid: have you heard of the term "duck typing?" because thats what youre basically discussing
<ninegrid>
I have heard of that
<JonnieCache>
well basically if everything in your array behaves in a common way then it doesnt matter what type it is
frihd has quit [Read error: Operation timed out]
<ninegrid>
Then one would avoid persuing different types in a single array in the absence of duck typing?
frihd has joined #ruby
<JonnieCache>
yeah. well in a strongly typed language like java you arent allowed to mix types in an array
<ninegrid>
What i mean is, barring the obvious use like to_s, if there were no other shared method names, then you would avoid it
<ninegrid>
I'm coming from ML
<JonnieCache>
ninegrid: it would probably make sense to do so yes
<ninegrid>
and haskell
<JonnieCache>
there isnt a hard and fast reason why you shouldnt do it, its more one of those "if youre doing this then its a good sign you might be confused about the problem youre solving" type of things
<ninegrid>
thanks for the help
<JonnieCache>
np
<Hanmac_>
ninegrid in ruby you can do this [:in, "ruby", 2,{},[], true, false, nil ] ... and then join it all together with join :P
reinaldob has quit [Remote host closed the connection]
<Hanmac_>
or the enumerable module is a good sample for duck typing ... they functions do not care in what class they are included ... the object only needs an each method
<JonnieCache>
ninegrid: generally in ruby you should get used to being able to do whatever insane thing you want, and shouldering the responsibility of deciding for yourself what is and isnt a good idea
<JonnieCache>
(or ask someone here of course. the point is the language/interpreter wont decide for you)
<ninegrid>
Hanmac_: but isnt that essentially concatenating to_s
yacks has joined #ruby
<Hanmac_>
you mean with join? yea it uses an to_s method
nobitanobi has quit [Quit: Leaving.]
h8R has quit [Read error: Connection reset by peer]
megha has quit [Ping timeout: 252 seconds]
h8R has joined #ruby
arya has quit [Ping timeout: 255 seconds]
mrdtt has joined #ruby
timonv has quit [Read error: Connection reset by peer]
timonv has joined #ruby
paolooo has quit [Quit: Page closed]
arya has joined #ruby
baphled has quit [Ping timeout: 248 seconds]
banisterfiend has joined #ruby
swankier has quit [Quit: well, that was silly.]
reinaldob has joined #ruby
reinaldob has quit [Remote host closed the connection]
<Spaceghost|cloud>
Hanmac_: Nifty. I'll read it, but wait for some Canonical person to pipe up on the subject like they always do.
<waxjar>
phinfonet, do you just want to iterate over a Hash?
joofsh has joined #ruby
rmartin has joined #ruby
phinfonet has quit [Read error: Connection reset by peer]
xemu has joined #ruby
phinfonet has joined #ruby
arya has joined #ruby
mva3212 has quit [Read error: Operation timed out]
ishtu has joined #ruby
tomzx_mac has joined #ruby
recycle has joined #ruby
ryanh has joined #ruby
niklasb has quit [Quit: WeeChat 0.3.9.2]
sambio has joined #ruby
arya_ has joined #ruby
<ishtu>
hello mates! plz advise first reading for ruby newcomer. The main aim is system administration with chef
sepp2k has joined #ruby
arya has quit [Ping timeout: 255 seconds]
tommyvyo has joined #ruby
jfl0wers has joined #ruby
b1rkh0ff has quit [Ping timeout: 256 seconds]
pcarrier has quit []
tPl0ch_ has joined #ruby
moos3 has joined #ruby
recycle_ has joined #ruby
recycle has quit [Read error: Connection reset by peer]
mjolk_afk is now known as mjolk
io_syl has quit [Quit: Computer has gone to sleep.]
daniel_- has joined #ruby
ishtu has left #ruby [#ruby]
pcarrier has joined #ruby
recycle_ has quit [Remote host closed the connection]
allanm_ has quit [Read error: Connection reset by peer]
arya_ is now known as arya
ttt has quit [Remote host closed the connection]
jonahR has joined #ruby
earthquake has joined #ruby
moos3 has quit [Quit: Computer has gone to sleep.]
VanM has joined #ruby
pcarrier has quit [Ping timeout: 246 seconds]
pu22l3r has joined #ruby
pu22l3r has quit [Read error: Connection reset by peer]
pu22l3r has joined #ruby
pcarrier has joined #ruby
brandon|work has quit [Ping timeout: 248 seconds]
b1rkh0ff has joined #ruby
SKEPTIC has joined #ruby
<SKEPTIC>
how can i get payment via cardit card on my site?
tastedancin has joined #ruby
clocKwize has quit [Quit: clocKwize]
<Spooner>
SKEPTIC, #rubyonrails
wreckimnaked has joined #ruby
sclarson_ has quit [Quit: sclarson_]
sclarson_ has joined #ruby
griffindy has joined #ruby
clocKwize has joined #ruby
sclarson_ has quit [Client Quit]
ninp0 has quit [Ping timeout: 255 seconds]
jrajav has joined #ruby
baphled has joined #ruby
<phinfonet>
i need to do object serialization in pure ruby, anyone can help-me?
dhruvasagar has quit [Ping timeout: 256 seconds]
bradhe has joined #ruby
yshh has joined #ruby
MattRB has quit [Quit: This computer has gone to sleep]
<apeiros_>
phinfonet: you're a bit low on information
<phinfonet>
i've an db query
SKEPTIC has left #ruby [#ruby]
<phinfonet>
that find my fields
<phinfonet>
but i'm using mongoDB
<phinfonet>
and i receive a bson object
<phinfonet>
i just need to do it:
buibex has quit [Remote host closed the connection]
<apeiros_>
(sorry, work interrupted, will be back soon)
<phinfonet>
object.each do |value|
segv- has joined #ruby
<phinfonet>
value.field_name
<phinfonet>
end
buibex has joined #ruby
statarb3 has joined #ruby
Uranio has joined #ruby
zigomir has quit [Quit: zigomir]
bradhe has quit [Ping timeout: 256 seconds]
earthquake has quit [Quit: earthquake]
uris has joined #ruby
brandon|work has joined #ruby
aquaranto has joined #ruby
ananthakumaran1 has quit [Quit: Leaving.]
<Hanmac_>
shevy ping
karasawa has joined #ruby
Coolhand|laptop has joined #ruby
uris has quit [Client Quit]
uris has joined #ruby
ffranz has joined #ruby
<shevy>
hey
Neomex has joined #ruby
shorts has left #ruby [#ruby]
Neomex has quit [Client Quit]
aquaranto has quit [Remote host closed the connection]
kayloos has joined #ruby
v0n has joined #ruby
postmodern has quit [Quit: Leaving]
breakingthings has joined #ruby
aquaranto has joined #ruby
dougireton has joined #ruby
<Hanmac_>
shevy do you think that my archive gem need the low functions ? like Archive.write(path) {|ar| ar.write_entry(); ar.write_data() } and similar stuff or do you think that they are unwanted?
s__dana_ has joined #ruby
<shevy>
dunno. if you can add stuff to the archive via << then I suppose you wont need these three methods
<shevy>
it's also a bit confusing. what is the difference for a user between .write and << of your gem?
Zespre has quit [Read error: Connection reset by peer]
jtharris has joined #ruby
solidoodlesuppor has joined #ruby
robotmay has quit [Ping timeout: 248 seconds]
_bart has joined #ruby
s__dana has quit [Ping timeout: 255 seconds]
s__dana_ is now known as s__dana
<Spooner>
phinfonet, I am not sure. try ["field_name"] or [:field_name
<Hanmac_>
currently << "path" opens the archive, stores its data in an array of strings, add the file from the << to the array, and then write it back to the archive ... while the class method write wouldnot store anything
<phinfonet>
ok
pu22l3r has quit [Remote host closed the connection]
pu22l3r has joined #ruby
mengu has joined #ruby
<phinfonet>
thaks Spooner
_nitti has joined #ruby
<phinfonet>
i was tried it like rails
<phinfonet>
hehe
<Spooner>
phinfonet, value["field_name"] I guess was right?
<apeiros_>
phinfonet: did your question get solved in the meantime?
<phinfonet>
yes
<phinfonet>
thanks Spooner and apeiros_
VanM has quit [Quit: Leaving]
d2dchat has joined #ruby
nari has joined #ruby
bluenemo has quit [Read error: Operation timed out]
MattRB has joined #ruby
robotmay has joined #ruby
Coolhand has quit [Remote host closed the connection]
s__dana_ has joined #ruby
geekbri has joined #ruby
lusory has quit [Quit: leaving]
invisime has joined #ruby
schaerli has quit [Remote host closed the connection]
Playground has quit [Ping timeout: 276 seconds]
Kakera has quit [Ping timeout: 248 seconds]
freeayu has quit [Remote host closed the connection]
thomasfedb has quit [Ping timeout: 244 seconds]
invisime has left #ruby [#ruby]
sayan has joined #ruby
sayan has quit [Changing host]
sayan has joined #ruby
s__dana has quit [Ping timeout: 256 seconds]
s__dana_ is now known as s__dana
EPIK has quit [Ping timeout: 256 seconds]
osaut has quit [Quit: osaut]
Neomex has joined #ruby
tagrudev has quit [Remote host closed the connection]
<Mo0O>
hello
_nitti has quit [Remote host closed the connection]
<Mo0O>
I'm trying to install gitlab, so in the install proccess I need to run the following : sudo -u gitlab bundle exec rake environment resque:work QUEUE=* RAILS_ENV=production BACKGROUND=yes
jean-louis has joined #ruby
<Mo0O>
but it return : rake aborted!
<Mo0O>
Don't know how to build task 'resque:work'
<Mo0O>
somebody know how to fix it ?
jerius has joined #ruby
<Hanmac_>
shevy i think first i add the other nice functions ... its a killer feature for my version of libarchive gem that you DONT need to call the low functions :P
<JonnieCache>
Mo0O: are you running it from the right directory?
arya has quit [Ping timeout: 248 seconds]
<dr_neek>
Mo0O: Did you bundle install?
blazes816 has quit [Quit: blazes816]
drago757 has quit [Quit: drago757]
thomasfedb has joined #ruby
<rmartin>
Mo0O: Did you require 'resque/tasks' in your Rakefile?
jrist-afk is now known as jrist
zph has joined #ruby
lusory has joined #ruby
buibex has quit []
speckz has joined #ruby
nari has quit [Ping timeout: 248 seconds]
poikon has quit [Remote host closed the connection]
<Mo0O>
JonnieCache: yes I'm in the right directory ;)
<Mo0O>
dr_neek: yes I bundle install
<Mo0O>
rmartin: no I didn't equire 'resque/tasks' in my Rakefile
baroquebobcat has joined #ruby
<rmartin>
try that and let me know
sailias has joined #ruby
_nitti has joined #ruby
<Mo0O>
ok, I try right now :)
karasawa has quit [Ping timeout: 248 seconds]
maz-dev has joined #ruby
telli has quit [Remote host closed the connection]
daniel_- has quit [Ping timeout: 248 seconds]
<Mo0O>
rmartin: cannot load such file -- resque/tasks
<speckz>
Hi! I hope somone can help m,e. I'm trying to install vines as per https://gist.github.com/4606967 but it comploains about needing >= 1.9.2 but according to what I see I have 1.9.3p0.
Maziz has joined #ruby
<rmartin>
Mo0O: if you do a "gem list" do you see resque listed there?
<dawkirst>
hi guys, super silly question: I'm trying to get Ruby to print 'foo' to the console, but I'm not seeing anything in my console (I'm on Ubunutu 12.04). Any ideas?
<Mo0O>
rmartin: no, so I think I need to install it ;)
browndawg has quit [Max SendQ exceeded]
<Muz>
dawkirst: what are you executing?
arkiver has quit [Ping timeout: 248 seconds]
<rmartin>
Mo0O: yes :) then do the require in you're Rakefile and should be ready to go. Regards!
samphippen has joined #ruby
<Hanmac_>
dawkirst did you run ruby directly or something like irb?
<rmartin>
Mo0O: *your Rakefile
<Mo0O>
rmartin: thanks a lot
browndawg has joined #ruby
<dawkirst>
Muz, puts "foo!\n"
<dawkirst>
Hanmac, in terminal 'ruby foo.rb'
<rmartin>
Mo0O: no prob.
jaequery has joined #ruby
biello has joined #ruby
Playground has joined #ruby
<Hanmac_>
dawkirst in that chase it should be wisible ...
Neomex has quit [Quit: Neomex]
quest88 has joined #ruby
_bart has quit [Quit: _bart]
<dawkirst>
Hanmac_, any idea how I can debug?
<Hanmac_>
dawkirst can you make a gist or pastie of the foo.rb? i am not sure if ruby reaches the puts line
digifiv5e has joined #ruby
<dawkirst>
Hanmac_, it definitely does, it's the first line :p
<dawkirst>
brb
drfreeze_ has joined #ruby
<dawkirst>
Hanmac_, restart of terminal did the trick
sayan has quit [Read error: Connection reset by peer]
SCommette has joined #ruby
joofsh has joined #ruby
baphled has quit [Ping timeout: 256 seconds]
philcrissman has joined #ruby
arya has quit [Ping timeout: 248 seconds]
autumn has quit [Ping timeout: 272 seconds]
autumn has joined #ruby
Maneta has quit [Remote host closed the connection]
<manifold>
Is it possible to substitute my system ruby with rvm ruby? I want to deal with only one implementation of ruby. I have tried to remove system ruby but failed, because it has dependants.
tk_ has quit [Quit: ばいばい]
jrist-mtg is now known as jrist
emocakes has quit [Quit: emocakes]
phantasm66 has joined #ruby
phantasm66 has joined #ruby
phantasm66 has quit [Changing host]
v0n has quit [Quit: WeeChat 0.4.0]
chussenot has quit [Quit: chussenot]
schaerli has joined #ruby
maxmanders has quit [Quit: Computer has gone to sleep.]
<Hanmac_>
manifold there should be a few lines that should be added into .bashrc ...
Kakera has joined #ruby
maxmanders has joined #ruby
timonv has quit [Read error: Connection reset by peer]
browndawg has quit [Quit: Leaving.]
timonv_ has joined #ruby
arya has joined #ruby
stayarrr has joined #ruby
chussenot has joined #ruby
dougireton has quit [Quit: Leaving.]
_nitti has joined #ruby
zommi has left #ruby [#ruby]
<manifold>
Hanmac_ I haven't found anything
jlast_ has joined #ruby
jlast has quit [Read error: Connection reset by peer]
<Hanmac_>
(but i often use it only with STDERR because when my stuff crashs i get more output than i can scroll)
sayan has joined #ruby
<hoelzro>
can't you just do something like system args, :redirection => { 1 => :close }?
etcetera has joined #ruby
<hoelzro>
I'm not sure of the exact syntax, but that's what the documentation seems to indicate
<daxroc>
Hanmac_: nice, appreciate it
<rapha>
hoelzro: looks like the rest of my regexp is the problem. The string is blahblahblah\u001Fblahblahblah\u001Fblahblahblah and i want to get the first part before the control char and the part after that. so i said .match(/(.*)\u001F(.*)\u001F/)[0].to_s - am I using the groups incorrectly?
baphled has quit [Ping timeout: 264 seconds]
baphled has joined #ruby
<aedornm>
rapha: use .*?
<aedornm>
Otherwise that regex will match to the last occuring \u001F
etcetera has quit [Client Quit]
kayloos has quit [Quit: kayloos]
rippa has joined #ruby
kayloos has joined #ruby
carloslopes has quit [Remote host closed the connection]
<Spooner>
rapha, Your regexp is fine, but you want to use 1 and 2, not 0 and 1 to get the strings out.
arturaz has joined #ruby
<aedornm>
oh I guess there's two in there... man I need a new font
<Hanmac_>
hm you also could do string.split("\u001F")
<rapha>
Spooner: I still get the whole string...
chrismhough has joined #ruby
<rapha>
Hanmac_: good idea, the regexps are actually overkill for this :)
<Spooner>
rapha, You don't. You get the whole string for match[0], but not for match[1] or match[2]
puppeh has quit [Remote host closed the connection]
<Spooner>
rapha, Remember that if you aren't using Match objects, you use $1 and $2, not $0.
thillux has joined #ruby
waxjar has joined #ruby
<rapha>
Spooner: didn't know that, thanks! :)
<Hanmac_>
rapha you could also do match().captures
wallerdev has joined #ruby
<Spooner>
rapha, So your regexp is fine, but as others said, a simple split would do it as well.
<lectrick>
If I use Regexp#match(string), how do I get ALL the grouped matches and not just the first one? There are multiple matches in this one-line string and it's only returning the first one.
alex__c2022 has joined #ruby
_nitti has joined #ruby
<Spooner>
lectrick, Use scan, as Hanmac_ just described :D
baphled has quit [Read error: Connection reset by peer]
<lectrick>
Spooner: oh wow. same wavelength. nice. ty
tPl0ch_ has quit [Quit: Verlassend]
Takehiro_ has quit [Remote host closed the connection]
autumn has quit [Quit: Bye~ xo]
mikepack has joined #ruby
<chiel>
hm.. i get the feeling Pow is messing with my mind
<chiel>
for every request it seems to spawn two workers
Dataholic has quit [Quit: Lost terminal]
autumn has joined #ruby
alex__c2022 has quit [Read error: Connection reset by peer]
<volk_>
does anybody here use the draper gem? wondering what the difference would be between python decorator and draper besides the fact that the python decorator is built into the language
<Hanmac_>
Spooner imo there should be an require_into or load_into ... like a file is "class A;end" and you do module B; require_into file, binding;end you get B::A
baphled has joined #ruby
alex__c2022 has joined #ruby
thinkclay has joined #ruby
lolmaus has quit []
GeekSir has joined #ruby
dr_bob has joined #ruby
<Spooner>
Hanmac, That would be nice, certainly.
Lynx_Eyes has joined #ruby
thinkclay has quit [Client Quit]
sh00p has quit [Remote host closed the connection]
DaZ has quit [Ping timeout: 260 seconds]
<chiel>
hm yeah, this definitely looks like a Pow thing, with thin it only shows the log messages once
<chiel>
weird.
<chiel>
i guess it's to do with the always_restart mechanic.
GeekSir has left #ruby [#ruby]
jlast has joined #ruby
<chiel>
no idea why it needs to spawn two workers for that though
<Hanmac_>
Spooner & shevy: it can be mimic'd with module B; binding.eval(File.read(path));end, but an require command would be more nice ..
<shevy>
ack
<shevy>
EVAL
etcetera has joined #ruby
<Hanmac_>
shevy its more evil ... its a binding.eval :D
<Hanmac_>
(PS: an load or require is similar to an eval(File.read(path)) so whatever)
otters has joined #ruby
autumn has joined #ruby
jfl0wers has joined #ruby
amaya_the has joined #ruby
<amaya_the>
:(
syamajala has joined #ruby
Virunga has joined #ruby
pcarrier has quit [Ping timeout: 246 seconds]
manifold has quit [Quit: Leaving]
Takehiro has joined #ruby
bradhe has quit [Ping timeout: 256 seconds]
<Hanmac_>
hm... imo an module or a class should allow an Mod.binding where you can access the inner binding of the Mod ... (Mod.send(:binding) is still the toplevel binding)
robbyoconnor has quit [Ping timeout: 256 seconds]
<lectrick>
Spooner/Hanmac_ : Is there a way to do (?>some_pattern) in a non-capturing fashion?
enebo has joined #ruby
alv-r- has joined #ruby
clj_newb has joined #ruby
<shevy>
one day we will overcome the class vs. module distinction
fyolnish has quit [Remote host closed the connection]
zer0bytes has left #ruby [#ruby]
_nitti has joined #ruby
filipe has quit [Remote host closed the connection]
fyolnish has joined #ruby
Liothen has joined #ruby
Liothen has quit [Changing host]
Liothen has joined #ruby
mantas322 has joined #ruby
dougireton has joined #ruby
<mantas322>
hello
<mantas322>
whats the preferred database for ruby or ruby on rails?
<mantas322>
mySQL?
<JonnieCache>
mysql is fine
<GeekOnCoffee>
or PostgreSQL
<Hanmac_>
real programmers use post-Its :P
<JonnieCache>
yeah postgresql is amazing
<mantas322>
do the majority of you guys use somesort of toolkit to do stuff with it?
rippa has quit [Ping timeout: 240 seconds]
<JonnieCache>
rails is that toolkit
<aedornm>
I was thinking of converting our databases over to PostgreSQL from MySQL for awhile now. That's about as far as I've gotten with it, too - thinking.
<aedornm>
So ... got this thing to bring up a VM, build a package with the local environment USE variables, and spit out the binary tar ball back to the client that emerge can install via a Ruby wrapper over portage. Now I'm stuck ... I don't know how I can use multiple environments.
<pyro111>
a_hash.map &proc{...}
Zolo has quit [Remote host closed the connection]
biello has joined #ruby
jtharris has quit [Quit: WeeChat 0.3.9.2]
fyolnish has joined #ruby
<beckyconning>
pyro111: oh cool. so how would i go about that? what would be the two liner? defining the proc and then applying it?
fragmachine has quit [Remote host closed the connection]
amaya_the has quit [Quit: ChatZilla 0.9.89 [Firefox 18.0.1/20130116073211]]
robert___ has quit [Ping timeout: 252 seconds]
daniel_- has quit [Ping timeout: 248 seconds]
<pyro111>
beckyconning: yes? you can even test that code
bradhe has quit [Remote host closed the connection]
Kingy has joined #ruby
tcstar has joined #ruby
mantas322 has quit [Quit: Page closed]
Spooner has joined #ruby
slainer68 has quit [Remote host closed the connection]
baphled has quit [Ping timeout: 252 seconds]
breakingthings has quit []
<beckyconning>
pyro111: sorry its just that its failing so i was confused thanks anyway
sayan has joined #ruby
dyrot has joined #ruby
ananthakumaran has quit [Quit: Leaving.]
adeponte has joined #ruby
<tcstar>
I'm running ubuntu -- and i'm trying to get ruby to install or upgrade... but can't seem to figure out how.. apt-get doesn't seem to have any upgrades -- rvm won't install properly.. i'm at a loss - so if anyone can point me in some decent info so i can begin my RoR learning i'd appreciate it.
DrShoggoth has joined #ruby
elaptics is now known as elaptics`away
<Spooner>
tcstar, apt-get should have 1.9.3, but it will be called "1.9" or "1.9.1". You could look at rbenv instead if rvm doesn't like you.
<Spooner>
tcstar, This Ubuntu has 1.9.3 as a specific apt-get package actually.
karasawa has joined #ruby
kenneth has quit [Quit: kenneth]
<tcstar>
yeah i just installed ruby1.9.3 -- then run ruby -v
<tcstar>
and this is my output: ruby 1.8.7 (2011-06-30 patchlevel 352) [x86_64-linux]
<pyro111>
>> rename=proc{123}; p Hash[*10.times.map(&rename)]
adeponte has quit [Remote host closed the connection]
<Spooner>
tcstar, You can only manage one system Ruby, which is what rvm/etc are all about helping with. You probably have ruby1.9.3 on ruby1.9 or similar command. Either uninstall ruby1.8-full or use rvm/rbenv/other and symlink ruby1.9 to ruby to have multiple versions..
AndChat| has joined #ruby
arya has quit []
arya has joined #ruby
inokenty has quit [Quit: Leaving.]
<Spooner>
tcstar Oops: Either uninstall ruby1.8-full AND symlink ruby1.9 to ruby OR use rvm/rbenv/other to have multiple versions..
<tcstar>
rvm doesn't install correctly either.. every time i run the rvm command -- it tells me it can't be found...
jeffreybaird has quit [Quit: jeffreybaird]
<tcstar>
i never installed ruby though, so i don't know why ruby1.8 would be on there... let me try to remove
<Spooner>
Have you restarted the terminal?
adeponte has joined #ruby
eldariof has joined #ruby
<beckyconning>
thanks pyro111 i must be doing something else wrong
<beckyconning>
getting "wrong number of arguments(1 for 0)"
bradhe has joined #ruby
<tcstar>
Yeah i've restarted my terminal (Guake) and used the standard term too
kpshek has quit []
fragmachine has joined #ruby
<AndChat|>
Tcstar getting angry?
<Spooner>
It sometimes fails to add the right stuff in your .bash_profile
<beckyconning>
pyro111: thanks : ) got it working
philips_ has quit [Excess Flood]
ckrailo has joined #ruby
<tcstar>
Yes and no AndChat -- but, i'm sure i'll get it figured out
kpshek has joined #ruby
<Spooner>
tcstar, I always had problems with rvm the same as you. I use rbenv now ;)
<tcstar>
whats crazy is even ruby itself -- is uninstalled completely and purged -- but running ruby -v still shows 1.8.7...
<Spooner>
Odd.
alex__c2022 has quit [Quit: alex__c2022]
razibog has joined #ruby
dougireton has quit [Quit: Leaving.]
maxmanders has quit [Quit: Computer has gone to sleep.]
<Spooner>
tcstar, Do you have a ruby19 or ruby1.9 command?
<Spooner>
I forget how it gets installed as the system. Still, generally better to use rvm if you can get it sussed.
_nitti has quit [Remote host closed the connection]
pavilionXP has joined #ruby
Solnse has joined #ruby
karasawa has quit [Ping timeout: 255 seconds]
<tcstar>
no, but apparently i have a ruby 1.8 command
dougireton has joined #ruby
<tcstar>
bleh! maybe i just need to reboot the system....
c0rn_ has joined #ruby
tcstar has quit [Remote host closed the connection]
karasawa has joined #ruby
Vainoharhainen has quit [Quit: Leaving...]
<Spooner>
Nah, that link tells you what you need to add to your dot files.
<Spooner>
Do that and restart your terminal.
<Spooner>
Then it should see rvm and you can install to your heart's content!
_nitti has joined #ruby
philips_ has joined #ruby
<yoshie902a>
hi everyone!, I just finished a parser and it seems to be taking an excessive amount of time to run one file. what is the best way to approach figuring out the bottle neck?
mrkris has joined #ruby
jpfuentes2 has quit [Quit: Computer has gone to sleep.]
noxoc has quit [Quit: noxoc]
<Spooner>
yoshie902a, Look at profile (standard lib) or ruby-prof (gem).
dmiller1 has quit [Ping timeout: 248 seconds]
<yoshie902a>
I'm reading up on ruby-prof now, found the same recommendation on stack overflow. Any preference between the two?
mahmoudimus has joined #ruby
<apeiros_>
ruby-prof is like 10-50x faster
jimeh has quit [Quit: Computer has gone to sleep.]
io_syl has joined #ruby
<Spooner>
ruby-prof is better, but it is a gem.
<apeiros_>
so if you can, by all means, use ruby-prof
<Xeago>
do I need an apostrophe at documents? "Elasticsearch shards documents based on a hash of the documents unique identifier."
jtharris has joined #ruby
<workmad3>
Xeago: no on the first, yes on the second
<Xeago>
knew it
<workmad3>
Xeago: because the second reference is actually a possessive, you're refering to the document's unique identifier
Virunga is now known as LennyLinux
clooth has joined #ruby
_bart has joined #ruby
<workmad3>
Xeago: it might be more correct to say 'a hash of a document's unique identifier' too
JumpMast3r has quit [Quit: JumpMast3r]
bel3atar_ has left #ruby [#ruby]
tjbiddle has joined #ruby
tastedancin has quit [Quit: tastedancin]
tjbiddle has quit [Remote host closed the connection]
<Xeago>
thanks, that reads better, yes
brianpWins has joined #ruby
<Spooner>
workmad3, Xeago I'd say it should be "the hash of a" since the hash is unique itself.
_bart has quit [Remote host closed the connection]
<workmad3>
Spooner: I was wondering about that
<Xeago>
Spooner: actually, the hash doesn't have to be unique
<yoshie902a>
Xeago: might want to try #elasticsearch, Shay and the other ES guys hang around there to answer questions.
alex__c2022 has joined #ruby
<Xeago>
it just needs to reduce to a fairly low number of collisiopns
tjbiddle has joined #ruby
<workmad3>
Spooner: but wondered if it would imply that a specific hashing algorithm was in use
<Xeago>
yoshie902a: already in there, but that is no place to ask english stuff :)
volk_ has joined #ruby
carloslopes has joined #ruby
<workmad3>
Spooner: so didn't suggest it :)
<Spooner>
Xeago, The id produces a single hash. Not that it was unique for all ids. *weaselled out of it*
<yoshie902a>
In general is parsing usually slow?
<Xeago>
Spooner: it gets bucketed/sharded
<Spooner>
yoshie902a, How long is a piece of string?
<workmad3>
Spooner: I guess it would depend on if 'the hash' had already been introduced to mean a specific hash method :)
ddd has left #ruby [#ruby]
mockra has joined #ruby
<Spooner>
workmad3, Oh, OK. Fair enough.
<Xeago>
workmad3: not the case, first use of hash in the document
pyro111 has quit [Quit: Leaving]
<harushimo>
here another a question, when you do a return :add, this is calling a method or function within the class correct?
<workmad3>
Xeago: right, then I'd say 'a hash' was more correct than 'the hash'
<Xeago>
thanks!
<Spooner>
harushimo, No, you are just returning a Symbol, :add.
<Xeago>
gotta walk home now, will be back in a bit
Xeago has quit [Remote host closed the connection]
<harushimo>
I'm looking at some code. They do is a lot
<yoshie902a>
My string length is 187206, it's an html document
elico has joined #ruby
<Spooner>
harushimo, Symbols are used for a lot of things...
<harushimo>
i figured. I'm looking at the ruby doc right now too
<harushimo>
I may have another question
Solnse has quit [Quit: Leaving.]
<Spooner>
yoshie902a, If it is html, then you are using Nokogiri, which is pretty fast.
sclarson_ has quit [Quit: sclarson_]
Solnse has joined #ruby
bondar has joined #ruby
<Spooner>
I, however, have to go.
Spooner has quit [Remote host closed the connection]
Elhu has quit [Quit: Computer has gone to sleep.]
<yoshie902a>
yes, I use nokogiri to recursively go through each node and I extract the text from each node. run it through openNLP to mark sentences markers
kennyvb has quit [Ping timeout: 260 seconds]
osaut has joined #ruby
beckyconning has quit [Quit: beckyconning]
mneorr has joined #ruby
dougireton has quit [Remote host closed the connection]
ddd has joined #ruby
kennyvb has joined #ruby
dougireton has joined #ruby
kenneth has joined #ruby
<yoshie902a>
is there a way to see if I have an infinite loop or something? I always just end up canceling my code after a few minutes or running. I feel my processor heating up and I just stop it.
tcstar has joined #ruby
chrismhough has quit [Quit: chrismhough]
<tcstar>
got both ruby 1.9.3 and rvm working.. thanks guys ;)
dougireton1 has joined #ruby
dougireton has quit [Remote host closed the connection]
AccessGranted has joined #ruby
<AccessGranted>
Death to Ruby, death to Ruby. PHP is the hackers' language!
AndChat| has quit [Ping timeout: 248 seconds]
bel3atar has left #ruby ["WeeChat 0.4.0"]
<AccessGranted>
And by the way death to America
jrist has quit [Read error: Connection reset by peer]
AccessGranted has left #ruby ["Leaving"]
megha has quit [Quit: WeeChat 0.3.9.2]
jonathanwallace has quit [Quit: WeeChat 0.3.9.2]
beckyconning has joined #ruby
megha has joined #ruby
<apeiros_>
*sob*, idiots never go extinct…
megha has quit [Client Quit]
<pothibo>
rofl
beneggett has quit [Remote host closed the connection]
<yoshie902a>
troll
benlieb has joined #ruby
<pothibo>
I don't even know what to response to that, it's too pathetic for my brain to process
<apeiros_>
the generic response is kickban. he politely left. probably knowing that it'd have happened anyway.
brandon|work has quit [Remote host closed the connection]
jonathanwallace has joined #ruby
jrist has joined #ruby
brandon|work has joined #ruby
LennyLinux has quit [Remote host closed the connection]
tspike has joined #ruby
moos3 has quit [Quit: Computer has gone to sleep.]
shevy has quit [Ping timeout: 246 seconds]
fragmachine has quit [Remote host closed the connection]
banisterfiend has joined #ruby
Xeago has joined #ruby
banisterfiend has quit [Read error: Connection reset by peer]
<tcstar>
being that i run apache, whats the easiest/cheapest way to deploy so apache can process the ror site? I was looking @ passenger but @ 99 a year probably not going to happen..
vlad_starkov has joined #ruby
dfyuij has quit [Ping timeout: 256 seconds]
havenn_ has joined #ruby
havenn has quit [Read error: Connection reset by peer]
joofsh has quit [Remote host closed the connection]
slainer68 has joined #ruby
reinaldob has joined #ruby
Hanmac_ has joined #ruby
alex__c2022 has quit [Ping timeout: 240 seconds]
alex__c2022_ is now known as alex__c2022
Kingy has quit [Quit: Leaving]
<breakingthings>
tcstar: Doesn't passenger have a free and enterprise version
<tcstar>
Not that i saw -- i'll look again
haxrbyt__ has quit [Remote host closed the connection]
tatsuya_o has quit [Remote host closed the connection]
haxrbyte has joined #ruby
benlieb has quit [Quit: benlieb]
<tcstar>
ooh they do have an O.S version
elkclone has joined #ruby
<danneu>
I wrote a scraper gem that returns listings allowing the gem user to do things like listing.title and listing.price. if the price node is missing, then it's set to nil. generally speaking is it sensible to coerce the nil to 0 in this situation?
tommyvyo has joined #ruby
elkclone has quit [Changing host]
elkclone has joined #ruby
benlieb has joined #ruby
Dann1 has joined #ruby
epylinkn has joined #ruby
speakingcode-wor has joined #ruby
ewag has joined #ruby
sambio has quit [Ping timeout: 256 seconds]
jpfuentes2 has joined #ruby
joofsh has joined #ruby
aeontech has joined #ruby
chridal has joined #ruby
havenn_ has quit [Ping timeout: 276 seconds]
<danneu>
that way, gem users can do stuff like listings.sort_by{|n| n.price} without nil errors. but that seems to mangle the api now since the listings aren't actually $0.
<danneu>
sort of a conceptual what's-a-better-api question
chussenot has joined #ruby
maximilianoo has quit [Quit: maximilianoo]
<Hanmac_>
danneu how about .sort_by(&:price)
<Hanmac_>
it does not solv your nil problem but makes this a bit better
Solnse has quit [Read error: Connection reset by peer]
Solnse has joined #ruby
<friskd>
tcstar: did you get apache working so that it actually parses the ruby files?
<friskd>
is anyone else using apache + passenger on osx?
Xeago has joined #ruby
<tcstar>
No, i just installed the passenger -- but haven't got apache to recognize the ruby yet
<friskd>
I have it installed, but apache is setup to point to the correct dir.
<friskd>
Same here, its not parsing my .rb files.
<friskd>
Not sure why.
<friskd>
i don't even have ROR in there
brunosaboia__ has quit [Quit: Fui embora]
BSaboia has joined #ruby
<friskd>
just a default.rb file
<friskd>
that loops through an array
rapha has left #ruby ["bye and thanks again for the help"]
Eaven has quit [Read error: Connection reset by peer]
elux has joined #ruby
<friskd>
tcstar: you on linux or mac?
Neomex has quit [Quit: Neomex]
<tcstar>
linux.. and aha
Uranio has quit [Quit: while you reading this, a kitty dies]
<friskd>
What did you find?
<tcstar>
it's the public folder... going to localhost/first_app/public displays ;)
mneorr has quit [Remote host closed the connection]
Eaven has joined #ruby
<friskd>
what does the folder have to do w/ it?
mneorr has joined #ruby
<friskd>
in my case i setup a vhost to point to local.ruby.com
<tcstar>
that should be the 'document root' for the vhost
<friskd>
and have a default.rb file in it
Nuck has quit [Ping timeout: 245 seconds]
<tcstar>
hmm not sure..
<friskd>
so you saw your ruby get parsed?
_nitti has quit [Remote host closed the connection]
<tcstar>
it's displaying in my browser... but, it's also just the basic structure atm... from doing rails new first_app -- i haven't gotten much deeper than that yet
recycle has quit [Ping timeout: 255 seconds]
mneorr has quit [Remote host closed the connection]
mneorr has joined #ruby
mockra has quit [Ping timeout: 255 seconds]
mockra_ has joined #ruby
recycle has joined #ruby
hoihr has quit [Quit: hoihr]
maletor has quit [Remote host closed the connection]
Michael_ has joined #ruby
mascool has joined #ruby
ryanh has quit [Quit: Computer has gone to sleep.]
mitchellh has joined #ruby
mitchellh has left #ruby [#ruby]
adambeynon has joined #ruby
maasha has joined #ruby
<yoshie902a>
tcstar: sorry, I missed some of the conversion, but you could deeply to heroku for free
<yoshie902a>
s/deeply/deploy
<Xeago>
apeiros_: Ping!
mark_locklear has quit [Remote host closed the connection]
miskander has joined #ruby
<maasha>
Hi, I am wondering if you can tweak Ruby to function in a command line sort of way: http://pastie.org/5838961
<friskd>
tcstar: ok. Yea i wonder if its since i'm just using a single .rb file and not rails
<friskd>
i have read a few posts and seems like you have to do some sort of rack interface to get it to parse...
<friskd>
Not like PHP where it would just load the file and parse it....
<maasha>
the trick is to pass a single line from method to method without keeping everything in memory
bananastalktome has joined #ruby
<maasha>
sort of like bash I guess
<banisterfiend>
maasha: not sure what u're asking tbh
<banisterfiend>
can u show the code u want to have?
bananastalktome has left #ruby [#ruby]
<maasha>
banisterfiend: eh, that paste was sort of the idea
<banisterfiend>
maasha: but i mean, why cant you just do that? what's the issue?
a_a_g has joined #ruby
angusiguess has quit [Ping timeout: 245 seconds]
<canton7>
maasha, like Rush?
alex__c2022 has quit [Remote host closed the connection]
alex__c2022 has joined #ruby
nomenkun has joined #ruby
ryanh has joined #ruby
<maasha>
banisterfiend: I fail to see how to pass a single line though these steps at a time
<banisterfiend>
maasha: what do u mean 'a single line' ? sry i dont understand
carloslopes has quit [Remote host closed the connection]
<maasha>
banisterfiend: So I dont want to load all of test.txt into memory. Only line by line.
<maasha>
banisterfiend: no particular reason. I want to see if this could work and how much that can be abstracted away to produce a truly minimal syntax.
etcetera has quit []
<shock_one_>
oddover, the same as bash globbing, I guess.
a_a_g has quit [Quit: This computer has gone to sleep]
Nuck has joined #ruby
Nuck has quit [Changing host]
Nuck has joined #ruby
<oddover>
The reason I ask is I'm trying to use it to look for a .gz file somewhere in a directory, and it has to follow symlinks to find it
<maasha>
having played a bit with rails and gems for rails I see that you can really bastardize code to look like plain text! Capybera and cucumber e.g.
schaerli has quit [Remote host closed the connection]
chriskk has joined #ruby
<shock_one_>
oddover, you can use Dir#entries and filter them with File#symlink?
mneorr has quit [Remote host closed the connection]
<oddover>
oh. it's not necessarily below a symlink
<oddover>
it just might be
mneorr has joined #ruby
<oddover>
I need to recursively search starting from a directory, in everything below it
etcetera has joined #ruby
<shock_one_>
oddover, I believe glob only resolves file names, so if symlink doesn't have .gz extension you should use something different. So you need a list of gz files in some directory (recursively) plus symlinks that follow to gz files, right?
<banisterfiend>
maasha: well, we read in the entire file at the start
<banisterfiend>
and break it up into lines
<banisterfiend>
then we manipulate the lines
<banisterfiend>
we have an Loc class which manages line numbers and lines of code
<maasha>
banisterfiend: so if the file is potentially bigger than mem?
<tcstar>
friskd -- it's not working for me truely either... when i run rails s it works fine, but not through apache.
<banisterfiend>
maasha: that's not a use case we care about, we're only interested in the typical use of cat to show the output for source files
<friskd>
Right.
<friskd>
tcstar: i just figured out why
<friskd>
So w/ ModRuby installed
_nitti has joined #ruby
<banisterfiend>
maasha: but it's not hard to support that, there's just a 99.99999% chance you/your users dont care
<banisterfiend>
(for our case)
<friskd>
You still need to have your stuff configured so that ruby can be interpretted by rack
ddd has left #ruby [#ruby]
<maasha>
banisterfiend: right, but for my case I am concerned about memory - I want to keep as little in mem as possible - which mean read in one line - pass it through all methods - and then the next line. If only you could do that with an iterator and yield some smart way.
<friskd>
So basically ruby runs as a cgi script that is interpretted via the rack api and then served up via passenger.
<maasha>
banisterfiend: like bash
<maasha>
and pipes
<friskd>
If your coming from the PHP world its quite different.
maxmanders has quit [Quit: Computer has gone to sleep.]
freakazoid0223 has quit [Quit: Leaving]
<banisterfiend>
maasha: i would set up the methods as just setting some kind of flag
<tcstar>
so i have to have rack, passenger and mod_ruby installed.... seeing as how i've got passenger integrated with apache -- figured that'd be enough.... guess that's what i get for doing my own thinking
<banisterfiend>
maasha: not actually applying them until the very end
<tcstar>
Yeah, i'm def coming from the PHP world -- and really only for 1 project that we just got....
atmosx has quit [Quit: And so the story goes…]
oddover has quit [Read error: Connection reset by peer]
bradhe has quit [Remote host closed the connection]
rjmt___ has quit [Ping timeout: 256 seconds]
<tcstar>
but, it'll be nice to be able to put ruby and RoR into our company knowledge base
bradhe has joined #ruby
<banisterfiend>
maasha: and at the very end i iterate through the file using: File.open(file, "r") { |f| loop-until-eof { apply_methods(f.readline) } }
<maasha>
banisterfiend: and how may that look? hmmm
reinaldob has quit [Remote host closed the connection]
_nitti has quit [Ping timeout: 276 seconds]
mneorr has quit [Remote host closed the connection]
mneorr has joined #ruby
<banisterfiend>
maasha: Pry::Code works that way to
<banisterfiend>
maasha: you can do stuff like: Pry::Code.from_file(blah).take_lines(5..20).with_line_numbers.around(30, 40).to_s
<banisterfiend>
the stuff is only applied at the to_s
<banisterfiend>
too*
<maasha>
banisterfiend: yeah, I should study pry closely.
horofox has quit [Quit: horofox]
pcarrier has joined #ruby
jtgiri_ has joined #ruby
<maasha>
banisterfiend: right, thanks, I will do some reading for now.
oddover has joined #ruby
<tcstar>
friskd -- just got mod_ruby installed now too... any further getting the ruby to run as cgi or whatever to get that to work -- appreciated... should be the same for all my machines which will be nice...
bradhe has quit [Ping timeout: 256 seconds]
osaut has joined #ruby
<oddover>
shock_one_: I don't know if you messaged back. I got disconnected.
robert__ has joined #ruby
<friskd>
tcstar: so you likely won't get ruby to just run as a single file unless you use rails, sinatra, or something that implements the rake api and you run.
<RubyPanther>
mod_ruby should give you a traditional cgi capability
maxmanders has joined #ruby
<RubyPanther>
whereas passenger is aka mod_rack and is not a general purpose apache tool
<RubyPanther>
mod_ruby has a lot of limitations and is not normally used at all anymore
<wmoxam>
mod_ruby was barely used at all ever
<wmoxam>
fastCGI was usually a better option
danneu has quit [Quit: WeeChat 0.3.8]
<wmoxam>
I don't think that mod_ruby ever supported > 1 instance of an app running at a time properly
slainer68 has quit [Remote host closed the connection]
aaronmacy has joined #ruby
jtgiri_ has quit [Quit: jtgiri_]
maasha has quit [Ping timeout: 245 seconds]
<RubyPanther>
when I started with rails mod_ruby was the main way of running it
robert_ has quit [Ping timeout: 276 seconds]
<RubyPanther>
it was so bad people were actually happy to adopt fcgi. Which had already flopped with everybody else. ;)
jeffreybaird has joined #ruby
<RubyPanther>
fcgi was so bad people were actually happy to adopt mongrel_cluster
<tcstar>
problem i'm having is when i go to: localhost/first_app -- i just get directory listing from the mvc view of rails.... if i go to localhost/first_app/app/controllers/controller.rb in the browser -- it loads but it's forbidden
<RubyPanther>
you're just not going to get happy CGI out of Ruby, you have to learn rack
MattRB has quit [Quit: This computer has gone to sleep]
<tcstar>
I'm fine either way -- just need it to work...
<oddover>
that's sorta the approach I tried, but I couldn't get it to work
mneorr has joined #ruby
_dak_ has joined #ruby
binaryplease has quit [Quit: WeeChat 0.4.0]
<shock_one_>
Works for me. Can you send me zip archive with files you're testing the script on?
emptyflask has quit [Remote host closed the connection]
<oddover>
oh, wait. I missed the bracketed part
<oddover>
that made it work
<oddover>
what does that mean?
<_dak_>
I'm trying to install command-t for vim, and when I use rvm to switch to system ruby I get "theme_precmd:12: command not found: rbenv_prompt_info"
<graft>
does anyone know how to tell where a gem is being required from?
<shock_one_>
If all works, forget it :-)
<oddover>
shock_one_: heh
<banisterfiend>
graft: yeah
arya has joined #ruby
theRoUS has quit [Ping timeout: 255 seconds]
<graft>
banisterfiend: what's the secret?
<Eiam>
I'm trying to get started with rubyprof, so I follow the guides, require 'ruby-prof' and do a start/stop around a block of code I wanted to profile. (Its code in a gem that my rails app calls) so I fire up rails s & hit the route.. RuntimeError (RubyProf is already running): hmm
<shock_one_>
graft, you can write wrapper around require which will tell you what you want.
krainboltgreene has joined #ruby
<oddover>
shock_one_: The way I started going was using the Find module
justinlilly is now known as justinabrahms
<oddover>
shock_one_: But I like this way better. Thanks a lot!
Criztian has quit [Remote host closed the connection]
<graft>
shock_one_: jeez, what a masochist
daniel_- has joined #ruby
daniel_- has quit [Changing host]
daniel_- has joined #ruby
<graft>
shock_one_: but good idea
<banisterfiend>
graft: did u not see the code i sent u?
musl has quit [Quit: WeeChat 0.3.9.2]
<shock_one_>
graft, Why masochist? I always thought that it's convenient technique.
nomenkun has joined #ruby
<banisterfiend>
shock_one_: it's not safe, at least with an alias name like that
<graft>
banisterfiend: i realized what i needed wasn't a gem but just a require line
razibog has quit [Ping timeout: 256 seconds]
razibog has joined #ruby
<graft>
banisterfiend: just doing some hunting to debug my irb, this won't go in to any production or even development code
dougireton1 has quit [Quit: Leaving.]
<graft>
now i just can't figure out why bond won't work
mneorr has quit [Remote host closed the connection]
mneorr has joined #ruby
slainer68 has quit [Ping timeout: 256 seconds]
musl has joined #ruby
shock_one_ has quit [Quit: Leaving]
dougireton has joined #ruby
<Eiam>
okay, apparently I cannot start & stop profiling at the top/bottom of a method thats calledin a loop because ruby-prof is already running
shock_one_ has joined #ruby
<Eiam>
not sure that makes any sense at all
w400z has joined #ruby
Banistergalaxy has joined #ruby
jduan1981 has quit [Quit: jduan1981]
user666 has joined #ruby
<user666>
Evening
banisterfiend has quit [Ping timeout: 252 seconds]
<user666>
I'm not sure if this is the right place to ask, but I'm going to do it anyway
banisterfiend has joined #ruby
<banisterfiend>
dc
<banisterfiend>
stupid connection
<banisterfiend>
graft: how do u know what require line corresponds to what gem?
arya_ has joined #ruby
evilsushi has joined #ruby
evilsushi has quit [Changing host]
evilsushi has joined #ruby
evilsushi is now known as awkwords
<user666>
Anyway, I have this line of code: row = db.execute "INSERT INTO \"bblog\" (\"id\",\"channel\",\"server\",\"count\") VALUES (NULL,'#{$output[2]}','#{$currentServer}','0')"
<user666>
Which results in the following error: no such column: rizon
<user666>
What am I doing wrong?
joeycarmello has quit [Remote host closed the connection]
<canton7>
are you certain that's the query which is causing the error? :P
arya has quit [Ping timeout: 248 seconds]
<canton7>
also, "a\"b" => %Q[a"b]
<awkwords>
ive got a list of 40 names, i want to print 10 names into a file.. so like 1-10 name1.txt 11-21 name2.txt
<Eiam>
awkwords: enumerable + take
<user666>
The query is fine, I was able to insert it using that query
<user666>
But not with ruby it seems
epylinkn has left #ruby [#ruby]
razibog has quit [Ping timeout: 244 seconds]
cespare has quit [Quit: WeeChat 0.3.7]
<shock_one_>
user666, Yes, looks like you picked up wrong query.
carloslopes has joined #ruby
recycle has quit [Read error: No route to host]
<user666>
But I just inserted something using that query
recycle has joined #ruby
<Eiam>
awkwords: my_names.to_enum.take(10) {|items| Marshal dump it out}
caleb_io has quit [Read error: Connection reset by peer]
<shock_one_>
user666, maybe this query works fine and that's some other one, that gives you the error.
joeycarmello has joined #ruby
CalebMingle has quit [Read error: Connection reset by peer]
<user666>
It's the only query I'm firing unfortunately
<Eiam>
awkwords: oh that won't loop though. well, you could wrap it in a loop. or do a slice on the data… This sounds like homework ;)
cespare has joined #ruby
ddd has quit [Ping timeout: 245 seconds]
<shock_one_>
user666, Have you tried to find the word «rizon» in your project?
<user666>
That's #{$currentServer}
<shevy>
yikes
<tcstar>
I think i got it working -- but on the base app -- when i click on the link to see the properties -- it just errors out with this error: no such file to load -- bundler
hybris has joined #ruby
<shevy>
btw cant you omit the #{} when you use globals, user666 ?
maletor has joined #ruby
<Eiam>
awkwords: better answer, ["joe","jack","john","jim"].each_slice(2) { |names| // array of two names }
<yoshie902a>
shevy: easy for you maybe, I'm struggling
<Hanmac_>
others call it purgatory :D
miskander has quit [Client Quit]
sintrix has joined #ruby
robert__ has quit [Ping timeout: 276 seconds]
<RubyPanther>
Programming is simple. That's why we Learn Code the Hard Way. It's just programming-motherfucker (.com)
rezzack has joined #ruby
Neomex has joined #ruby
Neomex has quit [Client Quit]
Eaven has quit [Remote host closed the connection]
ChampS666 has quit [Ping timeout: 276 seconds]
miskander has joined #ruby
<yoshie902a>
RubyPanther: not when things go wrong, like debugging. for example, i've spent all day on this one issue, getting nokogiri to parse html/xml, but it doesn't https://gist.github.com/4612046, yes, it should be simple, but sometimes you just want to bang your head
<RubyPanther>
yoshie902a: honestly I saw your gist but it was just a tiny bit of scraper code, a giant block of data, and no clear question.
<yoshie902a>
Nokogiri is not parsing this correctly. It returns blank. What can I do to parse the body from here?
ryanf has joined #ruby
<RubyPanther>
I've actually never really used nokogiri I was already super-happy with Hpricot when nokogiri came out so I'm still using it. But scrapers are hard, finicky, and not fun or technically interesting.
jduan1981 has joined #ruby
<RubyPanther>
even as a nokogiri hater I am very very skeptical that it is not parsing correctly. People use it in bots that scrape millions of pages a day.
Eaven has joined #ruby
<yoshie902a>
Then it's my code, I just have no idea why it won't work
<RubyPanther>
well, don't scrape.
<RubyPanther>
that is the "best practices" answer.
jblack has joined #ruby
<RubyPanther>
if an API is not available, right that first. If it isn't your data... ask for an appropriate format. And then wait until it it provided.
<RubyPanther>
s/right/write/
_dak_ has quit [Quit: Lost terminal]
[Neurotic] has joined #ruby
benlieb has joined #ruby
Eaven has quit [Remote host closed the connection]
ChampS666 has joined #ruby
<yoshie902a>
RubyPanther: sometimes, appropriate formatted data is not available. it's from an SEC document. thousands of companies files these files, no 100% consistent format. only one source directly from the gov.
cableray has joined #ruby
aaronmacy has joined #ruby
<RubyPanther>
I've done jobs writing scrapers. And I can tell you, almost every time they have to hire multiple people in a row to do it, because the first few fail.
maletor has quit [Quit: Computer has gone to sleep.]
<yoshie902a>
can you give me the last person's name, haha
<yoshie902a>
not fun!
<RubyPanther>
It is hard, and it is not even something worth doing. The value is guaranteed to be low. If the value was high, the data would be purchased in the correct format.
eldariof has quit []
<jblack>
ruby: so true.
<jblack>
Not so true on the latter.
<yoshie902a>
it can be purchased, at 10K a month
ilyam has joined #ruby
sharms has quit [Ping timeout: 256 seconds]
<yoshie902a>
not something I can afford
<RubyPanther>
exactly. point proven.
<jblack>
yup. those licensing costs for various datasets can be silly.
<shock_one_>
yoshie902a, It returns data for me.
<RubyPanther>
that means they don't want you to have it. Use different data.
<yoshie902a>
shock_one_: it did? did you change anything?
ilyam has quit [Client Quit]
<shock_one_>
Renamed code to code.rb
ilyam has joined #ruby
<yoshie902a>
shock_one_: could you get the body tag?
<jblack>
yosie: I deal with a similiar problem involving SoS sites and entity registrations.
dwn has quit [Ping timeout: 244 seconds]
<jblack>
So I'm rather familiar with your type of problem. They like to bolt down public domain information and put up arbitrary barriers so that they can charge a premium
geekbri has quit [Remote host closed the connection]
jfl0wers has quit [Quit: jfl0wers]
<Hanmac_>
yoshie902a it works for me, maybe your nokogiri version is broken?
sambio has joined #ruby
<yoshie902a>
maybe, I'm using jruby
<yoshie902a>
I'm going to switch to 1.9.3
cakehero has joined #ruby
elkclone has quit [Quit: It's never too late to unplug and run.]
<Hanmac_>
rapha: look at String#tr
maletor has joined #ruby
s__dana_ has joined #ruby
<tcstar>
man this is fun... got the error to go away, now it just shows a 404.. though going to localhost:3000 shows it fine still..
neersighted has quit [Ping timeout: 245 seconds]
nimred has quit [Remote host closed the connection]
nimred has joined #ruby
<Hanmac_>
rapha: look at String#tr
<rapha>
Hanmac_: thank you!
<yoshie902a>
shock_one_: damn! you are right, 1.9.3 worked
<rapha>
huh?! either ruby-doc.org is broken or my browser is
<yoshie902a>
is there a way to run some code on jruby and some on 1.9.3?
tatsuya_o has quit [Read error: Connection reset by peer]
bricker`work has quit [Ping timeout: 240 seconds]
themayor has quit [Ping timeout: 248 seconds]
<shock_one_>
yoshie902a, So, now you agree that programming is simple? :-)
tatsuya_o has joined #ruby
<yoshie902a>
I have a gem that need to use jruby , but it seems I may also need to use 1.9.3
s__dana has quit [Ping timeout: 240 seconds]
s__dana_ is now known as s__dana
bricker`work has joined #ruby
dfyuij has quit [Remote host closed the connection]
<rapha>
Hanmac_: looks like it's not even the best thing for what I'm trying to do. I have an array or Unicode characters and I want all of them removed from a string. Sounds more like a job for a regexp ... but how to form the array into a regexp - with .join?
<shock_one_>
yoshie902a, you can execute this piece of code as external command if you won't find better way. body = %x( ruby code.rb )
carloslopes has joined #ruby
jtgiri_ has joined #ruby
user666 has quit [Quit: goodnight]
<yoshie902a>
shock_one_: that is an idea
<Hanmac_>
rapha if you want to remove them look for gsub
<yoshie902a>
Hanmac_: need to because I am using openNLP
<RubyPanther>
in school they taught that "genius level programming" is worthless code that nobody else can understand or maintain
jtgiri_ has quit [Client Quit]
<breakingthings>
genius level programming that isn't properly separated and made in easy-to-understand-chunks isn't worth squat.
<RubyPanther>
any genius you have, apply it only to debugging. ;)
<breakingthings>
Your 500 character regex may perfectly validate emails, but nobody else is gonna have a clue what to do with it.
<shock_one_>
RubyPanther, in my school they taught how to use Microsoft Word, so you're lucky.
<breakingthings>
:
<breakingthings>
:d*
bricker`work has quit [Ping timeout: 248 seconds]
<rapha>
Hanmac_: gsub, sure ... just would you really do something like CHARS_TO_REMOVE=['\u1234', '\u2345']; my_string.gsub(CHARS_TO_REMOVE.join, '') ? Somehow that looks like it couldn't be right...
jtgiri_ has joined #ruby
<Hanmac_>
RubyPanther you just descriped 75% of my gems :D
<banisterfiend>
breakingthings: _why did pretty well with it :)
icole has joined #ruby
<banisterfiend>
breakingthings: i.e "genius level programming that isn't properly separated and made in easy-to-understand-chunks isn't worth squat."
mockra_ has quit [Remote host closed the connection]
<banisterfiend>
breakingthings: cf projects like mixico
<RubyPanther>
Hanmac_: genius debugging, or worthless code? :P
<yoshie902a>
havenn: it does not seem to work well in this case. If I rvm 1.9.3 it works well, if I switch to jruby 1.7.2, it does not
<yoshie902a>
my nokogiri version is 1.5.6
aaronmacy has joined #ruby
<breakingthings>
Gentlemen pls.
Solnse has quit [Read error: No route to host]
<tcstar>
RubyPanther thanks for that link it helps other than when going to http://localsite/rails/info/properties -- that's giving a 404 but other than that, looks like it's running fine
<havenn>
yoshie902a: JRuby version?
<Hanmac_>
RubyPanther: " code that nobody else can understand or maintain" :P
<RubyPanther>
I've never heard of "needing jruby" except when running on java-based shared web hosting or android
<yoshie902a>
havenn: jruby 1.7.2 (1.9.3p327)
<headius>
RubyPanther: most common "need" case we see is when the only or best lib for X is a Java lib
<headius>
you could call those through rjb too, but it's easier in jruby
mach1ne has quit [Client Quit]
adeponte has quit [Remote host closed the connection]
<RubyPanther>
tcstar: I would make sure apache is working as expected without passenger. Generally something like an unexpected 404 is straight apache wrangling
<shock_one_>
RubyPanther, with jruby you can also use Java libraries
<havenn>
yoshie902a: OS/Distro?
<tcstar>
let me check my other application that is running codeigniter -- so no passenger
punkrawkR^Home has quit [Read error: Connection reset by peer]
<yoshie902a>
havenn: OSX 10.8.2
<tcstar>
that pulls up fine..
<RubyPanther>
sure, but most tasks people have there are going to be C libs for it, so MRI isn't exactly lacking functionality from gems
* Hanmac_
points and laugh about java&mac users
emergion has joined #ruby
<headius>
but in the C lib case you usually have to have an existing Ruby C ext, or an existing FFI binding
<headius>
in JRuby, Ruby => Java just works out of the box
<RubyPanther>
if there is actually some kind of important functionality where the C libs don't have a wrapper, let me know, I love Ruby C
<tcstar>
lol.. My moms husband bought a brand new mac a few years ago -- then asked if i'd put windows on it... lol
<shock_one_>
RubyPanther, there is also a case when all the project code is written in Java and you have to access some libraries from it in Ruby.
<tcstar>
on another note, looks like it's not reading my assets either
neersighted has joined #ruby
<havenn>
yoshie902a: I guess double check that you have libiconv, libxml2 and libxslt installed? Hrmm.: brew install libiconv libxml2 libxslt
JarJar has left #ruby ["Leaving"]
<pothibo>
if I'm not mistaken, jruby has better perfs than MRI
<headius>
that too
<RubyPanther>
pothibo: you are mostly mistaken
<shock_one_>
pothibo, not since 1.9
<pothibo>
oh
<havenn>
JRuby has a higher scrabble word score than Ruby.
<headius>
much higher
<Hanmac_>
RubyPanther i love Ruby+C++ as combi :D
volk_ has quit [Remote host closed the connection]
<headius>
RubyPanther: mostly mistaken?
volk_ has joined #ruby
cakehero has quit [Quit: Computer has gone to sleep.]
<Hanmac_>
pothibo can you do 3d programming with >200FPS in Jruby too? :D i can with MRI
mockra has joined #ruby
<headius>
yes, you can
DrShoggoth has quit [Quit: Leaving]
<RubyPanther>
I'm sure you can find a poorly interpreted or narrow case benchmark where JRuby is faster, and I'm sure you can find fans who like it strongly enough to make the claim.
<shock_one_>
Hanmac_, But why to use Ruby for 3D programming?
<headius>
JRuby should be faster than MRI in general, not just for specific cases
<RubyPanther>
why "should" it be? Because Java is faster than C, right?
bel3atar has joined #ruby
<headius>
because JRuby actually ends up compiling Ruby code to native
<headius>
and MRI does not
<RubyPanther>
That has little meaning. What does "native" mean there?
phinfonet has quit [Ping timeout: 248 seconds]
* pothibo
puts popcorn in the microwave
<shock_one_>
headius, bytecode isn't native
<headius>
native as in CPU-native
<headius>
as in x86_64
<Gate>
pothibo: concur, this is going to be fun :)
<headius>
as in real native JIT
<headius>
we compile to JVM bytecode, and JVM JITs to native
<Hanmac_>
shock_one_ iDo because iCan
emergion has quit [Quit: Computer has gone to sleep.]
berserkr has quit [Ping timeout: 248 seconds]
aeontech has quit [Ping timeout: 245 seconds]
zph has quit [Quit: Computer has gone to sleep.]
<yoshie902a>
havenn: Just finished brew install and setting gem install nokogiri -- --with-xslt-dir=/usr/local/Cellar/libxslt/1.1.26
<headius>
I spend a considerable amount of my time optimizing JRuby reading through x86 assembly output
<shock_one_>
headius, I'm pretty sure at some point ruby code it also converted to machine instructions
<headius>
shock_one_: it most definitely is not
<Hanmac_>
headius: wrong! MRI1.9 does make bytecode too
<headius>
MRI is a pure bytecode interpreter
<RubyPanther>
I'm sure you do, but you should probably leave it to your users to tell people how great it is or how fast it is for them
moos3 has joined #ruby
<rapha>
Hanmac_: I used the string.gsub(ARRAY.join, '') method now and it seems to be working just fine. Thanks for pointing me in the right direction!
<headius>
Hanmac_: and never JITs it to native code
thone_ has joined #ruby
maycon has quit [Remote host closed the connection]
<headius>
RubyPanther: they do
bel3atar has quit [Quit: good bye cruel world]
<headius>
perhaps you should leave it to JRuby users to say it's not faster, since you have no idea what you're talking about
cawaker has joined #ruby
<yoshie902a>
still not working
<yoshie902a>
havenn: did you get it working with jruby 1.7.2 and nokogiri 1.5.6?
bel3atar has joined #ruby
<banisterfiend>
headius: RubyPanther is a well-known know-it-all and babbler, he's banned from #ruby-lang for talking nonstop nonsense there too (iirc)
<RubyPanther>
I do use it. And it is not very pleasant compared to MRI. It certainly isn't faster. If I want to see my Ruby code go really fast I run Ruby 2
<havenn>
yoshie902a: yup
MattRB has quit [Quit: This computer has gone to sleep]
kirun has joined #ruby
<headius>
RubyPanther: if you have a nontrivial case that's slower in JRuby, please show me
<GeekOnCoffee>
headius: keep up the good work <3 a former jruby user
<yoshie902a>
ugh :(
<havenn>
headius: Starting up Pry. :P
<headius>
havenn: startup time we know about
emptyflask has joined #ruby
<headius>
banisterfiend: I know…I just don't let misinformation sit
<headius>
to you, maybe…to me, it comes from years of investigating perf problems and having them end up impl bugs
<headius>
Hanmac_: there's some folks using FFI to bind C++, but it's fiddly like you'd expect
<RubyPanther>
I don't mean that as an insult, it just sounds very strange. If you take it as an engineering claim, it is just the same as Java people have been saying for over a decade.
renanoronfle has joined #ruby
<headius>
wmeissner is working on a new project that's basically FFI + a C compiler so you can basically do everything you'd do in an ext but still just use FFI
<headius>
that might work for your case
<RubyPanther>
Why should it be faster than C? It shouldn't be.
<Hanmac_>
and shock_one_ yeah with that i can make 3d games in ruby
dmiller1 has quit [Ping timeout: 244 seconds]
<headius>
RubyPanther: it doesn't have to be faster than C in general…just in the specific cases needed to run Ruby programs faster
segv-_ has joined #ruby
<havenn>
RubyPanther: Compare JVM GC to Ruby GC...
segv- has quit [Read error: Connection reset by peer]
segv-_ is now known as segv-
<headius>
in JRuby, almost all Ruby code eventually ends up compiled to JVM bytecode, which means it almost all ends up as native optimized assembly
<pothibo>
RubyPanther: I think you misunderstand the reason why Jruby is faster (C has nothing to do with it)
<headius>
much, much faster than MRI's interpreter
<renanoronfle>
hi, one question can i change respond_with message?
<headius>
and we and the JVM are also able to optimize away a lot of the overhead of making Ruby calls
<headius>
MRI can't do that
<Hanmac_>
headius: it may require that the C++ itself has an C-API ... and in some libs this is NOT possible, because you cant backport anything back into C
<shock_one_>
Hanmac_, I can write web-sites in C++ but I never will
<RubyPanther>
havenn: but then that proves the lie, because then anywhere that JRuby has better perf would be a MRI "bug" or misfeature
<headius>
our core classes are sometimes faster, sometimes slower than MRI's
<Gate>
renanoronfle: sorry, flame war in progress. You want to change how it does what? How the HTML looks?
dmiller1 has joined #ruby
<Hanmac_>
pah i can write web-sites in C
<headius>
RubyPanther: I consider JRuby being slower to be a bug because if we're optimizing like I've designed us to we should beat MRI every time
<headius>
MRI could certainly add a native JIT
<Gate>
Hanmac_: been there, done that, got the T-Shirt, quit that job as fast as I could.
<RubyPanther>
The Ruby is the same, the best case without extra moving parts is going to be the same, why should Java be assumed to have a better best case, or less moving parts?
<Hanmac_>
shock_one_ explain why an game should not be written in ruby
<RubyPanther>
if you said JRuby shouldn't actually be any faster, but it is, maybe it would be true or not but at least it would be a claim that doesn't defeat itself
<yoshie902a>
I'm going to restart my computer and try again. BRB
mengu has quit [Quit: Konversation terminated!]
yoshie902a has left #ruby [#ruby]
<Gate>
RubyPanther: I don't think you understand how interpreters and compilers work.....
<headius>
but the best case is not the same
<headius>
MRI's interpreter does *much* more branching and memory indirection than actual jitted native code
<RubyPanther>
Gate: Assume I do and check if there is an interpretation of my words that is still valid. ;)
<Hanmac_>
Gate what is the problem writing games in ruby? is it the speed?
jeffreybaird has quit [Read error: Connection reset by peer]
<headius>
and on top of that it allocates per-call structures that increase overhead compared to Ruby many times over
<RubyPanther>
if so, go with that one
jeffreybaird has joined #ruby
<headius>
JRuby optimizes much of that away
haxrbyte has quit [Read error: Connection reset by peer]
<Gate>
Hanmac_: I was referring to your comment about C website dev.
<headius>
and the JVM can actually inline Ruby code and optimize it like any other JVM language
<Gate>
Hanmac_: I did a stint on a C++ IISAPI + Java *nightmare* that I consider to be the single most torturous period of my career to date.
dustint_ has quit [Quit: Leaving]
nomenkun has quit [Remote host closed the connection]
slainer68 has joined #ruby
<Hanmac_>
Gate: i learned it as part of my education, i also learned to code asm but i would not recomend it ...
<shock_one_>
Hanmac_, Because it works so much slover than C++, for example. I also believe there is much less libraries, best practices and stackoverflow answers
<pothibo>
I honestly didn't expect 9 words to bring that much turmoil
<Gate>
Ruby would be fine for the gamelogic portion of the code, with the rendering happening in C or something on a seperate thread.
yoshie902a has joined #ruby
<RubyPanther>
if I put any tight loops or bottlenecks it a tiny bit if C, the rest of the app logic being in Ruby isn't going to make it slow. That's true even with a slow Ruby like 1.8
<headius>
and in JRuby, there's far less pressure to have to do that
aeontech has joined #ruby
ddd has joined #ruby
<Hanmac_>
shock_one_ i played with my gem that bindes an c++ lib .. one that can use GPU programms ... from the seed my little test game has nearly the same speed as the real C++ Programm ...
<headius>
the pure-Ruby rbtree, for example, runs as fast in JRuby as the C ext does in MRI
<yoshie902a>
I'm back, restart didn't help either
<headius>
that certainly could indicate the C ext is poorly-written, but when you can beat MRI + C ext with JRuby + Ruby, I call that a win
<renanoronfle>
Gate, :) i want change the message when i create obj, im not render html, render json
berserkr has joined #ruby
_nitti has quit [Quit: Leaving...]
<yoshie902a>
havenn: when I did brew install, did I need to do anything else?
<yoshie902a>
havenn: what system are you on? os X?
<RubyPanther>
The idea that you can replace C libs with pure Ruby made me lol
nga4 has quit [Ping timeout: 264 seconds]
bradhe has quit [Remote host closed the connection]
<havenn>
yoshie902a: Yeah, 10.8
<headius>
it's within the realm of possibility
<Gate>
renanoronfle: So if I recall correctly, what respond_with will do is render the model's JSON, are you saying that you would rather render your own JSON instead?
Dann1 has quit [Quit: GODDAMNIT]
<shock_one_>
yoshie902a, brew link, maybe
<yoshie902a>
shock_one_: brew link?
<pothibo>
shock_one_, yoshie902a: brew doctor might be of some help too
<yoshie902a>
havenn: when I copy and paste the final gem install command in the console, it tried to execute each line separately, if I were to try to use the gem install command in a gem file, do I need to put all the flags on the same line?
<Gate>
headius: not surprising, I was just curious as to orders of magnitude. I'm not going to quibble over a few megs of ram if I get a nice speed boost.
<havenn>
yoshie902a: Ah, yup - all on the same line
carloslopes has quit [Read error: Connection reset by peer]
ryanh has quit [Read error: Connection reset by peer]
<Amnesia>
havenn: nope, same behaviour
<headius>
Gate: yeah, it varies greatly on the type of app, data in-memory, number of workers needed, etc
<Gate>
Understood
dougireton has quit [Quit: Leaving.]
<havenn>
headius: Can't you do crazy stuff like shrink the heap if you want to though?
rboyd_ has joined #ruby
<headius>
you can set maximums
jlast__ has quit [Ping timeout: 276 seconds]
carloslopes has joined #ruby
<shock_one_>
Amnesia, check line separator value «$/»
tommyvyo has joined #ruby
jlast has quit [Read error: Connection reset by peer]
jlast has joined #ruby
jerius has quit [Ping timeout: 276 seconds]
dougireton has joined #ruby
<Amnesia>
shock_one_: sorry, could you please elaborate?
spider-mario has quit [Remote host closed the connection]
<yoshie902a>
havenn: what's the syntax to add flags in a gemfile?
<havenn>
yoshie902a: Good question. I don't know. Hrm.
<shock_one_>
Amnesia, m modifier makes dot match the character in global variable $/. It's usually /n but maybe it's changed somehow in your code.
dougireton has quit [Client Quit]
timonv_ has quit [Remote host closed the connection]
chrismhough has quit [Quit: chrismhough]
timonv has joined #ruby
Elhu has quit [Quit: Computer has gone to sleep.]
<Amnesia>
shock_one_: think it's \r\n
ryanh has joined #ruby
ryanh has quit [Max SendQ exceeded]
speakingcode-wor has quit [Remote host closed the connection]
<Amnesia>
(it's output from an interactive shell -> expect.rb)
ryanh has joined #ruby
ryanh has quit [Max SendQ exceeded]
<shock_one_>
Amnesia, you're using Windows, aren't you? What version of ruby?
<Amnesia>
nope, linux
<Amnesia>
and both 1.8 and 1.9.1
ryanh has joined #ruby
elux has quit [Quit: Leaving...]
io_syl has joined #ruby
dmiller1 has quit [Ping timeout: 245 seconds]
<shock_one_>
It don't think it'll help, but just in case. Try to change $/ to '/n'
<shock_one_>
You know what? You typed n instead of m
Monie has quit [Ping timeout: 246 seconds]
<Amnesia>
that's cause of: 23:30 shock_one : It don't think it'll help, but just in case. Try to change $/ to '/n'
<Amnesia>
"{
Monie has joined #ruby
<Amnesia>
:P *, I tried /m before
pu22l3r_ has joined #ruby
hadees has joined #ruby
SCommette has quit [Read error: Connection reset by peer]
<Amnesia>
(since that made sense:P)
<shock_one_>
OK, you misunderstood me. I wanted you to add this code: «$/ = '/n'»
Dwarf has joined #ruby
bean__ has quit [Quit: Computer has gone to sleep.]
rdark has quit [Ping timeout: 248 seconds]
froginvasion has joined #ruby
<Amnesia>
ah, near the top?
<froginvasion>
hi all
SCommette has joined #ruby
<shock_one_>
Yes. Could you simplify the code somehow so I don't have to figure out how it works?
<froginvasion>
I'm confused with Proc and return statement, if someone can bother to explain? My understanding is that a return will break out of the method where it is being called
chrismhough has joined #ruby
<froginvasion>
but it's confusing me a lot as in where it actually returns to
<rboyd_>
to the caller
<Eiam>
^
<banisterfiend>
froginvasion: you ask cool questions :)
phantasm66 has quit [Quit: *sleeeep….]
pu22l3r has quit [Ping timeout: 264 seconds]
<froginvasion>
banisterfiend: i have an exam tomorrow about this stuff so.. well yeah :D
<banisterfiend>
froginvasion: an exam about ruby? cool
<froginvasion>
I wrote a paper comparing smalltalk and ruby
etcetera has joined #ruby
<froginvasion>
I have to defend it
atmosx has quit [Ping timeout: 255 seconds]
<Amnesia>
shock_one_: adding that $/ assignment, breaks my gets function
<froginvasion>
but the gritty details freak me out even though i should know by now... but yeah
<froginvasion>
banisterfiend let me reread what you said last time though
<banisterfiend>
froginvasion: oh ok, well, in the case of 'return' in a block, pretend the block isnt there
Kakera has quit [Ping timeout: 255 seconds]
<banisterfiend>
froginvasion: pretend it was just a bare return statement
pu22l3r_ has quit [Remote host closed the connection]
<banisterfiend>
froginvasion: it will behave the same as if it was a bare return statement
<froginvasion>
that's my thoughts, but then there's statements in books i've read:
caleb_io has joined #ruby
<Amnesia>
shock_one_: the box I'm connecting to isn't windows either, so I guess the newline char \n should be fine
pu22l3r has joined #ruby
<banisterfiend>
froginvasion: def hello; proc { return }.call } identical to: def hello; return; end
louisror has quit [Ping timeout: 255 seconds]
<froginvasion>
"in a proc, return behaves differently. Rather than return from the proc, it returns from the scope where the proc itself was defined"
asym has quit [Ping timeout: 245 seconds]
dmiller1 has joined #ruby
<froginvasion>
and this phrase is what is confusing me :p
plotplanexe has quit [Remote host closed the connection]
<banisterfiend>
froginvasion: yes, that's the same as what i said
robert___ is now known as robert_
<shock_one_>
Amnesia, don't use it if it doesn't help
metaphori has joined #ruby
<banisterfiend>
froginvasion: so. where is proc defined in the def hello example above?
dougireton has joined #ruby
<froginvasion>
inside the definition
<banisterfiend>
froginvasion: right, so it'll return out of the method definition
<froginvasion>
but what happens if the proc was made in a totally different scope?
<froginvasion>
like, some other class
pyx has joined #ruby
<Amnesia>
shock_one_: ok, "1\n2\n3\n".match(/\d+.*/m) does return all lines :/
<banisterfiend>
froginvasion: then it'll return from that totally different scope, if it can. But in many cases that frame has already been popped off the stack so you'll get a LocalJumpError
<froginvasion>
so, in other words, Procs are not true closures? or is that not the issue here
<banisterfiend>
froginvasion: try this for example: def hello; proc { return }; end; my_proc = hello; my_proc.call #=> Error
<banisterfiend>
froginvasion: that's not the issue here
<banisterfiend>
(they are true closures)
metaphori has quit [Read error: Connection reset by peer]
<banisterfiend>
Eiam: no, it's how closures work, it carries around its environment
<froginvasion>
hm, okay. it's very odd, i had a code example in my paper showing the difference between proc and lambda in case of returns, and it worked previously, but since reinstallation it gives a localjumperror like you said
<banisterfiend>
so all the locals and so on
<banisterfiend>
the 'self' the __method__ etc
<Eiam>
banisterfiend: right, but in the case of this example, there are no locals
luisalima has quit [Ping timeout: 245 seconds]
dougireton has quit [Remote host closed the connection]
<Eiam>
so the closure is empty?
<froginvasion>
it still carries self, regardless of no vars i think
<banisterfiend>
Eiam: environment is more than just locals, it's lots of stuff
tatsuya_o has quit [Read error: Connection reset by peer]
arya has joined #ruby
tatsuya_o has joined #ruby
<banisterfiend>
it carries around cref/default definee/self/the current 'block', and so on
<Eiam>
banisterfiend: but its missin the stuff that allows it to return up, because that stuff is gone ?
techlife has joined #ruby
techlife has quit [Max SendQ exceeded]
mdw has quit [Ping timeout: 276 seconds]
<froginvasion>
that's also where im puzzled, despite the explanation
<Eiam>
froginvasion: glad I'm not defending this ;) I've always sucked at understanding this stuff, I just write code. and sometimes it works.
techlife has joined #ruby
techlife has quit [Max SendQ exceeded]
<Eiam>
banisterfiend: if the closure is supposed to contain stuff, how can it not be found in the context, the whole point of the closure is to.. enclose your context
<banisterfiend>
froginvasion: youer' confusing the copy of the local environment that the proc carries around with the _actual_ stack frame?
__BigO__ has quit [Remote host closed the connection]
<froginvasion>
lets get one think straight that i'm not confusing again (im tired, so doesn't help):
<peteyg>
Is "class MyClass << ModuleName" equivalent to "class MyClass; extend ModuleName"?
<banisterfiend>
Eiam: i dont understand your q :)
<banisterfiend>
peteyg: no
<Eiam>
froginvasion: sorry i'll step out o the conv im no helping
<banisterfiend>
peteyg: your first example isnt valid ruby ;)
<peteyg>
banisterfiend: Okay, got it.
<froginvasion>
Eliam dw about that, keep talking
<Eiam>
banisterfiend: gonna go snag a drink, I probbably don't even understand what I'm asking ;)
<banisterfiend>
hehe
<Eiam>
still working on SICP =p
<banisterfiend>
froginvasion: let me show you something
<froginvasion>
ok banisterfiend
<peteyg>
banisterfiend: I see things like class MyClass << self, I'm guessing that's Ruby's metaprogramming at work? Making addition's the existing class definitions?
<froginvasion>
peteyg you are correct. The construct you just typed is one that changes the context of self
<ccsidiot>
Hi there
<froginvasion>
yes it does
<banisterfiend>
froginvasion: cool, well *that* is really what a proc carries around with it
philcrissman has quit [Remote host closed the connection]
kold_ has joined #ruby
<banisterfiend>
that's the 'eenvironment' that it is the snapshot of a given stack frame
v0n has quit [Quit: WeeChat 0.4.0]
<ccsidiot>
I have a quick question. I am new to Ruby, I wonder how do I change Time.now to get in a particular timezone
caleb_io has quit [Quit: caleb_io]
techlife has joined #ruby
techlife has quit [Max SendQ exceeded]
metaphori has joined #ruby
<ccsidiot>
I tried getLocal("-8:00") however, it's expecting only 0 argument.
workmad3_ is now known as workmad3
<banisterfiend>
froginvasion: you can even go Proc#binding to get it directly, and you can eval() code inside it
techlife has joined #ruby
Monie has quit [Quit: Quit]
interactionjaxsn has quit [Remote host closed the connection]
<banisterfiend>
froginvasion: so your question is this: how can a proc fail to 'return' from its stack frame when it's always carrying it around with it, is that right?
<froginvasion>
yes. That's the thing i dont get :)
metaphori has quit [Client Quit]
elico has quit [Quit: elico]
tommyvyo has joined #ruby
griffindy has quit [Quit: Computer has gone to sleep.]
<froginvasion>
let me just get this straight with an example
<froginvasion>
one sec
tommyvyo_ has joined #ruby
<Hanmac_>
banisterfiend: do you like class A;binding().eval(File.read("moduleB"));end that is turned into A::B ?
<banisterfiend>
froginvasion: ok, the answer is that the thing it carries around with it is just a *copy* of a given stack frame, it's just there to support 'closure' behaviour, it's not the real stack frame. 'return' only works for a real stack frame, so it'll only work if the frame actually still exists on the stack
<banisterfiend>
Hanmac_: yeah we use that in pry quite a bit
<banisterfiend>
Hanmac_: better to do: binding.eval(File.read("moduleB.rb"), "moduleB.rb") though, so that source_location works properly :)
<shock_one_>
banisterfiend, Proc.new doesn't create a new stack frame?
<froginvasion>
wait, step by step. Lets look at this:
<froginvasion>
this doesnt work, because it can't return from top-level, correct?
linux01 has joined #ruby
<Hanmac_>
it would be cool if the is an class A; load:_into("moduleB");end :P
breakingthings has quit []
<froginvasion>
or because the stack frame is gone?
<banisterfiend>
froginvasion: yes, because 'return' doesnt make sense at top-level
<banisterfiend>
froginvasion: no, it just doesnt make sense
jtharris has quit [Quit: WeeChat 0.3.9.2]
<banisterfiend>
froginvasion: not because top-level doesn't exist (because it does) but because 'return' is meaningless there, it's not a method context
<ccsidiot>
I have a quick question. I am new to Ruby, I wonder how do I change Time.now to be in a particular timezone, I tried using Time.now.getlocal("+8:00"), it showed me getlocal should be having 0 arguments
sorbo_ has joined #ruby
<Hanmac_>
froginvasion: image you are standing on "Start" and someone says to you "return" and you are puzzles where you need to return
<yoshie902a>
I'm getting this warning, could this be the problem.. WARNING: Nokogiri was built against LibXML version 2.7.3, but has dynamically loaded 2.7.8
<yoshie902a>
how would I go about resolving the warning
alanp_ has joined #ruby
<banisterfiend>
froginvasion: so, yeah, ok, there's two situations return wont work: 1. the proc was defined in a method and that method frame is no longer on the stack 2. the proc was not defined in a method so 'return' has no meaning, it doesnt make sense to use it
<Hanmac_>
yoshie902a: reinstall the nokogiri gem
benlieb has joined #ruby
Takehiro has joined #ruby
alanp_ has joined #ruby
<froginvasion>
banisterfiend, alright, i think my brain is starting to get the hang of it :D
ryanh has quit [Quit: Computer has gone to sleep.]
<mnemon>
ccsidiot: should work .. irb(main):003:0> Time.now.getlocal("+01:00") => 2013-01-24 00:01:24 +0100
allsystemsarego has quit [Quit: Leaving]
<froginvasion>
i think i'll read the book you said sometime, but not before tomorrow ;)
apeiros_ has quit [Remote host closed the connection]
RORgasm has quit [Remote host closed the connection]
<froginvasion>
I hope my questions are not too dumb though :).
<shock_one_>
Why do we need different return behaviour in lambdas and procs?
mneorr has quit [Remote host closed the connection]
<Hanmac_>
workmad3 i would forbit it, like its forbidden to make subclasses of singleton classes
bradhe has joined #ruby
jimeh has joined #ruby
Kingy has joined #ruby
mneorr has joined #ruby
beckyconning has joined #ruby
Rix has joined #ruby
<workmad3>
Hanmac_: I can see your point
<workmad3>
Hanmac_: however, I can also see that doing so would introduce annoying edgecases that makes the implementation more complex, probably needlessly
bradhe has quit [Remote host closed the connection]
nari has joined #ruby
bradhe has joined #ruby
forced_request has joined #ruby
<ccsidiot>
I have a quick question. I am new to Ruby, I wonder how do I change Time.now to be in a particular timezone
beilabs has joined #ruby
MattRB has joined #ruby
gyre007 has quit [Remote host closed the connection]
<Hanmac_>
workmad3: try to make an instance of a a childclass of TrueClass :D
jrist is now known as jrist-afk
<workmad3>
Hanmac_: I know, subclassing is useless ;)
bradhe has quit [Read error: Connection reset by peer]
<ccsidiot>
:(
<workmad3>
Hanmac_: however, prohibiting subclassing of a few specific classes also seems useless, and also arbitrary
bradhe has joined #ruby
rboyd_ has quit [Ping timeout: 244 seconds]
<shock_one_>
They could introduce final class concept, like in Java
dougireton has joined #ruby
RagingDave has quit [Quit: Ex-Chat]
jonahR has quit [Quit: jonahR]
techlife has quit [Ping timeout: 252 seconds]
<ccsidiot>
I have a quick question. I am new to Ruby, I wonder how do I change Time.now to be in a particular timezone
techlife has joined #ruby
MattRB has quit [Quit: This computer has gone to sleep]
<Hanmac_>
shock_one_ no, final is bad, i saw it in C++11 too, but only the basics of the Basics class (True,False,Nil) does not make sense when subclassign
<workmad3>
Hanmac_: does it make sense to introduce an idea of an un-inheritable class purely for those 3 classes though?
<workmad3>
Hanmac_: I see that as un-necessary complication personally :)
<workmad3>
Hanmac_: while being able to subclass them is an amusing foible more than un-necessary complication :)
b1rkh0ff has quit [Ping timeout: 248 seconds]
hydrozen has joined #ruby
EPIK has joined #ruby
<shock_one_>
ccsidiot, Time.now - hours*3600
MattRB has joined #ruby
stopbit has quit [Quit: Leaving]
answer_42 has quit [Ping timeout: 276 seconds]
<shock_one_>
I would implement the inherited callback in these classes like this: def inherited(d); raise CantInheritException; end
chridal has quit [Quit: leaving]
<shock_one_>
Clever, huh?
Xeago has quit [Remote host closed the connection]
<Hanmac_>
workmad3 that is my list of this classes where subclassing is useless
<banisterfiend>
shock_one_: what's the rationale behind disallowing subclassing?
apok has joined #ruby
etcetera has quit []
<shock_one_>
banisterfiend, I have no idea.
chridal has quit [Client Quit]
toekutr has joined #ruby
chridal has joined #ruby
<banisterfiend>
workmad3: do u know? :)
<Hanmac_>
hm the Data class is an evil one too
MattRB has quit [Quit: This computer has gone to sleep]
<workmad3>
banisterfiend: Hanmac_ objects to being able to subclass from a limited number of core ruby classes
etcetera has joined #ruby
<workmad3>
banisterfiend: on the grounds that subclassing them is useless :)
<banisterfiend>
workmad3: i mean in general, what's the purpose of a sealed/final class?
<banisterfiend>
in c#/java
<workmad3>
banisterfiend: oh... there
<workmad3>
I guess to indicate that this class is not suitable for subclassing
postmodern has joined #ruby
Guest__ has joined #ruby
<workmad3>
which does make sense if you've got a good, strict separation between abstract classes for inheritance and concrete leaf classes that shouldn't be inherited from
<shock_one_>
banisterfiend, Wikipedia says that Java final classes works faster. Also in C++ bad things happen when class not designed for deriving (without virtual destructor) is subclassed
<banisterfiend>
workmad3: it just doesnt seem like the part of OOD tha should be emphasized, at least not nearly to the point of it being a language feature
chridal has quit [Client Quit]
TheFuzzball has quit [Quit: Computer has gone to sleep.]
<workmad3>
banisterfiend: I'd agree :)
Kingy_ has joined #ruby
chridal has joined #ruby
<workmad3>
banisterfiend: and shock_one_ makes a good point with C++ at least, a non-virtual destructor in a class in C++ should be, on its own, a strict 'no inheriting' error on compilation IMO
embs_ is now known as embs
Kingy has quit [Ping timeout: 244 seconds]
<workmad3>
banisterfiend: I guess it's really down to trust at the end of the day... a lot of java is about not trusting developers IMO... java security stuff baked into the VM that allows an admin to determine what apps can call what methods... final classes so that library authors and 'architects' can dictate who is allowed to inherit from what... because the bottom rung of developers can't be trusted to know what they're doing
<workmad3>
banisterfiend: which is potentially a bleak and cynical way of looking at java as a whole
b1rkh0ff has joined #ruby
mahmoudimus has quit [Quit: Computer has gone to sleep.]
jgarvey has quit [Quit: Leaving]
<workmad3>
banisterfiend: and java as a whole emphasises more class-based design than I think is good... but if you're emphasising it, it makes sense to put in controls, because the java ideal is that if you can just get that perfect class hierarchy into your app, and then seal your classes to ensure your perfect model is free from being tinkered with unexpectedly, then your application will be perfect
hadees has quit [Quit: hadees]
<banisterfiend>
workmad3: actually, i guess it makes sense
<banisterfiend>
workmad3: because subclasses get access to the private interface of a class
<workmad3>
ah I'd forgotten about that :)
dougireton has quit [Quit: Leaving.]
<banisterfiend>
so, if you allow subclassing on any old class, client code can break when they use your private interface (which they're allowed to do)
<workmad3>
wait, I thought it was the protected interface that subclasses could access?
solidoodlesuppor has quit [Quit: ChatZilla 0.9.89 [Firefox 18.0.1/20130116073211]]
alanp has quit [Ping timeout: 244 seconds]
elico has joined #ruby
<workmad3>
or are we talking about ruby again? :)
<banisterfiend>
workmad3: hm, i'm corrupted by ruby...our 'private' is equivalent to 'protected' in java/c++
emmanuelux has quit [Remote host closed the connection]
<shock_one_>
In Java you have to make immutable classes final because subclassing can break immutability.
<jblack>
I think that private in ruby isn't actually really that private.
<shock_one_>
nopper, subclasses can only access protected methods.
griffindy has joined #ruby
<Hanmac_>
jblack yeah because in ruby you can access nearly everything :D
thillux has quit [Remote host closed the connection]
friskd has quit [Quit: friskd]
<banisterfiend>
yeah the difference between protected/private in ruby is really tiny
nfk has quit [Quit: yawn]
<jblack>
right. it's more like a "You get both pieces when you break this" warning right before you dive off into introspection. =)
emptyflask has quit [Remote host closed the connection]
<banisterfiend>
shock_one_: how can subclassing break immutability
jimeh has quit [Quit: Computer has gone to sleep.]
mmercer has quit [Ping timeout: 276 seconds]
<LiquidInsect>
I like to warn people in comments that if I catch someone using send to get around a provate-declared method I will make fun of their hair
<LiquidInsect>
doesn't generally help
jlast has quit [Remote host closed the connection]
b1rkh0ff has quit [Read error: Connection reset by peer]
<banisterfiend>
hehe
h4mz1d has joined #ruby
<shock_one_>
If you have a list of object of your immutable class (which can include instances of subclasses, remember?) you can't be sure that all the objects will remain the same.
baphled has joined #ruby
elico has quit [Ping timeout: 244 seconds]
halph has quit [Read error: Connection reset by peer]
skcin7 has joined #ruby
god has joined #ruby
god is now known as Guest57178
MattRB has quit [Quit: This computer has gone to sleep]
<shock_one_>
sonne, I have a question for you, guys. It's generally known, that you can't access singleton class of one object from another object. But there is one exception when you actually can do it. What is that exception?
miskander has joined #ruby
friskd has joined #ruby
Rizzle has quit [Ping timeout: 245 seconds]
chussenot has quit [Quit: chussenot]
friskd has quit [Remote host closed the connection]
<shock_one_>
Is it my client changing words or is it some server settings?