Topic for #ruby is now Ruby programming language || ruby-lang.org || RUBY SUMMER OF CODE! rubysoc.org/ || Paste >3 lines of text in http://pastie.org || Para a nossa audiencia em portugues http://ruby-br.org/
Emmanuel_Chanel joined #ruby
thone joined #ruby
Cervajz joined #ruby
vereteran joined #ruby
mengu_ joined #ruby
mengu_ joined #ruby
sdavis joined #ruby
johnduhart joined #ruby
gentz joined #ruby
deadbea7 joined #ruby
fcoury joined #ruby
dubz joined #ruby
killing-joke joined #ruby
<killing-joke> trying to start Unicorn with REE. "/usr/bin/ruby: symbol lookup error: /usr/lib64/ruby/gems/1.8/gems/kgio-2.6.0/lib/kgio_ext.so: undefined symbol: RARRAY_PTR"
<killing-joke> i have system Ruby in /usr and Enterprise in /usr/local. i set RUBY_LIB and GEM_HOME etc, but cannot get it to find the right gems
milkshakes joined #ruby
ReinH joined #ruby
sdavis joined #ruby
minijupe joined #ruby
linduxed joined #ruby
dominikh joined #ruby
sdavis joined #ruby
savage- joined #ruby
crescendo joined #ruby
<Jarred> How do I turn a JSON object that's been parsed into something where I can call it as object_name.variable? Is there a method that already exists for doing that or do I have to write one myself?
<Jarred> i.e with http://pastie.org/private/oaftiytkupdvfxed9tyhxg (it's a JSON object parsed with the json gem, which has then been converted to an array and then to a string)
<ryanf> Jarred: you can use Hash[] to turn that into a hash and then use the normal [] operator to pull values out
<ryanf> alternately you could do like arr.assoc("created_at") I think?
ikaros joined #ruby
<ryanf> you'd have to go a bit out of your way to get dot access like that, but I'm also not sure what the point would be compared to just making it a hash
Targen joined #ruby
<ryanf> well, not that far out of your way. you could just use OpenStruct
yfeldblum joined #ruby
_whitelogger joined #ruby
Topic for #ruby is now Ruby programming language || ruby-lang.org || RUBY SUMMER OF CODE! rubysoc.org/ || Paste >3 lines of text in http://pastie.org || Para a nossa audiencia em portugues http://ruby-br.org/
<Jarred> Thanks
RomD joined #ruby
<Jarred> I'm just going to make it a Hash
welterde joined #ruby
looopy joined #ruby
knix joined #ruby
knix joined #ruby
vitoravelino joined #ruby
<apeiros_> you could also use a method_missing "enhanced" Hash
brianherman joined #ruby
beakerman joined #ruby
eerdogan joined #ruby
justicefries joined #ruby
marcuspat joined #ruby
tayy joined #ruby
LittleBill902 joined #ruby
incluye joined #ruby
grekkos joined #ruby
<grekkos> strange question but I'm looking to use Capistrano to deploy php web apps, has anyone done this before?
<shevy> waaaaah
<shevy> php!!!
xhr joined #ruby
<grekkos> I had a feeling I'd get that kind of response
emmanuelux joined #ruby
<grekkos> thing is I don't think PHP has anything as elegant as capistrano and rake and all that
tmart joined #ruby
brianherman joined #ruby
SaneWarning joined #ruby
tk___ joined #ruby
rpowell joined #ruby
fai|safe joined #ruby
RomD joined #ruby
rpowell joined #ruby
samxor joined #ruby
grekkos left #ruby
Manhose joined #ruby
nari joined #ruby
otakutomo joined #ruby
elevenarms joined #ruby
malkomalko joined #ruby
igotnolegs joined #ruby
travisjeffery joined #ruby
mongrelion left #ruby
rpowell joined #ruby
mikeric joined #ruby
travisjeffery joined #ruby
malkomalko joined #ruby
banisterfiend joined #ruby
krz joined #ruby
dbgster joined #ruby
duhastmich joined #ruby
<linduxed> i need to get an explanation of the keyword "next", but googling "Ruby next" isn't really giving me any results :-P
<linduxed> anyone who'd care to help?
<shevy> linduxed you iterate through something. that's when you use next sometimes, to continue without caring for the specific element
duhastmich left #ruby
<shevy> while gets
<shevy> next if /^#/ # Skip comments
<shevy> parseLine unless /^$/ # Don't parse empty lines
<shevy> end
<linduxed> shevy: so like break, but not dropping out of the loop?
<shevy> yeah
<shevy> but I rarely need to use it, somehow it doesn't seem too useful
<linduxed> ok
apeiros_ joined #ruby
Hachima joined #ruby
<shevy> you can try this linduxed
<shevy> %w( test1 test2 test3 ).enum_for(:each_with_index).map { |axis_range, index| next if axis_range == "test1"; axis_range }.map { |s| puts s }
<shevy> in IRB
<shevy> it will omit test1
Mahoek joined #ruby
Clooth joined #ruby
<samuelkadolph> enum_for? Why?
<shevy> does it matter
<samuelkadolph> It looks fugly
stephenjudkins joined #ruby
<shevy> %w( test1 test2 test3 ).map { |axis_range, index| next if axis_range == "test1"; axis_range }.map { |s| puts s }
<shevy> are you happier now :D
mattp_ joined #ruby
xol joined #ruby
<samuelkadolph> You forgot each_with_index
<shevy> I am going to write the perfect oneliner
<samuelkadolph> Then you wouldn't use next but select :P
<shevy> ah I don't really use next myself
<shevy> that was all part of me trying to help linduxed :(
<samuelkadolph> Your first example was better
<shevy> but you didn't like it
<samuelkadolph> I mean the while gets one
<shevy> ah that one
<shevy> hmm I don't like that one either though
<shevy> somehow I don't use while myself
stercor joined #ruby
<stercor> How do I clear "undefined method 'require_gem'" error?
LittleBill902 joined #ruby
goodieboy joined #ruby
<goodieboy> I just pushed a gem to rubygems.org but need to push a tiny enhancement (not a fix or additional feature). If my gem is at 1.2.1, what should the next version be?
iamjarvo joined #ruby
<goodieboy> ... basically, I'm making the dependencies less strict
<shevy> goodieboy 1.2.2 :D
<shevy> unless you care much about the minor version
<goodieboy> shevy: Nah, just curious about what others are doing
<goodieboy> 1.2.2 ... good enough for me :)
<shevy> well 1.3.0 wouldn't be worth it since it is just a bug fix ... what could be done is kill the 1.2.1 and release the new 1.2.1 too ... though 1.2.2 would probably make more sense
Draco_ joined #ruby
<goodieboy> shevy: yeah makes sense, I think I'll go with 1.2.2
<jimmy__> to re-release 1.2.1 kinda defeats the purpose of versioning
austinbv joined #ruby
thone_ joined #ruby
Banistergalaxy joined #ruby
Draco_ joined #ruby
flip_digits joined #ruby
mikeric joined #ruby
rsampaio joined #ruby
banister_ joined #ruby
LittleBill902 joined #ruby
thone joined #ruby
tayy joined #ruby
marcuspat joined #ruby
ziggles joined #ruby
<ziggles> Could someone please confirm if this is a bug in ruby... Or that I dont understand a simple regex? http://pastie.org/2922243
banisterfiend joined #ruby
<TheMoonMaster> ziggles: Declare $foo (eg: $foo = "derp") before you run that and watch what happens
<ziggles> TheMoonMaster: I see that it's interpolating it
Behi joined #ruby
<TheMoonMaster> Yup.
<TheMoonMaster> I've never seen it used like that, so I was surprised myself.
<ziggles> TheMoonMaster: hmm... if user input was given to a ruby script that contained something like: #$herpin would that still be ok?
<ziggles> TheMoonMaster: yeah ive never seen it either and bugging the people in #rails i see that it's a commonly used/known shorthand
<ziggles> well common to those who know lol
nerdy_ joined #ruby
<samuelkadolph> String interpolation doesn't work like that
skrewler joined #ruby
<TheMoonMaster> samuelkadolph: Why is it working then? Just a weird bug?
<samuelkadolph> You can omit the {} for instance, class and global variables
thone joined #ruby
draginx1 joined #ruby
<draginx1> http://pastie.org/private/twoxhcrc1stmbjgyhg whats wrong with these two lines?
<TheMoonMaster> Odd, never knew that. thanks.
<draginx1> says expected keyword_end O_o
<ziggles> draginx1: try taking the "if" off
<ziggles> draginx1: you actually don't need it
<draginx1> oh
<draginx1> works ty :)
<ziggles> draginx1: great! np
<ziggles> please send all profits to TheMoonMaster and samuelkadolph
<draginx1> lol
xol joined #ruby
marcuspat joined #ruby
macmartine joined #ruby
minijupe joined #ruby
dotnull joined #ruby
Pip joined #ruby
Pip joined #ruby
LittleBill902 joined #ruby
Targen joined #ruby
goodieboy joined #ruby
EddieS joined #ruby
cbuxton1 joined #ruby
LittleBill902 joined #ruby
looopy joined #ruby
stercor joined #ruby
<stercor> RoR seems to require sqlite3. How can I eliminate this requirement?
Manhose joined #ruby
incluye joined #ruby
LittleBill902 joined #ruby
looopy joined #ruby
justinmcp joined #ruby
xol joined #ruby
m_W joined #ruby
akem joined #ruby
akem joined #ruby
pac1_ joined #ruby
wmoxam joined #ruby
rpowell joined #ruby
kennethreitz joined #ruby
x0F__ joined #ruby
espeed joined #ruby
indigo_ joined #ruby
dasfugufish joined #ruby
dotnull joined #ruby
incluye joined #ruby
<deryl> it doesn't. (also see the #rubyonrails channel instead)
Norrin joined #ruby
<deryl> its set in Gemfile to default to sqlite. modify your Gemfile and bundle install. Or if this is an older Rails app, modify your config/database.yml and add the gem to the environment for whatever db you're going to use
<deryl> google has tons of examples
stephenjudkins joined #ruby
justinmc_ joined #ruby
<shevy> deryl he is long gone!
draginx1 left #ruby
savage- joined #ruby
<deryl> damn, i keep getting nailed with the join part quit blocks. :) got tired of all that noise. causes me to occasionally respond to someone i never saw leave
Banistergalaxy joined #ruby
tmart joined #ruby
<deryl> there, should fix that crap.
CannedCorn joined #ruby
justinmcp joined #ruby
radic_ joined #ruby
MekkisFreenode joined #ruby
flynn84 joined #ruby
justinmcp joined #ruby
kuadrosx joined #ruby
ryanf joined #ruby
cbuxton joined #ruby
flynn84 left #ruby
wmoxam joined #ruby
tomku|two joined #ruby
otakutomo joined #ruby
justinmcp joined #ruby
fai|safe left #ruby
xol joined #ruby
emmanuelux joined #ruby
randym joined #ruby
emptyflask joined #ruby
jhonce joined #ruby
_catch joined #ruby
Draco_ joined #ruby
Banistergalaxy joined #ruby
luckyruby joined #ruby
AndChat- joined #ruby
banisterfiend joined #ruby
austinbv joined #ruby
Banistergalaxy joined #ruby
banisterfiend joined #ruby
marcuspat joined #ruby
dotnull joined #ruby
ksinkar joined #ruby
macmartine joined #ruby
friskd joined #ruby
pen joined #ruby
michael_mbp_ joined #ruby
dotnull joined #ruby
looopy joined #ruby
rickmasta joined #ruby
rickmasta joined #ruby
jmeeuwen joined #ruby
emocakes joined #ruby
rippa joined #ruby
radmacd joined #ruby
Banistergalaxy joined #ruby
Azure joined #ruby
Azure joined #ruby
akem joined #ruby
akem joined #ruby
Azure joined #ruby
Kamoi joined #ruby
amacgregor_ joined #ruby
Hachima joined #ruby
S1kx joined #ruby
S1kx joined #ruby
maukoquiroga joined #ruby
<maukoquiroga> hi !
banisterfiend joined #ruby
tomb joined #ruby
gh joined #ruby
LittleBill902 joined #ruby
banisterfiend joined #ruby
tomb joined #ruby
macmartine joined #ruby
dnyy joined #ruby
Banistergalaxy joined #ruby
eldariof joined #ruby
michael_mbp joined #ruby
LittleBill902 joined #ruby
ksinkar joined #ruby
skim1776 joined #ruby
xpot joined #ruby
jarjar_prime joined #ruby
friskd joined #ruby
Indian joined #ruby
LittleBill902 joined #ruby
Banistergalaxy joined #ruby
banisterfiend joined #ruby
LittleBill902 joined #ruby
otakutomo joined #ruby
tolland joined #ruby
<tolland> hi
sorin joined #ruby
<tolland> Are there any packagers of ruby for CentOS 5? (I have installed a source ruby 1.8.7, but centos is insisting on the ruby 1.8.5 packages from the repo)
<tolland> i mean ruby 1.8.7 or above
<shevy> compile from source!
<shevy> wget ftp://ftp.ruby-lang.org/pub/ruby/1.8/ruby-1.8.7-p334.tar.bz2; tar -vjxf ru*33*bz2; chdir into and, configure with --prefix=/usr, make and make install!
<ryanf> haha
<ryanf> I read that as like
<ryanf> ru*b33*z
<ryanf> thought you were doing some kind of l337 thing
IrishGringo joined #ruby
zenergi joined #ruby
<shevy> nah, just too lazy to type out the full :)
<shevy> ruby 1.8.5 is really very old
thecreators joined #ruby
<skim1776> are RSpec and Cucumber always used together?
yxhuvud joined #ruby
enikar joined #ruby
<tolland> shevy: i can install from the ruby source but, the existing tools wont use the newly created binary with some jiggery in the symlinks
<shevy> hmm symlinks?
thebastl joined #ruby
<tolland> or ill have to install all the apps that need ruby from source as well
<tolland> are there like 1.9 or 2 rpms for centos that I am missing somehow?
LouisJB joined #ruby
<ryanf> skim1776: not necessarily, lots of people use rspec without cucumber
<ryanf> there are probably not many people using cucumber without rspec though
<skim1776> so cucumber goes with rspec, but rspec is independent from cucumber
Morkel joined #ruby
<ryanf> something like that
thebastl joined #ruby
sahli_ joined #ruby
justinmcp joined #ruby
stephenjudkins joined #ruby
<skim1776> can we say that Cucumber is not necessary for the testing - it's kinda luxury?
LouisJB_ joined #ruby
Seisatsu joined #ruby
eerdogan joined #ruby
stephenjudkins joined #ruby
justinmcp joined #ruby
stephenjudkins joined #ruby
ofcourse joined #ruby
<ofcourse> hi, I've just installed ruby on Win7 using rubyinstaller and when I try to print from the command line I get this error: "Unable to initialize device PRN"
Vendethiel joined #ruby
<ofcourse> Thanks skim1776, I've seen that one, it involves cygwin and shebang, I'm on windows native and using command line
<ofcourse> unless you see a way that that applies to my situation that I don't?
LittleBill902 joined #ruby
rpowell joined #ruby
<skim1776> ofcourse, I think studying ruby on windows is gonna be a pain, cygwin or VM with linux would be a good choice
<ofcourse> skim1776: what about windows makes it a apin for ruby?
<ofcourse> a pain*
<ofcourse> besides my current problem, which I'd think should be a basic sort of environment setting
lkba joined #ruby
Asher joined #ruby
dr_bob joined #ruby
adambeynon joined #ruby
<indigo_> skim1776: Oh man, it is a serious PITA
<indigo_> I spent an hour yesterday trying to debug DataMapper
<indigo_> Turns out the Windows gems are compiled against 1.9.2 instead of 1.9.3
<indigo_> But whatever, it's a learning experience :P
<skim1776> can we test only classes using rspec?
<shevy> tolland when your ruby installation works, you can install rubygems, then install everything via gems
<shevy> only very few gems need any form of compilation... hpricot comes to mind I think
<shevy> tolland that's always the question, every distribution has its own packages, packages formats, and expects you to know where to look for these, or how to install them. :) I myself was too lazy for that. These days I either install something myseful, via setup.rb rake or gems
stepnem joined #ruby
stephenjudkins joined #ruby
LittleBill902 joined #ruby
<banisterfiend> rippa: do u ever stay up all night teasing and abusing your dog for being a different species
<rippa> no
<rippa> because I don't have a dog
<rippa> I only have 10 gerbils
Htbaa joined #ruby
LittleBill902 joined #ruby
<rippa> here's 4 of them
<rippa> also them
LittleBill902 joined #ruby
rpowell joined #ruby
<linduxed> shevy: thx for the help, but i fell asleep there, it was 3 o'clock in the morning
<linduxed> :-P
LittleBill902 joined #ruby
<shevy> :D
<banisterfiend> rippa: all of your uploaded videos suck, every single one :P
vitoravelino joined #ruby
<rippa> you bet
<shevy> what are the gerbils doing
<shevy> are they on LSD or what
<rippa> they are just being gerbils
<rippa> that's what they normally do
<shevy> hmm
<shevy> teach them ruby!
trivol joined #ruby
stephenjudkins joined #ruby
Mahoek joined #ruby
iocor joined #ruby
Asher joined #ruby
stephenjudkins joined #ruby
stephenjudkins joined #ruby
jay_zawrotny joined #ruby
mikeric joined #ruby
apeiros_ joined #ruby
ramusara joined #ruby
skim1776 left #ruby
xol joined #ruby
stephenjudkins joined #ruby
ramkash joined #ruby
srji joined #ruby
stephenjudkins joined #ruby
iocor joined #ruby
LouisJB joined #ruby
<srji> hey guys
stephenjudkins joined #ruby
<srji> puts outputs an integer, p outputs a string
<srji> i don't understand the difference
<shevy> p calls #inspect on your object, puts calls #to_s on your object
Mahoru`Tsunemi left #ruby
<srji> when puts calls #to_s, does it have to output a string?
<srji> s/does/should
ramkash left #ruby
bosphorus joined #ruby
<shevy> srji not sure... redefine it and see?
DaZ joined #ruby
Htbaa left #ruby
<srji> i see
<srji> it's the same
tolland left #ruby
<apeiros_> seems puts falls back to Object#inspect if to_s does not return a string. and by Object#inspect, I mean it forgoes the object's own inspect and uses the core implementation directly.
justinmcp joined #ruby
<yxhuvud> interesting.
<apeiros_> consider: ruby-1.9.3-p0:055:0>> x = Object.new; def x.to_s; 1; end; def x.inspect; "hello"; end; puts x
<apeiros_> #<Object:0x007fdd9104acb0>
<apeiros_> that's ruby 1.9.3, as you can see. I don't know how it is in older rubies. I thought 1.8 raised.
<yxhuvud> shouldn't matter too much anyhow - not returning a string from to_s should be stomped upon
<apeiros_> I'd raise
<yxhuvud> agreed
<apeiros_> IMO it's clearly a bug if somebody tries to puts a non stringifiable object.
fermo joined #ruby
eldariof joined #ruby
<apeiros_> also consider: ruby-1.9.3-p0:056:0>> String(x)
<apeiros_> TypeError: can't convert Object to String (Object#to_s gives Fixnum)
<apeiros_> so Kernel#String() IMO does it right
<yxhuvud> I suppose it is consistent with to_i and Integer behaviour though
<apeiros_> now we could make fun of it and see what it does when the object it returns reports a class that does not return a string on to_s :D
tvo joined #ruby
tvo joined #ruby
<apeiros_> aw, mean, they (quite expectedly actually) don't go via the object's methods to determine the class :(
<shevy> hehe
<Mon_Ouie> Bad things would happen if they relied on object.class; they would try to access fields that are only available on strings on something that isn't really a string
<apeiros_> of course
bosphorus joined #ruby
justinmcp joined #ruby
bluOxigen joined #ruby
cyri_ joined #ruby
Telling joined #ruby
EddieBluh joined #ruby
justinmcp joined #ruby
pkkm joined #ruby
duey joined #ruby
ikaros joined #ruby
gener1c joined #ruby
<gener1c> if i load 2 different files in which i have 2 different constant variable assingments to the same constant variable name
<gener1c> would that be an issue since im loading them to the same namespace?
<apeiros_> a constant variable is an oxymoron :-p
<gener1c> yeah i know
<gener1c> but i dont know how to call it :P
<apeiros_> gener1c: pastie.org
<gener1c> ok
<apeiros_> you can separate the files using '##'
<apeiros_> e.g. '## file1.rb'
<gener1c> ok i will
<gener1c> oh nice!!!
<apeiros_> yes, that is an issue
<apeiros_> you redefine the constant and that's what ruby warns you about
<gener1c> yeah
<gener1c> but how would i elegantly do it then?
<gener1c> inside the class?
<apeiros_> depends on what you need it for
<apeiros_> yes, if you use it in different classes, that'd be a way
<gener1c> its for intenal use of each class
<gener1c> ah cool
<gener1c> trying it...
<apeiros_> class A; PHP_GET = "a"; end; class B; PHP_GET = "b"; end # those two are different constants
<gener1c> because now they are in the scope of the class
<gener1c> makes sense
<apeiros_> their full names are: A::PHP_GET and B::PHP_GET
<gener1c> elegant and pretty
<apeiros_> from methods of class A and from the class body of class A, you can refer to A::PHP_GET by just using PHP_GET
smgt joined #ruby
<gener1c> thanks :P makes alot of sense
<apeiros_> yw
<gener1c> plus
<gener1c> i am having issues making the script load the additional files when i run it from a different directory
tinhead joined #ruby
<gener1c> e.g: ruby1.9.1 /home/user/programming/ruby/loading_file.rb
<gener1c> response: no such file to load "/home/user/loading_file.rb"
codespectator joined #ruby
<apeiros_> gener1c: you probably want require instead of load (that won't solve your issue, though)
<apeiros_> gener1c: both load & require use $LOAD_PATH to find files you try to require.
<gener1c> so i need to make a bash file that will assign something new to $LOAD_PATH?
<apeiros_> so you need to make sure in your env or executable (and *only* in your executable, not in your library/loaded files/etc. - that'd be bad style) that your $LOAD_PATH is correctly set up
jorum joined #ruby
<apeiros_> one way is to wrap your stuff into a gem and install the gem. rubygems will then deal with the load path for you.
<apeiros_> another way is to use the -I (capital i) option with ruby: ruby -I/path/to/your/lib /path/to/executable.rb
<apeiros_> paths can of course all also be relative to your working directory, e.g. ruby -Ilib bin/exe.rb
robotmay joined #ruby
<apeiros_> and a third way (IMO the worst way) is that your executable knows where the lib directory is located relatively to itself and adds it to $LOAD_PATH.
<gener1c> wont use it then
<gener1c> i tried changing load to require
<gener1c> it doesnt recognize the file
<gener1c> do i need to use full path?
<gener1c> require './file.rb'
<gener1c> got it
<apeiros_> code for a typical PROJECT/bin/exe.rb, PROJECT/lib/foo/bar.rb where exe.rb tries to `require 'foo/bar'`: http://pastie.org/2923548
robyurkowski joined #ruby
<apeiros_> you don't need the './' and '.rb'. by convention you just do: require 'file'
<gener1c> so all my classes should be in a lib dir
<gener1c> and just the main should be in bin
<apeiros_> another convention btw. is to have a file per class & per module. that is, Foo goes into foo.rb, and Foo::BarBaz::Quuz goes into foo/bar/quuz.rb
<apeiros_> if the main is an executable, then yes, it belongs into bin
Draco_ joined #ruby
<gener1c> i do a class per file
<apeiros_> whoops, that should have been foo/barbaz/quuz.rb
<apeiros_> aw, fuck, I was still logged in under the company account when I gisted that =(
<tinhead> Ruby threads don't seem to get killed when the variable they are assigned to goes out of scope. How does one go about achieving this? Via ObjectSpace.define_finalizer?
<apeiros_> tinhead: you have to stop the thread
<apeiros_> and yes, threads keep running, regardless of whether they're still referenced anywhere.
<gener1c> so the thing you posted to pastie is the proper way to do it?
<tinhead> apeiros_: Simply put, my problem with using define_finalizer is that the thread get's created in the object space. So no amount of abstraction seems to enable me to kill the threads when they are GCed.
<apeiros_> what do you mean, "gets created in the object space"?
<apeiros_> gener1c: what I pasted is way 3 done properly
<apeiros_> way 1 & 2 are to be prefered IMO
<tinhead> apeiros_: I do Thread.new in initialize.
<apeiros_> and what stops you from storing it somewhere?
<apeiros_> btw., finalizers aren't guaranteed to be run, neither are there any constraints as to when they'll be run, if they're run
<tinhead> I did try puting it in an array which is a class variable. The finalizers don't run.
<tinhead> apeiros_: I manage how often GC runs by calling GC.start at the right spots.
<tinhead> apeiros_: Hm, so there is no guarantee that finalizers will be called even if I do GC.start?
<apeiros_> tinhead: my knowledge on that is limited, but that's how I understood it, yes.
<apeiros_> also if you fail to account for even a single reference, the finalizer is guaranteed to not run
<apeiros_> finalizers are IMO the wrong way to perform an action that must be performed
<apeiros_> and even more wrong if timing matters too
<killing-joke> my test app won't launch, saying i did not do "bundle install". why is this step necessary?
<apeiros_> killing-joke: because your app uses bundler.
<tinhead> apeiros_: hmm, timing doesn't resources do, a load average of 40 on 8 cores does
<tinhead> apeiros_: thanks for time, I'll let the room know if I am able to crack this one
Mchl joined #ruby
Tuxist joined #ruby
<killing-joke> apeiros_, thanks. i guess i see this in the gemlist. (running ... ) boy, there were a bunch of unmet dependencies.
Locke23rus joined #ruby
Ch4rAzZz joined #ruby
dbgster joined #ruby
trivol joined #ruby
LittleBill902 joined #ruby
RomD joined #ruby
EddieBluh joined #ruby
Silker joined #ruby
Sliker joined #ruby
codespectator joined #ruby
kalusn joined #ruby
g0bl1n joined #ruby
justinmcp joined #ruby
Jake232 joined #ruby
mengu joined #ruby
Mch1 joined #ruby
smgt joined #ruby
banister`movie joined #ruby
akem joined #ruby
Backsorry joined #ruby
akem joined #ruby
_walle_ joined #ruby
<_walle_> Hello, trying to find the escape character in slim so I can output the character # in my template, but can't find it anywhere. Anyone know how to do this? Please tell me if this is the wrong place to ask :)
<apeiros_> _walle_: I don't know slim, but \ is probably the most often used escape character
<pen> hey
<pen> how do I have a each block in a array select block?
<pen> ruby complains about block within block
kirun joined #ruby
<_walle_> apeiros_, thx, not in slim apparently :) I went around the problem instead
<apeiros_> pen: hu? pastie.org it up
<apeiros_> pen: please add the exception you get
<apeiros_> (preferably on the bottom to keep line numbers intact)
flip_digits joined #ruby
<pen> apeiros_: added
<pen> apeiros_: the weird thing is that, ok let me show you another method I have
<apeiros_> pen: seems like list1 == true, not an array
<apeiros_> nothing to do with the nesting
<pen> apeiros_: I just added another method in the paste, that def segment output is used as an input to this code
<pen> apeiros_: so list1
Algorith joined #ruby
<pen> apeiros_: and i'm sure that def segment returns an array
<pen> apeiros_: that's where it gets weird
<apeiros_> pen: you can be sure all you want, ruby tells you it's not :)
<apeiros_> so all you need to do now is when things start to go wrong
<apeiros_> you can make sure my assumption is correct by inspecting list1 before that loop
<apeiros_> e.g. `p :list1 => list1`
<pen> apeiros_: just do list1.inspect?
tayy joined #ruby
<apeiros_> should print: {:list1 => true}
<apeiros_> while you expect {:list1 => […something in here…]}
<pen> apeiros_: you are wrong
<pen> apeiros_: it prints out the list
<pen> apeiros_: ruby is wrong
<apeiros_> …sure
<Algorith> Has anyone before encountered a similar problem? Whenever I run a program containing a 'sudo' command Aptana completely crashes :s, pretty sure it's sudo related, when I run Aptana as root there are no problems at all.
<pen> apeiros_: yea, that's weird. because I inspect the list and it shows up in the structure I wanted
<apeiros_> pen: is the code small enough to paste it completly? with sample input that'll trigger the exception?
<apeiros_> Algorith: #ruby channel here, I think you wanted another channel…
<pen> apeiros_: it's not small and it has to do with other db structure then I have also paste that if you want to understand the list structure.
<pen> apeiros_: but let me tell you one thing, list1 is a list, it is not a true value
<apeiros_> pen: can you reduce it to a reproducable case?
<apeiros_> pen: your exception tells you otherwise
shevy joined #ruby
<pen> apeiros_: let me try
<apeiros_> "5:in `block in filter': undefined method `each' for true:TrueClass (NoMethodError) " this *very clearly* states that you're trying to call `each` on true
<apeiros_> try it in irb if you want: true.each {}
<apeiros_> $ ruby -e 'true.each {}'
<apeiros_> -e:1:in `<main>': undefined method `each' for true:TrueClass (NoMethodError)
<apeiros_> there. precise error you get.
<apeiros_> are you sure the error happens in the place you say it does?
<apeiros_> (line number in the backtrace helps with that…)
<pen> apeiros_: yea, I looked into that
<pen> apeiros_: but if it is impling that list1 is a true value, then how come list1.inspect returns a list?
<pen> apeiros_: does it work?
Lord-Harlot joined #ruby
<apeiros_> pen: will try. moment…
<apeiros_> that doesn't raise for me
<pen> apeiros_: that's what I have been doing
<pen> apeiros_: just with more data
<pen> apeiros_: what version of ruby are you running?
<apeiros_> 1.9.3
<apeiros_> you?
Squarepy joined #ruby
* apeiros_ tries with 1.9.2
tayy joined #ruby
<apeiros_> none of 1.8.7p352, 1.9.2p290, 1.9.3p0 raise an exception for me
<apeiros_> the code you pasted outputs "[]" and exists with status 0
Squarepy joined #ruby
<shevy> my code outputs ducks and exits with flowers
Tuxi joined #ruby
benja-M-_ joined #ruby
lkba joined #ruby
<apeiros_> pen: you're saying that exact piece of code you pasted raises the exception you pasted before?
wyhaines joined #ruby
eldariof joined #ruby
Russell^^ joined #ruby
<pen> hey
<pen> back
<pen> apeiros_: that's the code I have been using, just with larger data
<pen> data with more elements
<apeiros_> that wasn't my question
<apeiros_> my question was: does the code as pasted raise the exception when you run it?
<pen> apeiros_: oh, I haven't run it in under my ruby environemnt yet
<apeiros_> you see, it's somewhat pointless if it doesn't raise for you either.
<pen> apeiros_: just ran it, no problem too
<pen> lol
<pen> apeiros_: I got an empty list from it
<pen> apeiros_: I mean the return value
<apeiros_> yes, same.
<pen> apeiros_: yea, I am scratching my head now.
<apeiros_> well, it's further clues as to where the problem lies… narrow it down. if you can get a reproducable case where it raises, tell me.
heftig joined #ruby
<pen> apeiros_: btw, do you think there is a bug in my segment method?
<pen> apeiros_: like returning a true value?
<apeiros_> pen: segment will always return an array as far as I can tell
<pen> apeiros_: because I'm suspecting that it is returning true value
<apeiros_> this is programming. if you can create a reproducable case, all you have to do is trace the problem back to the source.
<pen> apeiros_: I am trying but this is just weird
<pen> apeiros_: I think the problem with true value is gone, I think i'm narrowing down to a place, I think filter is returning true value
<pen> apeiros_: is that possible? i'm not sure
<pen> apeiros_: it is showing the true problem in the second iteration of filter when I feed the output form the previous filter
<apeiros_> pen: yes
<apeiros_> line 26 will cause it to return true
<pen> apeiros_: oh, but i just want to return true for the select
<apeiros_> you probably want any? there instead of each
<apeiros_> return returns from the method
<apeiros_> break returns from the block, but only from the inner.
randym joined #ruby
<pen> apeiros_: cool. what does any? do?
<pen> apeiros_: like select?
<Mon_Ouie> No, it returns true if it finds one element in the array for which the condition is true
<apeiros_> pen: ri Enumerable#any?
<pen> oh
<apeiros_> I strongly suggest reading through all of Enumerable's methods
<pen> ok
<apeiros_> they're very useful
<apeiros_> also lots of things in ruby are Enumerable
jbw joined #ruby
<linduxed> are the arguments to a function like "def foobar(a, b, c)" stored in some array?
<apeiros_> linduxed: no
<linduxed> apeiros_: ok...
<apeiros_> also, it's methods, not functions
<linduxed> sorry
<linduxed> jargon slipping now
<apeiros_> you can define the method as: def foobar(*args)
<apeiros_> then all arguments will be stored in args as an array.
<linduxed> oh i see, that sounds pretty handy
<gener1c> a method is a function/procedure that is attached to an object
<linduxed> although in this case it won't be possible
<pen> spacebug: that's cool
<pen> apeiros_: cool
<apeiros_> it is. it's also what makes variable number of arguments possible
<gener1c> like in c
<gener1c> :P
<apeiros_> C has a splat operator? :)
<gener1c> hehe nope
<linduxed> hmmm
<gener1c> but i think a defined amount of arguments is important in most cases
<gener1c> an array could be used instead for example
<apeiros_> there are variadic functions in C
<apeiros_> see e.g. printf
<gener1c> yeah i know
<gener1c> i forgot how to make those but i have the K&R here
<gener1c> so i can find out
<gener1c> or maybe i can just google it
<linduxed> i've got a problem here, i've got a function that takes three integer arguments. i need to check how many of those are equal
<linduxed> so if a = b != c then it should return a certain value
<linduxed> either there are two, three or no equal integers
<Mon_Ouie> To be able to call a variadic function with an array of arguments, you need an alternative function that doesn't really expect variadic arguments
<Mon_Ouie> e.g. vprintf for printf
<linduxed> my first thought was to just go making a set of if statements, but that feels so sloppy
<linduxed> is there a better way?
<apeiros_> linduxed: 3 ifs should be the fastest way to do it
<gener1c> :P
<apeiros_> there's others, but I think with just 3 values it's the easiest too.
<apeiros_> actually 4 if's
<apeiros_> meh, 3 ifs. or exists, after all…
LittleBill902 joined #ruby
<linduxed> apeiros_: ok then it was as i thought... i'm getting detrimentally hesitant to type code when i think it would be ugly
<linduxed> s/think/suspect/
<apeiros_> don't overthink stuff
<apeiros_> if it takes you 2minutes to write an ugly solution and 30 to think of a nice one - write the ugly one and use the 28 minutes saved to write tests.
<Mon_Ouie> How do you know it takes 30 minutes to find the good one, and not 5, though?
<gener1c> blocks are amazing
<apeiros_> how do you know you found a good one at all?
<gener1c> are there different ways to use them or are they always used when iterating ?
<apeiros_> one nice thing about the human mind is a thing called "incubation". you don't need to actively think about a problem. your brain will still try to solve it.
<gener1c> ah wait i can use them like callback functions
<apeiros_> so if you have a solution, go with it. test it. and then if your brain suddenly pops a nice solution that is different, you can implement it without fear of regressions
<Mon_Ouie> def foo; yield 3, 4; end # this calls the block with 3 and 4
<gener1c> now i need to find a callback function usage article
<apeiros_> gener1c: you can store a block using &varname syntax
<apeiros_> def foo(&block); @callback = block; end
<gener1c> def function(var1,var2,&block)
<gener1c> yeah
<gener1c> wait what
<apeiros_> when you call foo with a block, that block will be stored in @callback and can be invoked using @callback.call
<apeiros_> at any time.
<gener1c> humz
<gener1c> implicit lambda?
<apeiros_> o0
<gener1c> is that an implicit lambda invocation?
<gener1c> you made a proc from that block
<apeiros_> never heard that term…
<gener1c> without using the lambda word explicitly
<gener1c> i thought i was supposed to use yeald
<gener1c> yield
<apeiros_> well, yes, ruby can (and does) convert from block to proc and vice versa
<apeiros_> yield will always invoke the block passed to the *current* method
<apeiros_> but if you save a block and use it in a different method, it's no longer the block passed to the current method…
<gener1c> ohhhhhhhhhhh
<gener1c> but wouldnt that hurt the readablility of the code?
<apeiros_> no
<apeiros_> consider things like: after 5.minutes do puts "5 minutes are over!" end
<apeiros_> you'll save that block to invoke it after 5 minutes
<apeiros_> or:
<apeiros_> button.on_click do puts "you clicked the button" end
<apeiros_> you'll save that block in order to invoke it whenever you detect a click
* shevy clicks on apeiros_
<gener1c> lol
* apeiros_ feels clicked
Johnnus_ joined #ruby
BAR_MEN joined #ruby
<apeiros_> or: class Foo; extend Validations; validate :attribute do |val| … end; end # <-- you'll store the block to invoke it whenever you want to validate an instance of Foo
<apeiros_> the possiblities are huge.
<apeiros_> and yes, blocks are awesome.
bosphorus_ joined #ruby
<shevy> :)
<apeiros_> procs likewise, but the syntax sugar that is blocks makes it super nice to use.
<shevy> you wanted to be able to pass multiple blocks to the same method once, or?
<apeiros_> shevy: wanted? I still want.
<shevy> ah ok
<apeiros_> they tried but fell short IMO with ->{}
<gener1c> pass em as a proc array?
<shevy> hmm don't like the -> notation too much myself
<shevy> skyrocket operator!
<shevy> a proc array?
<rippa> I wonder why -> doesn't use |x, y| format
goodieboy joined #ruby
<apeiros_> gener1c: yes, you simply pass procs, whether as individual arguments, as array, or as hash doesn't matter
<apeiros_> it's about the syntax
<apeiros_> rippa: probably amibguity issues in the syntax
m_W joined #ruby
<gener1c> whats wrong with [&blcok1,&blcok2]
<apeiros_> gener1c: that's not how you invoke the method
<gener1c> no im talking about an alternative to ->{}
<apeiros_> http_get success: proc { … }, failure: proc { … }
<apeiros_> that'd be
<apeiros_> ah
<BAR_MEN> :O
<gener1c> you cant pass an anonymouse array anyways
<apeiros_> o0
<apeiros_> of course you can
<gener1c> you can!?
<gener1c> nono i mean
<apeiros_> foo([1,2,3]) # <- sure
<gener1c> when defining
<gener1c> you canty
<gener1c> ur right
<apeiros_> ah
<gener1c> i meant
<gener1c> when defining
<gener1c> def methond([1,2,3]) has no meaning
<Mon_Ouie> neither does def method(1, 2, 3) mean something
<gener1c> def methond([var1,var2,var3])
<gener1c> nevermind , im confused
<Mon_Ouie> def foo((a, b, c)); puts b; end
<Mon_Ouie> foo [1, 2, 3]
<Mon_Ouie> But then if you have a finite amount of arguments you should be using foo(a, b, c) directly
<Johnnus_> How can i name a belongs to relationship in mongoid? For example a User model and a Car and i want to have a belongs_to :user, :as => :owner in car. How can i do that in mongoid?
Pip joined #ruby
Pip joined #ruby
_iori_ joined #ruby
<shevy> anonymouse! he wrote anonymouse!
<shevy> a mouuuuse!
<shevy> squeaaaaak
<gener1c> anonymoanonymous
eerdogan joined #ruby
Vendethiel joined #ruby
kmmndr joined #ruby
Jake232 joined #ruby
robyurkowski joined #ruby
bosphorus joined #ruby
kmmndr joined #ruby
emmanuelux joined #ruby
Knodi joined #ruby
kmmndr joined #ruby
jtdowney joined #ruby
Draco_ joined #ruby
Azure_ joined #ruby
Natch| joined #ruby
Pip joined #ruby
Pip joined #ruby
tk__ joined #ruby
<linduxed> how is this line wrong ?
<linduxed> if ( a == b ** b == c )
<apeiros_> it is probably parsed as: (a) == (b**b) == (c)
looopy joined #ruby
bier|tp joined #ruby
<apeiros_> and that in turn is ((a) == (b**b)) == (c)
<apeiros_> but how about you tell us how it is wrong?
bier joined #ruby
<linduxed> well i got some errors, but i fixed it (i think) by writing "if (a == b) ** (b == c)"
grekko joined #ruby
<linduxed> undefined method `**' for true:TrueClass :-S
<linduxed> isn't ** ruby's logical and?
<apeiros_> in that case, it obviously is (a == b)**b
<apeiros_> and no, a**b is a to the power of b
<apeiros_> && is and
looopy joined #ruby
crescendo joined #ruby
<linduxed> apeiros_: well that was my suspicion... but i checked this link out http://www.devarticles.com/c/a/Ruby-on-Rails/Ruby-Operators-and-Arrays/
<linduxed> apeiros_: and it didn't agree
<linduxed> apeiros_: or maybe i misread
<apeiros_> it says ** - Exponentials
<apeiros_> lol
<apeiros_> yeah, later down it says ** - logical and
<linduxed> should have followed my intuition and went for && ....
<rippa> that's messed up
Ch4rAzZz joined #ruby
<rippa> also While and stuff is capitalized
<rippa> that's not gonna work
<apeiros_> commented…
<apeiros_> bad article IMO.
matadon joined #ruby
<matadon> Any idea what method you need to implement on the class being enumerated over for Enumerable#grep to work?
<matadon> E.g., regexp matching on a Class
<apeiros_> ===
<Mon_Ouie> Nope, it does it the other way around
<Mon_Ouie> it calls pattern === element, not element === pattern
<matadon> Mon_Ouie: Exactly.
<rippa> matadon: #each , I guess
<matadon> rippa: No, that just implements the iteration part. I want to create a class Foo that can match against a regexp (e.g., pattern.match(Foo.new))
<Mon_Ouie> You just need an object whose === method can be called on what you're iterating over
<matadon> Mon_Ouie: So I have to munge the pattern provided to grep?
<matadon> Or is there some method I can implement on the enumerated object so that pattern.match(...) will work on it?
<Mon_Ouie> It just depends on what pattern === does
<Mon_Ouie> (it does not call match, only ===)
<apeiros_> matadon: you mean you have [YourClass.new, YourClass.new].grep(/pattern/) and you want the YourClass instances be matched?
<apeiros_> you'd need YourClass#to_str
<matadon> Yep.
<matadon> to_str
<matadon> Thanks, to_s wasn't playing ball.
<apeiros_> be aware though, that to_str technically means that your object has one true string representation
* apeiros_ wonders why ruby doesn't use a coerce mechanism there…
<matadon> apeiros_: Thanks! The string representation won't be a problem for this class.
<yfeldblum> [YourClass.new, YourClass.new].select{|o| o.to_s =~ /pattern/}
Lord-Harlot joined #ruby
goodieboy joined #ruby
<linduxed> is there a different comment character than # ?
<linduxed> like java has both // and the one for longer clauses?
<linduxed> i think it was **/ */
<apeiros_> there's =begin and =end
<apeiros_> but they must be at the very beginning of the line
<apeiros_> not whitespace in front of it
<apeiros_> yfeldblum: with that solution, I'd implement YourClass#=~ directly, so you can just do o =~ /pattern/, without to_s
closedbracket joined #ruby
dotnull joined #ruby
sythe_ joined #ruby
Pip joined #ruby
Pip joined #ruby
codespectator joined #ruby
kuadrosx joined #ruby
looopy joined #ruby
<linduxed> how would i express "if anyone of a, b or c are less than 0, raise FooException" ?
<linduxed> without doing three if statements...
<Mon_Ouie> if a < 0 && b < 0 && c < 0
dyer joined #ruby
<Mon_Ouie> You only need one
<rippa> [a, b, c].any? {|x| x<0}
<rippa> ^pervert way
<rippa> Mon_Ouie: you mean ||
<linduxed> rippa: that was what i was looking for... but then i realized after seeing Mon_Ouie's solution that it might be overkill :-P
<Mon_Ouie> Oh, right
<raz> hm, this doesn't seem to work in ruby 1.9.2
<raz> puts ERB.new("foo <%=bar%>").result(OpenStruct.new(:bar => "bar").send(:binding))
<Mon_Ouie> If you strip whitespaces, mine is actually the shortest one
<raz> what's the 1.9.2-way to do it?
<Mon_Ouie> 13 vs 20 chars
bgupta joined #ruby
codespectator joined #ruby
iamjarvo joined #ruby
dotnull joined #ruby
bluOxigen joined #ruby
<zaarg> is there some way to extract multiple items from an array at once? i.e. like f,g = foo.split(":")[0,1]
nicoulaj joined #ruby
kalusn_ joined #ruby
nerdy_ joined #ruby
kalusn_ joined #ruby
<Mon_Ouie> See the docs for Array#[] and Array#values_at
banister`movie joined #ruby
looopy joined #ruby
beakerman joined #ruby
looopy joined #ruby
dyer joined #ruby
RomD` joined #ruby
thepix joined #ruby
PaulBird joined #ruby
Hellojere joined #ruby
emocakes joined #ruby
michael_mbp_ joined #ruby
savage- joined #ruby
PaulBird left #ruby
felipegb joined #ruby
shaatar joined #ruby
dkannan joined #ruby
avandendorpe joined #ruby
cesario joined #ruby
cbuxton joined #ruby
MetaCosm joined #ruby
john2x joined #ruby
dotemacs joined #ruby
GSpotAssassin joined #ruby
davidboy joined #ruby
Norrin joined #ruby
leynos joined #ruby
Indian joined #ruby
shaatar joined #ruby
justicefries joined #ruby
zawopak joined #ruby
deweysmith joined #ruby
kirk_r joined #ruby
dnyy joined #ruby
dkannan joined #ruby
apeiros_ joined #ruby
dotnull joined #ruby
Jarred joined #ruby
atmosx joined #ruby
Clooth joined #ruby
michael_mbp_ joined #ruby
dagnachewa joined #ruby
relix joined #ruby
lolsuper_ joined #ruby
lolsuper_ joined #ruby
zbrown joined #ruby
sorin joined #ruby
dasfugufish joined #ruby
dotnull joined #ruby
king313 joined #ruby
banister`movie joined #ruby
pen joined #ruby
<linduxed> i don't think i understand exceptions correctly https://gist.github.com/1395994
codespectator joined #ruby
DaZ joined #ruby
<linduxed> the idea is that this "assert_raise(TriangleError) do triangle(1, 1, 3) end" for instance should pass
<linduxed> and this "assert_raise(TriangleError) do triangle(3, 4, -5) end"
k0i joined #ruby
<linduxed> come to think of it... there might be more to it than me not understanding exceptions...
<apeiros_> linduxed: fix your indents. rescue is indented by one too deep
<apeiros_> should be on the same level as the `begin` it belongs to
<linduxed> ok, but that didn't change much in the error
<apeiros_> also, assert_equal? this is not a test unit code, or is it?
<rippa> anyone used jruby with google apps?
<linduxed> apeiros_: probably not
<linduxed> apeiros_: i'm not sure if i should use it or not
<apeiros_> then don't use assert_equal. from where does it come anyway? did you include Test::Unit::Assertions?
<linduxed> apeiros_: all i know is that i need the exception to pop up when there are erroneous integers passed as arguments to triangle()
<apeiros_> raise TriangleError, "your message" if condition
<apeiros_> that's how you do it
<linduxed> oh
<apeiros_> rescue doesn't raise (not throw) an exception, it, well, rescues it.
<linduxed> well that was better
<apeiros_> opposite
<linduxed> i'll try that
<apeiros_> a rescue will stop an exception from propagating
<linduxed> that doesn't tell me much, i'm afarid
<linduxed> *afraid
<Mon_Ouie> apeiros_: Those are the Ruby koans
<apeiros_> Mon_Ouie: aha
<apeiros_> then I'd need more context to comment
<apeiros_> (and I'm not in the mood for more context…)
steph021 joined #ruby
<linduxed> apeiros_: solved it by doing it like this https://gist.github.com/1396005
Brozilla joined #ruby
<linduxed> however, is there a way to make line 19 shorter or go across multiple lines?
<Mon_Ouie> first clause of your condition is redundant
jorum joined #ruby
<Mon_Ouie> 0 + 0 <= 0 will be true anyway
<linduxed> yeah that's true
<linduxed> oh wait
<linduxed> i've killed off 1 1 1
<linduxed> and 2 2 2 and so forth
<linduxed> hmmm
<linduxed> i'll have to fix that
<linduxed> still
<linduxed> how do i split that up to multiple lines?
<linduxed> i can't split up the condition can i?
<Mon_Ouie> You can have a newline after ||
<linduxed> oh, that does it then
<linduxed> rippa: pretty true...
<yxhuvud> you can also use \
<matti> Mon_Ouie: Hey there :)
<linduxed> can i have a newline after if?
<Mon_Ouie> 'alut matti :)
<Mon_Ouie> Yes, it knows there needs to be one expression after if
<linduxed> ok
<Mon_Ouie> And that the condition is only one expression
rickmasta joined #ruby
Pip joined #ruby
Pip joined #ruby
srji joined #ruby
CannedCorn joined #ruby
looopy joined #ruby
macmartine joined #ruby
xpot-mobile joined #ruby
Hellojere joined #ruby
sorin joined #ruby
chrisbdaemon joined #ruby
emptyflask joined #ruby
yxhvuud joined #ruby
<chrisbdaemon> trying to write a class for aes encryption with openssl.. I have this: http://pastebin.com/zUSzf0DJ when I use my class to encrypt and decrypt a file, the decryption works sometimes but other times it returns an error about the "wrong final block length"
<chrisbdaemon> did I forget something or leave something out?
eldariof joined #ruby
Telling joined #ruby
crescendo_ joined #ruby
kassien_ joined #ruby
iband joined #ruby
kalusn joined #ruby
daidoji joined #ruby
wyhaines joined #ruby
robyurkowski joined #ruby
pabloh joined #ruby
flip_digits joined #ruby
ThinkSocrates joined #ruby
tomhsx joined #ruby
tatsuya_o joined #ruby
felipegb joined #ruby
wyhaines joined #ruby
bosphorus_ joined #ruby
<chrisbdaemon> got it, there was a problem with encoding, opening the file both times with "b" in the mode fixes it :) the encoding was screwing up my slicing the iv off the front of the file
chrisbdaemon left #ruby
<apeiros_> eeeew windows
ThinkSocrates left #ruby
Adman65 joined #ruby
closedbracket joined #ruby
kartouch joined #ruby
mxweas_ joined #ruby
banister`movie joined #ruby
atmosx joined #ruby
<atmosx> hello
<atmosx> can you tell me if this sqlite3 string has errors? I'm concerned about the 1st '?' … which should be sqlite3 table name=> db.execute('INSERT INTO ? (username, date, content, content_id) VALUES(?,?,?,?)', @userid, username, time, text, text_id)
<atmosx> it comes out with an error
fladamd joined #ruby
atmosx left #ruby
atmosx joined #ruby
jr00n joined #ruby
pantsman joined #ruby
pantsman joined #ruby
cbuxton joined #ruby
yellow5 joined #ruby
IrishGringo joined #ruby
Cervajz joined #ruby
workmad3 joined #ruby
djr_ joined #ruby
benja-M-__ joined #ruby
thecreators joined #ruby
qanyan joined #ruby
goodieboy joined #ruby
dbgster joined #ruby
<qanyan> Hello everyone, have a question. Please check following paste - http://www.pastie.org/2925102 Not quite sure why we've converted symbols to strings to make that include check? It could work without it
mikepack joined #ruby
<rippa> qanyan: because if you used symbol it would match regardless of existence of method with same name
Axsuul joined #ruby
xol joined #ruby
jay_zawrotny joined #ruby
<qanyan> rippa, was testing it in irb and it returned false but once I've made test.rb file and executed it there - returns true even for nonexisting method. Why is it happening?
jr00n left #ruby
mxweas_ joined #ruby
Cervajz joined #ruby
jonathanrwallace joined #ruby
tomzx joined #ruby
Annaeus joined #ruby
<Annaeus> Simple question: I have an idea for a web based app, my only programming experience is c++ (ten years ago) I've narrowed my language of choice down to Ruby and Python, any thoughts?
sullx joined #ruby
<rippa> use either
Jake232 joined #ruby
<shellox> Annaeus: ruby is better imho
<shellox> i really like the sinatra web framework for ruby
<rippa> sinatra sure is fun
sdavis joined #ruby
<Brozilla> and really simple
<Annaeus> shellox: yeah I'm leaning that way, just because I found the rails framework, haven't found a framework for python yet (although I'm sure they are out there)
<Afal> Django?
<rippa> Django
<shellox> ruby: rails or sinatra
<shellox> python: bottlepy or flask
qanyan left #ruby
<shellox> i dont like rails much to be honest
<rippa> rails is too invasive
<rippa> monkeypatches everywhere
<shellox> too bloated for me
<Annaeus> what makes sinatra better than rails?
<Brozilla> i'd go with sinatra if you're just starting. i started with rails right away and it's really confusing if it's your first experience with ruby
<shellox> and too much changes with every version
<Annaeus> interesting
<shellox> Brozilla: i code ruby for 1 year now. I started with sinatra for web stuff then and try tried rails, but i failed soo hard ;)
<shevy> what is special about sinatra
<shellox> Brozilla: i really asked myself 'wtf, where to add this?. Which woulb be the correct place'
<Brozilla> haha, exactly :p
<shellox> shevy: i like it because it's simple and powerful
<Brozilla> sinatra is really really simple
<Annaeus> I'm guessing sinatra is open source?
<Brozilla> it's basically just get '/page/:id' do [your code] end
<shellox> Annaeus: yep
<shellox> Annaeus: http://www.sinatrarb.com/
looopy joined #ruby
<shellox> Brozilla: keep things simple is good imho
<Annaeus> thanks, I was just about to google, since it was not on Git
<Brozilla> it is
<shellox> rails started simple but turned in the wrong direction imho
<shellox> i need 5% of the rails framework, so it doesnt make sense to ship a product with the other useless stuff, which i dont use
<shellox> Brozilla: and it's so fucking hard to write a rails app w/o a database ;)
<Brozilla> never attempted, but i can see why
<shellox> maybe it got easier now, im not sure
<shellox> i tried it with the release of rails3
jbw joined #ruby
marknyc joined #ruby
tmart joined #ruby
looopy joined #ruby
zommi joined #ruby
LittleBill902 joined #ruby
fladamd joined #ruby
<Annaeus> shellox and Brozilla: thanks for your help, I've decided to go with Ruby. Still up in the air on sinatra versus rails though, I'll take you at your word that sinatra is better, but rails has a bigger community with more help
fladamd joined #ruby
<fladamd> what does -> mean?
<fladamd> i.e. ->(value) { TagList(value) }
<rippa> I'd say sinatra is easier to get into
<rippa> fladamd: it's alternate syntax for lambda
<fladamd> ah, thank you!
<rippa> lambda {|value| TagList(value)}
<rippa> means exact same thing
tayy joined #ruby
petercoulton joined #ruby
sythe joined #ruby
sythe joined #ruby
jwmann joined #ruby
jwmann joined #ruby
jwmann joined #ruby
nyuszika7h joined #ruby
cyri_ joined #ruby
tmart joined #ruby
peterhil` joined #ruby
swarles joined #ruby
friskd joined #ruby
<swarles> how do you get arguments like the sprintf method that has a variable ammount of methods?
<swarles> like you can do sprintf("hello %s %s, how are you today? I am %s", first_name, last_name, my_name)
xol joined #ruby
rsampaio joined #ruby
rgrinberg joined #ruby
austinbv joined #ruby
<yfeldblum> `def my_method(first_arg, second_arg, *args)`
frogstarr78 joined #ruby
cableray joined #ruby
<shevy> wait
<yxhuvud> sleep
<shevy> where are the variable amounts of methods?
<shevy> did he mean arguments
<swarles> oh yes, sorry, i must not have paid attention while typing
<daidoji> well it works the same with methods though right?
<daidoji> because you can pass blocks to functions?
<yfeldblum> driving while texting ... car chashes ... typing while texting ... database sever crashes ...
<yxhuvud> daidoji: you can only pass a single block.
<shevy> gah
<shevy> "it works the same with methods" ... "you can pass blocks to functions"
<daidoji> yxhuvud, o really?
<shevy> I swear I am going to switch between functions and methods from now on even in the middle of a sentence
<yxhuvud> yes really. (You can convert them to procs and pass those, though)
<daidoji> I have never tried it though so I didn't know
<yfeldblum> you can only pass a block, or a single object which responds to #to_proc, in the block slot of a message-send
<daidoji> I guess I just always assumed
<daidoji> ahhh I see
<yfeldblum> x = Object.new; def x.to_proc; proc { 3 } end; call_some_method(&x)
<yfeldblum> in case anyone was looking for some advanced ruby tricks :P
tomhsx joined #ruby
<shevy> what is that doing
xol joined #ruby
<daidoji> just what he said
<yxhuvud> yfeldblum: it not only has to answer to to_proc, the method actually has to return a Proc.
<shevy> it returns 3
<daidoji> cause thats how its defined homie
<shevy> awesome
ryanf joined #ruby
Gazler joined #ruby
<yfeldblum> yxhuvud: that's right
<yfeldblum> you can also pass nil, so that this trick works: `call_some_method(3, 4, 5, :hi_there, &(Proc.new if block_given?))` whether or not a block was passed in to the current code
<yfeldblum> but please don't do that, it's ugly :P
IrishGringo joined #ruby
<daidoji> is anyone in here familiar with jruby? and even if you're not how does the rspec process go?
<daidoji> I should just be able to install the rspec gem and then run rspec with no arguements right?
<daidoji> after building from source i mean
<yfeldblum> i believe rspec requires arguments: you have to pass in the list of files/directories to run ... `rspec spec` or `rspec spec/models` or `rspec spec/models/post_spec.rb`
Draco_ joined #ruby
<daidoji> but I've got the process right correct?
austinbv joined #ruby
<daidoji> I build from the source and get the ruby executable (or jruby.jar in this case), then run 'rake spec' or 'rspec spec' and it should work
rickmasta joined #ruby
alexisd joined #ruby
SolarisBoy1 joined #ruby
<alexisd> hello, I'm looking for a server to deploy some rails apps, Heroku and Slicehost seems the cheapest ones, but they are quite expensive
<alexisd> I dont want to pay 150$ a month, do I have some alternatives plz?
airhorns joined #ruby
tomzx joined #ruby
<k0i> you could get a vps.. linode is like $20
<daidoji> alexisd, if you have to ask that question, you should probably just pay the money (imo)
<daidoji> it'll be less hassle for you in the long run
<swarles> def my_method(first_arg, second_arg, *args) How would i go about using that glob?
<alexisd> daidoji, I checked linode but it seems some poor on documentation, and I cant try it
<alexisd> do you use it ?
<alexisd> oops I mean k0i
<alexisd> daidoji, I dont have 2000$ a year
LittleBill902 joined #ruby
<alexisd> I now use free heroku account that is superb, but is like 200$ a month if I go commercial :(
<yfeldblum> rackspace cloud is $11/mo for the smallest slices
<daidoji> alexisd, I mean I myself would/have run VPSs for some of my smaller projects
<daidoji> but its a matter of experience
<yfeldblum> heroku has a free tier
<daidoji> I can do everything from linux on up to rails
<daidoji> so if you feel like you can do that then go with a VPS or a cloud solution thats cheap
<alexisd> yfeldblum, on https://cart.rackspace.com/cloud/ i check cloud servers and cloud files, that is 11$, but it says cloud sites starts from 150$ a month
<alexisd> I wonder why that huge difference
<daidoji> but its usually pretty cost effective just to let Engine Yard or Heroku do all the heavy lifting while you focus on your app
<daidoji> because you'll end up spending that much in support costs anyways
<alexisd> daidoji, yes heroku is amazing, but quite expensive :(
<alexisd> I wonder why rails host is so more expensive than php
<daidoji> alexisd, well because the php host doesn't have to do anything
<daidoji> you slap modphp on an apache box and you're set
<daidoji> the rails guys do a lot more to work with you to enhance your rails app
<daidoji> I mean if you're really really strapped for cash, go with the VPS solutions
<daidoji> but you'll have to support everything yourself
<alexisd> this pricing is really huge problem on rails
<alexisd> daidoji, you have heroku account?
<mattp_> how do i test actionmailer?
<daidoji> alexisd, I do but only the free version
<mattp_> i generate a Mail::Mesage and call .deliver
<mattp_> no errors outputed
<yfeldblum> alexisd: why are you looking at cloud sites? it doesn't support rails
<mattp_> but im not receiing the email
<alexisd> yfeldblum, the support, I have already deploy rails 3 on them
<alexisd> they*
<yfeldblum> alexisd: last i checked, they used to support rails on cloud sites but they were discontinuing that
<alexisd> yfeldblum, what are u saying? We talk about Heroku
sahli_ joined #ruby
<daidoji> yfeldblum, you could try EngineYard
<daidoji> it shouldn't be more than $100 assuming you don't get too many customers at first
<alexisd> daidoji, well I will try my 750 trial hours there
<Brozilla> is managing a VPS really that hard? i never hosted a ruby/rails site myself, but i wouldn't like to pay 150/month for a small site
<alexisd> Brozilla, yes thats am saying also
heftig joined #ruby
<Brozilla> idk I'm asking, i've got no experience with it, really
<yfeldblum> Brozilla: yes, you've got to worry about users, passwords, SSH configs, ports, firewalls, packages, etc
<Brozilla> surely there are pre-configured thingies around?
mdel joined #ruby
marcuspat joined #ruby
banister`movie joined #ruby
vitoravelino joined #ruby
vitoravelino joined #ruby
xol joined #ruby
LittleBill902 joined #ruby
Targen joined #ruby
srji joined #ruby
felipegb joined #ruby
<alexisd> thank you for your advices
<alexisd> I will pay I guess :(
<alexisd> see ya ppl, bb
petercoulton joined #ruby
macmartine joined #ruby
Banistergalaxy joined #ruby
rpowell joined #ruby
iocor joined #ruby
Silker joined #ruby
gener1c joined #ruby
<gener1c> is there a way to check howmuch b/w a single run of an app i wrote eats?
<gener1c> i tried ftop but there is too much clutter
randym joined #ruby
workmad3 joined #ruby
Sliker joined #ruby
gener1c joined #ruby
<gener1c> is there a way to check howmuch b/w a single run of an app i wrote eats?
randym_ joined #ruby
<Jarred> Does anyone here know their way around RMagick somewhat?
grekko joined #ruby
<zedUNDginger> Jarred: do u
<Jarred> nope
jtdowney joined #ruby
LouisJB joined #ruby
gener1c_ joined #ruby
zedUNDginger joined #ruby
SaneWarning joined #ruby
mengu joined #ruby
tomzx joined #ruby
benmoss joined #ruby
gener1c joined #ruby
luckyruby joined #ruby
emocakes joined #ruby
Draco_ joined #ruby
tomzx joined #ruby
friskd joined #ruby
rsampaio joined #ruby
daidoji joined #ruby
sythe joined #ruby
sythe joined #ruby
jorum joined #ruby
looopy joined #ruby
gener1c joined #ruby
looopy joined #ruby
Draco_ joined #ruby
tatsuya_o joined #ruby
Lytol joined #ruby
srji joined #ruby
ramusara joined #ruby
Draco_ joined #ruby
RomD` joined #ruby
dabaR joined #ruby
<dabaR> I am writing a gem, and I've added a dependency on railsless-deploy '>=1.0.2'
cande joined #ruby
<dabaR> It fails to install the gem telling me that it depends on that^
<dabaR> If I do gem install railsless-deploy -v=1.0.2, then install my gem, it works fine
<dabaR> I don't get why it doesn't just install it itself
rpowell joined #ruby
gener1c joined #ruby
dasfugufish joined #ruby
badabim joined #ruby
<ryanf> dabaR: installing from a .gem file doesn't automatically resolve dependencies iirc
<ryanf> but it should work once it's on rubygems.org
sdavis joined #ruby
eerdogan joined #ruby
<dabaR> It installs all the other deps
<dabaR> I made it available on my web server
<ryanf> oh, weird
<dabaR> That's the tut I followed, and it works fine.
<dabaR> But I've been installing this for a while now
<dabaR> Like, debugging, testing, etc.
dv_ joined #ruby
emocakes joined #ruby
dcarper joined #ruby
<dabaR> So the latest dep I added doesn't work any more
<dabaR> I feel that it is most likely that it is caching somehow something
<dabaR> Cause that dep looks like all the others in the gemspec
notbrent joined #ruby
robyurkowski joined #ruby
ernestocid joined #ruby
<notbrent> hi, i was wondering if anyone knows of a way to get a sequence of numbers regardless of whether it is incrementing or decrementing.. what i mean is, (1..3).each .. etc works, but (3..1).each etc does not, how could i make either case work?