apeiros_ changed the topic of #ruby to: programming language || ruby-lang.org || Paste >3 lines of text in http://pastie.org || Rails is in #rubyonrails
nopolitica has joined #ruby
startling has joined #ruby
carlyle has joined #ruby
keymone has joined #ruby
danielvdotcom has joined #ruby
elalande has joined #ruby
ConstantineXVI has joined #ruby
rramsden has joined #ruby
ChampS666 has joined #ruby
pachon has joined #ruby
pachon has quit [#ruby]
veronatii has joined #ruby
shadoi has joined #ruby
otters has joined #ruby
tar_ has joined #ruby
veronatii has quit ["Linkinus - http://linkinus.com"]
wefawa has quit [#ruby]
headius has joined #ruby
adamkitt_ has joined #ruby
davidcelis has joined #ruby
__class__ has joined #ruby
savage- has joined #ruby
replore has joined #ruby
rramsden has joined #ruby
__class__ has joined #ruby
cbuxton has joined #ruby
adamkittelson has joined #ruby
MrGando has joined #ruby
krusty_ar has joined #ruby
_ack_ has joined #ruby
h4mz1d has joined #ruby
shevy has joined #ruby
CheeToS has joined #ruby
runa has joined #ruby
fayimora has joined #ruby
sectionme has joined #ruby
tar_ has joined #ruby
jgrevich has joined #ruby
jgrevich has joined #ruby
jgrevich_ has joined #ruby
tingo has joined #ruby
yoklov has joined #ruby
pac1 has joined #ruby
Chryson has joined #ruby
brngardner has joined #ruby
albemuth has joined #ruby
__class__ has joined #ruby
jgrevich_ has joined #ruby
dfamorato has joined #ruby
<danielvdotcom> any suggestion for a scraping lib?
dfamorato_ has joined #ruby
<chico> nokogiri
strife25 has joined #ruby
cheok has joined #ruby
MrGando has joined #ruby
pac1_ has joined #ruby
macmartine has joined #ruby
Sailias has joined #ruby
BSaboia has joined #ruby
sacarlson has joined #ruby
alienvenom has joined #ruby
<Spaceghostc2c> ^
<fowl> its an evil that we have to live with
<any-key> nokogiri is just an XML/HTML parser (an awesome one, at that)
<any-key> mechanize or whatever is supposed to be awesome
startling has quit [#ruby]
kah_ has joined #ruby
deryldoucette has joined #ruby
zeroeth has joined #ruby
jacktrick has joined #ruby
frishi has joined #ruby
liluo has joined #ruby
alx- has joined #ruby
pastjean has joined #ruby
<shadoi> Use scrubyt if you want a DSL and some syntactic sugar on top of mechanize.
<shadoi> it can do sequential form posts, etc.
j3r0m3 has joined #ruby
j3r0m3 has joined #ruby
<any-key> I tend to roll my own but everyone has their own preferences for such things
williamcotton has joined #ruby
daniel_hinojosa1 has joined #ruby
seanstickle has joined #ruby
cobragoat has joined #ruby
chico has joined #ruby
dbgster has joined #ruby
nari has joined #ruby
chimkan_ has joined #ruby
KB9AGT has joined #ruby
joaoh82 has joined #ruby
chioque has joined #ruby
looopy has joined #ruby
<fowl> is that a question
<fowl> why did you hit control d?
<fowl> is it because you have twitchy fingers?
chioque has joined #ruby
shtirlic has joined #ruby
<danielvdotcom> any-key: chico thanks. i ended up just knocking it out with open-uri
radic_ has joined #ruby
rking has joined #ruby
surfprimal has joined #ruby
Drewch has joined #ruby
wilmoore has joined #ruby
iamjarvo has joined #ruby
gurugeek_ has joined #ruby
<chico> danielvdotcom: great
fbernier has joined #ruby
sacarlson has joined #ruby
andrewhl has joined #ruby
RORgasm has joined #ruby
patrick99e99 has joined #ruby
conor_ireland has joined #ruby
<patrick99e99> what is the difference between class Foo; class_eval { "def #{some_name}; puts 'bar'; end" }; end... and class Foo; class << self; define_method :some_name { puts 'bar' }; end; end; ?
<fowl> class_eval do "def ..." end
<fowl> if class_eval works like that my mind is blown
austinbv has joined #ruby
<austinbv> anyone wanna write a trie w/ radix sort with me?
<fowl> send it a string or a block, not a string returned from a block
<fowl> patrick99e99, can you pastebin that so its readable
<austinbv> could use a pair, you can push it to gh if oyu want to :)
ringotwo has joined #ruby
blueadept has joined #ruby
<fowl> austinbv, looks confusing
<austinbv> should be < 150 lines of code
<austinbv> I think I can get it in a couple hours
chico has joined #ruby
dzieglersf has joined #ruby
<fowl> is that homework or something
albemuth has joined #ruby
<patrick99e99> fowl: http://pastie.org/3759451
apok_ has joined #ruby
<patrick99e99> fowl, it just seems like when I look at rais source code, I see a lot of "def foo" in strings, that looks rather... yucky-- and just wonder why people seem to prefer that over define_method
kevinbond has joined #ruby
<patrick99e99> *rails source code
jamesbrink has joined #ruby
joe_dhay has joined #ruby
<joe_dhay> hi to all
<fowl> if you use strings you can do interpolation and create crazy dynamic methods to satisfy your twisted desires
mattyoho has joined #ruby
<joe_dhay> can somebody help me to my problem?
<dzieglersf> we can try
<fowl> patrick99e99, mostly its a matter of preference i think
<fowl> depends on what you need to do
ghosTM55 has joined #ruby
<patrick99e99> fowl: but wouldn't most people agree, it's nicer to define methods outside of strings?
<fowl> joe_dhay, plz dont pm me i get an annoying notification
<fowl> ask in here
<joe_dhay> ok
<joe_dhay> im new in rails ruby on rails
<joe_dhay> my boss want to upgrade the existing rails app from 2 to 3.2.2 version
<joe_dhay> i got this code
<fowl> patrick99e99, yes they probably would because when you see it in an editor it gets syntax highlighted and such and it might be slightly better performance wise (dont quote me on that)
<fowl> joe_dhay, i already told you join #RUBYONRAILS
adamkittelson has joined #ruby
<Boohbah> 6 lines, still no question
<joe_dhay> i just type that here?
<fowl> type /join #RubyOnRails
<joe_dhay> im done
<austinbv> fowl: nope for an app
<joe_dhay> @fowl
<joe_dhay> i already type that
<fowl> then ask in that channel
<joe_dhay> ok
<joe_dhay> heres the code
<joe_dhay> <%= submit_to_remote('create_btn', 'Add Specialist',:url => {:action => 'AjaxAddTenantSpecialist'},
<joe_dhay> :update => "specialistListingDiv" ) %>
<joe_dhay> this is my error
<joe_dhay> undefined method `remote_function' for #<#<Class:0x00000002718930>:0x000000033a7368>
<joe_dhay> can somebody help me to figure out the problem?
<fowl> holy shit. why is it lately so many people are ending up on my ignore list, its like a cosmic shift
<fowl> solar rays/magnetic interference have to be the cause
<austinbv> that's awesome
<fowl> you're doing an app like a phone app, in ruby?
<joe_dhay> nis that for me?
<austinbv> an api yeah
<austinbv> no more homework for me just real work :)
<fowl> o cool
SegFaultAX has joined #ruby
<joe_dhay> @fowl
<joe_dhay> have you seen my problem?
<Boohbah> joe_dhay: i think fowl is ignoring you
<joe_dhay> yes
<austinbv> Yeah I have a trie that holds > 10mil strings and I need to use a radix sort grab position
Sailias has joined #ruby
Radium has joined #ruby
cwang has joined #ruby
wefawa has joined #ruby
baroquebobcat has joined #ruby
h4mz1d has joined #ruby
phantomfakeBNC has joined #ruby
savage- has joined #ruby
joener has joined #ruby
snip_it has joined #ruby
<joener> #rubyonrails
jbhewitt has joined #ruby
chico has joined #ruby
deobald has joined #ruby
ringotwo has joined #ruby
fayimora has joined #ruby
ben225 has joined #ruby
rramsden has joined #ruby
apok has joined #ruby
niftylettuce has quit [#ruby]
JohnBat26|2 has joined #ruby
GuidovanPossum has joined #ruby
Tachyon has quit ["."]
Radium has joined #ruby
ryan_dev70 has joined #ruby
MrGando has joined #ruby
seivan has joined #ruby
brngardner has joined #ruby
macmartine has joined #ruby
CheeToS has joined #ruby
replore has joined #ruby
mxweas_ has joined #ruby
ryan_dev70 has joined #ruby
ctwiz has joined #ruby
afomi has joined #ruby
Drewch has joined #ruby
Araxia has joined #ruby
sarmiena_ has joined #ruby
nlc has joined #ruby
joener has joined #ruby
Mohan has joined #ruby
Mohan has joined #ruby
netrealm has joined #ruby
SJr has quit ["Leaving"]
headius has joined #ruby
macmartine has joined #ruby
lewis has joined #ruby
csprite has joined #ruby
jmcphers has joined #ruby
<ctwiz> can I get rails help here as well?
<lewis> the well grounded rubyist
<lewis> prove to me you're grounded
ctwiz has joined #ruby
mistergibson has joined #ruby
<mistergibson> Question: on mswin32: is ruby 1.9.2 limited to a 2GB process memory limit, or does it utilize the IMAGE_FILE_LARGE_ADDRESS_AWARE linking option?
quest88 has joined #ruby
joaoh82 has joined #ruby
brngardner has joined #ruby
ZachBeta has joined #ruby
igotnolegs has joined #ruby
RORgasm has joined #ruby
h4mz1d has joined #ruby
rippa has joined #ruby
Sailias has joined #ruby
mrkris has joined #ruby
KL-7 has joined #ruby
<mistergibson> Question2: *without-doing-a-system-call*; is there a way for ruby to report how much memory is unused from its OS-allocated process memory space limit?
mdhopkins has joined #ruby
ctwiz has quit [#ruby]
katya has joined #ruby
geekfactor_ has joined #ruby
jmeeuwen_ has joined #ruby
cheok has joined #ruby
ereslibre has joined #ruby
ereslibre has joined #ruby
lkba has joined #ruby
ged has joined #ruby
ping-pong has joined #ruby
peterhil has joined #ruby
QKO has joined #ruby
joener has joined #ruby
noyb has joined #ruby
<joener> hi to tall
<joener> hi to all
<joener> can someone help me to my problem????
jrgifford has joined #ruby
cjlicata has joined #ruby
io_syl has joined #ruby
io_syl has joined #ruby
dr_Poggs has joined #ruby
FFForever has joined #ruby
thomasfedb has joined #ruby
C0deMaver1ck has joined #ruby
Limb has joined #ruby
DarthGandalf has joined #ruby
dfr|work has joined #ruby
v0n has joined #ruby
Tick-Tock has joined #ruby
Nowaker has joined #ruby
adeponte has joined #ruby
Gekz has joined #ruby
Gekz has joined #ruby
neersighted has joined #ruby
Jelco has joined #ruby
Jelco has joined #ruby
nfluxx has joined #ruby
afomi has joined #ruby
zeroeth has joined #ruby
yxhuvud has joined #ruby
a_a_g has joined #ruby
havenn has joined #ruby
BryanWB has joined #ruby
bob_f has joined #ruby
jjore_ has joined #ruby
ePirat has joined #ruby
thone has joined #ruby
Careott has joined #ruby
quest88 has joined #ruby
greenarrow has joined #ruby
wefawa has quit [#ruby]
Morkel has joined #ruby
geekfactor has joined #ruby
lobolars has joined #ruby
mikepack has joined #ruby
jamespharaoh has joined #ruby
chson_ has joined #ruby
mxweas_ has joined #ruby
voodoofish has joined #ruby
hippyphysicist has joined #ruby
kawa_xxx has joined #ruby
mikeric has joined #ruby
kawa_xxx has joined #ruby
aidan has joined #ruby
<aidan> If I irb > require "taps" I get "no such file to load". But I see it in gem list ... what am I doing wrong?
greenarrow has joined #ruby
dfamorato has joined #ruby
sroy2 has joined #ruby
kawa_xxx has joined #ruby
antillas21 has joined #ruby
havenn has joined #ruby
lolmaus has joined #ruby
<lolmaus> Hi! Started studying Ruby. What's the difference between an iterator and an enumerator?
cezar-b has joined #ruby
twinturbo has joined #ruby
<adf_> lolmaus: an Enumerator can be used as an iterator, but generally external iterators are not used that much in ruby
<lolmaus> adf_, i'm totally confused
<adf_> lolmaus: we use internal iterators instead
<adf_> lolmaus: (1..10).each { |v| puts v } <------ internal iteration
<adf_> lolmaus: i = (1..10).each; i.next; i.next; i.ntext <-------------- external iteration
<adf_> next*
<lolmaus> adf_, so the "each" method is an iterator?
<lolmaus> adeponte, yikes, does "i" contain an array in the last example?
havenn has joined #ruby
<adf_> lolmaus: wait, what do u think an iterator is? what language do u come from?
dfamorato_ has joined #ruby
<lolmaus> adf_, no other language associations! I just want to distingush iterators from enumerators. Can you please give an example of an enumerator?
adeponte has joined #ruby
<lolmaus> Wait, Enumerator is a module? Something i can use for a custom class?
vectorshelve has joined #ruby
adeponte has joined #ruby
trivol has joined #ruby
_adeponte has joined #ruby
GoBin has joined #ruby
d34th4ck3r has joined #ruby
<katya> is it possible to install a prebuilt old-ass version of ruby to match what I've got on my webserver, or do I need to build from scratch?
blueadept has quit ["Leaving"]
<vectorshelve> katya: I think you might have to start from scratch... not sure though
dshdsgdfdf has joined #ruby
x0F_ has joined #ruby
<katya> a binary for a windows installation of 1.8.7 patch 72 wold be useful because I don't really _want_ to build from scratch every single component that the server needs
<Boohbah> it is too bad that you decided to use windows as your development environment
<hemanth> any migration notes from 1.8 to 1.9 ?
dhruvasagar has joined #ruby
<GoBin> katya, try pik, should be equivalent to rvm for linux
<GoBin> maybe it has your required version of ruby
KL-7 has joined #ruby
<adf_> lolmaus: i suggest you learn about iterators before you try to understand whether Enumerators are or are not iterators ;)
banjara has joined #ruby
<aidan> how can I debug why a gem won't load?
<KL-7> hi, when you need to delegate some method to a different object and don't use any shortcut for that (e.g., like SimpleDelegator) is it better to mimic the signature of the method you're delegating to or just have *args accepted and passed straight to the target method?
nemesit has joined #ruby
<hemanth> ruby compare string ignore space anyone?
<shadoi> aidan: ruby 1.9.2+?
amar_key has joined #ruby
<shadoi> hemanth: str =~ /^#{other_str}$/x
<aidan> shadoi: 1.9.1
<shadoi> aidan: rvm? how was ruby installed?
<aidan> shadoi: aptitude install ruby1.9
<shadoi> aidan: ubuntu 11.04?
<aidan> yes
<shadoi> that version of ruby is kind of fucked up
<aidan> oh :/
<shadoi> I recommend removing it and installing via RVM
<aidan> okay
kawa_xxx has joined #ruby
djdb has joined #ruby
<adf_> shadoi: sup doi
fr0gprince_ has joined #ruby
dross has joined #ruby
workmad3 has joined #ruby
artm has joined #ruby
<hemanth> shadoi, not working in 1.9.2p290
<hemanth> str="hemanth is testing"; other_str="hemanth is testing"
<shadoi> hemanth: here's a nasty way to do it: str.split.join =~ /^#{other_str.split.join}$/, you can do it more efficiently with a more complicated regex.
<fowl> hemanth, "hemanth is testing".squeeze(' ')
<shadoi> ah yeah, forgot about squeeze
<hemanth> shadoi, fowl seems like squeeze(' ') will save the day :)
bluOxigen has joined #ruby
joaoh82 has joined #ruby
bluOxigen has joined #ruby
<fowl> or you could gsub /\s/, '' to remove all whitespace
ikbenhet has joined #ruby
etehtsea has joined #ruby
<shadoi> I shouldn't try to give advice while doped up :)
<hemanth> fowl, squeeze did it! O yeah!
<hemanth> shadoi, heh heh does dope really work ?
aidan has quit [#ruby]
* hemanth must remember to squeeze
<shadoi> not for this damn sinus infection.
<hemanth> I heard on of the hackers saying : you method is wrong if it's > 5 lines in ruby, how true?
<hemanth> /on/one
d3c has joined #ruby
<adf_> shadoi: sup doi
<shadoi> hemanth: very.
<shadoi> hemanth: totally depends on the problem.
<hemanth> shadoi, yeah that's there, but on a general scale
<hemanth> now with squeeze, my def is just 4 lines, before it was 8 lines!
<shadoi> it's a good idea to keep any method short, 5 is a totally arbitrary limit though.
<fowl> now combine those lines into one expression without using ;
<fowl> then you will be one step closer to enlightenment
<hemanth> :D
<shadoi> for example the linux kernel code guidelines say to TRY to keep functions short enough to fit on a normal terminal.
<hemanth> nice
LMolr has joined #ruby
d3c has joined #ruby
<hemanth> fowl, forgot to mention, in those 4 lines, 1 is sleep, other is str="" and another is debug(""); so basically the issue is solved in one liner with squeeze
<fowl> nice :D
<hemanth> ^_^
aknewhope has joined #ruby
sspiff has joined #ruby
<hemanth> not other language has something like squeeze! :)
aruntomar has joined #ruby
workmad3 has joined #ruby
schovi has joined #ruby
twinturbo_ has joined #ruby
MrGando has joined #ruby
bigkevmcd has joined #ruby
moshee has joined #ruby
LMolr has joined #ruby
rohit has joined #ruby
ghosTM55 has joined #ruby
akemrir has joined #ruby
MrGando has joined #ruby
havenn has joined #ruby
timonv has joined #ruby
shiroginne has joined #ruby
Ionic has joined #ruby
trivol has joined #ruby
icy` has joined #ruby
icy` has joined #ruby
havenn has joined #ruby
ukwiz has joined #ruby
knopkodav has joined #ruby
havenn has joined #ruby
havenn has joined #ruby
ephemerian has joined #ruby
fabrice31 has joined #ruby
sohocoke has joined #ruby
shruggar has joined #ruby
d34th4ck3r has joined #ruby
InBar has joined #ruby
MH35 has joined #ruby
<MH35> Hello
<MH35> I want to distinguish running OS in some categories.
jmcphers has joined #ruby
<adf_> MH35: i dont believe u
berserkr has joined #ruby
NickXuhui has joined #ruby
Ammar01 has joined #ruby
mdw has joined #ruby
LMolr has joined #ruby
NickXuhui has joined #ruby
RORgasm has joined #ruby
<NickXuhui> anyone is here ??
<NickXuhui> I have some question ~~~ OMG
<Gekz> OMG
<adf_> NickXuhui: ask
MH35 has joined #ruby
<MH35> Hello.
<MH35> I want to distinguish running OS in some groups.
<NickXuhui> how rails3.2 deploy to Apache+Passenger
<MH35> Windows 95/NT, Windows2000/XP, Windows Vista/7, Mac OS X,Mac OS(9 or before), Other
<MH35> What should I do?
<NickXuhui> Unbutu
heftig has joined #ruby
blacktulip has joined #ruby
<MH35> NickXuhui, the question you asked is more suitable in #rubyonrails than here.
<MH35> My question is to distinguish Windows 95/NT, Windows2000/XP, Windows Vista/7, Mac OS X,Mac OS(9 or before), and Other
NickXuhui has joined #ruby
<MH35> Hello
<bigkevmcd> MH35: have a look at the source for facter (from Puppet Labs)
<NickXuhui> ok thank
stefanp has joined #ruby
<MH35> I see. I'll look there
<bigkevmcd> MH35: You can use RUBY_PLATFORM, but I have no idea how granular that is
roolo has joined #ruby
<MH35> RUBY_PLATFORM can detect if the OS is Windows, Mac OS X, or other.
aruntomar has joined #ruby
gyre007 has joined #ruby
<MH35> How should I separate Windows?
simao has joined #ruby
<MH35> Hello!
MH35 has quit [#ruby]
tatsuya_o has joined #ruby
Ammar01 has joined #ruby
tatsuya_o has joined #ruby
moshee has joined #ruby
moshee has joined #ruby
dshdsgdfdf has joined #ruby
visof has joined #ruby
visof has joined #ruby
<vectorshelve> shevy: Hey.... Good Day !!
icy` has joined #ruby
icy` has joined #ruby
Eldariof-ru has joined #ruby
ChampS666 has joined #ruby
edogawaconan has joined #ruby
crazed has joined #ruby
bier has joined #ruby
data21 has joined #ruby
d3vic3 has joined #ruby
adeponte has joined #ruby
knopkodav has joined #ruby
havenn has joined #ruby
BiHi has joined #ruby
francisfish has joined #ruby
jenglish has joined #ruby
Eldariof-ru has joined #ruby
clockwize has joined #ruby
arquebus has joined #ruby
d34th4ck3r has joined #ruby
<clockwize> hey guys, I'm running a rake task from cron and its just not working - when i save the cron env to a file then load a shell with that env and run it, it can't find rubygems? http://pastebin.com/FiWkBDX5
rippa has joined #ruby
enoch has joined #ruby
rtdp has joined #ruby
<enoch> hi all
<lolmaus> As long as hashes sustain the order of item pairs, how do i get the last item pair of a hash?
<enoch> im trying to install spree (an ecommerce system ruby based)
<enoch> when i give $ gem install rails -v=3.1.4
<enoch> it says "You don't have write permissions into the /usr/lib/ruby/gems/1.8"
<enoch> should i run it as root?
NickXuhu_ has joined #ruby
musee has joined #ruby
TESTKEYz has joined #ruby
Bartzy has joined #ruby
<mistergibson> Question: do references to 'nil' incur an RVALUE allocation?
eka_ has joined #ruby
arturaz has joined #ruby
a_a_g has joined #ruby
havenn has joined #ruby
fivetwentysix has joined #ruby
gurugeek_ has joined #ruby
twinturbo has joined #ruby
EzeQL has joined #ruby
Radium has joined #ruby
Radium_ has joined #ruby
dnyy has joined #ruby
edogawaconan has joined #ruby
jlebrech has joined #ruby
<lolmaus> What was that method that can be applied to any part of code to print its value to console?
davidpk has joined #ruby
tvw has joined #ruby
<lolmaus> For debugging
<lolmaus> It would print the value of what it's applied to and then pass the value back
<adf_> lolmaus: puts? :P
<adf_> lolmaus: p
knopkodav has joined #ruby
<lolmaus> adf_, like this... `if (a > b).debuggy && (c < d)`
<rippa> display
<adf_> lolmaus: hm in that case do: if (a > b).tap(&:display) && (c < d)
<lolmaus> Yeah, the `tap` :D
<lolmaus> But it wouldn't print anything :(
tatsuya_o has joined #ruby
<lolmaus> Only the left part is printed: `if (left_item != @most_frequent_word.size - 1).tap(&:display) && equal?(left_item, left_item + 1).tap(&:display)`
<lolmaus> Ah! It's not applied because the first part is false!
<lolmaus> Should be ||. Thx!
edogawaconan has joined #ruby
Jrz has joined #ruby
<jlebrech> i'm changing this method to use "self" instead of the parameter https://gist.github.com/bdf52959c80fe8682c72 I should just be able to swap 'ticket' for 'self' as long as self is a Ticket object?
koivula has quit [#ruby]
agenty has joined #ruby
Gonzih has joined #ruby
agenty has quit [#ruby]
BiHi has joined #ruby
hbs has joined #ruby
jitesh_shetty has joined #ruby
Radium has joined #ruby
edogawaconan has joined #ruby
latrommi has joined #ruby
Gonzih has joined #ruby
<lolmaus> I have manipulated with a hash by using to_a. Can i transform it back to hash? [[1,2],[2,3]...]
cm0v_ has joined #ruby
seivan has joined #ruby
<yxhuvud> yes. Hash[*arr.flatten(1)]
<shevy> here is proof that yxhuvud is correct:
<shevy> Hash[* [[1,2],[2,3]].flatten(1) ] # => {1=>2, 2=>3}
liluo has joined #ruby
BiHi has joined #ruby
<yxhuvud> shevy: you write the splat on that side? I'm not certain I agree with that
schaerli has joined #ruby
nari has joined #ruby
Pip has joined #ruby
<Pip> Is Ruby easy to do graphic programming?
<lolmaus> Pip, you mean GUI?
<Pip> Yes, GUI
<vectorshelve> hello all
<lolmaus> Pip, no. It's hackish. If you're a hardcore programmer, go for it. If you're a newbie, you'll find it too complicated and poorly documented.
<shevy> yxhuvud I dont know yet, I woke up ~20 minutes ago. my head is still blurred :)
<Pip> :S
<vectorshelve> shevy: Social Media has been talking about Kevin Systrom since the past 24 hours.... Instagram is on a roll
mwyrobek has joined #ruby
<shevy> Pip simple GUIs are easy to do but GUIs with lots of complicated widgets can be annoying
<shevy> I wanted to write an editor in ruby-gtk and the basics kinda work (edit things, open file save file... some vim-like keybindings), but then I tried to get colour highlighting and "icons on the left side that you can click, to achieve certain things with the text buffer"
<shevy> eventually it all just annoyed me and I gave up :(
cm0v_ has quit ["bye"]
<Pip> So how does Python make it?
<shevy> I'd like to write a GUI declaration just once and then have it work everywhere, including the web
<shevy> dunno. they have more people
<Pip> :D
<shevy> also better documentation
<Pip> You mean more smart people?
<shevy> I wrote
<shevy> more people
<shevy> when you have 1000 people on a language, a language evolves faster than when you have 500
Eldariof18-ru has joined #ruby
* Pip goes to #python to do an interview
<yxhuvud> shevy: that said, ruby is clearly growing and getting more diverse.
<fivetwentysix> ruby is such a fantastic language
<fivetwentysix> clearly much more elegant than writing javascript
<yxhuvud> though desktop apps are not very common to make so progress is slower there
<shevy> lol Pip
<shevy> Pip, can you do this into #python please:
<shevy> sszszSsz shshsz Szshszshsz SZhsshshshs?
<shevy> translation:
<shevy> "Is Python really better than Ruby?"
<Pip> wtf
<Pip> Oh
<shevy> It is python
<shevy> they speak python
<Pip> Kidding?
<Pip> that's the jungle king's language?
<fivetwentysix> python is no ruby
RORgasm has joined #ruby
falena has joined #ruby
<shevy> Pip it is no joke, I learned it from here:
<Pip> <nedbat> Pip: ah, there is no such thing, because Python isn't formally standardized.
<Pip> Haha, Ruby is ahead of Python right?
<Pip> Because there is a formal committee out there
<Pip> I was asking about the Python committee
<shevy> man
<shevy> ruby didnt need a standard
<Pip> Okay, there is a core committee
<Pip> shevy, Why not?
<shevy> the standardization came because people who hacked on rubinius were mad that things were unspecific
<shevy> Pip because matz never needed a standard
__main__ has joined #ruby
<shevy> so when you keep on raging about a standard
<shevy> you must remember the history!
<Pip> shevy, Matz told me Ruby is standardized in Japan
Targen has joined #ruby
<shevy> yeah since when and what does this even mean!
<Pip> <Pip> nedbat, I have a new question
<Pip> <Pip> nedbat, sszszSsz shshsz Szshszshsz SZhsshshshs?
<Pip> <nedbat> Pip: that isn't a question I understand.
<Pip> lol
<Pip> shevy, Liar
<Pip> I could be kicked for trolling
Asebolka has joined #ruby
<shevy> tell them I said they speak python
<Pip> No, that's spam
knopkodav has joined #ruby
frontendloader has joined #ruby
<shevy> man
<shevy> newcomers need to learn by asking clever questions :>
_null has joined #ruby
_null has joined #ruby
ken_barber has joined #ruby
_null has joined #ruby
_null has joined #ruby
frontendloader has joined #ruby
edogawaconan has joined #ruby
_null has joined #ruby
_null has joined #ruby
bluenemo has joined #ruby
bluenemo has joined #ruby
<Pip> check out what Matz said at 13:30 -----> http://www.youtube.com/watch?v=OubzA8Q25jQ
_null has joined #ruby
_null has joined #ruby
<shevy> oh yeah
<shevy> a talk in 2011
<shevy> :P
<shevy> jump back to the year 2004 man!
_null has joined #ruby
frontendloader has joined #ruby
dingdong has joined #ruby
NickXuhui has joined #ruby
edogawaconan has joined #ruby
tk__ has joined #ruby
<jlebrech> anyone use ruboto?
<proffalken> jlebrech: I've played around with http://code.google.com/p/android-scripting/ but not in any great way
mdw has joined #ruby
<jlebrech> i'm looking to write everything in ruby if I can.
<proffalken> jlebrech: ah, ok, in that case I can't help, sorry... :(
* proffalken is using the appinventor to create Droid apps which talk to a Rails API
xcvd has joined #ruby
<jlebrech> appinventor, can you quickly build then fine by actually coding later?
<jlebrech> fine tune*
mengu has joined #ruby
<proffalken> jlebrech: not sure, only really started with it over the weekend doing simple stuff
ken_barber1 has joined #ruby
<proffalken> all I really need is an app which calls the API I'm writing in Rails and returns the relevant content
dkamioka has joined #ruby
<proffalken> appinventor gives you access to the various sensors (location etc) and that's enough for me...
Floydzy has joined #ruby
iocor has joined #ruby
mwyrobek_ has joined #ruby
frishi has joined #ruby
davidcelis has joined #ruby
edogawaconan has joined #ruby
seivan has joined #ruby
edogawaconan has joined #ruby
dbgster has joined #ruby
adac has joined #ruby
chson has joined #ruby
mdw has joined #ruby
batmanian has joined #ruby
dshdsgdfdf has joined #ruby
peterhil` has joined #ruby
jrgifford has joined #ruby
LMolr has joined #ruby
Beoran__ has joined #ruby
<Bartzy> Hi
<Bartzy> I have an external command that has a one-line output of: foo blah1 blah2 blah3 blah4
<Bartzy> I want to run it, get the output, and get 'foo' into a variable, and the rest of the line (blah1 blah2 blah3 blah4) into another variable
abra has joined #ruby
<LMolr> you can use backticks and split(' ')
<shevy> not sure I understand
<shevy> oh, he wants to call a command from within a ruby script?
<Bartzy> LMolr: But that would split blah1 blah2 blah3, I want them as one variable
<shevy> you can always .join after the .split
<LMolr> Bartzy: like shevy or a Regexp#match
fixl has joined #ruby
<shevy> or ... splitted = your_command.split ' '; command, arguments = splitted[0], splitted[1..-1]
<Bartzy> should I use brackets () when calling function or not ?
<shevy> first, call them methods please, not functions
<shevy> second, it depends. you can use () all the time, the ruby parser is fine with it
<shevy> people tend to omit them at least when no arguments are passed
<shevy> cat = Cat.new
<shevy> cat.meow
<shevy> rather than
<shevy> cat.meow()
nanderoo has joined #ruby
<shevy> as for arguments, especially multiple arguments, it's kinda mixed. I myself always use () when there are multiple arguments
<shevy> I usually also use () when there is one argument
<shevy> but
<shevy> not always
<shevy> :\
<shevy> cat.attack :dog
<shevy> seems nicer than
<shevy> cat.attack(:dog)
ph^ has joined #ruby
d34th4ck3r has joined #ruby
<shevy> rails likes to omit the ()
atnight has joined #ruby
<shevy> cat.attack :dog, :when => 'in 3 hours'
<shevy> cat.attack :dog, when: 'in 3 hours'
<shevy> cat.attack(:dog, when: 'in 3 hours')
<shevy> ah well
Gonzih has quit ["Leaving"]
edogawaconan has joined #ruby
ph^ has joined #ruby
tatsuya_o has joined #ruby
sohocoke has joined #ruby
Zolrath has joined #ruby
fsck3r has joined #ruby
<fsck3r> Hi
<Bartzy> shevy: Thanks.
snearch has joined #ruby
<Bartzy> shevy: set :var, "value" - is that for global variables ?
<Bartzy> I'm using capistrano and want to learn some ruby
kvirani has joined #ruby
waxjar has joined #ruby
seanstickle has joined #ruby
Floydzy has joined #ruby
edogawaconan has joined #ruby
BiHi has joined #ruby
<Bartzy> Is it OK to just enter newlines inside a string ?
flaggy has joined #ruby
<Mon_Ouie> set :var, "value" is a method call
d34th4ck3r has joined #ruby
Bofu2U has joined #ruby
kp666 has joined #ruby
<netogallo> set :var , "value is equivalent to set(:var,"value") as long there are no other statements around (ie. that call is the only content of a line)
kp666 has joined #ruby
<netogallo> if you wan't to have long strings with newlines, you should consider using here document
rohit has joined #ruby
strife25 has joined #ruby
iamjarvo has joined #ruby
NickXuhui has joined #ruby
Eldariof-ru has joined #ruby
linoj has joined #ruby
zeroeth has joined #ruby
<Bartzy> Thanks
<Bartzy> best way to get only the 5 first chars of a string is just str[0..4] ?
`brendan has joined #ruby
<yxhuvud> str[0,5] is shorter and doesn't create an intermediary range.
soulcutter has joined #ruby
<adf_> Bartzy: i would use this: string.chars.each_with_index.with_object("") { |(c, i), o| o << c if i < 5 }
<Mon_Ouie> Also, it looks more explicit. You explicitly say want the 5 first characters, not all the character from the 0th to the (5-1)th
chico has joined #ruby
liluo has joined #ruby
<batmanian> what does this mean in Ruby? http://pastie.org/3761564
<batmanian> Why would one do that?
<Mon_Ouie> module_function is a better way of accomplishing that
<Mon_Ouie> The point is to be able to do Pochard.some_method and also include Pochard; some_method
<Asher> batmanian - it means that all of the methods defined in th emodule (which can be used to include/extend other modules) are also methods on the module
<Asher> batmanian - so you can then call ModuleName.method as well as ModuleIncludingModuleName#method or ModuleExtendedWithModuleName.method
jbw has joined #ruby
<batmanian> Asher I see, thanks
<jhchabran> Does someone knows that a colon means in the fmt string of rb_parse_args ?
<jhchabran> I can't find any reference in the docs
pastjean has joined #ruby
entrenador has joined #ruby
RORgasm has joined #ruby
pen has joined #ruby
geekfactor has joined #ruby
s33k has joined #ruby
user has joined #ruby
<s33k> how do i find hash of a file in ruby?
zeroeth has joined #ruby
<rking> s33k: Like the md5sum?
<s33k> yes
<rking> require 'digest/md5'; digest = Digest::MD5.hexdigest(data)
<s33k> rking: how does that work for binary data? like in an image file?
<rking> Hrm.. why wouldn't it?
<rking> s33k: I mean, you have to do whatever to get that "data" right. Which on Windows is the crazy binary read stuff.
<s33k> i don't understand.. what is the *data* you use in your code?
<Pip> What are you guys do with Ruby?
<Pip> *doing
<daed> pip; everything
<rking> s33k: This should do fine: data = open(file_name, 'rb').read
<rking> Pip: And then some.
yalue has joined #ruby
<Pip> Web application?
<daed> sure, i do lots of web apps too
<daed> and non-web related coding also
<rking> Pip: I use it for random foo, like utilities and such, but I'm getting into Rails.
<daed> the vmware cloudfoundry is primarily ruby for example, custom realtime message queue in ruby also
<chico> Pip: rails + automate stuffz
<daed> though the central cloud controller itself is rails based
<daed> still ruby
<daed> message queue is ruby/eventmachine
<daed> etc
hukl has joined #ruby
<daed> pip; i do as much as humanly possible in ruby, then revert to other languages if it seems like it'd be a better choice
<daed> which generally isn't the case
cha1tanya has joined #ruby
<s33k> rking: cool... i just found that Digest::SHA1.file('/path/to/filename').hexdigest works
<s33k> thanks anyways
<rking> Okiedoke. =)
tommyvyo has joined #ruby
otters has joined #ruby
apeiros_ has joined #ruby
dql has joined #ruby
abra has joined #ruby
ukwiz has joined #ruby
TECCHIO92 has joined #ruby
<TECCHIO92> CIAO
TECCHIO92 has quit [#ruby]
runix__ has joined #ruby
Gonzih has joined #ruby
joaoh82 has joined #ruby
pwelch has joined #ruby
PragCypher has joined #ruby
pwelch has joined #ruby
JonSchuff has joined #ruby
ikbenhet_ has joined #ruby
bawer has joined #ruby
havenn has joined #ruby
pastjean has joined #ruby
mechanicles has joined #ruby
SolarisBoy has joined #ruby
strife25 has joined #ruby
yoklov has joined #ruby
geekbri has joined #ruby
fbernier has joined #ruby
sspiff has joined #ruby
nlc has joined #ruby
Shrink has joined #ruby
fr0gprince_mac has joined #ruby
nacengineer has joined #ruby
headius has joined #ruby
nari has joined #ruby
sgmac has joined #ruby
sgmac has quit [#ruby]
<lolmaus> I want a ruby script to be executed on a Linux computer remotely over LAN (with parameters passed). What is the simpliest way to achieve that?
td123 has joined #ruby
Indian has joined #ruby
<Tasser> lolmaus, passing the parameters? ssh -e I'd say
banjara has joined #ruby
Poapf3l has joined #ruby
BrianE|mobile has joined #ruby
a_a_g has quit [#ruby]
dv310p3r has joined #ruby
pastjean has joined #ruby
<lolmaus> Tasser, the source computer is on Windows :(
<lolmaus> Not a Ruby question, obviously. :( Sorry. But if you're willing to help, please send a private message.
arvidkahl has joined #ruby
hrs has joined #ruby
<Tasser> lolmaus, doesn't matter, ssh exists for windows too
iocor has joined #ruby
mattyoho has joined #ruby
carlyle has joined #ruby
emmanuelux has joined #ruby
carlyle has joined #ruby
Mohan has joined #ruby
Mohan has joined #ruby
mattyoho has joined #ruby
lorandi has joined #ruby
trivol_ has joined #ruby
pu22l3r has joined #ruby
pu22l3r has joined #ruby
cha1tanya has joined #ruby
Eldariof-ru has joined #ruby
mrwalker has joined #ruby
mmokrysz has joined #ruby
mmokrysz has joined #ruby
LBRapid has joined #ruby
jitesh_shetty has joined #ruby
iamjarvo has joined #ruby
jgarvey has joined #ruby
phantasm66 has joined #ruby
GuidovanPossum has joined #ruby
netogallo has joined #ruby
dagnachewa has joined #ruby
<Bartzy> can I execute an external command in ruby inside a 'if' statement, if the exit code is 0 enter the if, and also get the output ?
Drewch has joined #ruby
vipaca has joined #ruby
vipaca has joined #ruby
malcolmva has joined #ruby
fivetwentysix has joined #ruby
internet_user has joined #ruby
abra has joined #ruby
ruby_tester has joined #ruby
<ruby_tester> Does anyone know the best way to interact and test a Java application (black box to me) with Ruby?
guns has joined #ruby
fearoffish has joined #ruby
fmcgeough has joined #ruby
fivetwentysix_ has joined #ruby
theRoUS has joined #ruby
<Tasser> Bartzy, don't do too much magic
<Tasser> ruby_tester, jruby
<Tasser> ruby_tester, or call it via the command line
<Tasser> ... and add cucumber ;-)
<ruby_tester> tasser: how am I supposed to know what to even use
ph^ has joined #ruby
<ruby_tester> I've been trying to understand cucumber
<ruby_tester> I cant seem to find a newb example
pen has joined #ruby
<ruby_tester> its a java application outside of the web
chico has joined #ruby
havenn has joined #ruby
yoklov has joined #ruby
Q| has joined #ruby
bbttxu_ has joined #ruby
<jlebrech> funny how companies through in ruby as a "maybe" into their job specs. if ruby isn't the only (scripting) language. i'm not interested.
<Q|> Is this the right place to ask system specific question regarding ruby? I seem to have a problem with an app finding the required deps on my Linux Mint (Debian-flavoured distro) in which it either can't find stuff installed by rubygems OR ignores stuff installed by apt.
chson has joined #ruby
<jlebrech> Q| install everything using rubygems, that's the rule
bbttxu_ has joined #ruby
beilabs has joined #ruby
<Q|> jlebrech: Ok, I'll try that, but I'll have to remove the apt-packages for all the modules as well, since they seem to confuse the ruby environment
RORgasm has joined #ruby
baroquebobcat has joined #ruby
atmosx has joined #ruby
jimeh has joined #ruby
EvanR has joined #ruby
thone_ has joined #ruby
jimeh has joined #ruby
davidpk has joined #ruby
d2dchat has joined #ruby
carlyle has joined #ruby
axl_ has joined #ruby
drose1 has joined #ruby
withnale has joined #ruby
<withnale> hello. quick q. how do I run a gem from a working directory?
krusty_ar has joined #ruby
atnight has joined #ruby
nikhgupta has joined #ruby
zeroeth has joined #ruby
dql has joined #ruby
kpshek has joined #ruby
<chico> require 'my-gem'?
<withnale> the gem isn't installed - it's in my working directory
mstratman has joined #ruby
chimkan has joined #ruby
<chico> try require_relative
EvanR has joined #ruby
wallerdev has joined #ruby
d3vic3 has joined #ruby
Sailias has joined #ruby
altivec_ has joined #ruby
cha1tanya has joined #ruby
dkamioka has joined #ruby
brngardner has joined #ruby
<shevy> withnale what about requiring the file that requires the rest of the working dir?
kevinbond has joined #ruby
altivec has joined #ruby
crankycoder has joined #ruby
<withnale> it's ok. I@m only editing one file so I'm going to edit it in place. I was assuming there was a gem option somehow to run a gem from a working directory somehow
_md has joined #ruby
<shevy> hmm
<shevy> you can require files from the commandline
<shevy> require -r 'name'
<shevy> and perhaps specify the current dir
<shevy> require -r './name'
ggolin_ has joined #ruby
<ggolin_> hi all
<shevy> not sure if that one works
DarkFoxDK has joined #ruby
<shevy> ggolin_ goblin!
<shevy> hi!
<Q|> This is ridiculous, I'm trying to solve an error for hours now and it's just getting worse! "Could not find rack (~> 1.1.0) amongst []" (runtime error). When I "gem install rack", reloading the page says: "undefined method `name' for "rack":String" (nomethoderror).
<ggolin_> is it possible to log to stdout and to a file using one logger instance?
<Q|> And it seems to be, because ruby-rack is installed as a module through apt-get. BUT, I can't remove it, because passenger and a bunch of other modules depends within apt on it.
<Q|> So, I have rack installed, twice, and it's still not finding it
<ggolin_> Q|, whats not finding it?
<Q|> Somewhere on the net I found out it may have to do with incompatibilities between rubygems 1.8 and rails, but you can't downgrade rubygems to 1.7.x on debian systems
dfamorato has joined #ruby
<Q|> ggolin_: The app I'm trying to run. It's called tracks (getontracks.org)
snip_it has joined #ruby
<ggolin_> you are using apache+passenger, q|?
<Q|> It ran fine before I did a distro upgrade, but after the upgrade, errors like these popped up. First it was related to redcloth, but now it's a bunch of it ^^
<Q|> ggolin_: Yes
<ggolin_> perhaps the passenger module configuration was altered during distupgrade, did you check that?
alx- has joined #ruby
savage- has joined #ruby
<Q|> ggolin_: I can't really tell, since apt only gives you a warning if a config seems to be changed / edited outside of apt.
<ggolin_> go look at /etc/apache2/mods-enabled ?
<Q|> ggolin_: I can only judge by the change date, and that is from Oct 7 2010
<Q|> ggolin_: So, seems like nothing changed there
kvirani has joined #ruby
crankycoder has joined #ruby
<ggolin_> q| you can view the file contents, yes?
<shevy> Q| it is often bad to combine the debian way to install things with the ruby way
<Q|> ggolin_: Yes, but I don't know what would've been into them before / after upgrade in case they did change, so I can't compare them.
<ggolin_> q| well if passenger cannot find your rack installation you could add the relevant configuration to the passenger config, yes?
<Q|> shevy: Yeah, I just realized this today. I'm not into ruby at all and just needed it for that single web-app. Getting it to run was a little trip by itself, but at least I happened to get it to run couple weeks ago. Until yesterday ^^
<shevy> yeah, debian hates ruby
mikepack has joined #ruby
<shevy> every day lost souls come here about the "cleverness" of the debian "developers" :(
<any-key> debian hates anything that isn't three years old
<any-key> we won't be seeing 1.9 in debian stable for another couple years now at this point
yoklov has joined #ruby
<Q|> ggolin_: I don't think it's related to passenger not finding the modules, but to the ruby app. In Debian, passenger depends on rack, so it's installed by default
<ggolin_> so about that Logger instance - is it possible to have logger = Logger.new write both to file and to stdout
<ggolin_> q| paste the error to pastebin please
ph^ has joined #ruby
<shevy> ggolin_ is a brave man
<shevy> he tries to fix the debian problems
<ggolin_> its not a debian problem
<Q|> Yeah, I doubt that as well
v4n_ has joined #ruby
<any-key> tee seems like it'd do the trick if you were on a commandline :\
<Q|> ggolin_: This error page is generated through passenger
<shevy> it is not a debian problem?
<shevy> apparently there is a missing dependency
<shevy> when I use gem, the command, the dependencies are resolved
rippa has joined #ruby
<shevy> gem install something <--- installs dependencies too
phantomfakeBNC has joined #ruby
<Q|> shevy: No, it can't be, since rack is a dependency of the passenger module and thus installed.
<Q|> shevy: And, if I install the rack gem, the error is different (which makes it even more confusing)
<shevy> sorry but 'When I "gem install rack", reloading the page says: "undefined method `name' for "rack":String" (nomethoderror).'
mdw has joined #ruby
<shevy> when I on my system here, which is free of debian :) do "gem install rack", rack gets installed
<shevy> I am going to test passenger
<Q|> shevy: It is installed here as well
<shevy> whoa that pulls in lots of shit
<shevy> rake-0.9.2.2 fastthread-1.0.7 daemon_controller-1.0.0 passenger-3.0.11
<Q|> shevy: Which distro?
<shevy> always source
jgrevich has joined #ruby
jgrevich has joined #ruby
<Q|> shevy: Well, which package manager are you using then?
<shevy> hmm may take me a while to find out how to use passenger
<shevy> I am using "gem"
<shevy> you seem to use apt-get
<Q|> Obviously, since I'm running a debian based distro ^^
<shevy> I am sure ggolin_ will be able to solve this in the debian way
joaoh82 has joined #ruby
<ggolin_> shevy, never said anything about solving this the debian way
<Q|> Somehow it seems to be a path issue
<Q|> I bet it's simple as that, I just don't know where to look at
<ggolin_> Q|, because it probably is
<ggolin_> q| as suggested, look at passenger.load and make sure its pointing to the right path
n1x has joined #ruby
<ggolin_> q| also paste output of sudo gem list
<Q|> ggolin_: Yes, it points to the mod_passenger.so, just checked it. And it's from 7th of October 2010 as well, so, apperently the distro upgrade didn't update passenger at all
<ggolin_> q| also paste output of sudo updatedb && sudo locate mod_passenger.so
<Q|> ggolin_: gem list just shows one gem (I removed everything else earlier today): rack (1.4.1)
P0apfel has joined #ruby
SolarisBoy has quit [#ruby]
<ggolin_> really. you removed everything.
dhruvasagar has joined #ruby
<ggolin_> tracks manual states that the app depends on several gems.
fowl has quit ["Leaving"]
<Q|> ggolin_: /usr/lib/apache2/modules/mod_passenger.so - which is the same path as the one in passenger.load, just checked it
CheeToS has joined #ruby
<ggolin_> q| what db backend is your app configured to work with?
P0apfel has joined #ruby
<Q|> ggolin_: Yes, I had this app running prior to the distro upgrade. At that point, only 4 gems were installed: redcloth, sanitize, nokogiri and rack
<Q|> ggolin_: MySQL. This gem was in the gem directory, but gem list didn't list it (for whatever reason). It was installed through apt though
DrShoggoth has joined #ruby
<Q|> ggolin_: And, the first error that I encoutnered, was not the rack error - it was the same error message, just for RedCloth instead of rack - that's how it started
<ggolin_> q| so now if you run irb and type in require 'mysql' - does it return true?
Nisstyre has joined #ruby
nlc has joined #ruby
<Q|> ggolin_: I think, the initial problem is (after the upgrade - not before it), that any ruby module, that is installed through apt AND as a gem, somehow isn't found anymore by tracks. I can confirm that for every of the 4 gems I had installed (did every combination of removing gem, apt package, both and none)
<ggolin_> q| see my question
<shevy> hehe
<Q|> ggolin_: No, it errors out. I just installed all the 4 gems I removed earlier today, so, mysql is installed as a gem now, and require mysql errors out
<ggolin_> require 'mysql'
<shevy> did you upload "gem env" output anywhere Q| ?
<Q|> ggolin_: "NameError: undefined local variable or method `mysql' for main:Object"
<ggolin_> note the single quotes
<shevy> ah "gem env" and also "gem list". I show you my list
<Q|> ggolin_: Ok, the first error was without the quotes. Now with quotes: LoadError: no such file to load -- mysql
jwmann1 has joined #ruby
jwmann1 has joined #ruby
macmartine has joined #ruby
<Q|> shevy: No, I didn't. But I can pastebin it, just a sec
<atmosx> easiest way to print 1st 3rd and 9th word from every string is via regex?
<atmosx> I can't recall right now, but there's an even easier way using puts or scan()
<ggolin_> atmosx, probably not
<atmosx> nice, I have to digg now through my code snippets
ckrailo has joined #ruby
<shevy> Q| that is the unusual path that debian uses - INSTALLATION DIRECTORY: /var/lib/gems/1.8
<ggolin_> atmosx, depending on the string contents. check out rubular.
<shevy> there should be subdirectories though with the .gem files somewhere in that directory
<atmosx> ggolin_: yeah I'm on it
<atmosx> ggolin_: my strings are 'lsof -i' extracts
<ggolin_> q| just run the setup.rb again
<Q|> shevy: Yeah, there's a "gems" subdirectory, and there are executables for every installed gem (but without an extension)
<shevy> if you are on ruby 1.8 you may have to do require 'rubygems' before require 'mysql'
<ggolin_> atmosx, you could pipe that through `column -t', then split on tab and print arr[0],[2],and [9]. thats all sorts of crazy but i think it ill work.
<shevy> Q| the installed gems are usually in the cache/ subdirectory of that directory
<shevy> for me here, my cache dir is /usr/lib/ruby/gems/1.8/cache/
<Q|> shevy: Ah, yeah, I just read about it, since rubygems is only automagically loaded in 1.9.x. Just a sec
<shevy> I'd assume that debian uses ... /var/lib/gems/1.8/cache but i would not be surprised if it does not :)
davidpk has joined #ruby
Vert has joined #ruby
<Q|> shevy / ggolin: Ok, that makes the modules load through command line: ruby -r rubygems -e "require 'mysql'"
<shevy> btw if you use ruby more, you can always use irb, and then add a file to irbrc to do something like:
<Q|> shevy: Maybe I'll have to set that path somehow systemwide?
<shevy> require 'rubygems' if RUBY_VERSION < '1.9'
<shevy> cool. so it works
<shevy> I dunno really
<shevy> my solution always was to remove debian ruby and use ruby from source
<Q|> shevy: I never did anything in ruby ^^ "Lear it someday" is on my todo list for a long time ^^
<KB9AGT> use rvm
<shevy> hehe
<shevy> people always suggest rvm when someone on debian tries to use ruby ;)
<Q|> KB9AGT: I read about that as well - what is it exactly?
<Q|> shevy: Yeah, it somehow seems to work, according to some posts I found on the web
<shevy> I think there must be some way to redefine the install path for gem
<shevy> but I have not found out where or how. "gem" must store that info somewhere for sure though
<Q|> As far as I see it, I'll very likely just have to somehow tell my system "Dude, require rubygems by default"
<Q|> I bet it's that simple
<shevy> or add more directories to it
<KB9AGT> this might help http://cheat.errtheblog.com/s/rvm/
macmartine has quit [#ruby]
macmartine has joined #ruby
<atmosx> ggolin_: thanks, columnt did the job using awk: lsof -i | grep -E "(LISTEN|ESTABLISHED)"|grep -v 'localhost'|awk '{ print $1, $8, $9, $10 }'|column -t
<Q|> Thx KB9AGT, I'll take a look into it later
<KB9AGT> k
<atmosx> ggolin_: I didn't knew there was such cmd hehe (/me loves unix)
<ggolin_> atmosx, np :)
<KB9AGT> rvm helps you keep different versions of ruby organized
<KB9AGT> you mat still even use your system wide version
<ggolin_> q| run the setup.rb supplied with your app.
flagg0204 has joined #ruby
theRoUS has joined #ruby
<Q|> ggolin_: How are the chances of something (database, files in /var/www/tracks) being borked after it? Because I'll make a backup first then
<Q|> KB9AGT: I see, kind of a sandbox for every ruby app then?
<ggolin_> always a prudent practice
<KB9AGT> not the apps just ruby versions put the apps where ever
peanuts___ has joined #ruby
<KB9AGT> rvm has a certain trickyness to it.
<any-key> she's a harsh mistress
<any-key> like the sea
<KB9AGT> you need to set some envars in bashrc
* any-key stares off into the distance
<ggolin_> so about that Logger instance - is it possible to have logger = Logger.new write both to file and to stdout?
<KB9AGT> will not see them in scite but works with most ide
<peanuts___> Hi all, I'm trying to do a simple thing but finally I don't know how to do. I have a string stored in DB such as "Hello #{@user.name}", how to interpret the string after with the variable in my ruby script ?
<KB9AGT> require 'json' perhaps?
d2dchat has joined #ruby
netogallo has joined #ruby
shruggar has joined #ruby
<KB9AGT> or do you prefer xml
lkba has joined #ruby
<any-key> peanuts___: what I would do is store the string like "Hello <>" or some other easily found character and gsub it with @user.name
<any-key> unless someone here has some reallllly clever alternative
<KB9AGT> I dunno things go too fast here. I need one on one for this.
<peanuts___> any-key: yes may be, but I'm sure that something better is existing
<any-key> peanuts___: nope
<peanuts___> I'm still looking for on the web for it
<any-key> peanuts___: string interpolation doesn't persist like that...as soon as "#{}" is looked at the contents are shoved into the string
<ggolin_> peanuts___, does it actually store a @user.name?
<Q|> ggolin_ / shevy: What do you think about this? This seems to be the solution to the problem, does it make sense from the point of an experienced ruby guy? http://stackoverflow.com/questions/6065015/undefined-method-name-for-systemtimerstring/6282459#6282459
<ggolin_> with the @ sign?
<ggolin_> q| i think you should run setup.rb. you removed a required gem and now the app does not work. according to the install instructions for tracks some gems are included with the app. go run setup.rb.
<any-key> if @user.name = 'Eric' it will store "Hello Eric" in the database
<KB9AGT> @ is for function instance or say class instance. do you really want to use an instance variable?
<peanuts___> no I store "Hello @user.name" and then my email template get the string from DB and must do the interpolation
havenn has joined #ruby
<shevy> Q| no real idea sorry. I always try to use the latest rubygems version though
<KB9AGT> @user = User.new is ok then
<peanuts___> and I must get "Hello Eric"
<ggolin_> peanuts___, yeah dont store '@user.name'
<any-key> peanuts___: I think you misunderstand the purpose of a template, then
<KB9AGT> do you have a User class?
<peanuts___> yes
<any-key> the template would have something like
<any-key> Hello <%= @user.name %>
dfamorato has joined #ruby
<ggolin_> ok this is getting a little too crazy for me
* ggolin_ is afk
<KB9AGT> go one on one
abra has joined #ruby
<peanuts___> any-key: so I need to know how to call ERB to render the string in DB
dfamorato_ has joined #ruby
<peanuts___> any idea ?
<any-key> what framework are you using?
<peanuts___> Rails
<Q|> ggolin_: Well, wait - I started removing gems _after_ this error occured earlier today. So, it can't be related to this. Like I said, I installed tracks couple weaks ago and all went fine, then did the distro upgrade (without changing anything related to ruby, removing gems or anything else), and after the distro upgrade the error appeared. I'll redo the setup steps for tracks anyway, just wanted to point out that I didn't remove stuff before
<Q|> the error happened
liluo has joined #ruby
<KB9AGT> you should be in a Rails channel peanuts
philips has joined #ruby
<any-key> peanuts___: heh, okay you should read over the railsguides, as there is a bunch of information you need to learn
<peanuts___> any-key:
<any-key> peanuts___: let me find you a good one
<peanuts___> I was using erb.html files for the email templates
<any-key> right
<any-key> it works exactly like any other view would
<peanuts___> it was working fine, but now I don't find files but I want to store it in DB
<any-key> store what?
<peanuts___> Hello <%= @user.name %>
<KB9AGT> Users?
<any-key> yeah I don't quite understand what needs to be stored in the DB
<any-key> User shuold be a model, it's already in the DB
<peanuts___> yes
<KB9AGT> please refer to the class Users
<peanuts___> it's for email notification
<any-key> I don't see what the problem is
<any-key> I'm sorry, you just need to be very explicit so we can be on the same page
<peanuts___> so I use action mailer from rails
jitesh_shetty has joined #ruby
<peanuts___> I did some templates with erb files
<peanuts___> but now, I don't have only one email templates
<peanuts___> I have more and will have more
<peanuts___> so I'd prefer to store all in DB
<any-key> no, templates do not belong in a database
<ggolin_> like i said, crazy.
<any-key> having a bunch of template files is normal
<KB9AGT> peanuts___ are you doing validations?
<ggolin_> next thing you know there will be images in the db, then its one way to hell - nosql, sharding, wifies, hipster glasses, typewriters, notepads.
<any-key> oh gawddd
<ggolin_> any-key, you know im right.
<any-key> So a SQL database walks into a NoSQL bar...
<peanuts___> ok let's say I have an email to send to all the users with "Hello name_of_user"
Barbaren has joined #ruby
<any-key> ...it leaves because it can't find a table
<Barbaren> hello
* any-key laughs at own joke
<ggolin_> any-key, love it
andrewhl has joined #ruby
<peanuts___> before, according to the docs of Rails I did a mailer view for it
<peanuts___> it works
<any-key> great!
<Barbaren> quick question, using the inherited hook, how can i figure out the classname of whichever class inherited from a some parent? :)
<peanuts___> now I'd prefer to store the contents of this view in DB
<any-key> peanuts___: and that is where you went to crazyville
<any-key> peanuts___: what would that buy you?
<any-key> why do you need that
* ggolin_ agrees with any-key
<any-key> peanuts___: I'm not trying to be rude, I just want you to reason through this
<peanuts___> requests of my team leader
<any-key> hand your keyboard to your team leader
davidcelis has joined #ruby
<any-key> so we can have a word with him/her
<ggolin_> hhahhaha
* ggolin_ senses a 'visionary'
<KB9AGT> And quit making this channel crazy. this is general Ruby right?
<peanuts___> but I don't see what is the problem ...
kenperkins has joined #ruby
<any-key> peanuts___: why would storing it in a DB be any better than keeping it in a file?
<KB9AGT> Go to a Rails channel. Just for your sake it just makes more sense to me.
<any-key> peanuts___: there are some things databases are good at, and some they are bad at
<peanuts___> ok I'll try to find something to fix it
<any-key> peanuts___: your computer already has a filesystem, a database is unneccessary :P
<peanuts___> thanks
<any-key> best of luck
<any-key> that was fun
<havenn> KB9AGT: #ruby channel is actually for the inspirational weight loss and weight loss exercises from the show Ruby on the Style Network. You might be looking for #ruby-lang (Ruby language).
<any-key> Barbaren: you may have better luck in #ruby-lang
<KB9AGT> ooooooooooooooooooooooooooooh!
<KB9AGT> tnx
mengu has joined #ruby
<any-key> Barbaren: I wish I knew the answer
<Barbaren> any-key: ok
<ggolin_> peanuts___, the problem is that there is a general industry practice out of which your teamleader is going to create a special case, which in turn will make your app a pita to support and any new dev who will be hired is going to ask the question "why the hell are you doing it this way/"
<any-key> next thing you know it'll be on the daily wtf
<any-key> :D
<ggolin_> if it isnt already
<any-key> I think there was one about storing templates in a DB
<KB9AGT> I could stand to loose a few pounds. How do I get started?
<ggolin_> stop eating
<any-key> yeah, and install jruby
* ggolin_ eats a donut
<KB9AGT> I'm already having a cup of java. :-D
<jlebrech> Ruby Achievement: created a parent class :D
<ggolin_> crap all i wanted to know was how to log into two separate streams using one logger instance
<any-key> ugh I have a project in java due today.....
<KB9AGT> better love java then.
<any-key> ggolin_: I don't really see why you can't just tell logger to do it's normal thing and then do a tail -f in another window
<any-key> that's what I always do
<any-key> I even have a few aliases for filtering out noise (like memcached)
<jlebrech> tmux
jitesh_shetty has joined #ruby
<any-key> or, you know, a decent terminal emulator like iterm2 :P
<ggolin_> any-key, yeah thats one way to do it. this is a long running script (12-18 hours) and i like seeing whats going on. hence the question.
stenno has joined #ruby
stenno has joined #ruby
<any-key> ggolin_: just fire up tmux or screen and attach whenever you wanna take a peek
<any-key> I've been in that position before, it works very well :D
<ggolin_> any-key, another requirement is auditing of what happened.
macmartine has joined #ruby
<any-key> you have the log file, that should be fine
<ggolin_> some operations will fail and i need to know which ones.
<ggolin_> yeah i guess i will jsut do that
<any-key> grep dat shit
* ggolin_ shrugs
* any-key heads to class
BrianE has joined #ruby
KB9AGT has quit ["Leaving"]
pen has joined #ruby
<Q|> "/usr/lib/ruby/vendor_ruby/1.8/rubygems/dependency.rb:247:in `to_specs': Could not find rack (~> 1.1.0) amongst [RedCloth-4.2.9, mysql-2.8.1, nokogiri-1.5.2, rack-1.4.1, sanitize-2.0.3] (Gem::LoadError)" <--- ? It lists rack, but it can't find rack? How can that be?
quest88 has joined #ruby
pen has joined #ruby
niku4i has joined #ruby
mcwise has joined #ruby
<ggolin_> q| it wants rack 1.1.1
<ggolin_> er 1.1.0
<ggolin_> you have 1.4.1
cloke has joined #ruby
<Q|> ggolin_: Ah, that's what that sign means. Looks like this is going to be the problem in the end
<Q|> Let's find out
asobrasil has joined #ruby
ben225 has joined #ruby
voodoofish430 has joined #ruby
Alex-_ has joined #ruby
jeffhorton has joined #ruby
daniel_hinojosa has joined #ruby
eywu has joined #ruby
joaoh82 has joined #ruby
KL-7 has joined #ruby
brngardner has joined #ruby
tatsuya_o has joined #ruby
tatsuya_o has joined #ruby
savage- has joined #ruby
LMolr has joined #ruby
<Q|> uninitialized constant Gem::SourceIndex::Deprecate <---- Looks like a specific gem is missing? Exception class for this error is NameError
nricciar has joined #ruby
<Asher> how are you getting to the error
<Q|> Asher: Trying to run "tracks" (getontracks.org) through apache + passenger. Starting tracks with WEBrick doesn't yield this error btw (after downgrading rubygems to 1.7.x)
wyhaines has joined #ruby
<shevy> Q| Gem::SourceIndex::Deprecate seems to be part of rubygems
sectionme has joined #ruby
<shevy> I use rubygems version: rubygems-1.8.21
kiwnix has joined #ruby
<shevy> btw it is odd that a project specifically depends on a given version
<shevy> usually it is >= x.x.x
delinquentme has joined #ruby
<Q|> shevy: Ok, that's weird then. No, it doesn't depend on a given version of rubygems, but, remember the stackoverflow question I posted earlier on? Well, what do you know - that guy was right, somehow rubygems 1.8.x seem to conflict with rails 2.3.11
<Q|> shevy: That's why I downgraded rubygems to 1.7.2, and at least I'm able to run tracks with the shipped WEBrick server. Now I just need to figure out why passenger still has issues running tracks
josefig has joined #ruby
<Q|> Allright, I guess I figured out what's happening
<Q|> This is his post: http://stackoverflow.com/questions/6065015/undefined-method-name-for-systemtimerstring/6282459#6282459. I followed the path of solution number (1), but he notes there: "you won't be able to do certain other things; freezing rails gems will fail"
<Q|> And in the passenger error page, I read this in the backtrace: 6 /var/www/tracks/vendor/rails/railties/lib/rails/gem_dependency.rb 21 in `add_frozen_gem_path'
<Q|> So, tracks is trying to "freeze a gem", right? Even though I don't know what that means, it shouldn't be possible according to Ben's post on stackoverflow
GuidovanPossum has joined #ruby
<Q|> Which leads to this error I had before downgrading rubygems: "/usr/lib/ruby/vendor_ruby/1.8/rubygems/dependency.rb:247:in `to_specs': Could not find rack (~> 1.1.0) amongst [RedCloth-4.2.9, mysql-2.8.1, nokogiri-1.5.2, rack-1.4.1, sanitize-2.0.3] (Gem::LoadError)"
enroxorz has joined #ruby
enroxorz has joined #ruby
<Q|> So, after all, it seems that tracks depends on rack 1.1.0, and that this is the reason all of this isn't working anymore - does this make sense?
io_syl has joined #ruby
<Q|> Because, running through WEBrick directly doesn't cause issues (not depending on rack 1.1.0 I guess), but through passenger it depends on rack, and thus tries to force rack 1.1.0
mengu has joined #ruby
mengu has joined #ruby
MrGando has joined #ruby
adac has joined #ruby
<shevy> dunno if it makes sense
<shevy> projects tend to "die" when they stagnate
<shevy> reading this, my impression is "do not use tracks" :)
<delinquentme> can you require 'module' as 'chickenfingers'
<shevy> hmm no delinquentme
<Q|> shevy: Well, I don't know either - but I guess I can downgrade rack to 1.1.0 and see what happens then ^^
<delinquentme> or something like that .. basically renaming the namespace on a module ref
perturbedpanda has joined #ruby
SegFaultAX|work has joined #ruby
stenno has quit ["Leaving"]
<Q|> shevy: Nah, tracks is actively developed. Current release is 2.0, and 2.1 is in beta right now
<shevy> delinquentme, sadly I think you can't rename or regroup a namespace easily. there is some feature though... autoload or something, where you can specify an optional argument to become a namespace, I think
<shevy> a new namespace that is
mikeg has joined #ruby
<shevy> Q| hmm it is actively developed but requires an old rack version?
<Q|> shevy: The 2.0 release - I didn't test 2.1 yet
ziggles has joined #ruby
<shevy> ah
<shevy> ok
<Q|> But who knows, maybe my conclusions are totally crap
<shevy> well we'll find out when you test 2.1 !
<Q|> shevy: Yeah, either this or when I figure out how to downgrade rack to 1.1.0 either in apt or rubygems.
wyhaines_ has joined #ruby
<shevy> hehehe
<shevy> well here for me
<shevy> I just either do gem uninstall
<shevy> then download the rack 1.1.0 gem
<Q|> shevy: Yeah, doing this right now
<shevy> http://rubyforge.org/frs/?group_id=3113&release_id=46532 here you can find older rack gems
<GuidovanPossum> Hello anyone ever run across a program that reads audio levels or spectrum analyzes a sound file and outputs the value at a set interval to xml or txt I've been looking for a bit, but can only do it real time off of the system audio now?
<shevy> 2010 :P
<Q|> shevy: I issued gem install rack --version 1.1.0
<shevy> 2 years old man!
<shevy> aha
<Q|> *lol*
<shevy> that could work too
<Q|> 2 Years, sweet
<shevy> but I dunno, I love my wget system even if it is not as straightforward as using gem
<shevy> since I install things from source, I always put the entry of URLs to the things I use
<Q|> shevy: Yeah, I had a Gentoo installation back in the days, and at some point I ran a LFS install as well - but that's like 10 years ago, and I just figured that I'm not a sysadmin and thus waste too much time tinkering around
<Sou|cutter> what does that even mean? Put the entry of URLs
williamcotton has joined #ruby
<Sou|cutter> also I have to say it sounds like you're a masochist, but whatever works for you
n1x has joined #ruby
jimeh1 has joined #ruby
<any-key> some people are into that sort of thing
hrs has joined #ruby
uris has joined #ruby
apeiros_ has joined #ruby
MrGando has joined #ruby
<jlebrech> can you use match in a case statement?
havenn has joined #ruby
<Tasser> jlebrech, you can use everything, even a proc. when obj; case cond is checked via cond === obj
<Tasser> just see if cond === obj returns true as expected
<yxhuvud> Tasser: he probably want a regexp in this case though ;)
cwang has joined #ruby
<yxhuvud> case foo; when /bar/ .. ;end
adeponte has joined #ruby
berserkr has joined #ruby
<Tasser> yxhuvud, am I too abstract?
atmosx has joined #ruby
apok has joined #ruby
<yxhuvud> Tasser: not really, I just believe (though I could be wrong, depending on what the argument to the case is) you answered the wrong question
<Tasser> hmm
<yxhuvud> though I might just be tired and reading your sentence incorrect
<jlebrech> how do I combine multiple case with matches? https://gist.github.com/9ff8ada63b1a5c027747
fragrant has joined #ruby
<fragrant> Hi, Which is the popular/mostly used html/xml parser for ruby?
<yxhuvud> jlebrech: ,
<yxhuvud> but in your case, else catches all
ryan_dev70 has joined #ruby
<jlebrech> yxhuvud so I can do case "packageOne", "packageTwo" ... how about a regext for "package..."
<yxhuvud> yes, that too
LMolr has joined #ruby
<fragrant> Hi, Which is the popular/mostly used html/xml parser for ruby?
<gogiel> nokogiri
banjara has joined #ruby
<atmosx> nokogiri
<atmosx> you can use mechanize though (to be a bit more - not that much - alternative)
<fragrant> Ok
fragrant has quit [#ruby]
bawer has joined #ruby
<any-key> nokogiri is awesome
<any-key> hpricot is also good for crazy-ass HTML
<any-key> dunno what state that project is in these days though
davidcelis has joined #ruby
<Sou|cutter> nokogiri is a solid choice.
dagnachewa has joined #ruby
<any-key> probably the best parser I've used in any language ever
moshef has joined #ruby
<atmosx> I'm hungry
carlyle has joined #ruby
<any-key> sucks to be you
<moshef> how do i check if array contains a certain value over (lets say) 5?
apok has joined #ruby
nobitanobi has joined #ruby
<moshef> do I have to go over the entire array with some each method?
<any-key> include?
<rippa> moshef: any?
<any-key> oh
<rippa> array.any? {|i| i>5}
<moshef> yeah
<any-key> any? is what you want
<moshef> thanks
<moshef> i know any
macmartine has joined #ruby
<rippa> there's no way to do that without going over array
<any-key> unless the array is sorted or something like that
patrick99e99 has joined #ruby
<rippa> then you cn do binary search
<bounce> or you already keep mins and maxes when inserting or something
Mohan has joined #ruby
Mohan has joined #ruby
Poapfel has joined #ruby
Poapfel has joined #ruby
cha1tanya has joined #ruby
<nobitanobi> I have an object called reward, and I want to output an attribute of it, if it's different than 0. Since this object can be nil or empty sometimes, I do two conditionals like this: https://gist.github.com/2352855 -- How could I simplify this?
SphericalCow has joined #ruby
Poapfel has joined #ruby
SphericalCow has joined #ruby
greenarrow has joined #ruby
zakwilson_ has joined #ruby
afomi has joined #ruby
c0rn has joined #ruby
<apeiros_> nobitanobi: unless reward.rewardMinPurchase.blank? || reward.rewardMinPurchase == 0
trebaum has joined #ruby
<nobitanobi> in Ruby if the first part of the || is false, it won't try to do the second one?
<apeiros_> nobitanobi: alternatively avoid that the value can be nil (that's part of a process called normalization)
<apeiros_> nobitanobi: no, like in most languages.
<apeiros_> && and || short-cut
<nobitanobi> I am consuming an API....
<nobitanobi> apeiros_: ok thanks.
<apeiros_> an API is just some form of input
<nobitanobi> apeiros_: I believe I should avoid that when creating the object from the API
<jlebrech> now, i just suck at regex. how do I test for "packageOne" "packageTwo" ...
<apeiros_> any input can be normalized.
fbernier has joined #ruby
<nobitanobi> apeiros_: I will look into normalization. thanks
<apeiros_> jlebrech: how did you try?
<apeiros_> jlebrech: and what was wrong about your try?
<jlebrech> apeiros_ i tried /package[a-Z]+/
<apeiros_> jlebrech: a-Z makes no sense
<apeiros_> either a-z, A-Z or a-zA-Z
phantomfakeBNC has joined #ruby
<apeiros_> oh, wait… it might actually make sense…
adamkittelson has joined #ruby
<apeiros_> would have to be A-z, though (a > Z) - but it'd include characters that you probably don't want
lorandi has joined #ruby
<jlebrech> yeah, a-zA-Z doesn't match either
trivol has joined #ruby
<apeiros_> jlebrech: um, yes, it does
<apeiros_> how do you figure that it doesn't?
<jlebrech> apeiros_ /package[a-zA-Z]+/ should match 'packageOne' through to 'packageNinetyNine'
<apeiros_> jlebrech: yes, it will
<apeiros_> or rather, it does
<apeiros_> again, how do you figure that it wouldn't?
d3vic3 has joined #ruby
<jlebrech> apeiros_ oh i think i have it
<apeiros_> (it will match far more than just that, but that's another problem - one at a time…)
NickXuhui has quit [#ruby]
<jlebrech> apeiros_ i'm passing an array, sometimes it's a nested value
<apeiros_> yes, that wouldn't work
<jlebrech> so i did `case s.to_s`
tewecske has joined #ruby
<nobitanobi> is there any difference on casting using String or to_s ?
macmartine_ has joined #ruby
<apeiros_> jlebrech: yuck, bad solution
<jlebrech> apeiros_ ok I have this case in an each, but i didn't do |k,v| but just |k|
elalande has joined #ruby
ringotwo has joined #ruby
<apeiros_> jlebrech: don't voodoo code. fix the problem.
Araxia has joined #ruby
<gurugeek_> jlebrech: yeah no voodoo plz
<jlebrech> this is what i have https://gist.github.com/f8fe45c1ac3edc62dada
jabre has joined #ruby
<apeiros_> jlebrech: ok, then the next issue with the regex - it will match more than just that
<apeiros_> "foobarpackagex" will be matched, for example
<jlebrech> apeiros_ i see.
<apeiros_> or "packagex~&/+" will be matched too
trebaum has joined #ruby
trebaum has joined #ruby
<apeiros_> with regexes, always use anchors. \A for begin of string, \z for end of string
<jlebrech> i'm using a definitive list, so it's not perfect but should be ok for a while
netrealm has joined #ruby
bondar has joined #ruby
atmosx has joined #ruby
BrianE has joined #ruby
nonotza has joined #ruby
taxman has joined #ruby
LMolr has joined #ruby
melodyy has joined #ruby
ged has joined #ruby
tobyo has joined #ruby
paige has joined #ruby
<paige> how do you call this?
<paige> define :iptables_rule, :enable => true, :source => nil, :variables => {}, :cookbook => nil do
<paige> template_source = params[:source] ? params[:source] : "#{params[:name]}.erb"
nfluxx has joined #ruby
Eldariof-ru has joined #ruby
<apeiros_> I call that a method-call with a block
<apeiros_> ooh, you mean call as in "invoke"?
<apeiros_> `define` is not a ruby method, so whatever lib/framework you use defines it. look it up in the API docs of that lib/framework.
<paige> neat
<paige> iptables_rule name:"chefadmin", variables:client_ips ?
<paige> look dude
<paige> iptables_rule "chefadmin"
<paige> I wanna set that variables [params:variables]
<paige> from where Im calling it
<paige> how do I do that
lewix has joined #ruby
lewix has joined #ruby
jamesbrink has joined #ruby
<apeiros_> I don't use chef, you probably want to go to a chef specific channel.
<paige> but you're a self proclaimed ruby coder?
<paige> like
<paige> this really could not be that different
macmartine_ has joined #ruby
<apeiros_> chef is a big framework and I'm not going to learn it just to answer your question.
paige has quit [#ruby]
<mcwise> :(
CannedCorn has joined #ruby
<apeiros_> sometimes…
Poapfel has joined #ruby
stephenjudkins has joined #ruby
kanzure has joined #ruby
PragCypher has joined #ruby
<kanzure> so.. i have a 100 MB csv file that i need to parse. the parser shouldn't load it entirely into RAM.
shruggar has joined #ruby
<kanzure> other constraint: there are line breaks inside columns, that aren't properly escaped
<canton7> depends whether you can spare 100MB of RAM. it's probably unnecessary
<kanzure> i would rather be clever than use 100 MB RAM
ceremo has joined #ruby
<canton7> (unnuecessary to load it all at once, I mean)
<ceremo> hi
<apeiros_> kanzure: if it has "not properly escaped line breaks", then it isn't csv
<kanzure> apeiros_: true! it's some bizarro format.
<apeiros_> but line breaks are allowed in columns in csv, as long as the field is quoted
<kanzure> apeiros_: but i can't use IO.read() or something
<ceremo> what is the smartest way to make it : I've a ruby script which generate an html page. How can I serve it ?
<canton7> ceremo, you want to serve HTML? Easiest way would be to use sinatra
<kanzure> apeiros_: is there one that will incrementally read the file efficiently, accounting for random linebreaks
<canton7> kanzure, IO.gets will read up to a separator,which you can define
brngardner has joined #ruby
<apeiros_> kanzure: read chunks
<kanzure> canton7: rows are separated by, alas, linebreaks
<apeiros_> if it's proper csv, the csv parser can do that
marten has joined #ruby
<kanzure> and some rows have a different number of columns
<rippa> why?
<canton7> ouchy!
<rippa> and how do you know where row ends then?
<rippa> soudns ambiguous
<kanzure> rippa: there are two types of rows
shadoi has joined #ruby
<canton7> One approach might be to read each line, then parse it. If the line ends when you're inside quotes, read the next line and append that to the previous one, continue parsing...
<kanzure> if the first column is filled out, then it's the first type, or something
<apeiros_> weirdo format indeed…
<rippa> anyway, read until linebreak, then read again if needed
<kanzure> rippa: i see.
<lectrick> How can I make a heredoc where indentation is ignored?
agoddard has joined #ruby
<rippa> lectrick: lstrip
<apeiros_> that won't remove it from every line…
<lectrick> rippa: Does lstrip act on each newline in the heredoc?
<lectrick> yeah exactly
<apeiros_> lectrick: I use gsub(/^#{indent}/, '')
<lectrick> or some variation
<canton7> lectrick, I've used http://pastie.org/3763283
<canton7> so myfar = <<-EOT.unindent .... (iirc correctly)
<apeiros_> you can either hard-code the indent, or go two-step: text = <<-HEREDOC; …; text.gsub(/^#{text[/\A\s*/]}/, '')
billturner has joined #ruby
<apeiros_> horrible :)
lorandi has joined #ruby
<lectrick> yeah i know there is a prettier solution to this
<apeiros_> why split it and join it again? that's just wasted resources, that's what ^ is there for…
<canton7> aye, looking at it now, it is horrible
<canton7> I found that on SO in my earlier days on ruby, and haven't used it again since
zemanel has joined #ruby
<apeiros_> also, match is more expensive than String#[]
<apeiros_> http://pastie.org/3763300 <-- sanitized that
* canton7 steals :)
<apeiros_> test it first
<apeiros_> I actually have almost that very code somewhere in my snippets
<apeiros_> use gsub! for unindent!
<apeiros_> (and don't use unindent! in an assignment or chain, since ! methods can return nil)
<canton7> apeiros_, I tihnk you forgot the 2nd argument to gsub
<chico> i'm having trouble installing ruby-debug with rvm 1.10.3, ruby 1.9.3, it tells something about a missing 'vm_core.h'
stkowski has joined #ruby
twinturbo has joined #ruby
<canton7> apeiros_, seems to work grand
kpshek has joined #ruby
<apeiros_> canton7: oh, yeah, totally…
<apeiros_> not the first time either…
krusty_ar has joined #ruby
<lectrick> apeiros_: How do I deal with encoding issues and gsub. I'm trying to unindent heredocs which are in various email test cases. The emails have various encodings. The plot thickens.
<apeiros_> I think my pastie one accepted an argument for the whitespace character class, defaulting to "[\x20\t]", i.e., it'd only consider spaces and tabs, nothing else
<apeiros_> lectrick: I only have utf-8 or binary, so I never have that issue, sorry
<apeiros_> I'd probably go via binary codefile and match in binary
dfibre has joined #ruby
<apeiros_> that's the //n flag
taxman has quit ["Leaving"]
QKO has joined #ruby
cha1tanya has joined #ruby
hydrozen has joined #ruby
<hydrozen> Hi there. Is there a way to change the order of a hash' keys in ruby 1.9?
<apeiros_> delete and add
<apeiros_> other than that, no
SphericalCow has joined #ruby
<apeiros_> @ hydrozen
SphericalCow has joined #ruby
<hydrozen> apeiros_: how do you make sure that the key is added at the beginning of the hash?
guns has joined #ruby
<hydrozen> apeiros_: or we have to recreate a new hash
<apeiros_> hash.replace({newkey => value}.merge(hash))
GuidovanPossum has joined #ruby
<apeiros_> you can recreate a hash, or create a new hash, but recreating a new hash is a pleonasm :-p
<hydrozen> hehe
<hydrozen> thanks
<SegFaultAX|work> https://gist.github.com/2353263 Why is d.extract_query("blah blah") throwing a no method found error? (The MyApp::Passthrough mixin does define this method)
lkba has joined #ruby
<SegFaultAX|work> If I open up a terminal and do class D; include MyApp::Passthrough; end D.new.extract_query("blah blah") it works fine.
<SegFaultAX|work> Oh wait, nevermind. Spork wasn't reloading my app/lib directory :D
flagg0204 has joined #ruby
sspiff has joined #ruby
shruggar has joined #ruby
atmosx has joined #ruby
timonv has joined #ruby
LMolr has joined #ruby
axl_ has joined #ruby
trivol has joined #ruby
netogallo has joined #ruby
kpshek has joined #ruby
SegFaultAX|work has joined #ruby
heftig has joined #ruby
schaerli has joined #ruby
mrwalker has joined #ruby
wimplash has joined #ruby
axl_ has joined #ruby
wimplash has joined #ruby
nricciar has joined #ruby
Russell^^ has joined #ruby
luckyruby has joined #ruby
mcwise has joined #ruby
atmosx has joined #ruby
sroy2 has joined #ruby
sroy2 has joined #ruby
sroy2 has joined #ruby
PragCypher has joined #ruby
CharlieSu has quit ["fork while fork"]
tvw has joined #ruby
cjs226 has joined #ruby
francisfish has joined #ruby
nricciar has joined #ruby
mucker has joined #ruby
atmosx has joined #ruby
lorandi_ has joined #ruby
Eldariof-ru has joined #ruby
matt-312 has joined #ruby
startling has joined #ruby
Mohan has joined #ruby
Mohan has joined #ruby
jenglish has joined #ruby
kirun has joined #ruby
ephemerian has joined #ruby
strife25 has joined #ruby
krz has joined #ruby
mbriggs has joined #ruby
trivol has joined #ruby
gen0cide_ has joined #ruby
<lectrick> apeiros_: What's the diff between heredoc <<-EOS and <<EOS ?
<lectrick> (one with the hyphen)
Axsuul has joined #ruby
timonv has joined #ruby
anildigital has joined #ruby
jfelchner has joined #ruby
<anildigital> Hi friends.. can somebody help me to fill this up https://docs.google.com/spreadsheet/ccc?key=0Ald2FiAfz114dFlwWUwxcF92eWJITkpPWHZFVEN1TXc&pli=1#gid=0
kaneda has joined #ruby
<rippa> lectrick: one with hyphen works with indented last string
tommyvyo has joined #ruby
brngardner has joined #ruby
<lectrick> got it
metamorfos has joined #ruby
KL-7 has joined #ruby
h4mz1d has joined #ruby
<metamorfos> hey guys, how do I convert a string of the format '2012-01-20' to a date format?
Oog_ has joined #ruby
<Oog_> with Daemonize the stop command doesnt seem to stop the monitors
<Oog_> is this a bug?
<Oog_> or how do i stop the monitors
shruggar has joined #ruby
davorb has joined #ruby
jalljo has joined #ruby
brahmana has joined #ruby
EZi2 has joined #ruby
mucker has quit ["Konversation terminated!"]
<brahmana> Got disconnected.. Not sure if anyone said something about the logger question.. If any can someone repost those please? (The problem code is here - http://pastie.org/3763367)
Eldariof-ru has joined #ruby
ukd1 has joined #ruby
ryanf has joined #ruby
heftig has joined #ruby
<Oog_> yep # TODO: identifiy the monitor process
<Oog_> that seems to be it
Zolrath has joined #ruby
<Oog_> hmm
imsplitbit has joined #ruby
Yu\2 has joined #ruby
ins\ has joined #ruby
dankest has joined #ruby
dankest has joined #ruby
tatsuya_o has joined #ruby
adac has joined #ruby
sgmac has joined #ruby
Notimik has joined #ruby
sgmac has quit [#ruby]
<apeiros_> lectrick: <<-FOO allows FOO to be indented
<apeiros_> the terminating one
<lectrick> thanks
<apeiros_> lectrick: I think zenspiders quickref mentions all the different ones and their differences
yoklov has joined #ruby
<delinquentme> ok so I've got kind of a novel question .. when were talking C and flashing microcontrollers ... is there any magic overlap for ruby? I've learned that ruby is a C core .. so I know its leaning towards off topic .. but does anyone happen to have any intelligent thoughts on how that C core might be put to good use in a high level programming stack?
rcloak has joined #ruby
strife25 has joined #ruby
IPGlider has joined #ruby
nobitanobi1 has joined #ruby
<bounce> so, you really want to stick ruby on a microcontroller?
<gogiel> delinquentme: you can do anything in C. and it's pretty easy in ruby. calculating things in ruby is pretty slow
davidpk has joined #ruby
stephenjudkins has joined #ruby
<delinquentme> bounce, not really .. what I was thinking is that maybe there is some clever trickery which would allow for a cleaner implementation stack .. maybe flashing C onto MCs via ruby IDK
<bounce> you generally don't flash C onto microcontrollers
<bounce> you write in C, generate the code, then flash that.
<TTilus> if you really want to put "something else" on microcontroller, try lisp
<bounce> ouch
<bounce> forth makes more sense
<canton7> as long as you can combine <your chosen language> down to your micro's instruction set, within its memory limitations...
<brahmana> delinquentme: What aspect of ruby makes you want to use it for MC programming?
<delinquentme> brahmana, not writing ruby to mcs
<delinquentme> but ruby as an interface for the C Code TO the MCs
<delinquentme> so the MC has its typical implementation
<TTilus> bounce: not bad really, but check ECL, Picobit and Hedgehog Lisp
<delinquentme> hmmm noted thats right its machine
<brahmana> umm.. so if I understand you right, you write C code, compile it and then you want to use Ruby as a build tool to actually write that machine code to the MC.. is that so?
<bounce> delinquentme: sounds like you like ruby-as-a-solveall so much you're trying your damnedest to find problems it might solve
<canton7> interfacing with hardware is not really ruby's strongest point...
<TTilus> ...or we just don't get what you're up to ;)
Eldariof59-ru has joined #ruby
<brahmana> delinquentme: Or is it that you want to write Ruby code, compile it to machine code and then put it on the MC?
* brahmana totally agrees with TTilus
Eldariof27-ru has joined #ruby
<bounce> on the topic of fscked-up things, there's a couple embedded-chip type things that have jvm support. jruby comes to mind.
<bounce> probably as good as idea as using java for 'embedded', but there you go.
<delinquentme> Basically I just made the connection that Ruby being a core of C .. and its ease of implementation of C .. would allow it to then perhaps lend itself to a novel way of getting running C-based code onto a MC
<delinquentme> C-based code compiled to machine
<bounce> well, look at the size of the core and figure if you'd like to pay the price
mmokrysz has joined #ruby
<bounce> most scripting languages end up having their core written in C these days, simply because nearly everything has a C compiler available.
<apeiros_> or JVM
<apeiros_> (scala, clojure et al)
<bounce> newfangled stuff ;-p
<brahmana> delinquentme: The C-core that you are talking about is the Ruby run time which is pretty huge to be run on a MC. Technically what you are talking is possible but practically, you probably don't want do that.
<bounce> the thing is, though, that microcontrollers are at the low power/low cost end of the computing spectrum. there's a task they need to do, and do it as cheaply as possible.
<bounce> spending a couple megs in ram and rom space, then a lot in interpreting overhead and automated things like garbage collection has a price
<bounce> ... even before you've started to tackle solving the actual problem the microcontroller is to be there for
<bounce> ruby as a focus that is just a little different
dbgster has joined #ruby
jimeh1 has joined #ruby
<bounce> s/ as/ has/
<brahmana> Ok folks... Can someone please tell me why my logger is acting weird?
<brahmana> Here is the code - http://pastie.org/3763367
<brahmana> The same code works perfectly fine from irb .. but when put in my daemon, it stops printing the timestamp and the log-level. What's messing that up?
<canton7> something to do with being threaded? I'm guessing
Tearan has joined #ruby
<Progster> Does File.file? in ruby only work when you're in the directory where that file is locatd?
<Progster> I'm getting all false's back
Bartzy has joined #ruby
<apeiros_> Progster: as with about all file related methods, you provide either an absolute path or a path relative to the current working directory
PragCypher has joined #ruby
<canton7> noo, just beat me. Just a filename counts as a relative path btw
slonimsky has joined #ruby
<canton7> use Dir.pwd to find out what the current working directory is
<Progster> absolute it is
<canton7> and Dir.chdir to change it
<apeiros_> fascinating fact: Dir.chdir takes a block. awesome in combination with Dir.glob
<brahmana> canton7: Daemon is single threaded.. no threads, fibres etc
<canton7> brahmana, fair play
MrGando has joined #ruby
<canton7> ooh, very ncie!
adamkittelson has joined #ruby
<Progster> apeiros_: it is, but if you have multiple threads accessing that directory, then aboslute paths are the only way to go
<apeiros_> o0
<Progster> otherwise you run into a cluster-fuck of integrity issues
elnur has joined #ruby
<brahmana> Progster++ for the adjective.. :D
ringotwo has joined #ruby
jimeh has joined #ruby
adamkitt_ has joined #ruby
<apeiros_> absolute vs. relative is relatively unrelated to threaded vs. single-threaded
<apeiros_> unless you're changing the working directory…
<Progster> if it's working of Dir.pwd then I would assume that's being stored in a static var somewhere
<Progster> off of
* apeiros_ wonders whether Dir.chdir is thread-local
<apeiros_> Progster: you shouldn't assume when programming
<apeiros_> that's the best way to get into clusterfucks in the first place
<Progster> I don't, which is why I'd use absolute paths
<Progster> from http://www.ruby-doc.org/core-1.9.3/Dir.html#method-c-chdir - "The return value of chdir is the value of the block. chdir blocks can be nested, but in a multi-threaded program an error will be raised if a thread attempts to open a chdir block while another thread has one open."
<apeiros_> Dir.chdir with a block is (sadly) not thread-local
elnur has quit ["Leaving"]
<apeiros_> ah, but at least that
pdtpatrick has joined #ruby
<Progster> your argument is still flimsy IMHO however, because by using absolute paths, I don't need to care whether Dir.chdir is thread-local or not. Hence it's assuming less, not more
KorriX has joined #ruby
<apeiros_> my part about assuming was about your statement: "I would assume that's being stored in a static var somewhere"
nikihr_ has joined #ruby
<Progster> and it is
<apeiros_> …
* apeiros_ sobs and goes on to read a book
ephemerian has joined #ruby
KorriX has quit [#ruby]
<Progster> to your point, my assumption was an assumption of restriction, not an assumption of relaxation, so no danger is present (besides effort in finding another method)
<apeiros_> you're missing the point.
<apeiros_> anyway, it's a good idea that you use absolute paths.
<Progster> what's the point?
<Progster> in short - if you don't know something, assume the worst.
<Boohbah> hi, i am trying to substitute underscores for spaces in the output from unix find. my first sub adds an underscore at the end of every line, so i need to do a second sub to remove it. is there a better way? http://pastie.org/3764061
<davidcelis> Boohbah: Strip it first
<Boohbah> davidcelis: ahh, thank you
idiocrash has joined #ruby
<idiocrash> hi, I have rvm version 1.0.19 installed. How do I upgrade to the latest?
chimkan_ has joined #ruby
SegFaultAX|work has joined #ruby
FreeDoug has joined #ruby
Poapfel has joined #ruby
nlc has joined #ruby
d-snp has joined #ruby
Chryson has joined #ruby
waxjar has joined #ruby
KnowTheLedge has joined #ruby
blueadept has joined #ruby
blueadept has joined #ruby
brngardner has joined #ruby
bosphorus has joined #ruby
jmcphers has joined #ruby
sgmac has joined #ruby
havenn has joined #ruby
samuelkaz has joined #ruby
nricciar has joined #ruby
brianpWins has joined #ruby
krusty_ar has joined #ruby
schovi has joined #ruby
nlc has joined #ruby
krusty_ar has joined #ruby
io_syl has joined #ruby
MasterIdler has joined #ruby
Guedes has joined #ruby
evan_luck has joined #ruby
jamesbrink has joined #ruby
ken_barber has joined #ruby
mdw has joined #ruby
trivol has joined #ruby
eywu has joined #ruby
l3ck has joined #ruby
Mohan has joined #ruby
Mohan has joined #ruby
patrick99e99 has joined #ruby
l3ck has joined #ruby
looopy has joined #ruby
brngardner has joined #ruby
trivol has joined #ruby
jamesbrink has joined #ruby
qeed has joined #ruby
<patrick99e99> does anyone know of a way to recursively get a list of filenames from within Rails.root? I am trying to tell the asset pipeline to precompile all .js and .css files in app/assets/js and app/assets/stylesheets... and so I am wondering if there is some Dir.glob option that will recursively let me get a list of files?
<patrick99e99> is this possible?
Oog_ has joined #ruby
<Oog_> how do i override a function in a class in a gem?
jamesbrink1 has joined #ruby
<chico> patrick99e99: Dir["#{config.root}/**/"]
<Oog_> hmm cant i just reopen the module and give my onefucntion precedence...
atmosx has joined #ruby
<Oog_> it involved multiple gems one of them uses Daemons
<Oog_> and i need to tell it not use pid files
n1x has joined #ruby
<patrick99e99> chico: great.. I just realized I have a problem though.. I want to exclude one directory.. Is that still possible?
<chico> patrick99e99: this expands into an array of strings, just exclude the one you don't want
jamesbrink has joined #ruby
stephenjudkins has joined #ruby
<lectrick> apeiros: I got it to work. https://gist.github.com/2354407
n1x has joined #ruby
<lectrick> apeiros_: ^^ Note also the test coverage. I finally made a habit of it!
jamesbrink has quit [#ruby]
<lectrick> I know I deserve no credit for that but for some reason it was a long time coming to grow a habit to create test coverage even on a one-line method
<patrick99e99> thanks chico
adamkittelson has joined #ruby
artm_ has joined #ruby
Boohbah has joined #ruby
<adac> This covers quite a lot of the youtube URL's to get back the youtube ID https://gist.github.com/2354375 . Hovever it does not work for this kind of URL: http://www.youtube.com/watch?feature=player_embedded&v=wnT7e6SqUrE Can someone help me to find a regex for this kind of URL?
l3ck has joined #ruby
mikeg has joined #ruby
h4mz1d has joined #ruby
Advocation has joined #ruby
MrGando has joined #ruby
yoklov has joined #ruby
deobald has joined #ruby
Faris has joined #ruby
icy` has joined #ruby
icy` has joined #ruby
VegetableSpoon has joined #ruby
<lindenle> if I get require : no such file to load is this a environment problem?
supergiantrobot_ has joined #ruby
classix has joined #ruby
MrGando has joined #ruby
<davorb> nope
<davorb> tried doing require "./myfile.rb"?
sgmac has quit [#ruby]
BrianE has joined #ruby
autojack has joined #ruby
<lindenle> <davorb>: it is puppet on a rhel4 system ... without gem
<lindenle> davorb: trying
<davorb> are you trying to require a gem or a local file?
nobitanobi has joined #ruby
<autojack> I have a REST API which is giving me back a time/date in this format: '2012-04-10T19:31:19Z' basically mysql date format. I can't change the API or otherwise get a different format. I need to figure out how many seconds difference that time is from now. DateTime.parse will parse the input string, but then I can't figure out how to do the seconds comparison. can anyone help? using ruby 1.8.7.
<lindenle> davorb: I believe it tries to require a gem require 'puppet/util/command_line'
VegetableSpoon has quit ["Leaving"]
tommyvyo has joined #ruby
<autojack> oops, I might have just figured it out.
<davorb> well if you're trying to require a gem, what i said won't work. in that case it's an environment problem. you need to check your $LOAD_PATH
<lindenle> davorb: yeah
<lindenle> davorb: is there a global environment settings?
<autojack> I needed to require 'time', then I can do Time.parse(string) and go from there.
<davorb> go into irb and type $LOAD_PATH
autojack has quit [#ruby]
<lindenle> davorb: right so the path I need is missing
<davorb> either that or the gem is missing
<lindenle> davorb: can I add to the LOAD_PATH?
sam113101 has joined #ruby
sam113101 has joined #ruby
chico has joined #ruby
crankycoder has joined #ruby
<lindenle> davorb: thx
sam113101 has joined #ruby
dabaR has joined #ruby
sam113101 has joined #ruby
<dabaR> I'm trying to use the ruby-git gem, https://github.com/schacon/ruby-git, and using g.add('.')
<dabaR> It seems to do 'git add .' and not 'git add . -A'
<dabaR> Anyone have experience with that?
<davorb> lindenle: tbh might just be easier to run the rvm install script. it should set up your environment and give you access to gems. plus, it makes it easy to change ruby versions. https://rvm.io/
<lindenle> <davorb>: looking
shruggar has joined #ruby
<davorb> lindenle: have a look at http://net.tutsplus.com/tutorials/why-you-should-use-rvm/ in that case. might be faster.
<davorb> i don't know how/if it works under windows, though
<dabaR> It doesn't
<dabaR> I'm pretty sure
<dabaR> But he offers alternatives for Windows on his site. Not sure how good they area.
burgestrand has joined #ruby
GuidovanPossum has joined #ruby
<lectrick> There really should be a builtin that does the equivalent of this in one call: $:.unshift(File.expand_path(File.dirname(__FILE__))) unless $:.include?(File.dirname(__FILE__)) || $:.include?(File.expand_path(File.dirname(__FILE__)))
QKO_ has joined #ruby
<Dreamer3> is there a way to introspect a method and ask where it was defined or where it came from?
sam113101 has joined #ruby
adeponte has joined #ruby
mcwise has joined #ruby
<lindenle> davorb: bash: line 272: syntax error near unexpected token `ruby'
<lindenle> davorb: grummble
drKreso has joined #ruby
<davorb> your environment seems really weird lindenle. just try to do the load path thingie in that case and see if you can get that to work.
<lindenle> davorb: it is rhel 4 that is weird ;) not "my" environment
<lindenle> my environment is awesome
* lindenle Ubunut and free
ken_barber has joined #ruby
<davorb> wow. i remember installing redhat 4.2 from a CD-ROM eons ago. that must have been like 1997.
<GuidovanPossum> Is that said You be you nut?
<Dreamer3> > p Object.method(:attributes)
<Dreamer3> #<Method: Class(Attributes)#attributes>
<Dreamer3> progress
<Dreamer3> Attributes module?
wvdschel has joined #ruby
<shadoi> lectrick: require_relative
<lindenle> <davorb>: yeah, dont get me started
<shadoi> lectrick: is the intended replacement for that bullshit
<lindenle> davorb: legacy software
<lectrick> shadoi: That's still less than ideal
<shadoi> lectrick: '.' was removed from the default load path because it can be used maliciously far too easily.
<lectrick> I know.
visof has joined #ruby
visof has joined #ruby
<lectrick> But there should be a nicer way to add paths to the $LOAD_PATH
<lectrick> in a clean maintainable way
dabaR has quit [#ruby]
<shadoi> You can always add a method to kernel in your environment to make it sane, and submit a patch to make it standard...
<lectrick> I may just do that
<Dreamer3> ok
<Dreamer3> "prototpye" gem pulls in attributes
<Dreamer3> which adds an attribute method to every object
virunga has joined #ruby
<Dreamer3> you'd think more people would notice this though
<shadoi> that's evil, that would break every one of my codebases.
<Dreamer3> wow
<Dreamer3> attributes 5.0.1 dates back to dec 2007
oooPaul has joined #ruby
<Dreamer3> so
netogallo has joined #ruby
<Dreamer3> so why does the gem require it
<shadoi> the prototype gem dates from 2007 also :)
<shadoi> It's just old.
<Dreamer3> ok
<Dreamer3> wait
<Dreamer3> not the prototype js library
workmad3 has joined #ruby
<Dreamer3> so what else is pulling this in
Indian has joined #ruby
<shadoi> the prototype gem adds javascript-like prototyping to the ruby language. It's probably not what you think it is.
<lectrick> How do I submit a patch to ruby? Is ruby on github? :)
nu7hatch has joined #ruby
<Dreamer3> ha
<Dreamer3> i think i did it :)
SegFaultAX|work has joined #ruby
* lectrick has gotten lazy since github is so cool
<Dreamer3> thinking it was a require i hard coded it
<Dreamer3> man
<shadoi> lectrick: https://github.com/ruby/ruby
<lectrick> shadoi: well damn. off I go. :)
<shadoi> lectrick: in general to get it accepted you need to be on the mailing lists and do some political maneuvering. :)
<lectrick> shadoi: Of course. I will start with the mailing list. I will figure out who I need to ply with beer and supplication later.
<tvw> I just downloaded ruby-1.9.3-p125 source from ruby-lang and wonder, whether the checksums are correct. I get different ones while the file decompresses fine.
<lectrick> shadoi: ruby-talk? I'm already on that. I assume you mean ruby-core?
<shadoi> yup
CannedCorn has joined #ruby
<shadoi> lectrick: I'd just work on the patch and then worry about blasting it out once it's something you can point at with tests.
netogallo has joined #ruby
<lectrick> shadoi: Oh I wouldn't even think to make a peep unless I had a test suite
chioque has joined #ruby
<shadoi> lectrick: also, it may be easier to add the feature to something like rubinius and back into YARV/MRI
<shadoi> there's a nice breakdown of a newb adding require_relative out there on the googles.
<lectrick> shadoi: thanks for the tips
<lectrick> I just added the require_relative call to one of my tests so I could run the test by itself, and it worked nice enough.
pac1 has joined #ruby
iamjarvo has joined #ruby
apok has joined #ruby
<shadoi> yeah, it's good enough for most of my stuff
sam113101 has joined #ruby
netogallo has joined #ruby
<adf_> lectrick: what's the bug/patch you're reporting?
keymone_ has joined #ruby
<shadoi> adf_: he'd like a consistent clean way to update $LOAD_PATH
asobrasil has quit [#ruby]
atnight has joined #ruby
<adf_> oh ok
jgrevich_ has joined #ruby
jgrevich_ has joined #ruby
<tvw> ok, the checksums are incorrect only for the german version of the page.
stephenjudkins has joined #ruby
two- has joined #ruby
ryan_dev70 has joined #ruby
juiceman5000 has joined #ruby
manizzle has joined #ruby
macmartine has joined #ruby
<juiceman5000> How do you get an array of an object's instance methods? I can't find syntax for it I think i may be asking google wrong
<shadoi> methods
<shadoi> object.methods
<shadoi> object.public_methods
<shadoi> etc.
<workmad3> juiceman5000: or, if you want it from a class, Klass.instance_methods
<adf_> juiceman5000: d u mean Method objects or just symbols of the method names?
<juiceman5000> ty i'll try obvious obvious code next time
<juiceman5000> lol
eka has joined #ruby
matled has joined #ruby
xcvd has joined #ruby
klaas has joined #ruby
Pip has joined #ruby
cjs226 has joined #ruby
pu22l3r_ has joined #ruby
francisfish has joined #ruby
sam113101 has joined #ruby
<delinquentme> hey all what are the double colons about
<delinquentme> " :: "
drKreso has joined #ruby
EddieS_ has joined #ruby
adf_ has joined #ruby
DPP has quit [#ruby]
<Pip> delinquentme, inheritance
<delinquentme> Pip, how is it different from Object < superobject
io_syl has joined #ruby
<Pip> Where?
Teomari has joined #ruby
flaggy has joined #ruby
<apeiros_> Pip: no, :: has nothing to do with inheritance
<apeiros_> delinquentme: :: is for namespacing
<Pip> Oh, sorry
<apeiros_> it can also be used for method invocation, but that's not widely used anymore
<Pip> I mixed that with C++
francisfish has joined #ruby
eywu1 has joined #ruby
Targen has joined #ruby
Karmaon has joined #ruby
<icy`> hm , if i'll be searching for files with a certain extension and min size, should i limit by the size first, or the extension?
<icy`> FileTest.size( ) first or path =~ / / basically
<rking> icy`: I hate premature optimization, but this seems definitely like a case of filtering on the name first, since it's more expensive to check the size.
<icy`> ok thanks
<rking> icy`: Since it's not more complex to do it that way, the tiebreaker is speed.
ben225 has joined #ruby
gregorg has joined #ruby
gregorg has joined #ruby
timonv has joined #ruby
nerdy_ has joined #ruby
<Pip> So you guys don't do GUI programming usually with Ruby?
<icy`> everyone is going into web i guess
<Pip> RoR?
<icy`> that is the popular one =D
<icy`> (framework)
sam113101 has joined #ruby
<shadoi> Pip: MacRuby is getting popular, and GTK and QT both have ruby bindings if you need windows support.
* Pip deosn't have a Mac
<shadoi> QT is probably your best bet.
<icy`> qt5 is going into the web toolkit direction too
<icy`> qml + js
havenn has joined #ruby
BSaboia has joined #ruby
dv310p3r has joined #ruby
tatsuya_o has joined #ruby
headius has joined #ruby
fr0gprince_ has joined #ruby
<jrgifford> Pip: you can do shoes for GUI programming in ruby. - http://shoesrb.com/
ctp has joined #ruby
looopy has joined #ruby
apok_ has joined #ruby
nari has joined #ruby
keymone has joined #ruby
IPGlider has joined #ruby
ryan0x2 has joined #ruby
jitesh_shetty has joined #ruby
Hunner has joined #ruby
<Hunner> Hello. Is there a way to take the intersection of a hash and an array, like `new_hash = hash.keys & ary`
<Hunner> Without iteration, of course
<Hunner> There is `new_hash = hash.keep_if { |k,v| ary.include? k }`, but again that's iteration and feels weird
kenichi has joined #ruby
sectionme has joined #ruby
zakwilson has joined #ruby
nif has joined #ruby
riyonuk has joined #ruby
sam113101 has joined #ruby
<riyonuk> Does anyone have a guide on understanding how API's work? From my research, it's just public functions over HTTP?
<riyonuk> I've used them before, but I've had to teach myself. Just trying to find a tutorial on them.
<d-snp> eh
<d-snp> how api's work in general? :D
<d-snp> every api is different
<d-snp> if you're lucky they implement something called REST, or they are RESTful, you can google it
<d-snp> it basically means that they behave like resources that you can GET, PUT, POST or DELETE over http
BrianE has joined #ruby
emmanuelux has joined #ruby
brngardner has joined #ruby
phantasm66 has joined #ruby
jgrevich_ has joined #ruby
kvirani has joined #ruby
frankaa112 has joined #ruby
jarred has joined #ruby
frontendloader has joined #ruby
Cyber-Dogg has joined #ruby
<Cyber-Dogg> I have YAML being loaded in
<Cyber-Dogg> but it's producing data like {"key"=>"value"}
ken_barber1 has joined #ruby
<Cyber-Dogg> I need it to produce data like {:key => "value"}
<canton7> Cyber-Dogg, either convert your keys to symbols after-the-fact (there are plenty of SO posts on how to do this), or store them as keys in YAML (use :key: instead of key:)
<Cyber-Dogg> ok thanks
slonimsky has joined #ruby
niku4i has joined #ruby
carlyle has joined #ruby