<dominikh>
the cute thing is, you can still own names like "subtle" or "cinch". just got to hope no other project thinks of the same retarded name ;)
<petercooper>
but what if your project name starts with a pound sign!
<outoftime_>
wait what's up with #rubyonrails ? not the right channel?
<zenspider>
outoftime_: horrible signal:noise
<outoftime_>
zenspider: oh as in the actual quality of the channel. yes, i've noticed.
<drbrain>
outoftime_: it has a reputation for not being helpful
<petercooper>
it's been years since I was there but I mentioned it because it used to be 1000+ screaming stupid newbie questions at each other and people fighting to give bad answers
<outoftime_>
I thought in terms of actual naming policy issues
<dominikh>
petercooper: sounds an awful lot like #ruby :P
<petercooper>
or stack overflow :P
<dominikh>
or the internet
<petercooper>
ouch!
<deryldoucette>
i *think* the reason #rubyonrails came about is because the #ror channel is almost always invite only
<dominikh>
isn't #row a redirect to #rubyonrails?
<dominikh>
#ror even
<deryldoucette>
Error: Cannot join to channel #ror (You must be invited)
<dominikh>
I joined just fine right now
<deryldoucette>
dominikh: been that way for well over a year when i moved here from efnet
<dominikh>
well, I just checked, and it redirects me :)
<deryldoucette>
hrmm. ok, lemme part #rubyonrails and see what gives
<petercooper>
just to bring a bit of its spirit here.. the last thing I learned was that a woman's farts once forced an AA flight to land.
<A124>
LoL
<deryldoucette>
dominikh: huh. never ever noticed that. wonder why the server reports back that you must be invited then
<deryldoucette>
it just redir'd me to #rubyonrails as you said
<dominikh>
deryldoucette: well, it is _also_ invite only
<dominikh>
so if you're already in #rubyonrails, it cannot forward you
<deryldoucette>
that would make sense
<dominikh>
and joining the actual #ror doesn't work either because of the invite only
enebo has joined #ruby-lang
macmartine has joined #ruby-lang
<deryldoucette>
got ya. see what ya get for assuming? i came into #rubyonrails from the get go. always assumed it was a totally separate and isolated channel, not with a redir.
<petercooper>
is ror like a super elite caboose?
<erikh>
probably
ascarter has joined #ruby-lang
<deryldoucette>
well from what i've been told since being on freenode its the official 'developer' channel for ruby on rails developers. i've no way of establishing the validity of that. since it was no big deal to me i never questioned it
<zenspider>
wait... I'm not super elite for having access to caboose?!?
<petercooper>
will tenderlove spill the beans?
<tenderlove>
wat?
bglusman has joined #ruby-lang
<erikh>
use /msg chanserv info #ror guys
amerine has joined #ruby-lang
<wmoxam>
is caboose still around?
<dominikh>
erikh: stop teaching people how to IRC. this is elite knowledge
<erikh>
the modes are just broken
<erikh>
dominikh: sorry
<petercooper>
tenderlove: deryldoucette was wondering if #ror is the official Rails core channel
<tenderlove>
not that I know of
<erikh>
campfire dudes
<wmoxam>
#rails-core
<tenderlove>
I think only me, bitsweat, and spastorino are on irc
<tenderlove>
and we're in #rails-contrib
<dominikh>
interesting tidbit: #ruby was registered before #ruby-lang was
<deryldoucette>
so is it an actual channel with people *in* it or what? or totally just a redir channel with modelock?
<petercooper>
You are like the most awesome genie whose lamp can be rubbed with a single word.
<tenderlove>
deryldoucette: it's an actual channel
<muzone>
It's a shell script that tracks changes to the files Rails generated for you when you first made your app - in the form of a list of what's been modified, added or deleted. This way you can later diff or replace the parts that are important to you - as opposed to rake rails:update which only updates your assets. Based on http://blog.envylabs.com/2011/10/upgrading-to-rails-3-1-1/
<zenspider>
what? why?
<muzone>
sorry i thought this was #rubyonrails
<muzone>
man
<muzone>
these new glasses make me look sexy but i cant see shit!!
<cored>
zenspider: sorry, wasn't here
<petercooper>
Anyone heard a rumor Ruby core wants to move parameter checking out of objects and into whatever calls the object's methods?
<zenspider>
cored: meh. asking a question and then walking away?
<tenderlove>
O_O
<zenspider>
petercooper: they're also adding optional type checking to ruby to make it faster and safer!
<petercooper>
sorry got mixed up with Rails
<cored>
zenspider: I had to go to the bathroom, sorry
<tenderlove>
petercooper: I was whispering it in zenspider's ear, sensually
<zenspider>
waaay too much information
<petercooper>
haha
<zenspider>
hahaha
<zenspider>
but. he was
<tenderlove>
secretly too
<petercooper>
are you like the angel / devil sitting on the shoulders of one uber dude?
<zenspider>
god... which one would he be?
<tenderlove>
the one that looks like a DIABEETUS cat
<injekt>
I read that as 'eat yer email' too much internet
<muzone>
hehe
burns180_ has joined #ruby-lang
shevy has joined #ruby-lang
Skif has joined #ruby-lang
Heimidal has joined #ruby-lang
jkyle has joined #ruby-lang
<jkyle>
how would I do an incremental isntall of a gem so I can patch the rakefile before the build stage?
<injekt>
jkyle: why would you want to patch an installed gems rakefile?
<jkyle>
I want to patch the rakefile before it builds the gem
<jkyle>
so, the gem is not currently installed but to get the build to work I need to patch the rakefile. something like fetch, extract, <patch or edit>, build, install
<injekt>
fetch it, edit it, and build/install it yourself
<injekt>
that is, fetch the entire project, edit the rakefile, build it, install it
<injekt>
boom
<andrewvos>
Any new scandals since I've been away from the internet?
<jkyle>
here we go, gem fetch, gem unpack, <patch it up>, gem build, gem install --skip-build
<injekt>
doesn't look like you've touched the rakefile you wanted to edit :)
<jkyle>
now, just for fun, I get to throw rvm and bundler in the mix...I really hate those apps :P
<injekt>
why are you using them then?
<jkyle>
sometimes we don't choose what we have to work with
<injekt>
I'm glad I don't live that
<jkyle>
injekt: independent contractor?
<jkyle>
that works with all new code, I would assume
<injekt>
no, but I don't mean everything. That is, I work with stuff I don't really *like*, but things like rvm and bundler have never (nor would ever) be a dependency of anything I do
<injekt>
I'm not an rvm fan, so I use rbenv
<injekt>
I use bundler because it's nice once you get past the stupid
<jkyle>
it's the deploy model used by the developers of this particular app for which I've inherited support. seems most ruby developers really like bundler + rvm though
erics has joined #ruby-lang
<injekt>
yeah, I certainly won't argue with that
<injekt>
it's very popular
Skif_home has joined #ruby-lang
<jkyle>
I think I'd like them more if I more actively developed the projects I support...seems they work alright once you get the magic incantations down on your own system.
darkf has joined #ruby-lang
<jkyle>
normally, I just have to jump in to fix things...and the first things I seem to have to fix are rvm and bundler
takaokouji has joined #ruby-lang
<injekt>
if an app is dependant on rvm it's doing it wrong
<injekt>
bundler is different
<jkyle>
bundler more than rvm
thone has joined #ruby-lang
<jkyle>
ok, so I did a gem fetch foo, then gem unpack foo.gem, then edited the rakefile. now I have a directory called 'foo' with the modified files.
<jkyle>
now, I think I need to create a gemspec and rebundle it, then install?
burns180 has joined #ruby-lang
<injekt>
I have no idea what you're doing?
<jkyle>
I need to patch a Rakefile and install the gem into a bundler environment
<injekt>
I still don't understand why you need to alter the rakefile, bundler and rubygems doesn't care about your rakefile
<jkyle>
it runs teh default rake task to build the extensions right?
<jkyle>
s.extensions = ["Rakefile"]
<jkyle>
in the gemspec
<jkyle>
in the rakefiile it uses an invalid swtich that it passes to gcc, specificially -R , which needs to be changed to a -L
havenn has joined #ruby-lang
<injekt>
what gem is this?
<jkyle>
xapian-full
<lsegal>
jkyle you might not like this but the standard answer tends to be: "fork, and, if possible, submit pull request"
<jkyle>
yeah, just asked our ruby guys and they're like "fork it!"
tomzx has joined #ruby-lang
<jkyle>
it's literally a one character change, R to L lol
<injekt>
system! "mkdir -p lib"
<injekt>
jeez
<A124>
Hey. Can any of you guys hang me out please?
<A124>
Is there Array#union, which does _not_ remove duplicates?
<petercooper>
+ ?
<jkyle>
A124: that wouldn't really be a union though, right?
<A124>
I'm not into removing duplicates .. of course, that would not be. I just need and union like fuctionality.
<jkyle>
the union of two sets is the set of all distinct elements in the collection
<jkyle>
by definition, no duplicates :) addition might do what yo wish though
<A124>
jkyle: Um.. will look it up
<A124>
jkyle: No, addition is not
<A124>
I need: file_2 - (file_1 & file_2)
<A124>
Is there any better way to do this? .. (This removes elements from array 2 which are not in both arrays.
<A124>
* Sorry, my error:
<A124>
file_1 - (file_2 - (file_1 & file_2))
voker57 has joined #ruby-lang
btfriar has joined #ruby-lang
<A124>
For me it looks like emulating a logical problem, but I haven't found anything in RDoc
burns180_ has joined #ruby-lang
btfriar has quit [#ruby-lang]
<jkyle>
I know recommended is to fork, but is it really impossible to walk through the installation process and patch the gem?
saneshark has quit [#ruby-lang]
<A124>
jkyle: What do you mean by that?
srbartlett has joined #ruby-lang
QoQOoO has joined #ruby-lang
fayimora has joined #ruby-lang
<jkyle>
this is what I tried to do: gem fetch foo && gem unpack foo && cd foo; <patch source>; bundle exec rake # default tasks builds/installs gem
<jkyle>
but I get this: Could not find gem 'xapian-full (>= 0) ruby' in any of the gem sources listed in your Gemfile.
<A124>
jkyle: Doen not the patch require additional library?
ramu3 has joined #ruby-lang
<A124>
Specificaly gem.
<jkyle>
k, think I got it
<A124>
;)
<jkyle>
bundle exec rake works if I _remove_ the gem from the Gemfile. otherwise bundle craps out because it sees a req that's not installed
gnufied has joined #ruby-lang
ontehfritz has joined #ruby-lang
<jkyle>
crap, that built it but it's still not in my bundle environment
* zenspider
lights rake on fire
heppy_ has joined #ruby-lang
<A124>
jkyle: xD
gentz has joined #ruby-lang
<jkyle>
how do you get the url that a gem is hosted at...like how do you show the metadata for a gem to know where it comes from?
burns180 has joined #ruby-lang
QaDeS_ has joined #ruby-lang
<zenspider>
jkyle: I don't think that information exists
<zenspider>
(in the installed gem)
<zenspider>
if you gem install with -V you'll see where it comes from
ilyam has joined #ruby-lang
looopy has joined #ruby-lang
sj26 has joined #ruby-lang
mistym has joined #ruby-lang
Z33K|Lux has joined #ruby-lang
l0st1 has joined #ruby-lang
gentz has joined #ruby-lang
seanstickle has joined #ruby-lang
voker57 has joined #ruby-lang
voker57 has joined #ruby-lang
shtirlic has joined #ruby-lang
burns180 has joined #ruby-lang
Austin__ has joined #ruby-lang
looopy has joined #ruby-lang
bglusman has joined #ruby-lang
bryancp has joined #ruby-lang
bglusman has joined #ruby-lang
boodle has joined #ruby-lang
krz has joined #ruby-lang
havenn has joined #ruby-lang
Temp has joined #ruby-lang
wmoxam has joined #ruby-lang
dreinull has joined #ruby-lang
dfr|mac has joined #ruby-lang
dfr|mac_ has joined #ruby-lang
dfr|mac__ has joined #ruby-lang
postmodern has joined #ruby-lang
jkyle has joined #ruby-lang
havenn has joined #ruby-lang
havenn has joined #ruby-lang
neoesque has joined #ruby-lang
gnufied has joined #ruby-lang
wmoxam has joined #ruby-lang
burns___ has joined #ruby-lang
lake has joined #ruby-lang
brownies has joined #ruby-lang
jkyle_ has joined #ruby-lang
havenn has joined #ruby-lang
darkf_ has joined #ruby-lang
burns180 has joined #ruby-lang
darkf has joined #ruby-lang
dreinull has joined #ruby-lang
havenn has joined #ruby-lang
jkyle has joined #ruby-lang
deryldoucette has joined #ruby-lang
QoQOoO has joined #ruby-lang
ilyam has joined #ruby-lang
<havenn>
shevy: I forget who it was this morning who as looking for a timer that would go off if a method wasn't called in however many seconds. You mentioned EventMachine as a solution. Was just looking at Celluloid today, and it has a nice solution as well: https://gist.github.com/1983287
CodeBlock has joined #ruby-lang
uniqanomaly has joined #ruby-lang
gokul has joined #ruby-lang
twittard has joined #ruby-lang
burns180 has joined #ruby-lang
hagebake has joined #ruby-lang
hagebake has joined #ruby-lang
rohit has joined #ruby-lang
rippa has joined #ruby-lang
havenn has joined #ruby-lang
zmack has joined #ruby-lang
tenderlove has joined #ruby-lang
jxie has joined #ruby-lang
gsav has joined #ruby-lang
deryldoucette has joined #ruby-lang
dhruvasagar_ has joined #ruby-lang
achiu has joined #ruby-lang
burns180_ has joined #ruby-lang
gregmoreno has joined #ruby-lang
deryldoucette has joined #ruby-lang
deryldou1ette has joined #ruby-lang
deryldoucette has joined #ruby-lang
deryldoucette has joined #ruby-lang
gsav has joined #ruby-lang
gsav has joined #ruby-lang
gsav has joined #ruby-lang
chimkan_ has joined #ruby-lang
gsav_ has joined #ruby-lang
gsav_ has joined #ruby-lang
btfriar has joined #ruby-lang
deryl has joined #ruby-lang
brianpWins has joined #ruby-lang
wmoxam has joined #ruby-lang
burns180_ has joined #ruby-lang
ilyam has joined #ruby-lang
adamjkl has joined #ruby-lang
<adamjkl>
i'm new to Ruby and have difficulty understanding why this code doesn't work as I want it to : http://pastebin.com/1zmciiDQ
<adamjkl>
when I try to display c["is"], it gives me 0, when it should clearly be 1
<adamjkl>
why is that?
Gekz has joined #ruby-lang
<wallerdev>
adamjkl: all your hash keys are actually arrays
<wallerdev>
because you used a regex group in scan
<wallerdev>
so for example you could do puts c[["is"]]
<wallerdev>
or you could do count[word[0]] += 1
<adamjkl>
wallerdev: so if I want the keys to be strings and not arrays, how should I modify the code ?
<wallerdev>
you could do count[word[0]] += 1
<wallerdev>
or you could use map or flatten with your words array
jkyle has joined #ruby-lang
<wallerdev>
for example words = str.scan(/-([a-z]+)-/).flatten
<wallerdev>
if you do "p words" you will see that your array currently looks like [["this"], ["is"], ["a"], ["sentence"]]
gianlucadv has joined #ruby-lang
<adamjkl>
wallerdev: I get it now, thanks a lot
<wallerdev>
no problem
mikeric has joined #ruby-lang
heppy has joined #ruby-lang
burns180 has joined #ruby-lang
sdeobald_ has joined #ruby-lang
kitallis has joined #ruby-lang
CodeBlock has joined #ruby-lang
SPYGAME has joined #ruby-lang
QoQOoO has joined #ruby-lang
toretore has joined #ruby-lang
JohnBat26 has joined #ruby-lang
x0F__ has joined #ruby-lang
burgestrand has joined #ruby-lang
andkerosine has joined #ruby-lang
<andkerosine>
How to serve compressed archives from Heroku if files can't be written?
robbyoconnor has joined #ruby-lang
robbyoconnor has joined #ruby-lang
butchanton has joined #ruby-lang
frangiz has joined #ruby-lang
msch has joined #ruby-lang
butchanton has joined #ruby-lang
aza_kibo_ has joined #ruby-lang
aza_kibou has joined #ruby-lang
yxhuvud has joined #ruby-lang
<TTilus>
andkerosine: maybe not serve them from heroku?
burgestrand has joined #ruby-lang
<TTilus>
andkerosine: there are a great deal of services just for that
butchanton has joined #ruby-lang
<TTilus>
andkerosine: and if you happen to mean that you serve a compressed version of something you deploy to heroku as resource, maybe compress on the fly?
|Vargas| has joined #ruby-lang
|Vargas| has joined #ruby-lang
srbaker has joined #ruby-lang
dc5ala has joined #ruby-lang
esotericalgo has joined #ruby-lang
<esotericalgo>
does array indexing have linear access time?
<heftig>
esotericalgo: you mean x[4]?
<esotericalgo>
heftig: yes
<heftig>
no, constant.
<heftig>
arrays are arrays, not linked lists.
<msch>
heftig: what happens if i add stuff at the end? does the whole array get copied into a bigger array?
<heftig>
yes.
<esotericalgo>
heftig: I was just curious since the required the Enumerable mixin requires each, which seems to suggest that all subsequent Enumerable methods would be O(n)
<heftig>
if it's too small, that is
<rippa>
esotericalgo: Enumerable doesn't provide [] though
<heftig>
[] is a method of Array, not Enumerable
<esotericalgo>
rippa: ahh, that would explain it, thanks
Fractality has joined #ruby-lang
<rippa>
also, many Enumerable methods are redefined in Arrays
<esotericalgo>
are the builtins in ruby or a lower-level part of the interpreter?
<heftig>
C
<esotericalgo>
thanks that cleared a lot up
<heftig>
Rubinius is a VM that implements a lot in Ruby itself
<msch>
heftig: any way i can create an empty array with a given capacity? e.g. if i have a tight loop and know i'll build an array with n elements
<heftig>
Array.new(x)
sdeobald_ has joined #ruby-lang
macmartine has joined #ruby-lang
burns180 has joined #ruby-lang
solars has joined #ruby-lang
io_syl has joined #ruby-lang
amerine has joined #ruby-lang
QoQOoO has joined #ruby-lang
kain has joined #ruby-lang
RomyRomy has joined #ruby-lang
burns180_ has joined #ruby-lang
_mh_ has joined #ruby-lang
_mh_ has joined #ruby-lang
Fullmoon has joined #ruby-lang
ryanf has joined #ruby-lang
bousquet has joined #ruby-lang
JohnBat26 has joined #ruby-lang
QaDeS has joined #ruby-lang
Takoi has joined #ruby-lang
macmartine has joined #ruby-lang
workmad3 has joined #ruby-lang
<Takoi>
Hi everyone. I'm looking foward to working with Actor model and Ruby, and I would like to know if you guys knew some nice gems to achieve that. I tried Revactor, but it's wait too "feature-full" than what I need. I really just need message passing (sync and async). Any idea ?
<cubesat631>
Hey Everyone. I'm currently trying to install Ruby 1.9 on my VM, but Ruby keeps being installed in local (running on Ubuntu currently)
<cubesat631>
which ruby >> /usr/local/bin/ruby
<cubesat631>
Any way to force it going into my usr/lib folder ? :/
<ddfreyne>
./configure --prefix should do it when comipling from source
<ddfreyne>
but I recommend rvm :)
<cubesat631>
What's RVM ?
<ddfreyne>
rvm.beginrescueend.com
solars has joined #ruby-lang
<cubesat631>
Trying it
<yorickpeterse>
RVM is a tool that allows you to install multiple rubies either for the entire system or for specific users
<cubesat631>
ERROR: The requested url does not exist: 'ftp://ftp.ruby-lang.org/pub/ruby/1.9/ruby-1.9.3-.tar.bz2'
<cubesat631>
bad start ^
<ddfreyne>
yikes
<ddfreyne>
what did you use to install ruby?
<cubesat631>
Downloaded the TAR, deTAR, ./configure (without prefix though), make, make install
<cubesat631>
What prefix should I put to throw it in my usr/lib folder ? :P
<yorickpeterse>
That shouldn't be needed for RVM
<yorickpeterse>
You run the snippet on their website and then just do `rvm install 1.9.3`
<cubesat631>
Yah but RVM is reaching an URL that doesn't exist
<cubesat631>
ERROR: The requested url does not exist: 'ftp://ftp.ruby-lang.org/pub/ruby/1.9/ruby-1.9.3-.tar.bz2'
<cubesat631>
Igot that
<yorickpeterse>
Hm, odd
<ddfreyne>
huh? you configure, make, make installed rvm?
<yorickpeterse>
Try `rvm install 1.9.3-p125`
<cubesat631>
no ddfreyne, was talking about Ruby
<cubesat631>
ddfreyne: I did like they said on the website
<ddfreyne>
oh right
<ddfreyne>
if you do "rvm get head" and try installing it again, does it work?
<cubesat631>
seems to be downloading with what yorickpeterse said
<ddfreyne>
1.9.3 should work too though I guess... ot sure
<cubesat631>
I didn't in my case ^
<cubesat631>
Compiling...
tbuehlmann has joined #ruby-lang
<cubesat631>
*cross fingers*
gnufied has joined #ruby-lang
<cubesat631>
Well it finished
<cubesat631>
I don't know if everything went good tho :p
<cubesat631>
I don't get anything when I run 'whereis ruby'
<ddfreyne>
did you open a new terminal?
<ddfreyne>
or used 'rvm reload'?
<cubesat631>
and running 'irb' gives me > bash: /usr/local/bin/irb: /usr/local/bin/ruby: bad interpreter: No such file or directory
<yorickpeterse>
cubesat631: you have to explictly "use" the ruby first
<yorickpeterse>
`rvm use 1.9.3` or `rvm use --default 1.9.3`
<yorickpeterse>
The latter will switch it over to the default Ruby for that user
<cubesat631>
ok
burns180_ has joined #ruby-lang
<cubesat631>
Using /usr/share/ruby-rvm/gems/ruby-1.9.3-p125
<cubesat631>
got that
<cubesat631>
Is it normal for it to be in /usr/share ? :/
Zolrath has joined #ruby-lang
<yorickpeterse>
Did you install it as root?
francisfish has joined #ruby-lang
<cubesat631>
yes of course
<yorickpeterse>
RVM is meant to be installed on a user specific level. You can install it system wide but it's not something most people would recommend
<cubesat631>
Well it's just a VM
<cubesat631>
I just want to be able to run Ruby lol
<yorickpeterse>
What OS?
<yorickpeterse>
Most package managers come with RVM and unless you're using Debian/Poobuntu they should be reasonable up to date. RVM however is something that's always up to date and allows project specific rubies and the like
<cubesat631>
I'm on Ubuntu right now
<yorickpeterse>
Not sure if 1.9 is in apt
<yorickpeterse>
Wouldn't surprise me if they're still on 1.8
<cubesat631>
Yeah but I got the 1.9 tar
<cubesat631>
but I don't know what prefix I should use on the ./configure
<yorickpeterse>
Well, there's two ways
<cubesat631>
to force it going into usr/lib
<yorickpeterse>
You can use RVM which you've already done (just install it user specific, thus without "sudo" and the like)
<yorickpeterse>
Or configure it with --prefix
<yorickpeterse>
e.g.
<yorickpeterse>
./configure --prefix=/foo/bar
<cubesat631>
so in my case /usr/lib ?
<yorickpeterse>
Yes
francisfish has joined #ruby-lang
<yorickpeterse>
But I think /usr/local/lib would be better suited (which is also the default location I believe)
<cubesat631>
it is
<cubesat631>
but
<cubesat631>
when I type 'ruby'
<cubesat631>
or 'irb'
<cubesat631>
it tells me it's not an installed program
<yorickpeterse>
Make sure your $PATH is correct
<yorickpeterse>
export PATH="$PATH:/usr/local/bin" something like that
<yorickpeterse>
You probably want to put that in your ~/.bashrc or ~/.profile file
<yorickpeterse>
That way you don't have to do it every time
roadkith has joined #ruby-lang
<cubesat631>
How do I do that ?
<cubesat631>
vi ~./.bashrc
<cubesat631>
and copy the line you gave me ?
<yorickpeterse>
Yes
<yorickpeterse>
Though RVM takes care of that for you :)
zmack has joined #ruby-lang
<cubesat631>
done
<cubesat631>
Oh Ruby 1.9 is mean, it does want me to delete all the special characters I used in my Strings lol
<cubesat631>
I used regular French characters
<cubesat631>
like éàèçù etc
QoQOoO has joined #ruby-lang
<yorickpeterse>
Eh, it doesn't
<yorickpeterse>
Turn on UTF8 encoding
<yorickpeterse>
put #encoding: utf-8 at the top of your file
<cubesat631>
You mean my like.... 100 files ?
<yorickpeterse>
Eh no
<yorickpeterse>
Are these strings set in the source files themselves?
<yorickpeterse>
Perhaps the easiest would be to do the following: Encoding.default_internal = 'utf-8'
<yorickpeterse>
That should only be needed once
<cubesat631>
Yeah I do something like raise ActorInitializationError, "ééééééééééééééé (just to show you)" if self.class == ::SimpleActor
ABK has joined #ruby-lang
<cubesat631>
Well I just did a script who wrote #encoding: utf-8 at the top of each file
<cubesat631>
Thanks anyway, much appreciated
<zenspider>
rawr
davidw has joined #ruby-lang
<Takoi>
:)
<yorickpeterse>
np
sdeobald__ has joined #ruby-lang
<Takoi>
Does someone know any library which would allow me to use the actor model in Ruby ? I tried Revactor, but they are just wayyyy more too many features in this awesome lib, I just would like to have a message passing system, sync and async
<Takoi>
It's awesome, but I'd say it's even more feature-full than Revactor, isn't it ? The thing is I just don't want to use a gem, 99% of which I don't even care for my application. You see what I mean ? I won't use a car to crush a nuts if I can have a nutcracker
Fullmoon has joined #ruby-lang
<yorickpeterse>
You're not forced to use all the features
kp666 has joined #ruby-lang
rohit has joined #ruby-lang
dhruvasagar has joined #ruby-lang
<shevy>
I use my car to drive over nuts
<shevy>
much faster than a nutcracker
<rippa>
I used micrometer to crack nuts
<rippa>
very handy
<Takoi>
rofl :)
<Takoi>
yorickpeterse: Yes of course. But it's for a robotics application (embedded system) and i'm very very limited in memory size
<andkerosine>
Anybody willing to look through and tell me where my code sucks hardest? : )
woollyams has joined #ruby-lang
<zenspider>
andkerosine: no tests
beiter has joined #ruby-lang
<beiter>
Hi
<beiter>
I need to extract bookmarks from a pdf file.Is there a good way to do this
<andkerosine>
zenspider: What is "tests"?
rob_ has quit [#ruby-lang]
<zenspider>
unit tests
<andkerosine>
Hm... never heard of them.
<tobiasvl>
andkerosine: how do you ttest your code? :)
<zenspider>
they run it... over and over and over again
<shevy>
think of them as putting mice in a cage with a wheel and they run and run and run and when a hole is in the wheel the mouse goes wheeeeeeeeeee and falls down and in goes the next mouse
Asher has joined #ruby-lang
gasbakid__ has joined #ruby-lang
woollyams has joined #ruby-lang
SiliconDon has joined #ruby-lang
<zenspider>
andkerosine: well... that's where your code sucks the hardest
<zenspider>
until you have tests, I have to assume the code is broken
<andkerosine>
Granted.
futurechimp has joined #ruby-lang
<beiter>
Any suggestions to my question
schroedinbug has joined #ruby-lang
burns180 has joined #ruby-lang
<andkerosine>
beiter: PDFKit is amazing for creation, but it doesn't do any reading... : /
<yorickpeterse>
krzyhoo: the #scan() is totally useless
francisfish has joined #ruby-lang
<yorickpeterse>
What rippa suggested is much better, hell, you can even use what I suggested
<krzyhoo>
yorickpeterse: so i should go with rippa
<krzyhoo>
ók
<yorickpeterse>
#scan(/./) does pretty much the same as #chars
<yorickpeterse>
It however requires the need for a regex object, something that's a waste of resources in this case
<krzyhoo>
yeah. but rippa suggestion sucks in my case
<rippa>
why?
<krzyhoo>
"ADDDS+R".chars.all? {|x| puts "OK" if "ADNRX+".include? x}
<krzyhoo>
because this must fails
<krzyhoo>
S is not allowed
<krzyhoo>
*fail
<rippa>
puts "OK" if "ADDDS+R".chars.all? {|x| "ADNRX+".include? x}
<krzyhoo>
rippa: awesome
<krzyhoo>
rippa: so, that leaves me with just one problem. if there is an "R" it can only exist once and must me at the end of the incomming string
<krzyhoo>
any ideas? :)
<krzyhoo>
chaining after } seems to be out of the question
<krzyhoo>
since "ADDD+R".chars.all? {|x| "ADNRX+".include? x} returns just true oor false
manojhans has joined #ruby-lang
looopy has joined #ruby-lang
Taki has joined #ruby-lang
<Taki>
Hey everyone. I'm currently trying to understand the actual difference between native threads and fibers. Talking about implementation, I get it. However, I would like to know what really happens in the computer when you create 10 threads, and when you create 10 fibers. Any link recommended ?
musicmatze has joined #ruby-lang
<Taki>
Basically, I just want to get the difference between native threads and green threads
<musicmatze>
Hi there! I've got a Question: Where can I find the ruby.h to extend Ruby in C? Do I really have to fork the whole Ruby-Source at for example github, or is there an easy way to do this? (I'm on Archlinux, I installed Ruby via pacman from the repos)
<yorickpeterse>
musicmatze: No
<yorickpeterse>
#include <ruby.h> should work fine on Arch linux
<yorickpeterse>
Taki: given the GIL would be removed threads can be executed at the same time
<yorickpeterse>
Fibers are sort of fancy blocks that you can resume and the like
<Taki>
yorickpeterse: so fibers are just like green threads right ?
<Taki>
(since you can schedule them on your own)
<yorickpeterse>
No
<yorickpeterse>
musicmatze: No need for PRIVMSGs
<yorickpeterse>
Taki: Fibers have no concept of thread safety and the like
<musicmatze>
yorickpeterse: okay, sorry. I use IRC the first time! ...
<yorickpeterse>
Threads, whether they're green or not, do
<yorickpeterse>
musicmatze: No problem
malev has joined #ruby-lang
malev has joined #ruby-lang
<yorickpeterse>
musicmatze: Are you using Rake compiler to compile the extension?
<Taki>
yorickpeterse: hm OK... About GIL, doesn't it "limit" a bit Ruby for concurrent programming ?
<yorickpeterse>
Yes
<yorickpeterse>
It means that threads can't run at the same time. Jruby has proper threading since it doesn't have a GIL and Rubinius 2 has proper threading as well
<yorickpeterse>
Though both have their downsides
<Taki>
Yeah
<Taki>
But
<Taki>
wait
<Taki>
2 threads can't be run at the same time in Ruby ? :o
<yorickpeterse>
No
<yorickpeterse>
Due to the GIL there can only be one thread active at a given time
<Taki>
Oh ok
<Taki>
well
<yorickpeterse>
This however also affects other languages such as Python
<Taki>
is there any language able to run different threads at the same time ? (I'm not a developper, just a very curious person)
morozovm has joined #ruby-lang
<Taki>
I think even Erlang isn't true parallelism
<yorickpeterse>
A lot of languages have a GIL given they support threading in the first place
<yorickpeterse>
Erlang doesn't have threads as far as I know
<Taki>
Well, Erlang is a bit odd
<yorickpeterse>
if you insist on using threads, use jruby
<yorickpeterse>
(that is, if you want to use Ruby)
<Taki>
Given a multicore processor, the VM creates 1 thread per core with its own scheduler, and then each core can run a process queue
<Taki>
that's Erlang :)
<Taki>
Well, as I said, i'm not a developper
<Taki>
I'm just trying to understand the concurrent programming
<Taki>
and mainly the difference between several languages
mark_locklear has joined #ruby-lang
burns180 has joined #ruby-lang
dejongge has joined #ruby-lang
benvds has joined #ruby-lang
looopy has joined #ruby-lang
gasbakid has joined #ruby-lang
ankurgel has joined #ruby-lang
imperator has joined #ruby-lang
<imperator>
good morning
leonL has joined #ruby-lang
rolfb has joined #ruby-lang
spuk has joined #ruby-lang
justinxreese has joined #ruby-lang
gasbakid has joined #ruby-lang
<andrewvos>
imperator: Good day!
beiter_ has joined #ruby-lang
burns180 has joined #ruby-lang
vmatiyko has joined #ruby-lang
sandbags has joined #ruby-lang
mssola has joined #ruby-lang
morozovm has quit [#ruby-lang]
chalky has joined #ruby-lang
<krzyhoo>
andrewvos: is there a handsome way to do it??
<Thingies>
beiter: You might change the structure a bit, but you would win much time
chalky has joined #ruby-lang
<beiter>
I can't change the structure though it comes from a program
<DefV>
beiter: do you care about the block numbers/names?
chalky has quit [#ruby-lang]
<Thingies>
Well, I won't say anything because I know a true rubyist can do it in like 1 line using split/map/insert/injekt/... and I would be ashamed lol
<beiter>
DefV: No I don't
<tobiasvl>
beiter: do you want it as an array? or a hash?
<beiter>
not necessary
<DefV>
beiter: read it as string and split it: data.split(/#[^\n]+/)
<DefV>
(and get rid of the empty first element
<DefV>
)
<beiter>
ok i'll give it a try
burns180_ has joined #ruby-lang
<beiter>
thx
ovnimancer has quit [#ruby-lang]
fouriek has joined #ruby-lang
tbuehlmann has joined #ruby-lang
dv310p3r has joined #ruby-lang
wyhaines has joined #ruby-lang
<krzyhoo>
andrewvos: awesome
fouriek has joined #ruby-lang
<krzyhoo>
dues just the trick
<krzyhoo>
you rock
<andrewvos>
wohoo
<krzyhoo>
the code will get like 20% smaller
<krzyhoo>
why didn't i came up with that solution
alexkane has joined #ruby-lang
<andrewvos>
Well I've needed it for a lot of projects
macmartine has joined #ruby-lang
<krzyhoo>
rails or ruby?
chalky has joined #ruby-lang
chalky has joined #ruby-lang
<andrewvos>
ruby
<andrewvos>
I haven't done any rails projects
<krzyhoo>
first time ever I meet a person that does more ruby with ruby than rails with ruby ;)
<krzyhoo>
can you tell me what did you use it mainly for?
<andrewvos>
You are in ruby-lang
<krzyhoo>
shit you are right ;-)
bglusman has joined #ruby-lang
chalky has joined #ruby-lang
* yorickpeterse
doesn't use Rails either
<yorickpeterse>
Then again I don't use Ruby for my job :[
<apeiros_>
whoever came up with that idea ("pastie: hi!") belongs hanged upside down and put on fire…
* imperator
has no idea what it's about
<apeiros_>
imperator: the idea is that a pastie bot would answer. so you can identify the pastie-bot in a channel.
<apeiros_>
it's such an insanely stupid idea to begin with…
v0yager has joined #ruby-lang
rooster218 has joined #ruby-lang
workmad3 has joined #ruby-lang
<andrewvos>
what
<shevy>
I'll do it!
<andrewvos>
WHAT
<shevy>
you got me at INSANE
<shevy>
KICKASS
<shevy>
WONDERFUL!!!
<andrewvos>
wtf
malev has joined #ruby-lang
burns180 has joined #ruby-lang
<ankurgel>
How do I create regexp that discards (^) a "word"?
<ankurgel>
/^word/ would mean at beginning..
<Mon_Ouie>
You mean "^" followed by "word"?
<rue>
!~ /word/
<ankurgel>
rue !~ before // ?
<ankurgel>
o.O
<Mon_Ouie>
!~ is the opposite of =~
<ankurgel>
Mon_Ouie, yes. but general regexp model implies at beginning.
<ankurgel>
Mon_Ouie, Oh!
<Mon_Ouie>
!(a =~ b)
<ankurgel>
but say I'm using gsub(pattern,substitution).
<ankurgel>
here I'm using that pattern, then?
hexo has joined #ruby-lang
<ankurgel>
?
Phrogz has joined #ruby-lang
<rue>
Probably not, depends on your specifics. You can use the negative lookahead in some cases
<rue>
Or just check #include? or something. But, specifics.
<ankurgel>
string="ankurgelruby-lang"
<ankurgel>
string.gsub!(/ / , 'x')
<ankurgel>
replace every non 'ruby' letter..
<darix>
ankurgel: just any letter that is not r u b or y?
<darix>
or in that order?
<Phrogz>
I have a Sinatra app running under Ubuntu that needs to create folders on the server that it can copy files to. However, Dir.mkdir creates folders with root/root owner/group and only o+w, yet `chgrp` and `chmod` from the process fails. What's the appropriate way to create folders and set the ownership permissions correctly.
<rue>
"yay ruby wee".gsub /(ruby)|(\w)/ do $1 || "?" end
<rue>
I'm not sure whether to be happy or sad about that achievement.
jkyle has joined #ruby-lang
<ankurgel>
darix, in that order.
<ankurgel>
rue, checking.
<ankurgel>
hm. why considering to be sad?
<ankurgel>
using grouping there?
<rue>
There must be a better solution
retro-in-better- has joined #ruby-lang
<Phrogz>
I want to play along; what are the rules?
<bnagy>
tr('ruby','x') ? I came in late sorry
ioga_wrk has joined #ruby-lang
<ankurgel>
bnagy, replacing every r,u,b,y with x
<ankurgel>
and what does tr method imply ?
<rue>
Phrogz: In a string, replace all characters except those forming "ruby" with "x"
<Phrogz>
.gsub /[ruby]/, 'x'
<andrewvos>
rue: No
<rue>
Too
<Phrogz>
Just replace all 'r' with 'x', replace all 'u' with 'x', replace all 'b' with 'x', and replace all 'y' with 'x'?
<rue>
No, the other way.
* Phrogz
hates it when the game is extracting the rules.
<ankurgel>
"ankurgelruby-lang" --> "xxxxxrubyxxx' type
<andrewvos>
ankurgel: rails provides a replace_all_occurences_of_r_u_b_and_y_unless_it_spells_ruby
<rue>
I'd imagine that almost always you can just extract the "ruby" strings, and then maybe, if needed, calculate the original string size or something.
<rue>
In other words, I don't understand how "xxxxxxrubyxxxxxrubyxxxxx" is useful
<ankurgel>
this is an example
<Phrogz>
:)
<ankurgel>
main thing I was looking is discarding a word (except word)
<Phrogz>
I'm not sure if I like mine more or rue's
<ankurgel>
Phrogz, yours is atleast comprehensible to me. I don't understand what rue did there.
<andrewvos>
ankurgel: Right, generate a hash of the string, replace all "ruby" occurences with that hash. Then replace all other characters.
<Phrogz>
ankurgel: Then read the docs for gsub :)
Sailias_ has joined #ruby-lang
<rue>
ankurgel: It matches "ruby", or then any word character. Then it replaces either "ruby" with itself, or the word character with "?"
<Phrogz>
ankurgel: Pretty sure there's a s/o on that. Looking.
heppy has joined #ruby-lang
wallerdev has joined #ruby-lang
<outoftime>
ankurgel: ubuntu?
<erikh>
ankurgel: rvm docs generate
<ankurgel>
outoftime, yes.
<bnagy>
ok I endorse .split('ruby',-1).map {|s| 'x'*s.size}.join('ruby') for the nomination
<ankurgel>
erikh, doc is working. I'm asking about the screwing-up problem with gem install
<erikh>
ah
<ankurgel>
even gem pkg doesn't work here.
jasonw22 has joined #ruby-lang
<outoftime>
ankurgel: your easiest bet is to just use RVM. ubuntu's package-managed ruby is rarely the latest anyway, and rvm makes this stuff painless.
<ankurgel>
when I try gem install __anything__ , or type require 'zlib' in irb, it displays the same error I mentioned above.
<apeiros_>
ankurgel: and when you do: rvm use 1.9.2; irb; require 'zlib', the error occurs?
<ankurgel>
yes. even when I set 1.9.2 as --default
<ankurgel>
gem -v = 1.8.17
<rue>
which gem
<ankurgel>
irb -v = 0.9.6
jmontross1 has quit [#ruby-lang]
<ankurgel>
gives LoadError everytime
<rue>
Oh, damn it, Gem series 1.8.x strikes again
<apeiros_>
hm, I'd probably take this over to #rvm then. I don't see an obvious reason.
<apeiros_>
rue: it's not a gem, it's part of stdlib there.
<apeiros_>
or do you mean gem interferes with stdlib in that case? o0
phlipper has joined #ruby-lang
<rue>
apeiros_: Nah, the 1.8.x just switches my brain into ruby 1.8 mode
<apeiros_>
ah :)
alex_k has joined #ruby-lang
<Mon_Ouie>
They should release rubygems 2.0 along with ruby 2.0 to prevent that
<ankurgel>
Mon_Ouie, When is ruby 2.0 releasing?
<Mon_Ouie>
I have no idea, although they are writing code for it already I think
<apeiros_>
Mon_Ouie: or just do chrome-versioning and release rubygems 19 already
gix has joined #ruby-lang
jasonw22 has joined #ruby-lang
RomyRomy has joined #ruby-lang
<dominikh>
haha
machine1 has joined #ruby-lang
<shevy>
that would be nice to see
<shevy>
version equality!
<shevy>
Libert
<apeiros_>
hm, I think it'd be an unreasonable burden
<dominikh>
it would
s_dana has joined #ruby-lang
<Mon_Ouie>
shevy: Not sure what encoding you're using, but I can't see your "é"s
<dominikh>
I can just fine :>
<shevy>
I don't know what encoding I am using either
<shevy>
Mon_Ouie, what is french for "version"?
<Mon_Ouie>
Version
<shevy>
hmmmm
<Mon_Ouie>
Never mind, the encoding thing was wrong on my end
<apeiros_>
Mon_Ouie: I can
<shevy>
I like those characters with fancy apostrophes atop, they make the character appear so much more important
<dominikh>
shevy: is probably using CP1252. it wasn't UTF-8.
<apeiros_>
hm, though it seems limechat has a fallback encoding… might well be I can see it due to that…
<dominikh>
apeiros_: yup
<imperator>
rvm claims another victim
virunga has joined #ruby-lang
virunga_ has joined #ruby-lang
virunga has joined #ruby-lang
burns180_ has joined #ruby-lang
<shevy>
lol
<shevy>
darth imperator shows no emotions and no mercy
* shevy
clenches fists and breathes heavily
twittard has joined #ruby-lang
esad has joined #ruby-lang
heppy has joined #ruby-lang
vpamulap has joined #ruby-lang
jamw has joined #ruby-lang
havenn has joined #ruby-lang
mikeric has joined #ruby-lang
<twittard>
Are there any good tools to do the following in Ruby? I've got a bunch of attr_accessors that are set by a single method call (It calls an HTTP resource and assigns the response values). I currently call this in the initialize method, but that's dirty. Besides defining the getter methods for these attr_accessors, and lazily calling this main method, is there a way to chain method calls? IE, if a method is called -- FIRST call another method?
<twittard>
I know there's alias_method_chain, but I don't think it behaves this way.
<twittard>
I could also monkey patch Object with something that does this.
<twittard>
But I'd prefer not to reinvent wheels that likely already exist.
<RickHull>
you want to avoid using intialize in case the http request fails?
<RickHull>
("that's dirty")
<twittard>
No, it's just a blocking operation that takes a long time. It shouldn't really live in initialize.
<RickHull>
i imagine it could fail as well, but ok
<twittard>
It can always fail, but that's not my biggest concern with it.
<RickHull>
i'm not following this approach: Besides defining the getter methods for these attr_accessors, and lazily calling this main method
<RickHull>
i was imagining a def get_values(http_resource) # get an http response and populate some ivars
<twittard>
def foo() @foo ||= begin; call_main_method!; @foo; end; end
plusk has joined #ruby-lang
<RickHull>
so i guess the question is, do you want to populate the ivars individually or in a batch?
<RickHull>
can you not call your populate method after you intialize?
<twittard>
I'd prefer to hide that logic from whatever is juggling the object. But that's a perfectly valid approach as well :).
<RickHull>
that said, maybe it's not much different than calling out to an external db
<twittard>
And document whatever you're trying to do. I'm not going to mentally parse that turd.
srbaker has joined #ruby-lang
<twittard>
RickHull: It pretty much is. Your point is perfectly good/valid and I may just do that for simplicity. My big problem is that I'm trying to build a system with lots of convoluted parts. Having knowledge of the object it's calling into (ie, there's a backend service call) makes it slightly less re-usable. That said, I can just make a "call_backend_services_and_stuff!" method part of the implementation. Just do nothing if there is no work to be
<twittard>
For reference, I'm shuffling CSVs, PGP encrypting those turds, and calling SOAP APIs. It's a mess.
<RickHull>
cut off after "no work to be"
<twittard>
damn it
<twittard>
oh wait. "to be done."
<twittard>
that was the last sentence.
<twittard>
RickHull: Thanks for your input, by the way :)
<RickHull>
np, cheers
<plusk>
twittard, i don't think this is needed. it's very small regexp
<twittard>
Regular Expressions are a convoluted thing. Break them up and document them.
<twittard>
always
spuk has joined #ruby-lang
<plusk>
twittard, ok. lets go: "why do you have so many parens?" i want separated values. What is my goal? I Have a grammar that have the following rule. A => B C | C. and i want to match this case "B C" even when on a string that have a C.
burns180 has joined #ruby-lang
<RickHull>
using regex to parse is a red flag
<twittard>
What Rick said.
<plusk>
what do you mean by red flag?
<RickHull>
i'm not very good a formal language theory
srbaker has joined #ruby-lang
<RickHull>
but true regular expressions are related to regular languages, i.e. generated by regular grammars (type 3)
<twittard>
google has been failing me a lot, lately. Basically, you want to tokenize strings.
<RickHull>
now, regex engines go beyond true regular expressions
<RickHull>
so they have more power than true regular expressiosn
<RickHull>
but an example of how not to use regex is to try to parse e.g. HTML
<RickHull>
as HTML is not regular, there is no good way to do it