Spami has quit [Quit: This computer has gone to sleep]
icole has quit [Remote host closed the connection]
andrewhl has joined #ruby
yakko_ has joined #ruby
jonathanwallace has joined #ruby
GoGoGarrett has joined #ruby
ebobby has joined #ruby
codezombie is now known as codezombie|away
gabrielrotbart has quit [Read error: Connection reset by peer]
yakko has quit [Ping timeout: 252 seconds]
gabrielrotbart has joined #ruby
kzar has quit [Read error: Connection reset by peer]
<GoGoGarrett>
2 objects created by from a single class, Car. How can I ensure that each instance has an uniq "color" property? I've tried this: https://gist.github.com/792d2ee58f903075bc0d
_nitti has joined #ruby
DatumDrop has joined #ruby
<Eiam>
god, accidently checking in a variable called $DEBUG = true; was the worst mistake ever
<Eiam>
so. much. whiny_nil.rb:58 spam
<alexspeller>
GoGoGarrett: I don't think return false does anything
<alexspeller>
(in an initaialize method)
lolcathost has joined #ruby
<GoGoGarrett>
is there another way to prevent it from being initalized?
<alexspeller>
You need to raise an error
<GoGoGarrett>
gotcha
sj26 has quit [Quit: Rainbows!]
codezombie|away is now known as codezombie
connor_ has quit [Remote host closed the connection]
<Eiam>
just put your extends into their own seperate module & use them there
tommyvyo has joined #ruby
<alexspeller>
Eiam: you should definitely be using ruby's module system
lolcathost has joined #ruby
joofsh has quit [Remote host closed the connection]
LouisGB has quit [Ping timeout: 256 seconds]
<Eiam>
alexspeller: yes, I said go make a module & put stuff in there
<alexspeller>
For any non-trivial codebase you will likely be using lots of different techniques appropriate to the problem
<Eiam>
instead of opening up someone elses thing and dumping junk in there
SpNg has joined #ruby
<Eiam>
don't shit in someone elses code, shit in your own yard
baroquebobcat has quit [Quit: baroquebobcat]
slainer68 has quit [Remote host closed the connection]
<alexspeller>
Eiam: That's not what extend, include, or inheritance to
<alexspeller>
*do
<alexspeller>
You may be thinking of monkeypatching, which is a different kettle of fish entirely
gyre007 has joined #ruby
karasawa has quit [Ping timeout: 265 seconds]
<Eiam>
I was thinking of monkey patching, but I don't see extend much differently than monkey patching. its the same concept but applied to a specific instance
DatumDrop has quit [Ping timeout: 260 seconds]
<Eiam>
is that not correct? extend is monkey patching for a specific instance ?
samuel02 has quit [Remote host closed the connection]
wf2f has quit []
MattRb has quit [Quit: MattRb]
csigi has joined #ruby
<Eiam>
okay, so include is monkey patching for a specific instance =)
<alexspeller>
nope
<Eiam>
" Include is for adding methods to an instance of a class"
<alexspeller>
yes, that is not monkey patching though, that's just how ruby's module system works
philcrissman has joined #ruby
segv- has quit [Quit: segv-]
<alexspeller>
You should not be worried / afraid of doing that
AndIrc___ has joined #ruby
ossareh has quit [Read error: Operation timed out]
Xeago has quit [Remote host closed the connection]
<Eiam>
*shrug* if I need an object to do something and it doesn't fit into an existing model/class/module, I make a new module/object to contain that kind of functionality
mneorr has joined #ruby
<csmrfx>
A simple http proxy in ruby? I need to debug http-requests from browser?
<Eiam>
csmrfx: nc ?
mercwithamouth has quit [Ping timeout: 255 seconds]
<Pip>
Is proc still available in Ruby?
<Eiam>
to_proc
koshii has joined #ruby
csigi has left #ruby [#ruby]
yaymukund has quit [Ping timeout: 240 seconds]
miskander has joined #ruby
<alexspeller>
that makes sense, but seriously, the basic usage of extend, include, and inheritance are not antipatterns, they just are different ways of using the module system
<csmrfx>
Eiam: "nc"? is that a name?
<Eiam>
csmrfx: netcat
wroathe has quit [Ping timeout: 256 seconds]
<Eiam>
its a simple http server you can start from command line
<Eiam>
it spits out exactly what it gets
emmanuelux has quit [Read error: Connection reset by peer]
<csmrfx>
Hm, ok
<csmrfx>
Perhaps I can build something around it
MattRb has joined #ruby
emmanuelux has joined #ruby
<csmrfx>
Eiam: great idea
karupanerura has quit [Excess Flood]
philcrissman has quit [Remote host closed the connection]
<Eiam>
csmrfx: I use it all the time to bounce a request against to see exactly whats going on, removes all the rest of my stack
<Eiam>
charlesproxy is another great tool for the other end
NsOmNiAc has quit [Read error: Connection reset by peer]
<alexspeller>
csmrfx: if you need something a bit more full-featured webrick has a built in http proxy
gyre007 has quit [Remote host closed the connection]
connor_ has joined #ruby
<Eiam>
alexspeller: I dunno about saying its an anti pattern (I don't think I was saying that, and certainly enough people monkeypatch that its hard to call it an antipattern)
gurps has quit [Quit: bye]
karupanerura has joined #ruby
<Eiam>
alexspeller: I just find that doing things like that add more complexity with very little value to me mentally, I prefer to keep things as simple as possible
hydrozen has joined #ruby
<Eiam>
but hey, I'm a pretty shitty coder so =)
hadees has quit [Quit: hadees]
<alexspeller>
Eiam, I understand and agree, yes, you don't want to be doing what you're saying
emocakes has quit [Quit: emocakes]
awarner has joined #ruby
<alexspeller>
But if you think that extend is doing that, you don't understand extend; it has legitimate, non-confusing, simple uses
<alexspeller>
it's just include for class-methods
<Eiam>
yeah i've made it through the article
xclite has quit [Remote host closed the connection]
<Eiam>
and I'm familiar with it from HTTParty because thats where i've done it
segv- has joined #ruby
segv- has quit [Client Quit]
<Eiam>
i have a class that includes it exactly as demonstrated in the example
<Eiam>
to me mentally, I'd rather "sublcass" httparty
<Eiam>
subclass
<Eiam>
than inject its code into the class. I get at a high level its the 'same thing' sort of, but i just naturally think of subclassing when i see something like that, not include
mercwithamouth has joined #ruby
<Eiam>
of course, C++ was my first language, then obj-c, so I'm sure thats why =)
joshman_ has quit [Quit: Computer has gone to sleep.]
<csmrfx>
Simple and simplifying is what it is *all* about
<csmrfx>
nobody has time for complex
<csmrfx>
value is created when you manage to abstract shitty details
<csmrfx>
jmo
foohey has quit [Remote host closed the connection]
ner0x has joined #ruby
GoGoGarrett has quit [Remote host closed the connection]
gurps has joined #ruby
<alexspeller>
It is about simplifying; I agree with that; however I disagree that using extend / include are not simple - this is very basic ruby and incredibly common idioms in ruby, _because_, in the right scenario, they allow you to make simpler code
<alexspeller>
anyways, I gtg, laters all!
alexspeller has left #ruby ["Leaving..."]
<csmrfx>
oh, so this was about modules
<csmrfx>
duh, use 'em
<Eiam>
csmrfx: no
<Eiam>
it was about include & extend
codezombie is now known as codezombie|away
<csmrfx>
Eiam: ok I see. Mixin's are ruby stylee. Inheritance, sometimes makes life hard.
SCommette has joined #ruby
<csmrfx>
jmo
<Eiam>
yeah, mixins. woo fuck yeah! =|
sailias has quit [Quit: Leaving.]
slainer68 has joined #ruby
slainer68 has quit [Remote host closed the connection]
chussenot has quit [Quit: chussenot]
chussenot has joined #ruby
miskander has quit [Quit: miskander]
pskosinski has quit [Quit: Learn Life's Little Lessons]
ngoldman has quit [Remote host closed the connection]
karasawa has joined #ruby
Umren|2 has quit [Ping timeout: 272 seconds]
digitalsanctum has quit [Remote host closed the connection]
digitalsanctum has joined #ruby
stevechiagozie has joined #ruby
karasawa has quit [Ping timeout: 265 seconds]
gyre007 has joined #ruby
<ryannielson>
I want to develop a gem that has an executable, in development what's the best way to test it? Do I have to run gem install with the location of the executable every time?
Pip has quit [Ping timeout: 264 seconds]
digitalsanctum has quit [Ping timeout: 248 seconds]
emmanuelux has quit [Remote host closed the connection]
lolcathost is now known as DijkstraGroupie
tommyvyo has joined #ruby
mneorr has quit [Remote host closed the connection]
Choobie has left #ruby ["End"]
jjbohn has joined #ruby
nathancahill has joined #ruby
DijkstraGroupie has quit [Ping timeout: 260 seconds]
c0rn has quit [Quit: Computer has gone to sleep.]
slainer68 has joined #ruby
ttt has joined #ruby
pskosinski has joined #ruby
beneggett has quit [Quit: Computer has gone to sleep.]
DatumDrop has quit [Ping timeout: 252 seconds]
rakl has quit [Quit: sleeping]
luckyruby has quit [Remote host closed the connection]
slainer68 has quit [Ping timeout: 260 seconds]
[-mX-] has joined #ruby
tjbiddle_ has joined #ruby
templaedhel has joined #ruby
connor_ has quit [Remote host closed the connection]
blazes816 has quit [Quit: blazes816]
connor_ has joined #ruby
bigmac has quit [Quit: Leaving]
fred909 has quit [Ping timeout: 240 seconds]
drago757 has quit [Quit: drago757]
[-mX-] has quit [Client Quit]
tjbiddle has quit [Ping timeout: 248 seconds]
DatumDrop has joined #ruby
drago757 has joined #ruby
carlyle has joined #ruby
tjbiddle_ has quit [Ping timeout: 255 seconds]
jpfuentes2 has joined #ruby
<shevy2>
hmmm
<shevy2>
I just realized something
carlyle has quit [Read error: Connection reset by peer]
<shevy2>
begin/rescue works a bit like if/else
<shevy2>
it seems to give me an additional layer of complexity however:
<shevy2>
- in one case, I need to rescue a specific exception, such as Errno::EACCES
DatumDrop has quit [Remote host closed the connection]
<shevy2>
- in the other case, I'd have to check for proper file permissions
carlyle has joined #ruby
<shevy2>
my question is - why are there two ways when one way might suffice?
ryanjh has joined #ruby
connor_ has quit [Ping timeout: 248 seconds]
main has quit [Ping timeout: 240 seconds]
jjbohn has quit [Quit: Leaving...]
asteve has joined #ruby
sn0wb1rd has quit [Quit: sn0wb1rd]
jds__ has quit [Remote host closed the connection]
_huoxito has joined #ruby
h4mz1d has joined #ruby
digitalsanctum has joined #ruby
breakingthings has joined #ruby
samphippen has quit [Quit: Computer has gone to sleep.]
DatumDrop has joined #ruby
<ryannielson>
exceptions are different than simple conditionals. Exceptions can carry up the execution path and be caught. Do some reading up on exceptions to get an idea.
jjbohn has joined #ruby
Engin has quit [Ping timeout: 252 seconds]
dr_neek has quit [Read error: Connection reset by peer]
dr_neek has joined #ruby
mengu has quit [Quit: Leaving]
maletor has quit [Quit: Computer has gone to sleep.]
mercwithamouth has quit [Ping timeout: 255 seconds]
joofsh has joined #ruby
aeontech has quit [Quit: aeontech]
dougireton has joined #ruby
h4mz1d has quit [Ping timeout: 255 seconds]
<waxjar>
ah that worked, changed cmd to ["/Users/username/.rbenv/shims/ruby", "$file"] in Ruby.sublime-build in the Ruby package
philcrissman has joined #ruby
horofox has joined #ruby
cantonic has quit [Ping timeout: 248 seconds]
jds__ has quit [Ping timeout: 252 seconds]
jekotia has quit [Read error: Connection reset by peer]
<shevy2>
swarley I think the long variants are always slower... '' vs. String.new, [] vs. Array.new, {} vs. Hash.new, I think it has to do with initialize(), or something, no real idea
shevy2 is now known as shevy
jekotia has joined #ruby
heftig has quit [Quit: leaving]
Zolrath has quit [Ping timeout: 260 seconds]
Zolrath has joined #ruby
gabrielrotbart has quit [Remote host closed the connection]
BSaboia has quit [Ping timeout: 260 seconds]
karasawa has joined #ruby
dr_neek has joined #ruby
beneggett has joined #ruby
<swarley>
shevy; I think it has to do with having a precompiled value versus looking up the class and calling
DatumDrop has joined #ruby
gabrielrotbart has joined #ruby
lolcathost has quit [Ping timeout: 264 seconds]
<swarley>
Since the interpreter can automatically know where to go for "" but it has to preform object lookups for String.new
gyre007 has quit [Remote host closed the connection]
Monie has quit [Quit: Quit]
karasawa has quit [Ping timeout: 248 seconds]
jbw has quit [Ping timeout: 272 seconds]
pacbard has joined #ruby
rvmeier has quit [Quit: Leaving]
adkron has joined #ruby
dougireton has quit [Quit: Leaving.]
Vert has quit [Read error: Connection reset by peer]
karasawa has joined #ruby
nathancahill has quit [Quit: nathancahill]
jjbohn has joined #ruby
Virunga has quit [Remote host closed the connection]
jjbohn has quit [Client Quit]
adkron has quit [Ping timeout: 252 seconds]
heftig has joined #ruby
digitals_ has joined #ruby
lolcathost has joined #ruby
d2dchat has joined #ruby
pavilionXP has quit [Ping timeout: 240 seconds]
beneggett has quit [Quit: Computer has gone to sleep.]
coasterDAME is now known as coaster
QKO_ has joined #ruby
digitalsanctum has quit [Ping timeout: 260 seconds]
pavilionXP has joined #ruby
brianpWins has joined #ruby
jgrevich has joined #ruby
h4mz1d has joined #ruby
QKO has quit [Ping timeout: 248 seconds]
Vert has joined #ruby
cyong has joined #ruby
aeontech has joined #ruby
<breakingthings>
Curses is irritating.
ryannielson has left #ruby [#ruby]
jbw has joined #ruby
joshman_ has joined #ruby
niklasb has quit [Ping timeout: 240 seconds]
medik has quit [Quit: medik]
jjbohn has joined #ruby
subbyyy has joined #ruby
alvaro_o_ has quit [Quit: Ex-Chat]
jgrevich_ has joined #ruby
jgrevich has quit [Ping timeout: 248 seconds]
jgrevich_ is now known as jgrevich
moshee has quit [Ping timeout: 264 seconds]
moshee has joined #ruby
moshee has quit [Changing host]
moshee has joined #ruby
danieldocki has quit [Quit: Leaving...]
jds__ has joined #ruby
nathancahill has joined #ruby
chussenot has quit [Quit: chussenot]
joshman_ has quit [Ping timeout: 256 seconds]
platzhirsch has left #ruby [#ruby]
philcrissman has quit [Remote host closed the connection]
Takehiro has quit [Ping timeout: 248 seconds]
kaen has quit [Quit: trying.]
nathancahill has quit [Client Quit]
h4mz1d has quit [Ping timeout: 260 seconds]
jlast has joined #ruby
carlyle has quit [Remote host closed the connection]
wmoxam has quit [Remote host closed the connection]
h4mz1d has joined #ruby
jmorton has quit [Quit: jmorton]
ffranz has quit [Quit: Leaving]
jds__ has quit [Ping timeout: 255 seconds]
graft has quit [Ping timeout: 276 seconds]
eka has quit [Quit: Computer has gone to sleep.]
hell_razer has quit [Ping timeout: 255 seconds]
graft has joined #ruby
graft has quit [Changing host]
graft has joined #ruby
johnmilton has quit [Quit: Leaving]
aeontech has quit [Quit: aeontech]
Monie has joined #ruby
digitals_ has quit [Remote host closed the connection]
digitalsanctum has joined #ruby
jjbohn is now known as jjbohn|afk
DatumDrop has quit [Remote host closed the connection]
voodoofish430 has quit [Quit: Leaving.]
horofox has quit [Quit: horofox]
clooth has quit [Quit: clooth]
niklasb has joined #ruby
hell_razer has joined #ruby
IceDragon has quit [Quit: Space~~~]
digitalsanctum has quit [Remote host closed the connection]
adeponte has quit [Remote host closed the connection]
joshcheek has joined #ruby
gavinhughes has joined #ruby
hackerdude has quit [Remote host closed the connection]
<gavinhughes>
Anyone know if there's a library similar to VCR that simply captures every external request a test suite makes and records them for future playback without all VCR's cassette naming stuff?
<aquagrunty>
yes, but i can't seem to figure out how to ORM'itize it
<aquagrunty>
i'm building a layer on top of a legacy MS SQL database
dawkirst_ has joined #ruby
ejnahc has joined #ruby
pu22l3r has quit [Ping timeout: 260 seconds]
<aquagrunty>
is sequel the most flexibe?
<aquagrunty>
*flexible
gabrielrotbart has quit [Remote host closed the connection]
<aquagrunty>
oh
dawkirst has quit [Quit: Leaving]
<aquagrunty>
oh!
<aquagrunty>
i found docs
<aquagrunty>
thanks havenn :)
dawkirst_ is now known as dawkirst
<dawkirst>
Hi, new to Ruby. If I want to play around with AWS, but especially S3, am I better off with fog or with something like aws-s3 or aws-sdk?
Takehiro_ has joined #ruby
kenneth has quit [Quit: kenneth]
pkrnj has joined #ruby
<Hanmac_>
aquagrunty thats the payback for choosing MS products :P
freeayu_ has joined #ruby
Takehiro has quit [Ping timeout: 276 seconds]
<aquagrunty>
Hanmac_: my god if i could change the choice they made years ago i would
tchebb has joined #ruby
agarie has joined #ruby
mensvaga has quit [Ping timeout: 248 seconds]
bjeanes has quit [Ping timeout: 248 seconds]
huoxito has quit [Ping timeout: 248 seconds]
fumbe has quit [Ping timeout: 248 seconds]
bjeanes has joined #ruby
huoxito has joined #ruby
browndawg has joined #ruby
agarie has quit [Remote host closed the connection]
fumbe has joined #ruby
TerabyteST has joined #ruby
<aquagrunty>
our entire loyalty database is built using SQL
<aquagrunty>
i've seen it
<aquagrunty>
i have seen it melt the faces of many great men
<aquagrunty>
those poor souls
<aquagrunty>
imagine an SQL table
<aquagrunty>
with over 100 columns
<aquagrunty>
SQL queries that span a good 2 or 3 screens
vlad_starkov has joined #ruby
<dawkirst>
Hi, new to Ruby. If I want to play around with AWS, but especially S3, am I better off with fog or with something like aws-s3 or aws-sdk? (not sure if this message was displayed earlier -- if it was, sorry)
<aquagrunty>
dawkirst: any reason you need to use AWS?
jameshyde has quit [Remote host closed the connection]
dr_bob has joined #ruby
jds__ has joined #ruby
TheFuzzball has quit [Quit: Computer has gone to sleep.]
<shevy>
topriddy, look at the page again:
<shevy>
(1) "I'm not a Ruby programmer."
<shevy>
(2) "disabling comments. If you got something to say, write a blog post."
<shevy>
he is a troll
<shevy>
even a scared one
mneorr has joined #ruby
jds__ has quit [Ping timeout: 252 seconds]
wermel has joined #ruby
toekutr has quit [Remote host closed the connection]
<aquagrunty>
yes
<aquagrunty>
finally switched from web2py to sinatra
<aquagrunty>
for my home server
<aquagrunty>
web2py is nice, but it's killing my memory on my vps
<aquagrunty>
ruby is too, but i like the syntax a bit better
jprovazn has joined #ruby
timonv has quit [Remote host closed the connection]
wermel has quit [Remote host closed the connection]
athst_ has joined #ruby
vlad_starkov has joined #ruby
<topriddy>
shevy: you think? but he had other ruby posts there. basically, i'm just a new guy gaining interest in ruby though...and just been careful. i do java at work. interested in python too. weighing both. completed the shortest ruby tutoral online already
<shevy>
aquagrunty \o/
freeayu_ has quit [Ping timeout: 260 seconds]
freeayu has quit [Ping timeout: 264 seconds]
freeayu has joined #ruby
freeayu_ has joined #ruby
athst has quit [Ping timeout: 265 seconds]
athst_ is now known as athst
<shevy>
topriddy he seems like a pure C hacker
Spami has joined #ruby
Spami has quit [Changing host]
Spami has joined #ruby
<shevy>
the C hackers will forever strive for perfection of execution
tPl0ch has joined #ruby
<shevy>
topriddy back when before I started with ruby, I was considering either python or ruby
main has joined #ruby
karasawa has joined #ruby
<shevy>
php was too awful
<shevy>
I used it for +2 years
<shevy>
both python and ruby have one thing in common - they focus on fun, or happiness
<Mon_Ouie>
hoelzro: Yeah. That was my first contact with Ruby and programmingg too :p
topriddy has joined #ruby
<Hanmac_>
hoelzro: the newer generations XP,VX,VXAce use ruby, the older ones 2k(3) does not have scripting
freeayu_ has joined #ruby
<hoelzro>
crazy, I wasn't aware of that
<topriddy>
shevy: major thing i can cull from that interview is that ruby is designed to make programming fun for Matz. Matz is a standard for what programmers should expect in a language
<Hanmac_>
advertising: (the maker replacement i work on will use ruby as scripting language too)
jds__ has joined #ruby
postmodern has quit [Quit: Leaving]
freeayu_ has quit [Client Quit]
robbyoconnor has quit [Read error: Connection reset by peer]
dmiller has quit [Ping timeout: 260 seconds]
freeayu_ has joined #ruby
robbyoconnor has joined #ruby
nari has quit [Ping timeout: 245 seconds]
mikecmpbll has joined #ruby
KevinSjoberg has joined #ruby
freeayu has quit [Read error: Connection timed out]
ephemerian has joined #ruby
chriskk has joined #ruby
freeayu_ has quit [Client Quit]
blacktulip has joined #ruby
eka has joined #ruby
tomzx has joined #ruby
icole has joined #ruby
frankie_ has joined #ruby
buscon has joined #ruby
hukl has joined #ruby
brunoro has joined #ruby
freeayu has joined #ruby
brunoro has left #ruby [#ruby]
<aquagrunty>
i am still strugglingi to get Sequel on ms sql
<aquagrunty>
DBI works
<aquagrunty>
but sequel doesn't for some reason
<Hanmac_>
hm eigher there is no one interested or all have adblocker on ...
nari has joined #ruby
icole has quit [Ping timeout: 260 seconds]
wreckimnaked has joined #ruby
frankie_ has quit [Remote host closed the connection]
taoru_ has quit [Remote host closed the connection]
slainer68 has joined #ruby
cha1tanya has quit [Quit: Leaving]
emergion has joined #ruby
cha1tanya has joined #ruby
zommi has left #ruby [#ruby]
KevinSjoberg has quit [Quit: Computer has gone to sleep.]
mahmoudimus has quit [Quit: Computer has gone to sleep.]
jds__ has quit [Remote host closed the connection]
ryanf has quit [Quit: leaving]
rdark has joined #ruby
Vainoharhainen has joined #ruby
athst has quit [Quit: athst]
<shevy>
topriddy as the main authority yes. but you did not understand the philosophy yet, it is to make the programmer feel happy
<shevy>
topriddy you compare that with python's militant "my way or the highway, but we must be fun" philosophy
beiter has joined #ruby
marr has joined #ruby
<topriddy>
shevy: like same? meanwhile, are you the same shevy guy i msg some weeks ago last yr that i was picking ruby?
freeayu has quit [Ping timeout: 265 seconds]
asteve has joined #ruby
<shevy>
topriddy no idea, I have a very short term memory here :)
asteve has quit [Client Quit]
<shevy>
if you don't remember, I probably won't either ;)
asteve has joined #ruby
<shevy>
I call that "outsourcing of my brain functions" :P
<topriddy>
lool. cool.
<topriddy>
thanks.
taoru has joined #ruby
<aquagrunty>
oh my
<aquagrunty>
god
<aquagrunty>
i found it
<aquagrunty>
its working
<aquagrunty>
oh my god yes :D Sequel.odbc i love you
chriskk has quit [Ping timeout: 260 seconds]
lkba has quit [Ping timeout: 260 seconds]
<shevy>
everyone seems sleepy
<Hanmac_>
or maybe they are at work like i am
haxrbyte has joined #ruby
Re^ has joined #ruby
Re^ has left #ruby [#ruby]
emergion has quit [Quit: Computer has gone to sleep.]
chriskk has joined #ruby
whowantstolivefo has joined #ruby
freeayu has joined #ruby
haxrbyte has quit [Ping timeout: 246 seconds]
friskd has quit [Read error: Operation timed out]
mahmoudimus has joined #ruby
grzywacz has joined #ruby
koshii has joined #ruby
berserkr has joined #ruby
horofox has joined #ruby
timonv has quit [Remote host closed the connection]
amaya_the has joined #ruby
emergion has joined #ruby
timmow has joined #ruby
gyre008 has quit [Remote host closed the connection]
<amaya_the>
:)
horofox has quit [Ping timeout: 248 seconds]
arietis has joined #ruby
arturaz has joined #ruby
timonv has joined #ruby
haxrbyte has joined #ruby
haxrbyte_ has joined #ruby
zz_chrismcg is now known as chrismcg
coderhut has quit [Quit: Page closed]
nkts has joined #ruby
haxrbyte has quit [Ping timeout: 260 seconds]
dmiller has joined #ruby
whitedawg has quit [Quit: Leaving.]
browndawg has quit [Ping timeout: 248 seconds]
gianlucadv has quit [Read error: Connection reset by peer]
jacktrick has joined #ruby
workmad3 has joined #ruby
dmiller has quit [Ping timeout: 246 seconds]
gianlucadv has joined #ruby
tPl0ch has quit [Quit: Verlassend]
<j0sh\a>
hi guys - I have created a nagios ruby script, but I only want it to alert during normal working hours. How can I do this in ruby?
<j0sh\a>
Something like unless Time.utc between 9-5 ..
dbrgn_ is now known as dbrgn
macfurin has joined #ruby
includex has joined #ruby
emergion has quit [Quit: Computer has gone to sleep.]
macfurin has left #ruby [#ruby]
nomenkun has joined #ruby
nomenkun_ has joined #ruby
RagingDave has joined #ruby
mikekelly has quit [Ping timeout: 265 seconds]
nomenkun has quit [Ping timeout: 248 seconds]
tonini has quit [Remote host closed the connection]
Gooder has quit [Read error: Connection reset by peer]
beneggett has quit [Quit: Computer has gone to sleep.]
coder_neo has joined #ruby
freeayu__ has joined #ruby
zarubin has joined #ruby
horofox has quit [Quit: horofox]
sayan has joined #ruby
sayan has quit [Changing host]
sayan has joined #ruby
wallerdev has quit [Quit: wallerdev]
Pip has joined #ruby
hukl has quit [Quit: Leaving...]
adamh has joined #ruby
timonv has quit [Remote host closed the connection]
zarubin has quit [Ping timeout: 264 seconds]
Beoran__ has quit [Read error: Connection reset by peer]
pencilcheck has joined #ruby
whitedawg has quit [Quit: Leaving.]
zarubin has joined #ruby
gues131 has quit [Quit: sleeping]
Beoran__ has joined #ruby
zarubin has quit [Read error: Connection reset by peer]
zarubin has joined #ruby
timonv has joined #ruby
jacktrick has joined #ruby
Umren|2 has joined #ruby
Hanmac_ has quit [Ping timeout: 245 seconds]
zarubin has quit [Read error: Connection reset by peer]
assurbanipal has quit [Remote host closed the connection]
zarubin has joined #ruby
Umren has quit [Ping timeout: 255 seconds]
havenn has joined #ruby
wallerdev has joined #ruby
fire has quit [Quit: WeeChat 0.3.9.2]
zarubin has quit [Read error: Connection reset by peer]
zarubin has joined #ruby
katherinem13 has quit [Ping timeout: 246 seconds]
wallerdev has quit [Client Quit]
karasawa has quit [Ping timeout: 276 seconds]
katherinem13 has joined #ruby
timonv has quit [Remote host closed the connection]
browndawg has joined #ruby
RagingDave has quit [Quit: Ex-Chat]
havenn has quit [Ping timeout: 276 seconds]
Virunga has joined #ruby
<gokul>
Hello, when I do File.open("test", "r+") { |f| f.write "\n" } it inserts a newline at the begining but first character of the next line is deleted ( previously first line ) ? anyone know why ?
tk_ has joined #ruby
<gokul>
What I want to do is to append text at the begining of a file
wreckimnaked has quit [Ping timeout: 248 seconds]
tvw has joined #ruby
billy_ran_away has quit [Ping timeout: 240 seconds]
karasawa has joined #ruby
slainer68 has quit [Remote host closed the connection]
chussenot has quit [Quit: chussenot]
billy_ran_away has joined #ruby
emergion has quit [Quit: Computer has gone to sleep.]
katherinem13_ has joined #ruby
<csmrfx>
gokul: ri File.open
danguita has joined #ruby
<banisterfiend>
gokul: use "a"
<banisterfiend>
oh
<banisterfiend>
at the beginning
katherinem13 has quit [Ping timeout: 246 seconds]
katherinem13_ is now known as katherinem13
<banisterfiend>
good luck with that, i think your best bet is to read the file into a buffer, write to the start of hte buffer, then write the buffer out back to disk
hukl has joined #ruby
pencilcheck has quit [Remote host closed the connection]
bluenemo has joined #ruby
bluenemo has quit [Changing host]
bluenemo has joined #ruby
yacks has joined #ruby
samphippen has joined #ruby
pencilcheck has joined #ruby
freeayu has quit [Read error: Connection reset by peer]
niklasb has joined #ruby
taoru has quit [Remote host closed the connection]
fir_ed has quit [Ping timeout: 272 seconds]
timonv has joined #ruby
dmiller has joined #ruby
mercwithamouth has joined #ruby
TheFuzzball has joined #ruby
browndawg has quit [Quit: Leaving.]
agarie has quit [Remote host closed the connection]
agarie has joined #ruby
mengu has joined #ruby
kjellski has joined #ruby
browndawg has joined #ruby
dmiller has quit [Ping timeout: 264 seconds]
sie has joined #ruby
<sie>
MRI still has GIL, correct?
yacks has quit [Ping timeout: 246 seconds]
<Pip>
sie, What is GIL
<workmad3>
sie: correct
wermel has joined #ruby
agarie has quit [Ping timeout: 240 seconds]
<sie>
Pip, Hi there Pip. :] Global interpreter lock.
<sie>
workmad3, What's keeping ruby from getting rid of it?
emergion has joined #ruby
<Pip>
sie, How does it work?
<workmad3>
sie: I don't know enough about the internals, but I think it's to do with the architecture of the MRI runtime that makes it difficult to safely remove
<sie>
Pip, Does not allow complete thread parralelization, so only benefit for threads is i/o waiting. (the wording's weird but the idea should be clear)
buscon has quit [Ping timeout: 276 seconds]
freeayu has joined #ruby
<sie>
I was curious exactly about the internals and the problem from ruby dev POV.
Hanmac_ has joined #ruby
<workmad3>
sie: or, in better terms, the runtime only allows one thread of execution to be active at a time
megha has joined #ruby
<sie>
Yea.
blaxter has quit [Quit: foo]
<Hanmac_>
workmad3 what about other threads? like when i do a binding, and inside the C++ side its using its own threading system it should be "semi"-indipent from rubys threading system right?
<workmad3>
Hanmac_: I don't know
<workmad3>
Hanmac_: I would suspect that it would be though :)
moshee has quit [Ping timeout: 264 seconds]
<sie>
Hanmac_, It is, I've tried it.
moshee has joined #ruby
moshee has joined #ruby
<sie>
As long as it has nothing else to stop it from working, it will.
katherinem13_ has joined #ruby
chriskk has quit [Quit: chriskk]
katherinem13 has quit [Ping timeout: 246 seconds]
katherinem13_ is now known as katherinem13
<Hanmac_>
in my bindings i reverse the calling order, so the C++ threads are the ones that call the ruby functions :P
vlad_starkov has quit [Remote host closed the connection]
Banistergalaxy has quit [Ping timeout: 248 seconds]
<clocKwize>
quickly: would a class inherit an initialiser method from a module?
megha has quit [Quit: WeeChat 0.3.9.2]
<clocKwize>
quicky*
Banistergalaxy has joined #ruby
<sie>
Hanmac_, Do you mean if you run ruby code from two independant C threads?
<Hanmac_>
clocKwize, only if in the class method calls super
<sie>
s/c/native/
gokul has quit [Quit: Leaving]
larissa has joined #ruby
<clocKwize>
Hanmac_: k, so assuming I don't define one, it will call the one in the module, if it exists
<clocKwize>
and if I do define one, I need to call super if I want it to call the one from a module
<banisterfiend>
clocKwize: of coures, module inclusion is nearly the same as class inheritance
<clocKwize>
yup :)
topriddy has joined #ruby
mercwithamouth has quit [Ping timeout: 248 seconds]
<Hanmac_>
sie, i dont know .. i only know that my binded lib creates multible threads, and calls the ruby functions from Listener classes, i dont know if they only call them from one thread
haxrbyte has joined #ruby
haxrbyte_ has quit [Read error: Connection reset by peer]
<sie>
Hanmac_, Anyway, if you try to run ruby code from anywhere in parallel, then one will wait for other to finish, that's it. :]
JohnBat26 has joined #ruby
thone_ has joined #ruby
bluOxigen has joined #ruby
skepti has joined #ruby
haxrbyte has quit [Ping timeout: 248 seconds]
cha1tanya has quit [Ping timeout: 248 seconds]
yacks has joined #ruby
thone has quit [Ping timeout: 265 seconds]
<aedorn>
technically you can disable the GIL in MRI and see what it breaks or doesn't break
heshanh has quit [Quit: Page closed]
pencilcheck has quit [Remote host closed the connection]
cha1tanya has joined #ruby
<sie>
The existence of GIL is unacceptable in my mind.
<topriddy>
what is GIL? :/
<banisterfiend>
sie: then use jruby
<sie>
Easier said than done.
<aedorn>
or Rubinius ... 2.0 seems to be shaping up pretty decently.
megha has joined #ruby
serhart has joined #ruby
<heftig>
rubinius doesn't yet support /(?<foo>foo)/=~"foo";foo
<heftig>
yay for obscure features
KevinSjoberg has joined #ruby
dwnichols has joined #ruby
<Hanmac_>
obscure is awsome :P
malkomalko has joined #ruby
ryanjh has quit [Quit: Computer has gone to sleep.]
<JonnieCache>
one does not simply remove the GIL
<hoelzro>
Ruby automatically puts named captures into locals?
buscon has joined #ruby
<sie>
JonnieCache, How come?
sailias has joined #ruby
carloslopes has joined #ruby
<JonnieCache>
lol it was mostly a reference to that LOTR meme
<Hanmac_>
hoelzro yes it does, but only if you do /regex literal with named captures/ =~ "string" , it does not work if you use an regex in a variable
BryanWB__ has joined #ruby
<sie>
JonnieCache, Usually it has a basis.
hukl has quit [Quit: Leaving...]
<JonnieCache>
but as i understand it, the GIL is a fundamental assumption of the interpreters architecture
roadt has joined #ruby
<sie>
Or at least that's what I think :/
hotovson has joined #ruby
<sie>
JonnieCache, A retarded assumption.
<JonnieCache>
so to remove the GIL is to rewrite the whole thing
<hoelzro>
Hanmac_: interesting
<BryanWB__>
JonnieCache: no, just rewrite all the C modules
<sie>
JonnieCache, Doubt it.
ffranz has joined #ruby
<JonnieCache>
well if its that easy why dont you do it
<JonnieCache>
you will be the toast of rubyland
<sie>
Add smaller locks where state matters.
<sie>
That's my question, but no one has an answer really.
<BryanWB__>
anybody having trouble w/ bundle install where there is cucumber in your Gemfile?
<BryanWB__>
it is hanging infinitely for me
<JonnieCache>
its because its fucking hardcore computer science that will make your eyes bleed and there are very few people in the world capable of doing it, and all those people are being paid large amounts of money to do other things which takes up all their time
<Hanmac_>
BryanWB__ "rewrite all the C" ... that is currenly 99.99% of that what i do for ruby :P
<Hanmac_>
of my 5 current working projects are 3 big C++gems and 2 are small ruby gems
<JonnieCache>
python sufferes the same problem and they havent managed to fix it even with vastly more resources than the ruby community
<banisterfiend>
sie: they had a branch where they removed the GIL
<Hanmac_>
so in ruby as in FF, gil is important
<sie>
banisterfiend, What happened to it?
dr_neek has quit [Quit: dr_neek]
katherinem13 has quit [Ping timeout: 248 seconds]
coderhut has joined #ruby
c3vin has joined #ruby
sepp2k has joined #ruby
<banisterfiend>
sie: things actually ran slower without it, i dont remember why exactly. Also, it breaks C a lot of C extensions, and writing C extensinos becomes a lot harder
Choclo has quit [Read error: Connection reset by peer]
vlad_starkov has joined #ruby
<sie>
banisterfiend, not much there in the post
<Hanmac_>
hm my current bindings does not touch the GIL ... so i do neigher a blocking or unblocking ...
arkiver has quit [Quit: Leaving]
arkiver has joined #ruby
<mpfundstein>
the conclusion of the article is funny
<banisterfiend>
sie: it gives a few decent reasons: many existing C extensions would break, many C extensions would run slower, writing C extensions becomes a lot harder,
<mpfundstein>
"Many ruby devs would shoot themselves in the foot if Matz would remove the GIL"
<mpfundstein>
lol
<sie>
banisterfiend, It doesn't say why and that's why I don't belive it.
<sie>
It has statements, but no basis for them.
<sie>
I understand that it's for the normal poeple, but still.
slainer68 has joined #ruby
<banisterfiend>
sie: because if multiple C threads are running at the same time you have to worry about thread safety, currently that's not hte case
c3vin has quit [Ping timeout: 240 seconds]
<banisterfiend>
sie: majority of C extensions at the moment know they wont execute concurrently with other ones, so they dont bother building in thread safety
<sie>
Then it's shitty code.
tommyvyo has joined #ruby
<mpfundstein>
no
<sie>
Yes.
<mpfundstein>
its the same in unix
<Hanmac_>
mpfundstein like :" You shoot yourself in the foot and then have to justify it to all your friends who are still naively using Perl. "
<sie>
o.O
<mpfundstein>
you have strtok
<banisterfiend>
sie: That's a stupid thing to say, it's YAGNI code, it's good.
<mpfundstein>
for example
<mpfundstein>
which is absolutely not thread safe
<banisterfiend>
sie: why build in thread safety (which is hard to get right) when you dont need to?
<mpfundstein>
in order to make it threadsafe they invented strtok_r
<mpfundstein>
ruby is how old?
<mpfundstein>
199x
adkron has joined #ruby
<JonnieCache>
sie: again, if you are in a position to dish out such criticism then surely you are in a position to fix it with ease
<banisterfiend>
sie: it increases boilerplate and complexity of your code, and it's totally unnecessary when you have guarantees that it's not going to be running concurrently
megha has quit [Quit: WeeChat 0.3.9.2]
<mpfundstein>
banisterfiend: well, avoid globals, make context structs, pass them through your functions, dont rely on state.. there are some rules which can make thread safety "easier"
<banisterfiend>
mpfundstein: no shit, there's lots of ways to write threaded code, but when you have guarantees that your code is not going to be running in a threaded environment do you really want to bother with any of that?
<sie>
My point is that ruby needs good threaded code. I think being afraid of doing threaded code is immature.
<mpfundstein>
banisterfiend: word to that
<topriddy>
GIL = Global Interpreter Lock. #NoThanks
<mpfundstein>
sie: have you ever written a large scale multithreaded program ?
vlad_starkov has quit [Read error: Connection reset by peer]
<csmrfx>
so, seleniuming
<csmrfx>
what should I use to drive a browser?
<csmrfx>
(with ruby)
vlad_starkov has joined #ruby
coder_neo has quit [Ping timeout: 276 seconds]
<matti>
Is this another "we hate GIL" thing going?
szck has joined #ruby
<sie>
mpfundstein, No, not too big.
<banisterfiend>
sie: If you want a ruby implementation without a GIL, use JRuby, thousands of people do already. MRI is not likely to remove the GIL any time soon.
tommyvyo has quit [Client Quit]
megha has joined #ruby
wuzzzzaah has joined #ruby
coder_neo has joined #ruby
<mpfundstein>
sie: well if you did, than you sould know about the pain :-)
<csmrfx>
sie: you can start solving the problems associated with MRI GIL any time you like
<csmrfx>
if you want good threaded code, how about trying jruby
<matti>
csmrfx: He is trolling, is he?
<Hanmac_>
sie and about bindings ... how can you write an threadsafe binding if the binded lib is not threadsafe?
akl_ has joined #ruby
<csmrfx>
Sure, and I can also code *anything*
<sie>
That's not the issue.
<csmrfx>
topriddy: you can
<csmrfx>
Can be done, but *time* is limited
<sie>
trolling... ...
<sie>
You can make everything thread safe.
<topriddy>
can someone tell me if ruby is thread safe? can i write multithreaded apps in ruby like i would do in java?
<csmrfx>
topriddy: well, I dont know if *you* can do it, but it is possible
<topriddy>
and i sure hope simple case such as asynchronous activities is provided for
<csmrfx>
topriddy: exactly as in java
jacktrick has quit [Quit: Leaving]
<csmrfx>
(with jruby)
<topriddy>
like click send email html form button, send email at background, return a email sent/processing page.
<matti>
"Ruby is thread safe" -- what is wrong with this statement? ;]
<csmrfx>
now go write some and report back once you have threaded code
Morkel has joined #ruby
<apeiros_>
the world is thread safe!
<JonnieCache>
hes not trolling its just the arrogance of youth :)
<csmrfx>
my shirt is threaded
<matti>
JonnieCache: Or stupidity.
wreckimnaked has joined #ruby
<JonnieCache>
everyone is like that in that ~1.5year gap when they have a lot of skills but little professional experience
szck has quit [Ping timeout: 256 seconds]
<matti>
JonnieCache: s/they have/they think they have/
<JonnieCache>
one has to fuck up at least one big project and have their dreams crushed
danguita has quit [Ping timeout: 252 seconds]
nari has joined #ruby
jlast has joined #ruby
<matti>
JonnieCache: Sadly, we have more Sparkly Developer Ninjas as of late than ever.
dmiller has joined #ruby
<sie>
JonnieCache, Attacking me doesn't prove you're right.
<matti>
JonnieCache: Every one is a developer nowadays. Your nerd-next-door too, probably.
<JonnieCache>
i dont need to prove im right. its not a competition.
aganov has quit [Ping timeout: 276 seconds]
<matti>
JonnieCache: +1
<matti>
:)
<sie>
..
aganov has joined #ruby
<csmrfx>
And then, we continued, on topic, about *real* problems we actually experienced with ruby solutions....
<csmrfx>
...and forgot all the imaginary ones that are of no relevance
<sie>
I think it is a real problem, maybe only not as important as other ones.
<sie>
We're all entitled to our own opinion. :]
<JonnieCache>
but yeah sorry i was being a bit rude. didnt mean to. its just something ive seen before. i was that guy once. thinking i could automatically conquer any problem just because i could do CS stuff like write concurrent compilers
dr_bob has quit [Quit: Leaving.]
<csmrfx>
sie: if you have a real proble, then you can pastie or gist your problem and the error and we can try to help you
<csmrfx>
*problem
c3vin has joined #ruby
<sie>
JonnieCache, I'm simply discussing. I'm not saying „I CAN DO IT!“ or that it's easy. I was wondering why and people jumped onto thinking I'm simply the new guy, which although is true, isn't revelant to the question.
<mpfundstein>
sie: that is like you discuss with someone the internals of an BMW engine without now what a sparking plug does
jlast has quit [Ping timeout: 260 seconds]
dmiller has quit [Ping timeout: 264 seconds]
RagingDave has joined #ruby
<mpfundstein>
sie: i cant argue how hard it would be to implement it in ruby as i dont know the ruby src... but i know how freaking hard it is to write *good* threaded code
<mpfundstein>
sie: and its not because the language requirements differ etc.. the problem is that the threaded code is incredible hard to follow and threading must be planned upfront to receive good results
c3vin has quit [Ping timeout: 240 seconds]
[1]c3vin is now known as c3vin
mercwithamouth has joined #ruby
<csmrfx>
is the GIL problem actually about the underlying C libs...
wuzzzzaah has quit [Quit: wuzzzzaah]
akl_ has quit [Remote host closed the connection]
adambeynon has joined #ruby
ner0x has joined #ruby
ffranz has joined #ruby
coderhut_ has joined #ruby
nwertman_ has joined #ruby
coderhut has quit [Quit: Page closed]
<workmad3>
I know the rubinius runtime has managed a lot of progress towards removing the GIL there... I remember (I think it was from a RR podcast) a discussion that I seem to recall pointing out that doing it in rubinius had very little impact on achieving the same in MRI though, because of differing architectures and general implementation
serhart has quit [Quit: Leaving.]
nwertman has quit [Ping timeout: 260 seconds]
chussenot has joined #ruby
<Hanmac_>
my gems are mostly work on MRI and rubinius too
<workmad3>
I don't have a massive problem with the GIL though, tbh... I find it much easier when I need concurrency to start down the multi-process route
<workmad3>
bit of extra overhead for multiple ruby processes, yes, but much simpler to conceptually follow what's happening IMO
<matti>
workmad3: +1
<topriddy>
for an experienced java developer, wanting to play with ruby in spare time? do i have to concern myself with all these brouhahas?
<workmad3>
topriddy: not really
haxrbyte has joined #ruby
<workmad3>
topriddy: the GIL is just an aspect of the runtime that limits performance in threaded, CPU-bound apps running on multi-core machines
mjolk has joined #ruby
whitedawg has joined #ruby
sayan has quit [Read error: Connection reset by peer]
<workmad3>
topriddy: if you're just playing in your spare time, I doubt you'll hit any real issues with it (and if you're an experienced java dev, you may want to play with jruby anyway... stays on the JVM, no GIL, and interops well with standard java libs from what I've heard)
mark_locklear has joined #ruby
<matti>
workmad3: ... and has its own set of peoblems.
<matti>
problems*
dr_neek has joined #ruby
<workmad3>
matti: yeah :)
haxrbyte_ has joined #ruby
clocKwize has quit [Read error: Connection reset by peer]
<matti>
If, before even using the language for some time you are already worried about things like GIL.
invisime has joined #ruby
<matti>
I dare to say "you are doing it wrong".
KL-7 has joined #ruby
<workmad3>
matti: :D
<matti>
Its like fallacy of pre-mature code optimisation.
<matti>
With that being said, this paranoia can extend way futher.
<matti>
Like.
clocKwize has joined #ruby
<matti>
I should stop sleeping knowing that my DDR memory which is unbuffered and non-ECC may cause parity errors during RAS/CAS
<matti>
OMG
<matti>
That is dissasterous.
hamed_r has quit [Quit: Leaving]
<matti>
Lets panic now.
bluOxigen has quit [Ping timeout: 246 seconds]
jpfuentes2 has joined #ruby
<workmad3>
matti: what???
* workmad3
removes all sleeps from all code running on his machine
<workmad3>
must avoid parity errors!!!!
bluOxigen has joined #ruby
<matti>
workmad3: No, sleep as "my sleep".
horofox_ has joined #ruby
<sie>
my $sleep;?
<JonnieCache>
matti: just thing about all those cosmic rays fucking up your data?
<matti>
workmad3: You know, with the dreams of me being super successful surrounded by beautiful women.
<JonnieCache>
oops
x0F has quit [Disconnected by services]
vlad_starkov has quit [Remote host closed the connection]
x0F_ has joined #ruby
<JonnieCache>
s/thing/think
<matti>
JonnieCache: OMG NO NO NO
<workmad3>
matti: ah right, those things :)
<matti>
JonnieCache: You fream me out.
Proshot has joined #ruby
x0F_ is now known as x0F
<matti>
:<
<JonnieCache>
cosmic rays apparently flip bits in computers quite regularly
<matti>
Hehe
<workmad3>
JonnieCache: time to wear that lead hat to block all those damn cosmic rays
<matti>
sie: People discover threads, get all excited about them...
akl_ has joined #ruby
KL-7 has quit [Quit: Leaving]
NimeshNeema has joined #ruby
<matti>
sie: Start using it and then go "OMG this thing is hard".
<matti>
sie: Then, later they discover event-driven programming paradigm.
<matti>
sie: Again, get all excited... start using it.
banisterfiend has quit [Remote host closed the connection]
<matti>
sie: And again go "ZOMG this thing is also HARD cookie",
cha1tanya has quit [Quit: Leaving]
<sie>
I've used threads, it's not the silver bullet, but I found a good application for them.
moshee has quit [Ping timeout: 260 seconds]
<matti>
sie: The problem is, that often people confuse when to use processes, threads and what is really parallel vs concurrent.
nwertman_ has quit [Ping timeout: 276 seconds]
moshee has joined #ruby
moshee has joined #ruby
moshee has quit [Changing host]
<matti>
sie: And as proven by many projects out there "striving for simplicity always pays off".
<Hanmac_>
try brownees from the second last christmas ... this are HARD cookies :P
<sie>
I know, I'm already in high school!
<workmad3>
threads are basically just a way of setting up processes with uncontrolled shared memory
<sie>
Hanmac_, haha
<workmad3>
which we then spent decades figuring out how to add control back to the access
<matti>
Hanmac_: Now that is borderline S/M ;p
Villadelfia_ has joined #ruby
megha has quit [Quit: WeeChat 0.3.9.2]
SeySayux has quit [Ping timeout: 260 seconds]
nari has quit [Ping timeout: 248 seconds]
<matti>
I am just waiting for conversation about how Ruby optimises tail-recursion to happen.
<matti>
:)
<matti>
It will trully be the cherry on the top ;p
<matti>
God, one can miss good old FUD on usenet ;p
<workmad3>
:)
blueOxigen has joined #ruby
<matti>
But IRC fill the gap just right.
<ner0x>
How can I remove all gems and reinstall using rvm?
<matti>
fills*
Villadelfia has quit [Ping timeout: 260 seconds]
<workmad3>
ner0x: is this with a ruby that's already installed with rvm?
<csmrfx>
So many good rubyists with time to irc it's amazing!
QKO_ has quit [Read error: Operation timed out]
<sie>
ner0x, rm -rf ~/.rvm
<workmad3>
csmrfx: you're assuming we're good rubyists? :)
<workmad3>
sie: no
QKO has joined #ruby
<csmrfx>
workmad3: I know
<workmad3>
sie: if you want to do that, at least use rvm implode
<matti>
csmrfx: I am not a Rubist ;p
bluOxigen has quit [Ping timeout: 276 seconds]
mikecmpbll has joined #ruby
<matti>
csmrfx: I am this unique AI that lurks on the net, and happens to read IRC ;p
<sie>
matti, *rubyist, I think
SeySayux has joined #ruby
<apeiros_>
rubynaut
<csmrfx>
rubbyers?
* apeiros_
is a rubynator
<matti>
I just do Ruby Gangname style.
* matti
always wanted to say that ;p
<matti>
Or, whatever the correct spelling is ;p
<ner0x>
workmad3: I can rvm remove and rvm reinstall? Or possibly delete an .rvm/gems/* dir?
<matti>
apeiros_: Haha
<matti>
apeiros_: :)
<csmrfx>
Ruby tuesday...
carloslopes has quit [Remote host closed the connection]
jonathanwallace has quit [Read error: Operation timed out]
<workmad3>
ner0x: you should be able to do it with 'rvm gemset empty'
<ner0x>
workmad3: I'll try it.
platzhirsch has joined #ruby
<Spami>
hey guys what tools/services are you using to test a website in order to make sure it's cross browser ?
<workmad3>
ner0x: not sure if that'll work with the default gemset... you might need to ask in #rvm about that :)
<platzhirsch>
Is there a convention for maximum column width in ruby files?
<ner0x>
workmad3: I need to figure out gemsets.
blueOxigen has quit [Ping timeout: 248 seconds]
dmiller has joined #ruby
tommyvyo has joined #ruby
<workmad3>
matti: Gangnam style!
<workmad3>
matti: although it's now 2013... we need the new gangnam style now...
<matti>
sie: I am sure that if you happen to remove GIL form Ruby this type of events may follow: millions will love you (like they did with Elvis), DHH will propose a marriage, and Google will hire you for a lot of $$$ on the spot asking whether you want to have 120 square-meter office with the view of the ocean, or prefer split-level penthouse office in NYC.
<matti>
sie: Meanwhile, get cracking with normal Ruby.
<lupine>
platzhirsch, 80 columns, as ever
nwertman has joined #ruby
<workmad3>
matti: I suspect EY would be more likely te come up with the job offer, rather than google :)
<workmad3>
matti: google is more python
<platzhirsch>
lupine: thanks
carloslopes has joined #ruby
<matti>
workmad3: I was just being hysterical ;p
<workmad3>
matti: that's no reason to be completely crazy ;P
<ner0x>
workmad3: Nope, removed rails, etc. That works.
<matti>
workmad3: :S
<matti>
workmad3: hehe
<lupine>
if you want to be really conservative, 72 columns, but rubyists aren't known for that
<lupine>
don't be surprised to occasionally come across lines hundreds of columns wide, though
<matti>
lupine: We all have 27" Thunderbolt displays, dont we ;p
griffindy has joined #ruby
<workmad3>
lupine: I push the boat out with SMS columns... 160 chars
bluOxigen has joined #ruby
<matti>
lupine: 120 is teh gig on them ;p
<workmad3>
programming maxim #80: If your screen is wider than 80 characters, your font size is too small
<lupine>
these days, I make use of the extra horizontal space by tiling editors
dmiller has quit [Ping timeout: 246 seconds]
<lupine>
I did consider moving my screen into its supported portrait mode
aedorn has quit [Quit: Leaving]
szck has joined #ruby
<sie>
matti, Why are you telling me this?
<csmrfx>
I like the vert position
<matti>
sie: Voices made me ;]
sailias has quit [Quit: Leaving.]
<csmrfx>
Did you know that having your windows visible, requiring only eye+head movement vs window or view increses your productivity by up to 10%
nemesit has joined #ruby
asteve has quit [Quit: Computer has gone to sleep.]
<platzhirsch>
How can I wrap lines in Ruby if they succeed 80 characters? Is there a formatting rule?
<lupine>
(I don't even come close to following all that)
<platzhirsch>
lupine: thanks for pointing out :)
<platzhirsch>
what a pitty, I like the idea of PEP8 for Python, Vim checks every time I save the file
CaptainKnots has joined #ruby
CaptainKnots has quit [Changing host]
CaptainKnots has joined #ruby
jonathanwallace has joined #ruby
<workmad3>
platzhirsch: python very much subscribes to the idea of 'one (accepted) way to do anything and everything'
<workmad3>
platzhirsch: ruby subscribes to the idea of 'one size does not fit all'
* apeiros_
still thinks 80cols rule runs counter the notion of descriptive method- & variable names
<platzhirsch>
workmad3: but offering multiple alternatives at the same time
<apeiros_>
platzhirsch in an 80col world would be called pltzhrsch
<apeiros_>
or plhr
<workmad3>
platzhirsch: a strict 80 col limit would mean a line was wrapped the moment I had 81 chars... I prefer flexibility, if I have 81 chars I may keep it on one line or split it, depending on which seems neater
<platzhirsch>
apeiros_: yes, throwing many underscores into the names and writing a full sentence
zyriuse_ has joined #ruby
vlad_starkov has joined #ruby
<lupine>
apeiros_, given some of the method names i've come up with in the past, the 80-col limit is helpful, I would contend
<zyriuse_>
help
<lupine>
it's a gentle encouragement to keep things broken up
<apeiros_>
lupine, platzhirsch: I didn't say that a single name would be 80 cols
<apeiros_>
but usually you have more than a single method/variable in a line, don't you?
<platzhirsch>
apeiros_: absolutely
<lupine>
sure, the example that immediately sprang to mind looked a bit like foo_is_bar && bar_is_baz && xyz_is_a_kind_of_nice_thing ? do_my_stuff : do_my_other_stuff
<lupine>
(phew, that is > 80 cols)
<apeiros_>
lupine: the difference between concise & verbose…
fuzai has joined #ruby
<workmad3>
platzhirsch: think of it like this... would you rather be completely untrusted and have a rule dictated to you that you must never go over 80 cols, or would you rather be trusted and be able to go over that amount if it made sense to do so?
<lupine>
I use descriptive names and in general, if I find my lines going over 80 cols, it's because there's a concept waiting to be reified
<lupine>
not always true, of course
<llaskin>
so I just switched from 1.8.7 to 1.9.3. In the process I had to redefine the String.is_binary_data?, however, I'm still getting an issue where something that *WAS* a string before and when printed out via puts outputed "blah" now outputs [["blah"]]. Even when I run a String#to_s on it, the value of it still remains [["blah"]]
<llaskin>
any thoughts?
<apeiros_>
lupine: my experience is that people tend to blindly shorten names when forced to use 80 cols. if you've better experience, good for you.
<platzhirsch>
workmad3: I cannot decide that without taking programming into context, I like both. The freedom Ruby offers here and the restriction for instance Java puts on it (for example one class per file, more or less]
<apeiros_>
I prefer not blindly applying measures
<fuzai>
Hi i'm very new to ruby again ( i tried it years ago ) and i'm trying to install a module I pulled from a git repo and it's documentation is lacking. https://github.com/obrie/turntabler is what i'm trying to use and after i do the two command it lists and it claims it's installed the module, my test script borks as the the require for the library
<csmrfx>
Dont your editors support wrapping?!
<workmad3>
lupine: exactly :) while it might be generally the case, it isn't a universally true rule
mrsrikanth has joined #ruby
<fuzai>
could someone explain to me what i need to do to install that module correctly?
kevinfagan has quit [Quit: Leaving...]
<csmrfx>
llaskin: impossible, unless you changed .to_s
<fuzai>
i'm using ubuntu 12.04.01 and ruby -v says 1.9.3
<workmad3>
csmrfx: I turn it off because I hate line wrapping
<llaskin>
csmrfx: but yet, it's happening.
Banistergalaxy has quit [Ping timeout: 256 seconds]
<csmrfx>
llaskin: because you changed .to_s
<llaskin>
sadly i can't create a "minimal working example"
<llaskin>
i did NOT change to_s.
<workmad3>
llaskin: if it's [["foo"]], then .to_s will produce "[[foo]]"
<csmrfx>
fuzai: please pastie or gist your session and errors so people can help troubleshoot
<platzhirsch>
csmrfx: it does
<apeiros_>
llaskin: sounds to me like you had an array before
<topriddy>
anyone willing to share sample dev environment/tools for their ruby environment on mac?
Zolrath has quit [Ping timeout: 255 seconds]
<fuzai>
exit
fuzai has quit [Quit: Leaving]
megha has quit [Quit: WeeChat 0.3.9.2]
anannie has joined #ruby
dmiller has quit [Ping timeout: 248 seconds]
allsystemsarego has joined #ruby
<llaskin>
going result.to_a.flatten prints out ["llaskin"]
<llaskin>
so flatten.flatten?
arkiver has quit [Ping timeout: 248 seconds]
megha has joined #ruby
<anannie>
I've noticed something strange; I'm trying to get an approximate square root by doing a bitwise shift to the right and for some reason this operation is slower than doing Math.sqrt... Why is that? Further why does the bitwise right operation return nil for the variable it's done on?
GoGoGarrett has joined #ruby
<ner0x>
https://gist.github.com/4484000 gem install therubyracer error Any help would be appreciated. I'm assuming it's a version mismatch.
<llaskin>
result.to_a.flatten.flatten doesn't work neither does result.to_a.flatten.to_s. Both result in "[\"llaskin\"]" as their output
jjbohn has joined #ruby
<apeiros_>
.flatten.flatten is pointless
<apeiros_>
flatten already recurses
<apeiros_>
["llaskin"].first # => "llaskin"
<apeiros_>
if you have multiple, use .join
<apeiros_>
but I'd clean up whatever creates that mess in the first place…
jpfuentes2 has quit [Quit: Computer has gone to sleep.]
sailias has joined #ruby
digifiv5e has joined #ruby
jtharris has joined #ruby
jpfuentes2 has joined #ruby
zyriuse_ has quit [Quit: leaving]
<anannie>
Here are the two identical pieces of code and for some reason, the first one will run slower, than the other. Despite the fact that bitwise operations should be faster! https://gist.github.com/4484088
miskander has joined #ruby
<llaskin>
apeiros_: its the mysql gem
<llaskin>
mysql2 gem that is
<llaskin>
sorta out of my hands without hacking the gem...which I really don't wann do
kpshek has joined #ruby
banisterfiend has joined #ruby
<apeiros_>
llaskin: I doubt that the mysql2 gem is the issue…
<Hanmac_>
about unit test cases ... what about calling assert_equal in a loop ? i i use it to look if an enumerator returns the right elements at the right time?
<llaskin>
apeiros_: first still outputs ["llaskin"]
<topriddy>
good advised online ruby tutorial
geekbri has joined #ruby
<apeiros_>
llaskin: then you're not telling the whole story.
<llaskin>
i am giving you the entire code that produces this
<ericwood>
topriddy: yes. It's been too long since I learned, I'm not sure what the best guides are now
<ericwood>
so, sorry :P
<Hanmac_>
topriddy its not "ruby code", its more than "rubys code" :P
megha has quit [Quit: WeeChat 0.3.9.2]
<ericwood>
builds character
<Hanmac_>
its more a wordpun :P
amaya_the has quit [Ping timeout: 265 seconds]
Guest25886 has joined #ruby
<llaskin>
apeiros_: the value stored in the db wwhere I have llaskin of type the value table is of type varchar(1024).
breakingthings has joined #ruby
hasse has joined #ruby
<llaskin>
the method I am using is identical except I changed the hostname/username/passwd
<llaskin>
what else would you like of the story?
willob has quit [Quit: Leaving.]
amaya_the has joined #ruby
dr_bob has joined #ruby
ndrei has quit [Ping timeout: 252 seconds]
bluOxigen has quit [Ping timeout: 264 seconds]
<topriddy>
Hanmac: ericwood: trolls arent amusing when you have a real life problem to solve.
<topriddy>
ericwood: I have 2007 little book of ruby.
<llaskin>
i'm definitely not trolling...just trying to get help
fuzai has joined #ruby
* Hanmac_
learned ruby without an real ruby book ....
<ericwood>
topriddy: the Ruby koans are not a bad starting point, but it really depends on how much you know about it already and your previous programming experience
<Hanmac_>
i dont even rememeber how i learned ruby ...
callenb has quit [Quit: Leaving.]
tchebb has quit [Read error: Connection reset by peer]
Takehiro has joined #ruby
digitalsanctum has joined #ruby
<ericwood>
Hanmac_: yeah, I did a little bit of everything and wrote shitty code until it clicked, so I always have trouble answering that question :\
<topriddy>
llaskin: same here. good luck.
<fuzai>
http://pastie.org/5648309 could someone please explain to me what the double || on the first line means?
* ericwood
maintains that his joke earlier was funny and not terribly detrimental.
<workmad3>
fuzai: it's a block parameter
<llaskin>
fuzai: thats going to do it for each user that is inside of client
Nisstyre-laptop has joined #ruby
<Hanmac_>
fuzai its like a variable in a for loop
<fuzai>
is there something I could google that would explain that more in depth?
<fuzai>
oh ok
clocKwize has quit [Quit: clocKwize]
megha has joined #ruby
<fuzai>
ohhhhh i think i get it now
<fuzai>
thank you
clocKwize has joined #ruby
<anannie>
I've googled everywhere and I can't find this on any listing
<fuzai>
sorry i understand perl and php and some other things and the last time i looked at ruby was a few years ago for a brief while
<llaskin>
fuzai sure, try to take a look at how blocks work in ruby. Take a look at the array.each definition or an example of how the each block works
chussenot has quit [Quit: chussenot]
<fuzai>
could you give me a good link to read up?
<fuzai>
i'm good at reading things :)
<anannie>
fuzai: Try Zed Shaw's Learn Ruby The Hard Way
mercwithamouth has quit [Ping timeout: 252 seconds]
hotovson has quit [Remote host closed the connection]
tchebb has joined #ruby
ttt has quit [Ping timeout: 245 seconds]
<apeiros_>
llaskin: as said, figure out what you really have
<workmad3>
anannie: you'd need to look at the implementation of >> for a fixnum
<apeiros_>
if .first is still the same as without, then you do not have an array.
Nisstyre-laptop has quit [Quit: Leaving]
<anannie>
I mean the first piece of code with a bitwise shift to the right should work faster than the one that uses the internal Math.sqrt function. I keep on going through the code, I've googled everywhere and there really isn't any reason why the first implementation is slower and note that it isn't slower by a few milliseconds but by a few seconds https://gist.github.com/4484088
Fox_candy has left #ruby [#ruby]
<anannie>
I have workmad3
carloslopes has quit [Remote host closed the connection]
chussenot has joined #ruby
<workmad3>
anannie: because you need to keep in mind that 'num >> 1' isn't a bitshift... it's 'num.>>(1)'
<Hanmac_>
hm it seems that the server time is wrong :/
<apeiros_>
llaskin: anyway, result probably is not an array.
<ericwood>
I need a desk clock that just outputs the Unix time
<apeiros_>
llaskin: and as I told you, you should figure out what it is, then read the docs of whatever it is.
<Hanmac_>
did you guys see that? the eval-in bot is from the future :D
<llaskin>
result is of type MYSQL2 element
<workmad3>
anannie: also, even for small numbers dividing by 2 is a big difference compared to sqrt... for 16, you're running the loop twice as much as you need, for 25 you're running it almost 3 times...
thone has joined #ruby
<llaskin>
i def spent time looking at the docs for it
<Hanmac_>
llaskin: than it may call Object.to_a with per default is [object] ... maybe
<apeiros_>
llaskin: ah, no, :as => :array - you do get an array of arrays back
hasse has quit [Ping timeout: 245 seconds]
<workmad3>
anannie: and I bet Math.sqrt(16) is more efficient than running 'number = number / prime and factor_list << prime if number % prime == 0' 4 times ;)
v0n has joined #ruby
<anannie>
workmad3: Ah, that explains it. :)
<apeiros_>
llaskin: I said ["foo"].first # => "foo"
lateau has joined #ruby
<apeiros_>
but you have [["foo"]], and then of course .first gives you just ["foo"]
<llaskin>
yea result.class is actually of type Mysql2::Result
<anannie>
workmad3: What I was trying to implement was a series of shifts depending upon the size of the number to arrive at an approximate root.
<workmad3>
anannie: yeah, once you start thinking in terms of actual numbers, it gets clearer :)
<apeiros_>
if you only want one row and one field, there's probably a method on Mysql2 to do that for you
<anannie>
workmad3: I should implement that first and then compare things, because it really depends upon the order of magnitude
<Hanmac_>
llaskin hm if you do "as array" than its totaly normal that an array of arrays ... array of rows, while a row is a array => so an array of arrays ... that else did you expect?
nathancahill has joined #ruby
ananthakumaran has joined #ruby
<apeiros_>
indeed, seems mysql2 is rather minimal in the provided functionality.
<apeiros_>
oh, cross poster…
<workmad3>
apeiros_: it's a db adapter... I wouldn't expect it to provide much
<apeiros_>
workmad3: I'd expect it to cover the underlying client lib
<llaskin>
apeiros_: yea but the mysql gem all of a sudden stopped working...don't ask me why, and i didn't want to waste time figuring out....and in 1.8.7 the prior code which was result.to_a.to_s worked.
<apeiros_>
granted, mysql is a wee bit in the past, but the client lib could most certainly more than that
buscon has quit [Read error: Connection reset by peer]
thone has quit [Ping timeout: 240 seconds]
buscon has joined #ruby
<workmad3>
I don't know what the client lib has... would it really have much more than how to establish connections with various options?
scruple has quit [Ping timeout: 240 seconds]
<workmad3>
and converting the results into objects suitable for ruby
<Hanmac_>
1.8.7 is dead and the support will end in less than six months ... so what will you do? (and what will apple do?)
<llaskin>
Hanmac exactly why I am trying to migrate to 1.9.3 NOW.
megha has joined #ruby
<shevy>
LONG LIVE 1.8.7!!!
<llaskin>
and thus dealing with issues.
<Pip>
Will Ruby 2.0 be fabulous?
<shevy>
Pip better than your mom!
beneggett has joined #ruby
callenb has left #ruby [#ruby]
Elhu has quit [Ping timeout: 252 seconds]
<Hanmac_>
2.0 will be better than 1.9.3-p362
<llaskin>
but will it work well with windows
Villadelfia_ is now known as villadelfia
<shevy>
the earlier ruby versions worked well with windows
<ericwood>
really?
<shevy>
why do you ask whether future versions would not work, that doesn't make a lot of sense
<shevy>
yes
Elhu has joined #ruby
<ericwood>
I remember people bitching about it, and hearing that it got better with newer versions
<llaskin>
shevy cuz I've had to do some kludging to make 1.9.3 work with windows
<llaskin>
or that is the ruby-debug-ide gem...
<shevy>
I have had no problems with ruby on windows
vlad_starkov has quit [Remote host closed the connection]
<JonnieCache>
its partly because the community has no interest in supporting windows users
jgarvey has joined #ruby
<JonnieCache>
so there was always a lack of resources for them
coderhut_ has quit [Ping timeout: 245 seconds]
<JonnieCache>
(when i say no interest there are obviously exceptions)
KevinSjoberg has quit [Quit: Computer has gone to sleep.]
wroathe has quit [Ping timeout: 246 seconds]
tk_ has quit [Quit: ばいばい]
pencilcheck has joined #ruby
AndIrc___ has quit [Ping timeout: 255 seconds]
philcrissman has joined #ruby
joshcheek has joined #ruby
rdark has quit [Ping timeout: 260 seconds]
joshcheek has quit [Client Quit]
* Hanmac_
supports plattform indipent libs ... so my gems should work on the same systems as the libs doo
sayan has joined #ruby
sayan has quit [Changing host]
sayan has joined #ruby
topriddy has quit [Quit: Leaving.]
phantasm66 has joined #ruby
phantasm66 has joined #ruby
phantasm66 has quit [Changing host]
theRoUS has joined #ruby
theRoUS has quit [Changing host]
theRoUS has joined #ruby
rdark has joined #ruby
Liothen has quit [Remote host closed the connection]
<banisterfiend>
Hanmac_: do your gems exist or are they vaporware
<Hanmac_>
they exist as reopsitories but they are not finish
<ericwood>
My gems aren't Finnish, either
fermion has joined #ruby
miskander has quit [Quit: miskander]
* Hanmac_
thinks that my gems are faster finish than Berlins new Airport
freeayu__ has quit [Remote host closed the connection]
DatumDrop has joined #ruby
supergiantrobot has joined #ruby
larissa has quit [Quit: Leaving]
hotovson has joined #ruby
serhart has joined #ruby
x82_nicole has joined #ruby
asteve has joined #ruby
miskander has joined #ruby
dmiller has joined #ruby
pcarrier has joined #ruby
stopbit has joined #ruby
joshman_ has quit [Quit: Computer has gone to sleep.]
mrsrikanth has quit [Quit: Leaving]
<banisterfiend>
Hanmac_: got a link to them?
digifiv5e has quit [Changing host]
digifiv5e has joined #ruby
carloslopes has joined #ruby
<ericwood>
I'm *this* close to just telling my shell to stick "bundle exec" in front of every command :|
end_guy has joined #ruby
<apeiros_>
ericwood: just alias a couple
<ericwood>
I do
<ericwood>
it's just the principal of the thing, ya know?
megha has joined #ruby
<apeiros_>
I used a function which checks for presence of Gemfile and in case there is, uses bundle exec $@
<banisterfiend>
ericwood: rvm does that by default
<ericwood>
that's actually a great idea
alexspeller has joined #ruby
<rismoney>
i am doing an myarray.each {|item| ..whole bunch of stuf..} and I want to create within the iterate a hash that looks like :item => somevar where item is now a symbol
<ericwood>
banisterfiend: yeah but I don't trust it
dmiller has quit [Ping timeout: 240 seconds]
<banisterfiend>
ericwood: it's annoying as fuck, i turned it off
_nitti has joined #ruby
<ericwood>
rismoney: sounds like you want map instead of each
<banisterfiend>
or each_with_object({})
<ericwood>
ah, yes, that!
<banisterfiend>
rismoney: where do you get the symbol from? how do u know what ot make the key ?
<ericwood>
enumerable has too many neat functions to keep straight
<end_guy>
I have a class that is already defined, but when that class gets used I would like it to be overriden and just return a different class altogether. Is this possible?
<rismoney>
can i do a .to_sym? on item?
<alexspeller>
rismoney depends what class item is
<banisterfiend>
rismoney: you can try :) probably safter to go item.to_s.to_sym though
<rismoney>
item is a string
<ericwood>
you can do it, then
<alexspeller>
oh to_sym will work no problem then
<ericwood>
or .intern
DatumDrop has quit [Remote host closed the connection]
<ericwood>
that one will fetch you a cup of coffee as well
<end_guy>
i.e. I have class A; ...; end, and class B; ...; end. When class A is used, I want it to return/use class B. Is that possible?
mercwithamouth has joined #ruby
horofox_ has joined #ruby
<ericwood>
define "is used"
<banisterfiend>
end_guy: A = B
<end_guy>
Ok. That did seem to work when I tried it, but it made some errors in a different part of the application I'm working on.
<banisterfiend>
end_guy: class constants can be reassigned, you'll get a warning, but it will work
<end_guy>
banisterfiend: Thanks :-)
AndIrc___ has joined #ruby
m_3_ has quit [Quit: leaving]
reactormonk has quit [Ping timeout: 260 seconds]
<Hanmac_>
you could make a function get_right_class(*args) and return in them A or B depending on the parameters
kpshek has quit []
<apeiros_>
OH: "plug & play", no, no, it's "plug & pain", wait, no, it's "plug & pay"…
AndIrc_46 has joined #ruby
AndIrc___ has quit [Read error: Connection reset by peer]
carloslopes has quit [Ping timeout: 248 seconds]
bean has joined #ruby
matschaffer has joined #ruby
Neomex has joined #ruby
m_3 has joined #ruby
reactormonk has joined #ruby
m_3 has quit [Client Quit]
<matschaffer>
hi, so if I have an object. I can see it's method lookup path by saying obj.class.ancestors. But I can't do the same for class methods also check their superclass (e.g., Car.class.ancestors won't show Vehicle, but it can call Vehicle's class methods). Is there a more authoritative way to ask an object for it's method lookup chain?
kpshek has joined #ruby
AxonetBE has joined #ruby
<rismoney>
whats the idiomatic way to add attrib=> value to a hash
m_3 has joined #ruby
m_3 has quit [Client Quit]
magistr has left #ruby ["Ухожу я от вас"]
mpfundstein has quit [Quit: Lost terminal]
m_3 has joined #ruby
clocKwize has quit [Quit: clocKwize]
m_3 has quit [Client Quit]
TomyLobo has joined #ruby
<apeiros_>
hash[attrib] = value
cha1tanya has joined #ruby
cha1tanya has quit [Changing host]
cha1tanya has joined #ruby
m_3 has joined #ruby
<rismoney>
ah i was trying strange forms of hash << attrib => value
<apeiros_>
hm, odd… doesn't seem to work as I expected it…
<alexspeller>
(Only part trolling, ruby on windows is a real pain in the ass... still...)
<tri>
ruby 1.9.3p362
nathancahill has quit [Quit: nathancahill]
hukl has joined #ruby
cecino has joined #ruby
buscon has quit [Quit: Leaving]
buscon has joined #ruby
tvw has quit [Remote host closed the connection]
cecino has left #ruby [#ruby]
<Hanmac_>
tri sorry that i need to tell you but its possible that 1.9.3p362 is trainted and for some unknown reason does not work well with rails and others ... you could try an a little bit older version or ask the guys at #rubyonrails
xAndy is now known as xandy
<apeiros_>
ok, this is weird…
<apeiros_>
class Foo; end; class Bar < Foo; end; Bar.singleton_class < Foo.singleton_class # => true
<startling>
alexspeller: oh, cool, I'm familiar with that format.
lateau has quit [Remote host closed the connection]
G has quit [Ping timeout: 260 seconds]
flingbob has quit [Remote host closed the connection]
KevinSjoberg has joined #ruby
_nitti has quit [Remote host closed the connection]
<apeiros_>
banisterfiend: stuff like that makes me want to work on my own language again…
<shevy>
lol
<alexspeller>
Also, learning clojure really improved my ruby
<banisterfiend>
apeiros_: hehe, ruby just cant decide if it wants to hide or expose singleton classes
<Pip>
alexspeller, 1 to 10, 1 means too bad, 10 means fabulous, what's your vote?
SCommette has joined #ruby
<alexspeller>
vote on what, clojure?
<banisterfiend>
alexspeller: interesting, in what way
<shevy>
Pip what are you, a survey bot?
<Pip>
alexspeller, rubykoans
nateberkopec has joined #ruby
<csmrfx>
I want my own language, too. Or, drawn logic (not written isn't a language).
jekotia has joined #ruby
_nitti has joined #ruby
<rismoney>
in rspec how do you do a hash should have a key and hash[key] should have a val?
<Pip>
Anyone read the ruby monk?
<alexspeller>
banisterfiend: it's good to have multiple ways to think about things, and clojure is a lisp which is a very functional way of doing things
<Pip>
Please tell us how bad or good that material is
<alexspeller>
so for example it helps you understand and use ruby's functional stuff in a more natural way, it did for me anyway
<shevy>
Pip if you read it your mojo will grow by 35%
<alexspeller>
You can use ruby in a very functional style and sometimes that is a very applicable to problems
startling has quit [Quit: ERC Version 5.3 (IRC client for Emacs)]
<shevy>
alexspeller how does functional style ruby look like?
swex_ has joined #ruby
<Pip>
shevy, That's a lot
nomenkun has quit [Ping timeout: 248 seconds]
swex has quit [Ping timeout: 255 seconds]
thone_ has joined #ruby
<alexspeller>
shevy: [1,2,3].map{|e| e * 2}.inject(0){|memo, value| memo + value}
<alexspeller>
for example
<Pip>
Is it a good habit or idea to use return statement in a method?
<banisterfiend>
alexspeller: can u giev an example
<banisterfiend>
alexspeller: dat nasty
<csmrfx>
Pip: no need to.
<banisterfiend>
alexspeller: .inject(:+) :P
<Pip>
cschneid, no need to what?
<csmrfx>
poor cschneid, always getting mixed in my arguments
<banisterfiend>
Pip: methods are teh messages sent between objects (in a sense), but not objects themselves
<Pip>
Messages should be objects
<banisterfiend>
bean: cool
hell_razer has quit [Quit: Leaving]
<banisterfiend>
Pip: so says "pip" on #ruby ;)
<alexspeller>
ruby is awesome because you have a huge toolbox to choose from - there are sometimes when functional, non-mutable state is advantaguous and some cases where mutable is simpler
<csmrfx>
>> def meth_odd; p "foo"; end; meth_odd.class
<topriddy>
reminds me of basic days as things look really simple.
emergion has quit [Quit: Computer has gone to sleep.]
sayan has joined #ruby
sayan has quit [Changing host]
sayan has joined #ruby
dmiller has joined #ruby
<sie>
topriddy, There's too less code to have any real flaws or criticism.
horofox_ has quit [Read error: Connection reset by peer]
<sie>
IMO
horofox_ has joined #ruby
Spami has quit [Ping timeout: 255 seconds]
<bean>
except like... use objects
<bean>
:p
retro|cz has joined #ruby
jlast has joined #ruby
<sie>
Well... yeah
breakingthings has joined #ruby
<sie>
He actually is using objects. Kernel!
<topriddy>
nope. mainorb :p
<sie>
mainorb?
Dwarf has quit [Ping timeout: 246 seconds]
rdark has quit [Read error: Operation timed out]
nathancahill has joined #ruby
luckyruby has joined #ruby
dmiller has quit [Ping timeout: 248 seconds]
<topriddy>
sie: sorry, ignore :)
<topriddy>
writing same code in java though…hehe…different strokes]
yoshie902a has joined #ruby
coder_neo has quit [Ping timeout: 248 seconds]
hackerdude has joined #ruby
ds29 has joined #ruby
rdark has joined #ruby
pskosinski has joined #ruby
<ds29>
hi guys. Anyone knows how to use win32/api to get the ActiveWindow
<ds29>
I tried GetActiveWindow = API.new('GetActiveWindow','','L','user32')
<topriddy>
sie: if i was on windows what would be the equivalent for #!/usr/env/bin
<yoshie902a>
How do I insert a <span> rage into a string at a specific character location. For example. "The strong tag is in the 11th location" and I would like to insert <span> at the 11th character to get "The strong <span>tag is in the 11th location".
<ds29>
and then call it but it didn't seem to work
<yoshie902a>
s/rage/tag
baroquebobcat has joined #ruby
<sie>
topriddy, mmm, well I don't think windows likes shebangs.
<sie>
You'd simply have to associate .rb with ruby executable.
<sie>
topriddy, Windows is a clusterfuck in my opinion.
<topriddy>
sie: okay. thanks
xclite has joined #ruby
Karantin has joined #ruby
quest88 has joined #ruby
<topriddy>
sie: you use linux then?
<sie>
linux, mac, bsd
<sie>
Everything but windows.
berserkr has joined #ruby
<topriddy>
hehe…some work someday would throw windows on your face
<sie>
Nope.
<yoshie902a>
never mind. Found it. insert(11,"<span>"),, thanks!
maletor has joined #ruby
woolite64 has joined #ruby
<topriddy>
sie: you just inspired a shebang tweet ^_^….backing to code
havenn has joined #ruby
<ds29>
hi anyone knows about my question about the Win32API in ruby to GetActiveWindow ?
<j0sh\a>
Hi guys, am running chef 10.16.2 on this box and am seeing lots of deprecation warnings on about chef 11 and node["key"] should be node.set["key"]. IS this correct?
zigomir has quit [Quit: zigomir]
<jpfuentes2>
josh, you should probably check in chef or chef google group
<jpfuentes2>
but that is correct
DatumDrop has joined #ruby
yoshie902a has left #ruby [#ruby]
<jpfuentes2>
i think it primarily happens when using node["key"] in a recipe
thone has joined #ruby
vipaca has joined #ruby
vipaca is now known as Guest97309
timonv has quit [Remote host closed the connection]
maletor has quit [Quit: Computer has gone to sleep.]
<j0sh\a>
ah shit - sorry thought was in chef channel
<j0sh\a>
this window is fkin tiny! :)
miskander has quit [Quit: miskander]
thone has quit [Ping timeout: 260 seconds]
_46bit has quit [Quit: Leaving.]
mmokrysz has joined #ruby
rondale_sc has joined #ruby
<shevy>
better the window and not ... something else
the_hack has quit [Quit: Computer has gone to sleep.]
Bry8Star has joined #ruby
the_hack has joined #ruby
v0n has quit [Quit: WeeChat 0.3.9.2]
v0n has joined #ruby
adamh has quit [Quit: adamh]
supergiantrobot has quit [Quit: supergiantrobot]
kpshek has quit []
kpshek has joined #ruby
dougireton has joined #ruby
c0rn has joined #ruby
dmiller has joined #ruby
hydrozen has joined #ruby
stevechiagozie has joined #ruby
apeiros_ has joined #ruby
pcarrier has quit []
buibex has joined #ruby
<hydrozen>
In Tomdoc, is it really necessary to write "Public:" in the description section? What is assumed when you do not put a prefix (public, internal, deprecated)?
Dwarf has joined #ruby
dr_neek has joined #ruby
speakingcode has quit [Remote host closed the connection]
blazes816 has joined #ruby
lateau has quit [Remote host closed the connection]
buibex has quit [Remote host closed the connection]
dr_bob has left #ruby [#ruby]
lateau has joined #ruby
srji has joined #ruby
miskander has joined #ruby
miskander has quit [Client Quit]
hoelzro is now known as hoelzro|away
JustinAiken has left #ruby [#ruby]
topriddy has quit [Ping timeout: 256 seconds]
<anannie>
Is there a quick way to know how many bits a number is long?
whitedawg has quit [Quit: Leaving.]
<csmrfx>
well object type is
<csmrfx>
>> "100".to_s(2)
<eval-in>
csmrfx: Output: "/tmp/execpad-a821471941f5/source-a821471941f5:1:in `to_s': wrong number of arguments(1 for 0) (ArgumentError)\n\tfrom /tmp/execpad-a821471941f5/source-a821471941f5:1:in `<main>'\n" (http://eval.in/6200)
<f0ster>
it probably takes up a fixed amount of space because of ruby's typing, is my guess anannie. otherwise you would just convert binary
<anannie>
workmad3: How many significant bits it takes up. I'm still working on that square root thing, and I'm trying to arrive at a cool guess for newton's algorithm using bit shifting, so I'm trying to figure out the number of shifts that should occur.
<anannie>
workmad3: The idea is to make it faster than finding the square root precisely.
AxonetBE has quit [Quit: Leaving.]
<matti>
+1 for bit wrangling.
a_a_g has joined #ruby
<f0ster>
alex20032: either way if speed as the utmost imperative you wouldn't be using either
Nisstyre has joined #ruby
<JonnieCache>
anannie: you're doing the carmack algorithm right?
<anannie>
I know it sounds like a waste of time, but I wrote a routine that finds the first 10,001 primes in 0.332s
<anannie>
JonnieCache: No that's for finding the inverse of a square root.
<anannie>
I'm trying to get the entire sieve down to under .1s
jlast has quit [Ping timeout: 264 seconds]
<anannie>
Preferably under .09s.
<JonnieCache>
newton's algorithm is part of the carmack thing though isnt it?
<f0ster>
anannie: project euler ?
<anannie>
f0ster: Yup. I solved it, and I'm trying to make my solution better/faster
<f0ster>
anannie: nice
rdark has quit [Ping timeout: 260 seconds]
nomenkun has quit [Ping timeout: 248 seconds]
<f0ster>
anannie: you could compile something in C heh
mahmoudimus has quit [Quit: Computer has gone to sleep.]
<anannie>
f0ster: Actually I'm just starting out with coding, so I don't know X
<anannie>
* C
<f0ster>
Ah
<anannie>
Would you like to take a look at the code I wrote?
irek has joined #ruby
breakingthings has quit []
rdark has joined #ruby
<JonnieCache>
youre the second "newbie" to code here in as many weeks whos learning though project euler
Spami has joined #ruby
Spami has quit [Changing host]
Spami has joined #ruby
<JonnieCache>
its highly commendable
<anannie>
My first idea was to divide by two until I got down to an approximate root, which I could then use. That failed for higher numbers, even though an interesting pattern did emerge.
<alex20032>
Well, project euler could be a great place to learn ruby
kjellski has quit [Quit: Leaving]
dcope is now known as teafukintits
<anannie>
I'm trying to teach myself math as well
nemesit has quit [Quit: Leaving...]
TerabyteST has joined #ruby
teafukintits is now known as teafuk
teafuk is now known as dcope
<JonnieCache>
respect
malkomalko has quit [Remote host closed the connection]
<anannie>
Ah I thought you were talking about the one on line 23
<anannie>
How can I make it more rubyish?
[Tyrant] has joined #ruby
Neomex has joined #ruby
mafolz has quit [Quit: mafolz]
<JonnieCache>
well essentially i would make some expression that defined every value to iterate over ahead of time, and call .map or something on it
pavilionXP has quit [Ping timeout: 276 seconds]
<JonnieCache>
but the algorithm may preculde that
<workmad3>
anannie: are you sure that getting an approximate square root will make your algorithm faster?
Guest49926 has joined #ruby
buscon has quit [Quit: Leaving]
lolcathost has joined #ruby
<workmad3>
anannie: when you consider that you're calculating the square root once, but for each integer your approximation is out by, you'll be adding division
<anannie>
workmad3: Well that's why I'm searching for an algorithm that helps me find it down to the first order of magnitude. I don't need decimal level precision.
xandy is now known as xAndy
<workmad3>
anannie: also, you can use ary.empty? instead of ary.length == 0
<anannie>
workmad3: So far I haven't found anything that's better than just using the inbuilt function.
kurioscreative has joined #ruby
topriddy has quit [Quit: topriddy]
elux has joined #ruby
alaska has joined #ruby
<anannie>
workmad3: The thing is that I'm calculating the square root each time I'm doing factorisation, which is two times every 6th number
<workmad3>
anannie: yes, and you'd be doing your approximation the same amount
amaya_the has quit [Quit: ChatZilla 0.9.89 [Firefox 17.0.1/20121128204232]]
<anannie>
workmad3: Hrm, but if I'm just estimating it to the first order of magnitude then wouldn't it save several operations over the complete run-time?
<workmad3>
anannie: probably not
carloslopes has quit [Remote host closed the connection]
szck has quit [Quit: Leaving.]
<anannie>
Oh?
<anannie>
May I ask why workmad3?
akemrir has quit [Ping timeout: 248 seconds]
dougireton has quit [Quit: Leaving.]
Virunga is now known as LennyLinux
dougireton has joined #ruby
megha has joined #ruby
<workmad3>
anannie: because your loop repeats an extra (knowably useless at this point) time for the difference between your approximation and the actual square root
cha1tanya has quit [Ping timeout: 260 seconds]
<workmad3>
anannie: so what you need to find out is how many loops are equivalent to a single square root
grzywacz has quit [Ping timeout: 248 seconds]
<workmad3>
anannie: my suspicion is that it's probably only a couple of times around the loop
<anannie>
ah but the loop isn't designed like that, the loop is designed to iterate through a list of prime numbers, so each step isn't actually linear, so if it's accurate to the first order then it should be good enough.
Dwarf has quit [Ping timeout: 246 seconds]
h4mz1d has joined #ruby
<JonnieCache>
anannie: lol you claim to be "learning" code and math but youre better at it than 99% of people
_46bit has quit [Quit: Leaving.]
<workmad3>
anannie: possibly
<workmad3>
anannie: I'd want to see a profile of the method to see what's taking up the time there though ;)
<workmad3>
anannie: if the majority of the time isn't the sqrt, then optimising that isn't going to help
<anannie>
workmad3: I know that if I change one of the more fundamental operations then it would get faster, but I don't know how or which things to change.
<anannie>
workmad3: Okay, how do I do that?
<anannie>
several time.nows?
emocakes has quit [Quit: emocakes]
<workmad3>
anannie: simplest way - get Time.now at the start of the method, then after the sqrt print out Time.now - start_time, then after the loop print out Time.now - start_time
jonathanwallace has joined #ruby
headius has joined #ruby
<anannie>
JonnieCache: I actually am a complete noob. I was exposed to coding a bit earlier on, but I started seriously doing it just a few weeks ago. Same with math. I essentially dropped out of high school at some point. I scraped by, but I was terrible at it!
<workmad3>
anannie: oh, you'd want to do Time.now - sqrt_time - start_time at the end
szck1 has joined #ruby
a_a_g has quit [Read error: Connection reset by peer]
<anannie>
workmad3: Okay, I'll do that.
mensvaga has left #ruby [#ruby]
<workmad3>
anannie: and you're interested in the numbers that are prime btw, those are the numbers that will take the most work to compute
a_a_g has joined #ruby
<workmad3>
anannie: so are the ones where the loop will run the maximum number of times
<anannie>
Yes workmad3
<JonnieCache>
lol i guess it just shows what you can achieve when your mind isnt poisoned by industrialised education
<workmad3>
anannie: :)
pskosinski has quit [Quit: Learn Life's Little Lessons]
<workmad3>
anannie: and welcome to optimisation 101 - always profile, so you can optimise the bottleneck ;)
<anannie>
Okay, I'll do this and get back to you workmad3. Thank you so much for teaching me!
megha has quit [Quit: WeeChat 0.3.9.2]
<fuzai>
is there an easy way to test a variable against an array?
<anannie>
fuzai: You should read the Array class functions
<anannie>
fuzai: It'll take a while, but it will teach you far more than asking anyone else...
<anannie>
workmad3: I got a pretty interesting result. For the last 42 times the factorisation method is called, except for a single case where I guess a prime was found, the sqrt operation takes almost as much time or even greater time as the loop. For the first 10 primes, this is at parity. https://gist.github.com/4485857
iNerd is now known as Moofy
Spaceghostc2c_ has joined #ruby
<heftig>
whoops, forgot the "w"
<workmad3>
anannie: so that was up to 52 primes?
pskosinski has joined #ruby
wallerdev has joined #ruby
<workmad3>
anannie: how about up to 100 primes?
<anannie>
workmad3: No it was up to 10,001 primes
<workmad3>
ah, ok
<anannie>
workmad3: I knew that you would raise that point ;)
roadt has quit [Ping timeout: 256 seconds]
<workmad3>
anannie: so, how big a difference was it when it was a prime found?
ds29 has quit [Ping timeout: 255 seconds]
<anannie>
around an order of magnitude, here's a bump where a prime was found;
haxrbyte_ has quit [Read error: Connection reset by peer]
aasmith has joined #ruby
alex20032 has left #ruby [#ruby]
friskd has joined #ruby
<anannie>
I think that a prime has been found on this line; After sqrt; 3.007e-06 ; After loop; 5.188e-06. I'll run it again so that it prints out a notification when a prime is found
<csmrfx>
hm, is ruby really the best tool for this
<workmad3>
sounds like a plan :)
akl_ has quit [Ping timeout: 260 seconds]
<workmad3>
anannie: hmm, looking at the data, you actually have quite a few places where the sqrt was an order of magnitude faster than the loop
williamcotton has joined #ruby
<workmad3>
anannie: e.g. 'After sqrt; 3.036e-06; After loop; 2.7997e-05'
itnomad has quit [Ping timeout: 265 seconds]
<anannie>
Yes, workmad3. It's true for the last prime as well.
<workmad3>
(line 49 and 50 of your gist)
aasmith has left #ruby [#ruby]
<anannie>
But those are only a few places though, most of the times when it's being called you get around the same order of magnitude
adamh has joined #ruby
<workmad3>
right, so roughly speaking, your sqrt is taking between 50% and 10% of the time of your method
<anannie>
Yes, workmad3
lolcathost has quit [Ping timeout: 265 seconds]
raz has quit [Ping timeout: 265 seconds]
<workmad3>
with, in the important cases (a prime being found), it taking more 10% than 50%, and you've already filtered the tests so that you're more likely to hit primes
<workmad3>
now you have a baseline to check against ;)
<workmad3>
although I would suspect that you'll get more speedup out of improving your loop than improving the sqrt
<anannie>
I wonder if I could use fermat's theorem to speed things up even more
Spami has quit [Quit: This computer has gone to sleep]
gyre007 has quit [Ping timeout: 276 seconds]
<anannie>
workmad3: Yes, you're right. I should actually implement both, an approximation algo for finding the square root and some sort of hybrid primality test that calls up a fermat's witness and tests things
Dann1 has joined #ruby
Spami has joined #ruby
Spami has quit [Changing host]
Spami has joined #ruby
<workmad3>
anannie: only do one at a time though
miskander has joined #ruby
<anannie>
workmad3: Okay, I'm confused regarding the algorithm for the square root, whatever implementation I have come with, has always been slower than the ruby implementation done in C
<workmad3>
anannie: it seems to be the case that more time is spent in the primality test, so that would be the better place to start, IMO... try an improvement there
karasawa has quit [Quit: leaving]
mmokrysz has joined #ruby
<workmad3>
anannie: not that surprising
karasawa has joined #ruby
<workmad3>
anannie: you have to go through more layers in ruby compared to what the C code has to do :)
coder_neo has joined #ruby
<anannie>
workmad3: Isn't there some way to cut through those layers inline?
<workmad3>
anannie: no, you'd need to drop into C yoursely
<workmad3>
*yourself
mrsolo has joined #ruby
raz has joined #ruby
tjbiddle has joined #ruby
ner0x has joined #ruby
tjbiddle has quit [Remote host closed the connection]
roadt has joined #ruby
timonv has joined #ruby
<workmad3>
(well, there are some gems and tools that let you do things like inline C or inline assembler, iirc)
<blazes816>
you could write a c extension to do the heavy stuff
<anannie>
Is that possible? I've read about Python's any feature... The problem also is that I don't know C, but I should be able to do math stuff in it
<ner0x>
node or libv8 for execjs?
tjbiddle has joined #ruby
<blazes816>
anannie: yeah it's possible. c shouldn't be too bad for you, but there'll be some snags i'm sure
Paradox has quit [Ping timeout: 245 seconds]
lolcathost has joined #ruby
<workmad3>
anannie: ruby isn't exactly the most performant language out there
<workmad3>
anannie: but it is pretty easy to get to grips with :)
TerabyteST has quit [Quit: terabytest]
<anannie>
blazes816: But would it also be faster? If it takes time to call up the inline C thing then wouldn't it be slower on the net?
<workmad3>
anannie: so you've gotta ask yourself - do you want to spend time doing micro-optimisation on this, or do you want to try out your speedups in the math areas and keep on learning ruby?
emocakes has joined #ruby
<anannie>
workmad3: Well I'm not going to go around trying to find mersenne primes with this
<blazes816>
anannie: you'd have to compare your ruby version to the c version, and then profile the overhead of calling the c, and do a cost-benefit analysis
slainer68 has quit [Remote host closed the connection]
<havenn>
anannie: You can rapidly implement in Ruby, then only switch the extremely performance finicky parts to C ext for best of both worlds.
noric has joined #ruby
<blazes816>
idk what you're doing, but the ruby version is probably find ;)
<workmad3>
anannie: after all, we're talking about 0.2s over 10001 primes here ;)
<workmad3>
anannie: and you're pretty close to the Prime class in the ruby stdlib for this :)
<workmad3>
(that's 0.16s for 10001 primes)
<anannie>
workmad3: True, true. I just got carried away with an assignment I gave myself. The thing is that I actually plan to implement real-time feedback loops in robots someday and well in the real world a lot of stuff can happen in .2s
<anannie>
blazes816: I'm not sure if I'm smart enough to implement something significant using ASM land... I can't imagine how people write practical stuff in it!
<workmad3>
havenn: see, 0.034s for run 2 :)
<havenn>
workmad3: Yup, that is the difference I wrongly prescribed to Gen being diff. >.>
<blazes816>
anannie: it takes a while, but even if you can't do anything 'practical' in it, just knowing the basics of it makes you a better programmer
goraxe has quit [Read error: Connection reset by peer]
<anannie>
Even learning Ruby is non-trivial for a complete n00b, but I'm quite glad I did. At the start it was very, very hard to think of something in Ruby terms, but now after solving things and making them, I can actually do it and it's pretty fun.
noxoc has quit [Quit: noxoc]
timonv has joined #ruby
mrsolo has quit [Quit: This computer has gone to sleep]
_46bit has left #ruby [#ruby]
alvaro_o has joined #ruby
goraxe has joined #ruby
the_hack has joined #ruby
Elhu has quit [Quit: Computer has gone to sleep.]
mrsolo has joined #ruby
zeade has joined #ruby
workmad3 has quit [Ping timeout: 248 seconds]
Neomex has quit [Ping timeout: 255 seconds]
<ericwood>
it's fun and good for you
rondale_sc has joined #ruby
jlast has joined #ruby
jlast_ has quit [Ping timeout: 255 seconds]
stan has quit [Ping timeout: 256 seconds]
toobulkeh has joined #ruby
shevy2 has joined #ruby
haxrbyte has joined #ruby
ashp has left #ruby [#ruby]
krawchyk has quit [Remote host closed the connection]
nkts has quit [Ping timeout: 248 seconds]
alanjc has joined #ruby
shevy has quit [Read error: Operation timed out]
roadt has quit [Ping timeout: 248 seconds]
<toobulkeh>
I keep getting a TypeError on coerce when trying to sum up a Float to a Fixnum.. is this normal? - https://gist.github.com/4486297
<ericwood>
on the right-hand side append ".to_f"
a_a_g has quit [Read error: Connection reset by peer]
jdripper has quit [Quit: Leaving.]
a_a_g has joined #ruby
<toobulkeh>
of the initialization to 0?
<waxjar>
that shouldn't give any errors, the + method on Float and Fixnum should take care of that
<toobulkeh>
waxjar: I would think so but it doesn't
krawchyk has joined #ruby
<havenn>
toobulkeh: If you start with total_ram = 0.0?
<ericwood>
or do what I said since it's less elegant
<waxjar>
x = 1; x += 0.1 # => 1.1
karasawa has quit [Ping timeout: 248 seconds]
<canton7>
toobulkeh, what's the class of host.hardware.blah...to.gigabytes?
<toobulkeh>
canton7: Float
<canton7>
I'm willing to bet it isn't anything standard
<canton7>
are you absolutely completel sure? prove it
<canton7>
*completely
<toobulkeh>
It's from the alchemist Gem
friskd has quit [Quit: friskd]
<toobulkeh>
hmmm you're right :) thanks!
<toobulkeh>
Alchemist::NumericConversion 0_o
<ericwood>
hehehe
chussenot has quit [Quit: chussenot]
<toobulkeh>
you guis so smart, makes me blush
rdark has quit [Quit: leaving]
joeycarmello has joined #ruby
cdt has quit [Quit: Ex-Chat]
icole has joined #ruby
<canton7>
it's not like Float to implement #coerce badly... Raise an issue with Alchemist
h4mz1d has quit [Ping timeout: 248 seconds]
<toobulkeh>
Yeah I was like.. no way
<toobulkeh>
will do
the_hack has quit [Quit: Computer has gone to sleep.]
<ericwood>
no, go fix it yourself :D
<canton7>
issues can have code attached :P
<toobulkeh>
might be designed that way
digital-ghost has joined #ruby
<toobulkeh>
thank you thank you
haxrbyte has quit [Remote host closed the connection]
browndawg has quit [Quit: Leaving.]
megha has quit [Quit: WeeChat 0.3.9.2]
<canton7>
looks like it returns the wrong thing entirely from #coerce :P
<digital-ghost>
I'm just learning ruby and the for loop/enumerators. Can anyone explain why a for loop with a range like 1..10 will print the literal sequence, but if I use 10.times do |i| it'll be zero based?
<canton7>
try not to use for loops
<canton7>
(1..10).each do |i| ...
<apeiros_>
digital-ghost: because 10.times is not 1..10
<digital-ghost>
Right, I've been told that as well, but I'm trying to understand the alternatives and why they're to be used over for loops
clooth has quit [Quit: clooth]
<havenn>
digital-ghost: We start counting from 0, so 3.times is similar to 0..2 not 1..3.
fred909 has joined #ruby
JonnieCache has quit [Read error: Connection reset by peer]
mneorr has quit [Remote host closed the connection]
<canton7>
digital-ghost, #each has better scoping
<digital-ghost>
I guess it's odd to me, that the other methods don't seem to start at zero.
<digital-ghost>
Such as, 1.upto(10)
toobulkeh has left #ruby [#ruby]
<havenn>
digital-ghost: 0.upto(9)
nomenkun has joined #ruby
nathancahill has joined #ruby
<havenn>
digital-ghost: These are all Enumerators: [(0..9).each, 0.upto(9), 10.times]
<digital-ghost>
Alrighty, guess I just need to wrap my head around this. When I look at the code, I just don't think of counting from 0 when I see .times
<polerin>
sorry, first week in ruby land. I'm a php dev, and this is one of the things that PHP does easy enough. bleh. First one like this though.
jonathanwallace has joined #ruby
dougireton has quit [Quit: Leaving.]
<shevy2>
polerin you must think differently. in ruby, everything is about beautiful poetry
<Eiam>
I have a gem that I built (gem build blah.gemspec) then I installed it. in a script (just a generic .rb file) i have a require 'my-gem'. when I try to execute it I get a load error (https://gist.github.com/c044b8d0cd7b9008df12) but my gem clearly has that file in its structure
nga4 has quit []
<Eiam>
and if i visit that path, i can see it right there in /lib/my-gem/monkeypatch.rb
<cirwin>
Eiam: my favourite mistake with making new gems is not to actually include the code in the gem
<cirwin>
if you're using the `git ls-files` approach to including files, check you added them to git
<polerin>
shevy2: Trust me, I'm not a fan of hackery... my fault is obsessive reusability and elegance. Sometimes to the point that it turns very bad :P
dankest|away is now known as dankest
<Eiam>
cirwin: I'm sorry I don't quite understand.. I just have some files here on the system with a gemspec
<Eiam>
no git involved
<cirwin>
and the gemspec lists all the files correctly?
<Eiam>
are you saying my gemspec is setup to not include my own gem?
<cirwin>
it might not include all the files
<Eiam>
files = Dir["{app,config,db,lib}/**/*"]
<Eiam>
seems like that should snag it all?
<cirwin>
yeah, tha tlooks right to me
wroathe has quit [Ping timeout: 256 seconds]
zastern has joined #ruby
elico has quit [Quit: elico]
stim371 has joined #ruby
<Eiam>
I have <gem name>/lib/gem-name/my.rb's as the total directory structure
carloslopes has joined #ruby
dougireton has joined #ruby
<Eiam>
gemspec is defined at the same level as lib
<ale``>
what ruby project generator would you recommend?
<cirwin>
Eiam: try running "gem specification *.gem" and see what it looks like
<cirwin>
ale``: what project are you doing?
<cirwin>
just a simple one shouldn't need a generator
<cirwin>
if you're using rails, it comes with a generator
<Eiam>
cirwin: I see it in files, files: -lib/my-gem/monkeypatch.rb
mark_locklear has quit [Remote host closed the connection]
jrist is now known as jrist-doctor
emmanuelux has joined #ruby
<ale``>
cirwin: right now I'm still thinking what to work on, just looking for a recommendation :-)
dougireton has quit [Client Quit]
<Eiam>
cirwin: okay so i moved my script from one location into the location of the gem that i compiled and it worked
Vainoharhainen has joined #ruby
jimeh has joined #ruby
<Eiam>
which tells me the require 'my-gem/monkeypatch' is not being put relative to the gem but to my script? (even though that require is IN the gem I built)
Axsuul has quit [Remote host closed the connection]
<ale``>
mhmh, pry seems interesting :-) Going to read about it first.
Vert has quit [Ping timeout: 252 seconds]
akl_ has quit [Ping timeout: 240 seconds]
<kapowaz>
encounters other entries (e.g. ‘assets’) besides web or worker? Does it just ignore them?
<kapowaz>
anyone here familiar with foreman able to comment on a question? I'm looking at using foreman + rerun for recompiling assets (i.e. with rake-pipeline-web-assets) and a project I'm poking around with to get an idea for it uses this, with the rerun command specified in the Procfile. Question is, what's the deal with how Heroku interprets said Procfile if it
kenneth_ has joined #ruby
kenneth has quit [Read error: Connection reset by peer]
kenneth_ is now known as kenneth
mengu_ has quit [Quit: Konversation terminated!]
danneu has quit [Ping timeout: 252 seconds]
Axsuul has joined #ruby
cantonic has quit [Quit: cantonic]
rpbertp13 has joined #ruby
wroathe has joined #ruby
horofox_ has quit [Quit: horofox_]
dougireton has joined #ruby
topriddy has joined #ruby
danneu has joined #ruby
carloslopes has quit [Read error: Connection reset by peer]
karl___ has joined #ruby
<karl___>
i'm parsing XML and was using rexml/document, which is super slow for my xml files (approx 50mb each). Can anyone recommend a faster xml library to use?
horofox has joined #ruby
<ericwood>
you're probably doing DOM parsing
<ericwood>
try using a SAX parser instead
<cirwin>
karl___: nokogiri
<cirwin>
wraps libxml2
<ericwood>
yes, nokogiri is the greatest, and it has DOM and SAX parsers you can use
tenmilestereo has quit [Quit: Leaving]
<karl___>
thank you both
griffindy has quit [Quit: Computer has gone to sleep.]
eldariof has quit []
<ale``>
cirwin: how should i trigger the line numbers with whereami? (btw, pry seems _really_ nice)
<ericwood>
a DOM parser will take every node and build up a tree in memory -- this is bad for large documents
<cirwin>
ale``: if you type whereami you'll see the line numbers
_alejandro has joined #ruby
<ericwood>
a SAX parser issues callbacks on certain nodes and you can basically roll your own
cantonic has joined #ruby
<karl___>
ericwood: cirwin: this is very helpful
<ale``>
cirwin: I can only see "Inside Foo"
* ericwood
remembers trying to parse his iTunes library's XML file and bringing his machine to a halt with a DOM parser :|
Neomex has quit [Quit: Neomex]
topriddy has quit [Read error: Connection reset by peer]
<banisterfiend>
ale``: sry, i already fixed that bug ;)
Amnesia has joined #ruby
<Amnesia>
question
the_hack has joined #ruby
<Amnesia>
>> if "./hidden/.." =~ /\.\/\.{0,2}\/+\w\.{1,2}*/; puts 'hoi'; end
digital-ghost has quit [Ping timeout: 245 seconds]
grzywacz has joined #ruby
grzywacz has quit [Changing host]
grzywacz has joined #ruby
jekotia has joined #ruby
<apeiros_>
jrabbit: no. doesn't make sense for a dynamically typed language anyway.
<apeiros_>
it's not like ruby cared whether you pass a string or an array.
<ericwood>
they're all ducks as far as it is concerned
<havenn>
Pip: Both work great, but yeah use || && unless you want to memorize precedence order or you might get screwed up.
pkrnj has joined #ruby
<jrabbit>
apeiros_: ah ok it just seems messy for some reason
<apeiros_>
jrabbit: because it is.
<apeiros_>
say what you mean.
v0n has quit [Ping timeout: 256 seconds]
<apeiros_>
i.e. - create proper methods for the different use cases
<jrabbit>
apeiros_: I'm trying to shoehorn all references to a resolution into a resolution object so I don't have to muck about with strings versus arrays representing the same thing
<havenn>
jrabbit: paste a Gist of the code?
c0rn has joined #ruby
<apeiros_>
that e.g. would be a proper solution :)
<ericwood>
apeiros_: he could use one method that tests the class of the argument and reacts accordingly
<nfk>
stupid scope question: i have a class and methods within this class but i can't in any way declare an object instance outside the methods (but within the class) they they all could access
<nfk>
i have tried $, @ and @@
icco has quit [Quit: run away.]
<apeiros_>
nfk: ¿que?
<nfk>
if it matters, it's rails unit tests
<JMcAfreak>
apeiros_: technically, you'd say "como"
<apeiros_>
JMcAfreak: that's not faulty-tower-style then!
<apeiros_>
fawlty?
<apeiros_>
dang
<JMcAfreak>
fawlty
<apeiros_>
yeah, fawlty towers
<nfk>
apeiros_, yes, i know i could just pass the object to methods but that's tedious
joeycarmello has joined #ruby
horofox has joined #ruby
_46bit has joined #ruby
<apeiros_>
interesting, I didn't notice I suggested that
_46bit has left #ruby [#ruby]
icco has joined #ruby
<Spooner>
apeiros_ : I think you mean Farty Towels.
ner0x has quit [Quit: Leaving]
<nfk>
apeiros_, or if you meant where's the question, the questio is, how do i do that?
Nisstyre has quit [Ping timeout: 256 seconds]
<apeiros_>
Spooner: nope
<nfk>
get methods within a class to access an object declared within that same class
hotovson has joined #ruby
the_hack has joined #ruby
tommyvyo_ has joined #ruby
dustint has quit [Quit: Leaving]
<Spooner>
nfk What do you mean by declared within the same class? Can you paste up a snippet?
jthomp has joined #ruby
<nfk>
Spooner, i still haven't cleared the ownership of the code so not really, sorry
baphled has quit [Ping timeout: 240 seconds]
jthomp has quit [Client Quit]
<jrabbit>
apeiros_: thanks :)
<nfk>
but i suppose i can write something similar
<Spooner>
That would be fine.
<nfk>
user = User.new({:some => "stuff"})
<nfk>
test "some test" do
_46bit has joined #ruby
_46bit has quit [Remote host closed the connection]
<nfk>
assert user.valid?
<nfk>
end
bigkevmcd has quit [Ping timeout: 256 seconds]
lolcathost has quit [Quit: When I come back, please tell me in what new ways you have decided to be completely wrong.]
<Spooner>
In most frameworks you'd use something like 'before do @user = ... end' to set up the object that will be used in each test. Alternatively, just make it inside the test if it isn't used multiple times.
alanp_ has joined #ruby
alanp_ has quit [Read error: Connection reset by peer]
topriddy has quit [Read error: Connection reset by peer]
<nfk>
Spooner, the thing is that i would like to reuse the object instance
alanp_ has joined #ruby
srji has quit [Ping timeout: 248 seconds]
<Spooner>
What test framework are you using? It is a pretty standard thing to do, so it should make it very clear how to do this.
blacktulip has quit [Remote host closed the connection]
<nfk>
whatever comes with rails by default
<nfk>
i know it's not rspec
<nfk>
but i can't remember the name of it
Gues_____ has joined #ruby
Gues_____ is now known as RubNoob
<RubNoob>
hello, has anyone used the carrierwave gem?
fermion has joined #ruby
<Gate>
RubNoob: yep
_nitti has quit [Remote host closed the connection]
<RubNoob>
@Gate do you have any good resources for handling relative pathing/restricted access using cancan?
alanp has quit [Read error: Operation timed out]
nari has joined #ruby
lolcathost has joined #ruby
jlast has quit [Remote host closed the connection]
phipes has joined #ruby
c0rn has quit [Quit: Computer has gone to sleep.]
cascalheira has joined #ruby
jgarvey has quit [Quit: Leaving]
bean has quit [Quit: Computer has gone to sleep.]
danneu has quit [Quit: WeeChat 0.3.8]
philcrissman has quit [Remote host closed the connection]
<kenneth>
where does one find good rubyists to hire in sf
<kenneth>
all the guys we get are python / php guys
<kenneth>
i'm looking for some smart rubyists for my team :/
phipes has quit [Client Quit]
phipes has joined #ruby
c0rn has joined #ruby
carloslopes has quit [Remote host closed the connection]
<blazes816>
kenneth: careers.stackoverflow.com and angelist are pretty good. my boss found me crawling through github
JMcAfreak has quit [Quit: leaving]
jerius has quit []
stopbit has quit [Quit: Leaving]
samuel02 has quit [Remote host closed the connection]
nemesit has quit [Quit: Leaving...]
nateberkopec has quit [Quit: Leaving...]
alanp_ is now known as alanp
generalissimo has quit [Remote host closed the connection]
phipes has quit [Quit: phipes]
IceDragon has joined #ruby
g0bl1n has joined #ruby
g0bl1n has quit [Changing host]
g0bl1n has joined #ruby
g0bl1n has quit [Read error: Connection reset by peer]
<Pip>
What does << mean as a String method?
nicobrevin1 has joined #ruby
alex__c2022 has quit [Quit: alex__c2022]
asteve has quit [Quit: Computer has gone to sleep.]
nicobrevin1 has quit [Read error: Operation timed out]
c3vin has quit [Ping timeout: 240 seconds]
pkrnj has quit [Quit: Computer has gone to sleep.]
emergion has joined #ruby
jtharris has quit [Quit: WeeChat 0.3.9.2]
havenn has joined #ruby
nicobrevin1 has joined #ruby
francisfish has quit [Remote host closed the connection]
dmerrick has joined #ruby
SCommette has quit [Quit: SCommette]
red|dye has left #ruby [#ruby]
the_hack has quit [Quit: Computer has gone to sleep.]
d2dchat_ has quit [Remote host closed the connection]
<RubNoob>
does anyone know how to generate a private url for the carrierwave gem
the_hack has joined #ruby
serhart has joined #ruby
<Gate>
RubNoob: sorry, didn't see your highlight. I generally use s3 for file storage so protecting the files then using timed links is pretty easy
srji has joined #ruby
johnmilton has joined #ruby
<RubNoob>
@Gate I guess I'm kind of confused as to storing an upload (i.e. images) privately and then serving it using a publicly available thumbnail of some time
<RubNoob>
*type
speakingcode has joined #ruby
Nisstyre has joined #ruby
<RubNoob>
@Gate basically what I'm currently doing is saving the thumbnail to a publicly accessible dir, the actual image to a private dir, and wrapping the thumbnail in a link that points to the download action in a controller
<RubNoob>
@Gate then, in the controller, I assess the user's privs and allow them to download if they have access
<Gate>
RubNoob: makes perfect sense to me.
Targen has joined #ruby
<RubNoob>
@Gate thanks, ok - but here's where I get hung up…when generating the URL for the private download URL, I'm getting a full path rather than a relative path at the root of the server URL
the_hack has quit [Client Quit]
GoGoGarrett has joined #ruby
<Gate>
RubNoob: although if I were to do it, I would keep the files together, and use the controller action to decide on each file whether to downlaod it
cantonic has quit [Quit: cantonic]
<RubNoob>
@Gate do I need to create a model instance method that returns the customized (relative to root path) url, or is there a built-in way to do that in carrierwave?
dankest has quit [Quit: Leaving...]
ffranz has joined #ruby
srji has quit [Client Quit]
<Gate>
What method are you using to generate the URL?
sailias has joined #ruby
<nfk>
is there something specific i must note when using a loop inside string? such as this puts "#{instance.errors.each do |e, m| puts "#{e}: #{m}}\n"
<Gate>
nfk: yeah, puts will put to std out, I don't think that will do what you want
<nfk>
if do just the inner loop, it functions as expected but within the outer "#{}" it prints the hash itself
shiftpgdn has joined #ruby
<apeiros_>
nfk: #{} will insert the *return value* of the expression
<nfk>
apeiros_, and return value is the hash?
<apeiros_>
and the return value of obj.each {…} is always obj
<Gate>
nfk: try "#{instance.errors.map do |e,m| "#{e}: #{m}"}"
<Gate>
note that map instead of each
beiter has quit [Quit: beiter]
mmitchell has quit [Ping timeout: 248 seconds]
<apeiros_>
just: puts instance.errors.map do |e,m| "#{e}: #{m}"}
<apeiros_>
puts will join an array with newlines
nicobrevin1 has quit [Ping timeout: 246 seconds]
<Gate>
nfk: try "#{instance.errors.map do |e,m| "#{e}: #{m}" end}"
<RubNoob>
image_url
cantonic has joined #ruby
<RubNoob>
@Gate image_url
<Gate>
sorry, forgot the end
<Gate>
RubNoob: cool, just a sec, gotta brush up :)
<apeiros_>
just: puts instance.errors.map { |e,m| "#{e}: #{m}" } # correct syntax this time
* apeiros_
doesn't expect do/end with map…
u- has quit [Remote host closed the connection]
<Gate>
RubNoob: oh, heh. Do model_instance.image.url instead
emergion has quit [Quit: Computer has gone to sleep.]
<RubNoob>
@Gate yea, same path generated (from the root of my machine)
<Gate>
RubNoob: Oh, you want it relative to a page instead of relative to the server root?
<Gate>
Sorry, I think I misunderstood
ner0x has joined #ruby
<RubNoob>
@Gate well, for instance, I'd like to do: <a href="<%= image.url -%>" and have it generate http://<SERVER>:<PORT>/private/images/....
<RubNoob>
@Gate (sorry for the inline code)
<Gate>
RubNoob: no problem, I think I just realized I missed something obvious. Since the files are not publically shared, you don't want image.url. You want the path to your download controller instead
Targen has quit [Read error: Connection reset by peer]
<Gate>
RubNoob: so it depends on what your controller is named, and what is in your routes file.
emocakes has quit [Quit: emocakes]
<RubNoob>
@Gate, ok, I think I understand, let me tool with it a bit, thanks in advance
<nfk>
Gate, apeiros_, thanks
allsystemsarego has quit [Quit: Leaving]
<Gate>
RubNoob: no problem. And for some reason my client isn't highlighting @Gate, drop the @ if you need my attention :)
xsdg has quit [Ping timeout: 276 seconds]
<RubNoob>
Gate got it, thanks! :)
Vainoharhainen has joined #ruby
<Gate>
:)
<RubNoob>
Gate worked perfectly, I think I've got it - thanks so much for your help, much appreciated!
<Gate>
RubNoob: no problem. Enjoy.
apeiros_ has quit [Remote host closed the connection]
rismoney has joined #ruby
platzhirsch has joined #ruby
snafoo has quit []
jjang has joined #ruby
<platzhirsch>
I want to structure my small Ruby project in a Gem fashion, in lib is my code and in bin the code gets invoked, so is the usual approach to add $LOAD_PATH << './lib' after the shebang in the bin ruby code?
<Eiam>
god, EVERY time I write some code that I'm happy with for once and don't feel like a fucking mess, I start testing it and hit these stupid ass edge cases that turn code I was happy with into a mess dealing with these 20% cases
_alejandro has quit [Remote host closed the connection]
<Eiam>
oh look some jackass is in the system with no dsid, or look, his dsid is his LAST NAME instead of I dunno, an id. fantastic.
<platzhirsch>
Eiam: you seem very jolly
<Gate>
Just oozing cheer
<Eiam>
platzhirsch: I just want to be happy with my code for once, I want it to look great and just feel like I did something clean for nce
<Eiam>
once
lateau has quit [Ping timeout: 260 seconds]
<platzhirsch>
Eiam: I hear you, just finished some library code a while ago, that was the first time I wrapped a project up, I hope more follow soon
xsdg has joined #ruby
maletor has quit [Quit: Computer has gone to sleep.]
mercwithamouth has quit [Ping timeout: 255 seconds]
rburton- has joined #ruby
baphled has quit [Ping timeout: 246 seconds]
<Gate>
I know the feeling, eiam. I usually get that joy from the problems where I get to obscenely constrain my data. Like the time I wrote a "math interpreter" to do basic interpolated arithmetic
mneorr has quit [Read error: Connection reset by peer]
RagingDave has quit [Quit: Ex-Chat]
<Gate>
I tested it by giving it an SAT practice test. First time I ever used unit tests, too :)
JonnieCache has joined #ruby
mercwithamouth has joined #ruby
mneorr has joined #ruby
AndIrc_46 has quit [Read error: Connection reset by peer]
maletor has joined #ruby
dankest has joined #ruby
<JonnieCache>
so i hear the sky is falling
<JonnieCache>
confirm/deny?
subbyyy has joined #ruby
<Eiam>
so how do people handle edge cases in their code
<Eiam>
do you do exceptions? if/else? do you restructure the code to treat exceptions as normal flow
Alaude has quit [Quit: Page closed]
AndIrc_76 has joined #ruby
<JonnieCache>
i'm in your yaml, rooting your servers
emergion has joined #ruby
AndIrc_96 has joined #ruby
Nisstyre has quit [Ping timeout: 260 seconds]
AndIrc_76 has quit [Read error: Connection reset by peer]