malkomalko has quit [Remote host closed the connection]
trend has quit [Ping timeout: 240 seconds]
xastion has joined #ruby
trend_ has joined #ruby
kenichi has quit [Remote host closed the connection]
khakimov has quit [Quit: Computer has gone to sleep.]
wangr has quit [Ping timeout: 246 seconds]
khakimov has joined #ruby
oooPaul has quit [Quit: Ciao for now!]
xaq has quit [Remote host closed the connection]
jenrzzz-mac has quit [Quit: jenrzzz-mac]
byronb has joined #ruby
minijupe has quit [Quit: minijupe]
nari has quit [Ping timeout: 248 seconds]
eywu has joined #ruby
baroquebobcat has quit [Ping timeout: 244 seconds]
ckrailo has quit [Quit: Computer has gone to sleep.]
<shevy>
now I am in a state of confusion again
albemuth has quit [Ping timeout: 248 seconds]
<shevy>
I have a method, w, which returns the main object
borkman has left #ruby ["ERC Version 5.3 (IRC client for Emacs)"]
<shevy>
or, when first called, it'll create the main object
<shevy>
I used to describe a project like so:
<shevy>
w.title = 'bla'
<shevy>
w.description = 'lalala'
albemuth has joined #ruby
<shevy>
but now I am also tired of typing "w."
vitor-br has joined #ruby
jcblitz has quit [Quit: jcblitz]
thecreators has joined #ruby
finch has left #ruby ["WeeChat 0.3.7"]
<apeiros_>
shevy: the typical solution to that is to use an instance_exec'd DSL
<shevy>
oh
IrishGringo has quit [Ping timeout: 244 seconds]
<apeiros_>
Project.new do; title 'bla'; description 'lalala'; end
<apeiros_>
(as usual, replace ; with newlines)
iocor has quit [Quit: Computer has gone to sleep.]
havenn has quit [Remote host closed the connection]
<icy`>
apeiros_, i'm trying to just set the first item's price and timestamp, yet it seems to affect all elements. I must've messed up somewhere with default value..? http://codepad.org/OxXxqA8z
<apeiros_>
icy`: slooooow loading
<apeiros_>
you probably keep using the same object
<icy`>
basically h = Hash.new([pc.new]*5) , where pc is a struct(:price, :time)
xastion has quit [Ping timeout: 244 seconds]
<apeiros_>
yeah, [obj]*5 will create an array with 5 times the *same* object
<icy`>
oh =/
<apeiros_>
i.d. ary[0].object_id == ary[1].object_id etc.
<apeiros_>
you want: Array.new(5) { pc.new }
<apeiros_>
the block is executed 5 times. so each time a new instance is created
<apeiros_>
also, personally I'd use a proper name and a constant instead of pc :-)
<apeiros_>
s/i.d./i.e.,/
<icy`>
thanks for the tips =) pc makes sense to me though as in my mind it stands for 'price check'
<apeiros_>
PriceCheck then
axiak has joined #ruby
<apeiros_>
you won't remember what pc stood for in 2 weeks…
<shevy>
hehe
<shevy>
and if not in 2 weeks, then surely not in 2 years!
<icy`>
camel case eh =D
red-panda has quit [Remote host closed the connection]
<apeiros_>
yes. it's a class.
<apeiros_>
it's not ARRAY either :-p
Xethron has quit [Ping timeout: 244 seconds]
<apeiros_>
(though, I CamelCase *all* constants - classes are just objects after all…)
* icy`
nods
Xethron has joined #ruby
redgetan has joined #ruby
Monofu has joined #ruby
zaychenok has quit [Quit: Konversation terminated!]
zaychenok has joined #ruby
fserb has quit [Quit: ttyl]
redgetan has quit [Quit: This computer has gone to sleep]
bawer has joined #ruby
bawer has quit [Client Quit]
bawer has joined #ruby
jimeh has quit [Ping timeout: 244 seconds]
bawerd has joined #ruby
pu22l3r has joined #ruby
pr0zac0x2a has quit [Ping timeout: 245 seconds]
lmarcetic has joined #ruby
Targen has quit [Ping timeout: 246 seconds]
piotr_ has quit [Ping timeout: 244 seconds]
kah_ has joined #ruby
tintin has joined #ruby
<tintin>
Will ruby 2 be a new version of ruby or will it be a new program?
<tintin>
Will ruby2 be backward compatible with ruby 1.9.3 ?
randomautomator has quit [Remote host closed the connection]
kenperkins has joined #ruby
Xethron has quit [Ping timeout: 244 seconds]
Konboi has joined #ruby
Xethron has joined #ruby
macmartine has joined #ruby
<apeiros_>
yes, yes and yes
horseman has joined #ruby
<icy`>
ETA for ruby2 ?
<tintin>
Can it happen like python3? python3 came to solve problems of python2 and python3 is not backward compatible
<tintin>
Can it happen for ruby too?
<tintin>
in future?
<lmarcetic>
tintin, python3 and perl6 broke backwards compatibility, and are somewhat experimental in nature
<horseman>
tintin: ruby 2.0 will not break compat wth ruby 1.9 when it comes out
<icy`>
rvm to the rescue
<tintin>
lmarcetic: I know that.
<lmarcetic>
tintin, then why would you fear for ruby? it's just a new version number.
crankycoder has joined #ruby
Banistergalaxy has quit [Ping timeout: 244 seconds]
alexim has quit [Quit: sleep]
<tintin>
Because if that happens for ruby too in future, then all my apps written in older ruby will be a waste of time because i have to re-write/porting again
chrxn has quit [Read error: Connection reset by peer]
<apeiros_>
tintin: are you a troll?
Nies has quit [Quit: Saliendo]
<tintin>
NO
kenperkins has quit [Ping timeout: 244 seconds]
chson has joined #ruby
ringotwo has quit [Remote host closed the connection]
<apeiros_>
1.9 was not backwards compatible. and it didn't take much for most things to get updated for it.
<apeiros_>
that "all of my old stuff is wasted" crying is just utter bollocks.
<apeiros_>
also just because a newer version comes out doesn't make the older versions magically vanish. there are even ruby 1.8 installs still in use.
<lmarcetic>
there's a real question posted by some guy in #rails
<apeiros_>
#rails is no real channel
<apeiros_>
#ror or #rubyonrails are the thing (both the same)
<lmarcetic>
so it has 102 fake users in it?
<apeiros_>
it has 102 idiots in it :-p
zaychenok has quit [Quit: Konversation terminated!]
<apeiros_>
though it's about 80 more than last time
<lmarcetic>
*mumble grumble*
zaychenok has joined #ruby
<Spaceghostc2c>
#rails is a shit place with shit people.
<apeiros_>
maybe due to that time when #ror only let registered users in
<lmarcetic>
alright, no need for insults
<apeiros_>
yeah, sorry about that
<apeiros_>
but seriously, #rails is the wrong channel
<lmarcetic>
apeiros_, i meant Spaceghostc2c mainly. i'm in the other one now
nopolitica has quit [Ping timeout: 244 seconds]
<shevy>
tintin ruby 1.9.x already was the transition towards 2.0
<shevy>
if you use an operator like -> in 1.9.x it won't work in 1.8.x but it should work in 2.0
shadoi has quit [Quit: Leaving.]
<Spaceghostc2c>
Duh?
wpaulson has joined #ruby
zaychenok has quit [Read error: Connection reset by peer]
bigoldrock has quit [Quit: Leaving.]
zaychenok has joined #ruby
adamkittelson has quit [Ping timeout: 244 seconds]
<apeiros_>
I think shevy just phrased it confusingly. 1.8 does not have -> (stabby lambda), 1.9 introduced it. and 2.0 will still have it.
<horseman>
apeiros_: shevy is confusion incarnate :P
zaychenok has quit [Read error: Connection reset by peer]
tintin has left #ruby [#ruby]
zaychenok has joined #ruby
<apeiros_>
there's something to that…
<shevy>
horseman - the man with the thousand nicks
kenperkins has joined #ruby
<icy`>
hmm.. $VERBOSE=true is picking up "mismatched indentations" ... tell me this isnt going in the python direction o.O
<apeiros_>
it isn't
horseman has quit [Remote host closed the connection]
<apeiros_>
it's just a warning and a quite valid one.
<icy`>
the fix was lining up the ends
<shevy>
keep in mind that some hours ago apeiros_ wrote something about warnings in ruby though ... ;)
<icy`>
i'm not sure if I had even written that class
<apeiros_>
lining up the ends?
<shevy>
allow me to quote apeiros_ :)))
<icy`>
if...end block, or while...end
<shevy>
<apeiros_> it's also the reason why i say ruby's warning system is broken.
<apeiros_>
paste the code before and after the warnings? I get the feeling that your fix actually made things worse…
<icy`>
no, I literally only changed whitespace
cearls has joined #ruby
<apeiros_>
icy`: yes, that's the point of that warning
savage- has quit [Remote host closed the connection]
<apeiros_>
but you can change it in a good way or in a bad way
cearls has quit [Client Quit]
<apeiros_>
the bad way is to just remove all indentation…
<apeiros_>
(one bad way)
cearls has joined #ruby
<icy`>
for example, there was some if statement whose end was one tab further in
<apeiros_>
yes, that's wrong. on all accounts :)
K0rnflake has joined #ruby
<apeiros_>
I sure hope you use 2-spaces soft-tab, yes?
kvirani has joined #ruby
<shevy>
tab!
<shevy>
a tab user!!!
<icy`>
does that mean turning tabs into spaces? then yes
<shevy>
KILL HIMMMM
Monofu has quit [Quit: quit]
<shevy>
ohhhhh
<shevy>
spaces are fine
<apeiros_>
icy`: yes it means that tabs are turned into 2 spaces.
<shevy>
we'll kill someone else instead
<apeiros_>
hard-tab means it inserts the tab-character.
<icy`>
er when in gvim if i type end it does not tab left
<apeiros_>
shevy: there you go. kill gvim!
<shevy>
why does he use different amounts of ' ' when he types here? :\
macgregor_ has joined #ruby
<icy`>
delete [] shevy
<shevy>
gvim is strange
<icy`>
anyway ;P
jcblitz has joined #ruby
<shevy>
vim is okish though, at least the keybindings or however you name them
<shevy>
9dd
<shevy>
:33
* Spaceghostc2c
digs the vimz
centipedefarmer has joined #ruby
LordJesusChrist has joined #ruby
<LordJesusChrist>
Fuck you all.
<offby1>
ignore LordJesusChrist
kvirani has quit [Remote host closed the connection]
<LordJesusChrist>
Err, wrong channel.
* LordJesusChrist
has tourettes.
crankycoder has quit [Remote host closed the connection]
LordJesusChrist was kicked from #ruby by apeiros_ [yeah, fuck you too]
mnaser has quit [Quit: Computer has gone to sleep.]
kevinbond has quit [Client Quit]
jeer has quit [Quit: Computer has gone to sleep.]
horseman has joined #ruby
zaychenok has quit [Quit: Konversation terminated!]
zaychenok has joined #ruby
zaychenok has quit [Client Quit]
zaychenok has joined #ruby
wallerdev has joined #ruby
<horseman>
wallerdev: sup wally
<wallerdev>
hey do i know you? :)
<apeiros_>
that's the problem if you wear so many masks…
Banistergalaxy has quit [Ping timeout: 265 seconds]
<icy`>
ok my "indenting back to the left after typing 'end'" issue got fixed after talking to the nice folks in #vim =)
<wallerdev>
hey apeiros_ :)
<apeiros_>
hi wallerdev
<wallerdev>
got that ruby swag?
<apeiros_>
no
<wallerdev>
lol
<apeiros_>
the ruby swag is off
<apeiros_>
:(
<wallerdev>
:(
balki has joined #ruby
voodoofish430 has quit [Quit: Leaving.]
<wallerdev>
any cool projects?
igotnolegs has joined #ruby
<apeiros_>
no. been working on a tabular data importer. but due to being sick it took me 4 days to write 1 day worth of code…
<icy`>
oh, btw, what was that interactive ruby quiz where you could "follow" some of the people who posted answers
<apeiros_>
also, ruby excel gems are a mess…
dross_ has joined #ruby
<icy`>
it was mostly one-liner answers about core ruby objects, at least in the beginner where it tried to run your code... i had come across it not too long ago. Had trouble googling for it o.O
andrewhl has joined #ruby
<icy`>
mightve some variation of 'rubyist' in it
dross has quit [Ping timeout: 244 seconds]
mnaser has joined #ruby
mnaser has quit [Changing host]
mnaser has joined #ruby
tommyvyo has joined #ruby
jeer has joined #ruby
<wallerdev>
apeiros_: yeah haha i hate being sick, you think you can code fine when you're sick but your mind just deosnt work
<apeiros_>
well, it's mostly coughing
<apeiros_>
but it's interrupting. also I feel weak.
azaq23 has quit [Quit: Leaving.]
hemanth2 has joined #ruby
<icy`>
apeiros_, =/ get well soon! Eurocup cheering you up at least?
<apeiros_>
soccer? meh :)
<apeiros_>
I yanked out the antenna cable from my tv. sucked up too much time.
jeer has quit [Client Quit]
<wallerdev>
you should play soccer its a lot of fun
<apeiros_>
oh, playing sure. but watching?
k_m has joined #ruby
<horseman>
wallerdev: wally.
<apeiros_>
I prefer watching starcraft battles. I wished there was a barcraft close…
<horseman>
apeiros_: is swiss good at soccer?
<wallerdev>
wally?
<apeiros_>
we beat the germans 5:3 recently!
<wallerdev>
soccer is super boring to watch
sailias has joined #ruby
<apeiros_>
but no. swiss suck at soccer.
<apeiros_>
oh, well, actually the swiss U19 is world champion in soccer. quite unexpected.
maletor has quit [Quit: Computer has gone to sleep.]
dross_ is now known as dross
liluo has joined #ruby
L-----D has joined #ruby
kevinbond has joined #ruby
<horseman>
apeiros_: congrats
robotmay has joined #ruby
<horseman>
apeiros_: all those lithe young swiss boys, did u get a chance to watch them btw?
<apeiros_>
no, I find soccer boring to watch.
<apeiros_>
most sports actually.
<horseman>
apeiros_: even female gymnastics?
<icy`>
sorry, i got caught up in a pm
<icy`>
anyway, you can stream most things on the computer now ;P
williamcotton has joined #ruby
<icy`>
apeiros_, i used to watch some of those sc2 commentary vids of tourney games, i guess
<icy`>
also quite a timesink
<apeiros_>
sure. but not such a mindless timesink as zapping through tv channels.
sailias has quit [Quit: Leaving.]
<icy`>
true; i usually just prefer movies
pu22l3r has quit [Remote host closed the connection]
<icy`>
that process ^ is mindless because of commercials, mainly
<apeiros_>
well, we're lucky that we don't have the horrible commercials situation that seems prevalent in the US
<apeiros_>
I mean, how can you even stand watching tv in the US? the few times I visited I could barely stand that…
jcblitz has quit [Quit: jcblitz]
mnaser has quit [Quit: Computer has gone to sleep.]
apok_ has joined #ruby
cyong has left #ruby [#ruby]
Synthead has joined #ruby
robotmay has quit [Remote host closed the connection]
apok has quit [Ping timeout: 244 seconds]
Araxia_ has quit [Quit: Araxia_]
<Spaceghostc2c>
apeiros_: I don't watch T.V., I don't even own one.
cyong has joined #ruby
dhodgkin_ has joined #ruby
dhodgkin has quit [Read error: Connection reset by peer]
dhodgkin_ is now known as dhodgkin
redgetan has joined #ruby
k_m has quit [Quit: Leaving]
silentpost has quit [Ping timeout: 244 seconds]
apok_ has quit [Ping timeout: 246 seconds]
<apeiros_>
Spaceghostc2c: nah, I still want to watch movies or play games. but those are "directed" things. unlike zapping through tv where I'd just sit there and wonder after 4h what I actually did…
<Spaceghostc2c>
apeiros_: I watch movies and play games. Just not on a TV.
jenrzzz-mac has joined #ruby
<apeiros_>
I like watching movies in the couch on a big screen :-p
<apeiros_>
fuck, annoying bug on youtube - moves videos some 20% to the right, cutting it off…
<apeiros_>
wtf?
Markvilla has quit [Quit: Markvilla]
silentpost has joined #ruby
cyong has quit [Quit: Leaving.]
randym has joined #ruby
<apeiros_>
awesome… adobes idea of "check for updates" is to open a browser window and show you a list with version numbers. "go check yourself, then go to the downloads page"
horseman has quit [Remote host closed the connection]
<iSuckAtRuby>
I swear this is not a homework question, but could someone help me (hint me) to write a method to reverse a string? Yes, I know there is a method in the standard library.
<iSuckAtRuby>
looking at the source code for the method in the standard library is unfortunately not giving me many hints (because my C skills are too rudimentary).
Tricks has quit [Read error: Connection reset by peer]
Tricks has joined #ruby
counterbeing has quit []
<iSuckAtRuby>
I shall patiently await my savior ;D
<graspee>
only a school could be stupid enough to force someone to implement something that is already implemented, except do it worse
<horseman>
graspee: it's a good exercise to learn the basics
<iSuckAtRuby>
I don't think it's stupid if a school does that.
<iSuckAtRuby>
yeah, I agree.
<seanstickle>
Well, you're not learning if we do it for you.
<iSuckAtRuby>
I think that's a great thing to do. It's obviously unnecessary, but that doesn't mean it doesn't teach you anything.
<iSuckAtRuby>
I don't want someone to do it for me. I want someone to give me a hint on how to manipulate the array class
<iSuckAtRuby>
because I have no fucking idea what I'm doing and I've been at this for hours.
<iSuckAtRuby>
the source code for this just confused me.
<seanstickle>
You know how to get the last member of an array?
<iSuckAtRuby>
[-1]?
<iSuckAtRuby>
well
<seanstickle>
And how about the member before the last member?
<iSuckAtRuby>
(var)[-1]
<iSuckAtRuby>
(var)[-2]? and so forth? I'm not sure, that's part of where I was getting confused.
<seanstickle>
Yup
<iSuckAtRuby>
the rubyist example, like I said, was vague in my opinion.
<seanstickle>
There you go.
<apeiros_>
iSuckAtRuby: swap 0 and -1, then 1 and -2, then 2 and -3 etc.
<seanstickle>
Problem solved.
<apeiros_>
until your ends meet
<epitron>
PEW PEW PEW
<seanstickle>
Oh, geez, you're overloading him with too much awesome
<seanstickle>
Start with the very slow, and then move up eventually to the somewhat slow
* epitron
pushes him into the deep end
* epitron
throws sharks in
<apeiros_>
alternatively: just iterate over each character from the end, pushing it onto the new string
<iSuckAtRuby>
*gasp* oh swap them. duh.. For whatever reason I didn't think of that. I'll find some way to implement that.
bglusman has joined #ruby
<apeiros_>
the later is easier, the former is in-situ
<epitron>
s[-1], s[1] = s[1], s[-1]
<epitron>
i think that might just work
<epitron>
[0] of course, not [1]
<iSuckAtRuby>
you can do assignment like that with multiple arrays? I didn't know that.
<seanstickle>
How swapping in situ occurs to iSuckAtRuby as obvious, but iterating in reverse order is obscure … baffles me
<iSuckAtRuby>
I knew you could do it with other types though.
<iSuckAtRuby>
multiple arrays on the left hand side of the assignment, I mean.
<apeiros_>
it's not multiple arrays
<iSuckAtRuby>
no the iterating in reverse order was obvious conceptually
<epitron>
s[1] is a slot in an array
<apeiros_>
s[x] = y is syntax sugar for the method call s.[]=(x,y)
<epitron>
the array "s"
<iSuckAtRuby>
I just was not (am not) sure how to implement it. Hence why I asked :)
<seanstickle>
iSuckAtRuby: the same way you'd do it in C or Java
<iSuckAtRuby>
the swapping is what didn't occur to me.
tomb_ has quit [Quit: Computer has gone to sleep.]
<epitron>
why you givin him a hard time seanstickle?
<seanstickle>
I am so mean.
<seanstickle>
:(
<iSuckAtRuby>
no you're not :)
<epitron>
*flashback to seanstickle's first day on irc*
<epitron>
*getting berated for not knowing how to reverse a list*
<epitron>
:~(
<iSuckAtRuby>
HAHAH WHAT A DUMBASS *ducks*
<seanstickle>
True true
<iSuckAtRuby>
lmao
<iSuckAtRuby>
xD
<seanstickle>
I was in the #python channel recently, and realized it was full of assholes
<apeiros_>
note that with multibyte encodings doing something like `reversed = ""; (original.length-1).downto(0) { |i| reversed << original[i] }` will be slow
<epitron>
and the cat's in the cradle and the silver spoooooon
<seanstickle>
So I apologize for any rudeness on my part
sbanwart has quit [Ping timeout: 246 seconds]
<seanstickle>
I don't want to be like #python
<offby1>
seanstickle: I was just about to write (before I wiped the potato-chip grease off my hands): do you think ruby is more popular with beginning programmers than (say) python?
<epitron>
apeiros_: is multibyte weird when you do << ?
<offby1>
seems that way to me but it's hard to tell
<apeiros_>
epitron: no, the problem is original[i]
<seanstickle>
offby1: now? yes
<epitron>
ah
<epitron>
it has to scan the string or something?
<iSuckAtRuby>
apeiros, that means about as much to me as scrambled ancient greek ;)
<seanstickle>
offby1: 8 years ago, no
<apeiros_>
epitron: how do you think it finds the i'th char in the string?
<horseman>
offby1: hey eric
<apeiros_>
it can do a straight calculation of the position
<offby1>
Comes a horseman
<offby1>
you and your aliases
<offby1>
use "screen"!
* epitron
converts the string to UTF16
<apeiros_>
it might be at byte i, it might be at byte i*3…
bglusman has quit [Ping timeout: 248 seconds]
<epitron>
PEW PEW PEW
<apeiros_>
no use
chrxn has joined #ruby
<apeiros_>
utf16 doesn't guarantee 2byte per char either.
<horseman>
offby1: why is your gravatar made from half your face reflected
<offby1>
horseman: very perceptive
<epitron>
wha?
<horseman>
offby1: dont u think that's a bit odd
<graspee>
he has lots of aliases because people keep blocking him. it's like "rotating the shield frequencies" in star trek
<offby1>
horseman: 'cuz I like the way it looks. A former co-worker thought it was creepy though
<offby1>
*shrug*
<epitron>
are you saying utf16 can encode > 16-bit stuff?
<seanstickle>
offby1: Ruby is more popular because (a) it's a better language that Python, (b) it's got a better community than Python, and (3) it's got a better future than Python
<apeiros_>
epitron: yes. broken code. sadly too many programmers think they're smart by doing that and produce broken code…
<apeiros_>
epitron: yes. of course. all utf encodings can encode *all* of unicode
<offby1>
seanstickle: I assume somewhere in there is "it's easier to learn"; maybe that's part of (a)
chienpo has left #ruby [#ruby]
<seanstickle>
offby1: yes, part of (a)
<seanstickle>
offby1: but should be on its own, I guess
zaychenok has quit [Ping timeout: 248 seconds]
<epitron>
seanstickle: s/is/seems to me that it is/
<apeiros_>
and unicode is currently at >110k codepoints, so 16bit doesn't cut it. also many code points are way beyond 2^16
<seanstickle>
epitron: hey, your opinions are your own
<epitron>
apeiros_: ah
<iSuckAtRuby>
I know next to nothing of it, but I really like C, even though it's obviously difficult.
* epitron
converts the string to UTF128
<iSuckAtRuby>
it's kind of terse and beautiful in its own way.
<epitron>
my code will be unbroken until we start subsuming alien langauges
<apeiros_>
iSuckAtRuby: ever worked with, say, iconv in C?
<apeiros_>
it made me want to kill somebody…
<epitron>
C is like assembly on steroids ^_^
<apeiros_>
C is also full of shitty libraries
freeayu has quit [Ping timeout: 248 seconds]
Targen has joined #ruby
<epitron>
well, you get what you pay for
<seanstickle>
s/you get/it is my opinion that you get/
<apeiros_>
I paid the same for ruby. I got much much more…
* epitron
pays for Watcom C++ 25.1
<epitron>
seanstickle: that was an expression :)
* offby1
used to pay for VMware
<seanstickle>
s/was/might be considered to have been by me to be used as/
<epitron>
BREVITY, says the bard, IS, and this is the important bit, THE SOUL OF, wait for it, WIT
jenrzzz-mac has joined #ruby
<offby1>
:)
fyolnish has joined #ruby
<offby1>
not to put too fine a point on it
<epitron>
:)
<iSuckAtRuby>
oh my gosh
<seanstickle>
fiddlesticks!
<iSuckAtRuby>
@ aperios, you know how you said iterate each one with an array? It's possible to do the whole thing with
<iSuckAtRuby>
oh
<iSuckAtRuby>
wait
<iSuckAtRuby>
nevermind
* seanstickle
considers other euphemistic announcements
<iSuckAtRuby>
I was going to say with one line of code and assignment. But then doing it for n lines doesn't make sense.
* offby1
goes to see a man about a dog
<iSuckAtRuby>
*for n chars in a string, I mean.
<offby1>
what kind of a language channel is this that doesn't have an eval bot! *tsk* *tsk* *tsk*
<apeiros_>
iSuckAtRuby: use tab completion for nicks.
jenrzzz-mac has quit [Remote host closed the connection]
<apeiros_>
less embarassing since you will typo less…
jenrzzz-mac has joined #ruby
<epitron>
iSuckAtRuby: if you want to solve that weird utf8 problem, you could split your string into chars (string.chars.to_a)
<epitron>
then do the reversing thing
<offby1>
apeiros_: what IRC client do you use? (I see you use a Unicode "ellipsis" character)
<epitron>
(but that doesn't really matter since this is only an exercise for fun)
<apeiros_>
offby1: limechat
* offby1
googles
freeayu has joined #ruby
<apeiros_>
and I use … by typing it manually.
<iSuckAtRuby>
I didn't even know IRC had auto completion.
<apeiros_>
opt-. here.
<iSuckAtRuby>
ITS LIKE BASH GUYS
<apeiros_>
iSuckAtRuby: irc doesn't. your clien thas.
<graspee>
irc doesn't, clients do
<apeiros_>
no. bash is comparatively sane.
<iSuckAtRuby>
or, yeah, my client I mean. Dammit, how many faux pas can I make in one IRC session.
<iSuckAtRuby>
apeiros_, stallman is crying right now.
<offby1>
iSuckAtRuby: it depends on the client you're using, but I expect most of them do completion
dchelimsky has quit [Remote host closed the connection]
<iSuckAtRuby>
damn you completion
<offby1>
jinx jinx jinx
<apeiros_>
iSuckAtRuby: 317, after that, your faux-pas limit is exhausted and you have to leave.
<offby1>
hell, he's only at five or six; plenty of headroom
<apeiros_>
offby1: use strict.
fyolnish has quit [Remote host closed the connection]
<iSuckAtRuby>
yup, I'm well from a buffer overflow atm.
<iSuckAtRuby>
I wonder what other secrets xchat holds for me other than autocompletion.
<apeiros_>
there's a ruby plugin
<iSuckAtRuby>
I guess if I knew perl I'd be able to make it into an operating system like emacs.
<apeiros_>
no, you totally need lisp for that.
samuelkadolph has quit [Quit: Quitting]
<iSuckAtRuby>
aww. But lisp is for smart people :(
<maahes>
or smalltalk, or haskell
<iSuckAtRuby>
Ocaml?
<iSuckAtRuby>
nahhhhhh
<maahes>
basically any language that does reflection and dynamic typing, etc.
<offby1>
iSuckAtRuby: nah, I do lisp :)
<iSuckAtRuby>
oh, so like brainfuck.
samuelkadolph has joined #ruby
<maahes>
although, technically yes you could program "the giant repl" in C or something
<iSuckAtRuby>
what OSes are you guys on anyway? *BSD or GNU/Linux or Windows?
* offby1
mumbles something about "Greenspun" and ten rules
mjb2k has joined #ruby
<offby1>
iSuckAtRuby: Ubuntu but I'm connecting to it from a Mac running ssh
<epochwolf>
since I don't want to flood myself off a low bandwidth connection
imami|afk is now known as banseljaj
jenrzzz-mac_ has joined #ruby
<iSuckAtRuby>
@offby1, just out of curiosity, did you just write that? (I assume, I doubt you have useless methods clones just lying about your github)
<offby1>
sure
jenrzzz-mac_ has quit [Remote host closed the connection]
<iSuckAtRuby>
by the way, you cheated, you were supposed to let me suffer and figure it out on my own :)
<iSuckAtRuby>
thanks though.
<offby1>
heh
<offby1>
yours uses a variable "i" that you haven't defined
<iSuckAtRuby>
I was wondering about that.
<iSuckAtRuby>
If I used 's' would it at least have been uh..... workable?
<iSuckAtRuby>
heh
<offby1>
my guess is that you've done some programming in some other (inferior :-) language ...
jenrzzz-mac_ has joined #ruby
<iSuckAtRuby>
goodness I have no idea what I was doing there. It's so easy to read someone's elses implementation like yours but writing you own, yeesh. (yes I know, this is obvious, but I'm new blood).
<offby1>
*shrug*
<offby1>
gotta start somewhere
jenrzzz-mac has quit [Ping timeout: 245 seconds]
jenrzzz-mac_ is now known as jenrzzz-mac
<offby1>
eventually it'll click. If not, try cooking :)
ZachBeta has joined #ruby
Progster has quit [Ping timeout: 246 seconds]
<iSuckAtRuby>
just out of curiosity, say for someone like me that didn't know the unshift method until seeing you use it just now, how would you have done it?
<iSuckAtRuby>
what would you have used instead of unshift if you were a really rudimentary programmer like me?
<graspee>
if you have determination, anything can be accomplished. unless you run out of time. or people with guns are trying to stop you. but normally, yeah
<axiak>
if I were a lisper, I'd use tail recursion
<axiak>
:P
<iSuckAtRuby>
that sounds abstruse.
<axiak>
although, tbh I would have if any ruby implementation actually does TCO
<apeiros_>
ruby1.9 does
<axiak>
nice!!!! :-D
<apeiros_>
you need to hit the secret switch, though
<axiak>
I just started ruby a week ago, so this is really exciting for me
<axiak>
hahaha
<apeiros_>
no, seriously, it's in there but not active by default.
<axiak>
I miss python's l[::-1], but if ruby has TCO then I'm never going back
<axiak>
haha
<apeiros_>
I don't know what the reason is to hold it back.
<iSuckAtRuby>
I started two days ago, and that lisp-like code is interesting but yeah, defintiely no idea what's going on there.
<apeiros_>
what does ::-1 do?
<axiak>
probably the standard reason, tracebacks are broken
<axiak>
apeiros_: reverse in python is just a consequence of allowing arbitrary slicing with steps
<axiak>
so [::-1] is reverse
wpaulson has joined #ruby
<axiak>
(they also have a .reverse(), but that's out of the discussion here)
<graspee>
how do i turn on TCO then?
<graspee>
i could google it but maybe someone else wants to know too
<offby1>
axiak: I've done Python for a while, and I never saw [::-1]
<offby1>
"Reduce TCO now!"
<offby1>
^^ what you'll probably find ^^
<axiak>
offby1: the standard reason to use [::-1] over reversed() is that [::-1] returns the same type as what you gave it, so 'abc'[::-1] is 'cba' etc
<offby1>
"reversed" doesn't?!
<graspee>
Damn that's irritating
<offby1>
these languages ... they have WARTS
<graspee>
i'm going to recompile my ruby now
<axiak>
offby1: no, most functions in python are annoying in that they return lists. including map/filter/reduce/reverse/sorted
<axiak>
but note that these are functions, not methods
<graspee>
i'm a bit scared of the experimental nature and "there may be bugs" info i found though
<axiak>
if an object has a .reverse() method, it's usually equivalent to .reverse!
<apeiros_>
graspee: I think it's a #define somewhere in the source. rvm might have a patch to do it for you.
<axiak>
anyway, enough python
<graspee>
it is a compile time option yeah
<axiak>
so the main issue with TCO is that the stack is now different from what people expect
<iSuckAtRuby>
that looks like what I wrote but its giving me errors
<iSuckAtRuby>
let me check it more closely
<axiak>
note the use of "class String"
<offby1>
axiak: pretty similar
<iSuckAtRuby>
oh
mattonrails has quit [Remote host closed the connection]
<iSuckAtRuby>
but, didn't you say that I *didn't* need to make a class? How would implement it without a class? (I know this is an OOP sacrelige, but I just am interested).
<axiak>
we're not making a class here
fayimora has joined #ruby
<axiak>
but you called it with myObj.my_reverse
<axiak>
if you don't want to, you can define a method in the current self called my_reverse, and call it with my_reverse(myObj)
<axiak>
but you have to use it the correct way
<axiak>
see how offby1 is using my_reverse differently
<offby1>
I just gotta be me
<axiak>
it doesn't matter
<offby1>
Also, een country I come from, they heff no objects
<axiak>
it doesn't matter if you use objects or not
<axiak>
just be consistent :P
<offby1>
Hobgoblins have the consistency of foolish minds
<offby1>
kinda runny with lumps
<axiak>
heh
<Gavilan>
iSuckAtRuby: What are you trying to do?
L-----D has quit [Ping timeout: 244 seconds]
<iSuckAtRuby>
reverse a string.
<iSuckAtRuby>
yes
<iSuckAtRuby>
yes
<iSuckAtRuby>
I know.
td123 has quit [Quit: WeeChat 0.3.8]
<iSuckAtRuby>
before you say it.
<Gavilan>
iSuckAtRuby: What's the problem with reversing a string?
<iSuckAtRuby>
an inept mind is the problem.
<Gavilan>
iSuckAtRuby: why?
<offby1>
the problem is it doesn't work :)
<iSuckAtRuby>
well
<iSuckAtRuby>
I'm not really sure exactly why my use doesn't work
<iSuckAtRuby>
but something about the string class
<iSuckAtRuby>
as offby1 just said.
ZachBeta has quit [Quit: Computer has gone to sleep.]
<iSuckAtRuby>
I'm trying to understand what he said though
<bnagy>
anyway try zlib zlin1g zlib1g-dev or something
<bnagy>
*zlib1g
Vainoharhainen has joined #ruby
Aaton_off has quit [Ping timeout: 256 seconds]
Aaton_off has joined #ruby
Aaton_off is now known as Aaton
chrxn has quit [Quit: Computer has gone to sleep.]
mohits has joined #ruby
<selvakumaran>
bnagy, its Zypper
<selvakumaran>
in suse
<bnagy>
ok well anyway, there are some basic libs that you probably want
<bnagy>
zlib, a compiler, openssl, libyaml...
<selvakumaran>
Ok
<selvakumaran>
fine, i am issuing zypper in zlib zlin1g zlib1g-dev in terminal lets see what happens
<bnagy>
zlib1g
kaiwren has joined #ruby
<bnagy>
not zlin
<graspee>
the gem that always gives me errors is ruby-opengl
<graspee>
so i gave up trying to fix it
<selvakumaran>
bnagy, ok
<selvakumaran>
graspee, :)
<selvakumaran>
i am trying to install libxml-ruby
<graspee>
never tried that one
d3vic3 has quit [Ping timeout: 248 seconds]
kingfishr has quit [Read error: Connection reset by peer]
kingfishr has joined #ruby
bradhe has joined #ruby
d3vic3 has joined #ruby
<selvakumaran>
graspee, fine
stockholm has joined #ruby
<selvakumaran>
ananthakumaran, ping
gentz has joined #ruby
jimeh has joined #ruby
<shevy>
selvakumaran you probably need to have libxml2 ready
saschagehlich has joined #ruby
<shevy>
latest libxml2 source is at ftp://xmlsoft.org/libxml2/libxml2-2.8.0.tar.gz I am sure zypper provides a way to install that too
xnm has quit [Read error: Connection reset by peer]
<shevy>
libxml-ruby-2.3.2.gem seems to be the latest ruby binding to it
graspee has quit [Quit: pan pan pangolin]
Ammar01 has joined #ruby
davidw has joined #ruby
davidw is now known as Guest97362
cjs has joined #ruby
<cjs>
Anybody here familiar with making C extensions for Ruby?
<selvakumaran>
shevy, Thanks for the update
<shevy>
cjs, Hanmac here should be :-)
<Hanmac>
cjs: what are you planing todo?
nipra has quit [Ping timeout: 265 seconds]
piotr_ has joined #ruby
<cjs>
I'm wondering about the sample from the pickaxe book: they declare a global VALUE cTest in which they store the result of rb_define_class("MyTest" ...); does that VALUE need to be persisted, or can we just throw away the return value and get it again with another call to the rb_define_class function call?
<cjs>
I'm guessing the latter....
selvakumaran_ has joined #ruby
<cjs>
Also, how does the interpreter figure out what Init_whatever function to call when the extension is loaded? Will it always be Init_foo where "foo" is what's passed to the create_makefile function in extconf.rb?
workmad3 has joined #ruby
nipra has joined #ruby
Guest97362 is now known as davidw
davidw has quit [Changing host]
davidw has joined #ruby
selvakumaran has quit [Ping timeout: 265 seconds]
grantbdev has quit [Quit: Leaving]
<cjs>
Hm...reading the MKMF docs in the appendix of the pickaxe book would probably also be a good move on my part. :-)
red-panda has quit [Remote host closed the connection]
<Hanmac>
cjs i prefer my defined classes in global VALUE objects because i maybe need them later
red-panda has joined #ruby
<shevy>
cjs I think via Init_ is a convention
<shevy>
it is explained somewhere
<cjs>
Hanmac: Hm. Makes sense. I'm actually doing my extension in C++, so I'll just pop them in to a separate namespace to avoid polluting the global one.
manizzle has quit [Ping timeout: 246 seconds]
<shevy>
"When Ruby tries to load an extension, the first thing it does is look for a function named Init_extname, where extname is the name of the extension."
maletor has quit [Quit: Computer has gone to sleep.]
<Hanmac>
cfs i do my extendions in c++ too ... when you do, the Master init function need to be extern "C" ... and then i use namespaces to store the functions in need for define_method
<cjs>
Yup, I've got the extern "C" bit down. I'm doing the standard "namespace ruby { #include "ruby.h" } thing as well. Ok, so I seem to be going the right direction here. Good.
manizzle has quit [Read error: Connection reset by peer]
manizzle has joined #ruby
yankov has quit [Quit: yankov]
zommi has quit [Remote host closed the connection]
wvdschel has quit [Ping timeout: 244 seconds]
nari has joined #ruby
mbk_ has joined #ruby
vlad_starkov has joined #ruby
bluenemo has joined #ruby
bluenemo has quit [Changing host]
bluenemo has joined #ruby
pygospa has quit [Disconnected by services]
L-----D has quit [Quit: Leaving]
qwerxy has joined #ruby
TheRealPygo has joined #ruby
sspiff has joined #ruby
sspiff has quit [Changing host]
sspiff has joined #ruby
williamcotton has quit [Quit: williamcotton]
cyong has left #ruby [#ruby]
konrads has joined #ruby
<konrads>
Hello. I am looking for a ruby gem with native ntlm proxy support
<WhereIsMySpoon>
Hi, I have https://gist.github.com/2935549 but when someone gives an invalid url I still get an exception which crashes the program - I thought rescue was supposed to catch exceptions?..
<cjs>
When I want to define a module within another module, I just do rb_define_module("A::B")?
rakm has quit [Quit: Computer has gone to sleep.]
konrads has quit [Ping timeout: 244 seconds]
<banisterfiend>
cjs: i think you use define_module_under
ph^ has quit [Ping timeout: 248 seconds]
jitesh_shetty has quit [Ping timeout: 244 seconds]
<cjs>
Ah, thanks.
freeayu has quit [Ping timeout: 246 seconds]
<vectorshelve>
WhereIsMySpoon: try using URI.parse for validating the URL and then use rescue
<vectorshelve>
WhereIsMySpoon: check the comment something like this
<shevy>
WhereIsMySpoon and where is the error
<shevy>
vectorshelve is making giant steps with ruby :D
<vectorshelve>
shevy: thank you shevy hope my comment illustrates something useful to him :)
hemanth has quit [Read error: Connection reset by peer]
<shevy>
and it kinda does that... I am not going to add much to it
hemanth has joined #ruby
<shevy>
I use it from my pseudo-shell, in case I installed a linux distribution... but xorg is not working. so I just do "irc ruby" and it connects me to the ruby channel here and then I can ask for
<shevy>
HELP!!!!
<shevy>
you see WhereIsMySpoon? :D
<shevy>
I think it is better to keep functionality as modular and as simple as possible, whenever possible
<shevy>
same for an irc bot
Progster has joined #ruby
<shevy>
WhereIsMySpoon status information would be awesome for a bot... I mean, compile a program, package it up, then provide a download link to the result
<WhereIsMySpoon>
shevy: one sec i was afk, looking at the pastie now
Markvilla has joined #ruby
<shevy>
eval() functionality would be nice too. one has to ensure that someone would not abuse such a bot of course
<shevy>
you could use it like a variable though :P
<WhereIsMySpoon>
oh its like a static variable in java?
<WhereIsMySpoon>
class variable
<shevy>
dunno. I think java forbids you to make changes
<shevy>
nono a class variable has @@
<shevy>
and sucks
<shevy>
ask workmad3
<shevy>
:)
<WhereIsMySpoon>
whats the difference between a class variable and this
<shevy>
the @@
<shevy>
hahahaha
ananthakumaran has quit [Ping timeout: 244 seconds]
<WhereIsMySpoon>
<_>
<WhereIsMySpoon>
look you
<shevy>
no, a constant means what
<WhereIsMySpoon>
it's a constant?
<WhereIsMySpoon>
...
<shevy>
yeah
<WhereIsMySpoon>
i dont understand the question
<shevy>
precisely
<shevy>
it is constant
<shevy>
it does not change
<WhereIsMySpoon>
ok
<shevy>
because it is constant
<shevy>
does it change WhereIsMySpoon?
<WhereIsMySpoon>
not in your code
<shevy>
...
<shevy>
ok here is a good example of a constant in ruby
<shevy>
Math::PI # => 3.141592653589793
<WhereIsMySpoon>
sure
<WhereIsMySpoon>
that wont ever change
<shevy>
you know when you need PI, for math circles
<shevy>
yes!
<shevy>
you now understood constants!
<WhereIsMySpoon>
ok
<shevy>
grab a beer
<WhereIsMySpoon>
lol
<WhereIsMySpoon>
i wish
<WhereIsMySpoon>
im at work
<Ethan>
I want a beer
<shevy>
it's a bit strange in ruby because you can change constants :\
<Ethan>
Oh wait, I'm not 21.
<shevy>
but you should not change them
<WhereIsMySpoon>
...
<WhereIsMySpoon>
then why bother making it possible to change them
sspiff has quit [Remote host closed the connection]
<WhereIsMySpoon>
if its stupid to
<shevy>
module Math; PI = 42;end
<shevy>
Math::PI # => 42
<shevy>
dunno WhereIsMySpoon
<WhereIsMySpoon>
yes, that isnt helpful
<shevy>
matz likes freedom
<WhereIsMySpoon>
ic
<WhereIsMySpoon>
well
<vectorshelve>
very beautifult convcerstation log between shevy and WhereIsMySpoon :) I missed quite a few part of it.. reiterating
<shevy>
perhaps there also was another reason, I dont know
<WhereIsMySpoon>
what did this even have to do with my bot
<WhereIsMySpoon>
<_>
<shevy>
WhereIsMySpoon you asked about include :P
<WhereIsMySpoon>
oh yes
<shevy>
you can only include constants
<WhereIsMySpoon>
shevy: so back to this compile thing
nfk has joined #ruby
<WhereIsMySpoon>
what were you talking about
<shevy>
module Foo <-- Foo
<WhereIsMySpoon>
o.o
<shevy>
well, if someone wants to download a binary package
mayankkohaley has quit [Ping timeout: 240 seconds]
<WhereIsMySpoon>
that looks like trouble
<shevy>
and wants it build anew
<shevy>
then he could ask the bot to do that
<shevy>
:)
<WhereIsMySpoon>
true
<WhereIsMySpoon>
is there a library for interacting with gcc?
gyre007 has joined #ruby
<WhereIsMySpoon>
and make
<shevy>
but I think 98% of linux users are now like windows users
<WhereIsMySpoon>
not gcc
<WhereIsMySpoon>
why did i say gcc
<WhereIsMySpoon>
i meant make
<shevy>
WhereIsMySpoon, well you can always use system('gcc foo.c')
<WhereIsMySpoon>
or will i just have to execute system calls
<shevy>
or system 'make'
<WhereIsMySpoon>
blah
<shevy>
yeah
<shevy>
:)
<shevy>
we don't yet have a rubyOS
mayankkohaley has joined #ruby
<WhereIsMySpoon>
haha
<WhereIsMySpoon>
:D
<shevy>
it would also be a lot of work
<WhereIsMySpoon>
yea
<shevy>
much less work to just use ruby on linux (or another OS, it even works on windows)
<WhereIsMySpoon>
but who would use windows to code on
<shevy>
hmm
<WhereIsMySpoon>
unless they're coding vb.net or something
<WhereIsMySpoon>
in which case they have a whole new problem
<WhereIsMySpoon>
trololo
<shevy>
yeah, ruby aint very important for windows folks
<shevy>
but if I would go back to windows, I'd use ruby
<shevy>
with msys, you kinda have a bash-like shell on windows
<WhereIsMySpoon>
or you could use cygwin
<WhereIsMySpoon>
anyhoo
<shevy>
yeah, pretty much the same. but every ruby script can work on windows! we have like a giant ruby ecosystem here
<shevy>
and can make windows suck less
<WhereIsMySpoon>
shevy: i cant see actually compiling/making the binary being an issue
zomgbie has joined #ruby
<WhereIsMySpoon>
the only thing is i have to learn the dcc protocol
<WhereIsMySpoon>
and implement that into my bot
<WhereIsMySpoon>
:)
<WhereIsMySpoon>
so i will get on that
<WhereIsMySpoon>
:)
<shevy>
hmm you could auto-upload to some other site
<shevy>
and just provide the link to that
<WhereIsMySpoon>
shevy: meh, im not really that keen on relying on some external site that may or may not work
<WhereIsMySpoon>
shevy: oo actually
<WhereIsMySpoon>
i could upload to dropbox
<shevy>
lol
<WhereIsMySpoon>
then provide link to that
<shevy>
didnt you just say you dont wanna rely on external sites ;P
<WhereIsMySpoon>
yea but
<WhereIsMySpoon>
dropbox is like
<WhereIsMySpoon>
reliable
<shevy>
there are always exceptions to any rule!
<WhereIsMySpoon>
themediaplace.com isnt
<WhereIsMySpoon>
or whatever site u want
<shevy>
today I shall not drink anything
<WhereIsMySpoon>
you know what i mean
<shevy>
... except beer
cyong has quit [Quit: Leaving.]
<WhereIsMySpoon>
sounds dangerous
<shevy>
yeah, if it gets out of hand. a friend used to drink about 5 bottles of beer a day
<WhereIsMySpoon>
that isnt much
kaiwren has joined #ruby
<WhereIsMySpoon>
i could drink that in a night out :S
<WhereIsMySpoon>
shevy: someone commented on my give_youtube_description gist with some method to get linkedin profiles :S:S
sspiff has joined #ruby
sspiff has quit [Changing host]
sspiff has joined #ruby
<WhereIsMySpoon>
o.o
nipra has quit [Ping timeout: 246 seconds]
DrForr has joined #ruby
bglusman has joined #ruby
<shevy>
perhaps a bot
<shevy>
I still prefer pastie.org over gist
<WhereIsMySpoon>
why
<WhereIsMySpoon>
i have a github acc
<shevy>
I like the colours more
<WhereIsMySpoon>
so gist is good for me
<WhereIsMySpoon>
pfff
<WhereIsMySpoon>
are you a real man?
<WhereIsMySpoon>
:p
<shevy>
I use github too but the gists I dont like
ilmenite has joined #ruby
<shevy>
there is worse though
<shevy>
like pastebin
<WhereIsMySpoon>
anyone here use quassel
<WhereIsMySpoon>
pastebin sucks ass
red-panda has quit [Remote host closed the connection]
cheater_ has joined #ruby
d3vic3 has quit [Ping timeout: 244 seconds]
bglusman has quit [Ping timeout: 244 seconds]
<ilmenite>
hi, ive got an array, arr = {"test" => "blah", "102" => "hello"}, im trying to use this to replace all occurences of test with blah and 102 with hello. Using gsub, i can get only the 102 to be replaced with hello, this is what im doing: "102 test".gsub(/(\d+)/) {|m| arr[$1] }
<ilmenite>
any idea how do i get it to replace the string matches as well?
<WhereIsMySpoon>
that's a hash not an array
<ilmenite>
oh, my bad, im still new to ruby
<WhereIsMySpoon>
[] is array
zomgbie_ has joined #ruby
<WhereIsMySpoon>
in a hash you have key => value
d3vic3 has joined #ruby
iori has quit [Remote host closed the connection]
<WhereIsMySpoon>
:)
<ilmenite>
so then using this hash, why does it replace only numbers and not strings?
cheater has quit [Ping timeout: 244 seconds]
<WhereIsMySpoon>
"102" is a string
<WhereIsMySpoon>
not a number
zomgbie has quit [Ping timeout: 244 seconds]
iori has joined #ruby
<bnagy>
ilmenite: hsh.invert?
<WhereIsMySpoon>
and i assume it's because in that regex you're assuming it's an array and it's getting confused
<bnagy>
ohh you mean you want to use the hash to make replacements in a string
<ilmenite>
yes
visof has quit [Ping timeout: 244 seconds]
<bnagy>
replacements.each {|old, new| str.gsub old, new }
mohits has quit [Read error: Connection reset by peer]
<workmad3>
bnagy: reduce is useful if you're writing map-reduce style algorithms, however most ruby programs don't do that... instead, reduce tends to be misused for things like converting arrays into hashes
cantonic has quit [Ping timeout: 265 seconds]
cantonic_ is now known as cantonic
<workmad3>
bnagy: what I love is that an array of 2-item arrays, people love writing reduce methods, or each_with_object methods for when they could just do hsh = Hash[ary] :)
mohits has joined #ruby
<WhereIsMySpoon>
haha
<WhereIsMySpoon>
nice workmad3
<WhereIsMySpoon>
:p
<WhereIsMySpoon>
workmad3: in your solution, replacements = [ "hello", "test" ] and what is str?
<bnagy>
so I just looked at ST2... gotta admit it is kind of pretty
<bnagy>
but 20 years of vim finger memory is not happy about having to use the mouse that much :(
ephemerian has quit [Quit: Leaving.]
<workmad3>
WhereIsMySpoon: on the first execution, it's the argument passed into .reduce, on each execution after that it's the result of the previous execution
<WhereIsMySpoon>
haha
<workmad3>
bnagy: I bet your wrists wouldn't be happy either
<WhereIsMySpoon>
workmad3: what argument do you pass into reduce?
<bnagy>
it just needs vi style edit mode
<workmad3>
WhereIsMySpoon: whatever you want as the argument on the first execution
<WhereIsMySpoon>
im so confused
<workmad3>
WhereIsMySpoon: if you don't give an argument there, reduce will use the first item of the collection, which is how (1..10).reduce(&:+) works
hemanth has quit [Read error: Connection reset by peer]
<workmad3>
WhereIsMySpoon: don't worry... map and reduce are more functional-programming concepts... map is used for repeating an operation across an entire collection, reduce is for taking a collection and reducing it to a single result
<workmad3>
WhereIsMySpoon: yeah, so in that situation, the argument should be the string that you want the replacements done on
<bnagy>
well map is pretty core to ruby, like if you don't get map you're gonna have a bad time
<workmad3>
WhereIsMySpoon: and replacements should be {"hello" => "world"}
tatsuya_o has joined #ruby
<workmad3>
WhereIsMySpoon: and in that situation, the reduce is repeatedly applying the gsub for each replacement, starting with an initial string
<WhereIsMySpoon>
right so
snearch has joined #ruby
<workmad3>
that's something... ilmenite: any reason you're not using String.tr ?
ilmenite has quit [Quit: log off]
ilmenite has joined #ruby
<WhereIsMySpoon>
workmad3: so we take a hash of replacements, turn it into an array, then replace str with the other word in the array ?
<bnagy>
workmad3: tr is for charsets
<workmad3>
oh, ignore that, forgetting what tr is for
<workmad3>
bnagy: yeah, brainderp moment :)
<workmad3>
WhereIsMySpoon: no
<WhereIsMySpoon>
D:
<workmad3>
WhereIsMySpoon: we have a hash of replacements, each k-v pair in the hash is passed into the block (this happens to be as an array [key, value]) and we replace key with value
<workmad3>
WhereIsMySpoon: the hash isn't 'turned into an array', just each pair is passed in
<WhereIsMySpoon>
ohh
byronb has joined #ruby
byronb has quit [Excess Flood]
thecreators has joined #ruby
<WhereIsMySpoon>
workmad3: i think i got confused cause i only made a one k-v long hash
<WhereIsMySpoon>
:)
<workmad3>
WhereIsMySpoon: and the reduce then does that repeatedly for each pair, applying the substitution to the string generated by the last substitution
zinjacoder has joined #ruby
<WhereIsMySpoon>
workmad3: thats quite subtle
<bnagy>
WhereIsMySpoon: Enumerable. Read it. Memorize every method.
<WhereIsMySpoon>
it looks very ruby, but is a little difficult to actually understand
cjs has quit [Ping timeout: 245 seconds]
<WhereIsMySpoon>
bnagy: D:
<workmad3>
WhereIsMySpoon: it's very easy to understand once you've groked reduce :)
<WhereIsMySpoon>
true :)
<WhereIsMySpoon>
anyhoo
rippa has quit [Ping timeout: 244 seconds]
<WhereIsMySpoon>
lunchtime
<bnagy>
print out the rdoc for Enumerable and take it with you
<WhereIsMySpoon>
to bed?
<WhereIsMySpoon>
:p
ringotwo has quit [Read error: Connection reset by peer]
<bnagy>
you can be like 'yo, with my subway toppings, group_by colour, and I want mayo on each_slice, botch'
ringotwo has joined #ruby
<bnagy>
which is funny because botch is what I did to that line
* bnagy
gets his coat
<Hanmac>
workmad3 ... so th there is a hash like {"hello" => "world"} and an string like "123hello456" wich should be changed to "123world456" right?
<marcin>
hi, I have problem with ruby here doc usage. Every time i want to use it I'm getting syntax error. I'm new to programming so please don't kill me :-)
<Hanmac>
bnagy my last line does not work as i wanted ... so i think the shortest way is "replacements.each_with_object(string){|(k,v),s|s.gsub!(k,v)}"
apeiros_ has joined #ruby
tvw has quit [Remote host closed the connection]
<vectorshelve>
shevy: mate after thinking quite a lot got an interesting idea on building a gem.. for stock prices of companies in market and commodities :)
liluo has quit [Remote host closed the connection]
<bnagy>
works for me on win7, which is the clsest windows I have to hand
<bnagy>
sorry, I need to go and play pool and drink beer
<bnagy>
good luck!
<marcin>
thanks!
stummi has joined #ruby
<stummi>
hi, can i start the ruby-cli tool in somewhat like an interactive mode like python?
<ilmenite>
stummi, irb is what your looking for
krusty_ar has joined #ruby
<stummi>
ilmenite, ah, yes. thanks :)
<Tasser>
stummi, or pry
zz_chrismcg is now known as chrismcg
Facefox has joined #ruby
Facefox has quit [Max SendQ exceeded]
<banisterfiend>
ilmenite: you're*
<ilmenite>
?
<banisterfiend>
ilmenite: you're* looking for
<banisterfiend>
not 'your looking for' :)
ephemerian has quit [Quit: Leaving.]
<ilmenite>
oh yes, ive got to read more books
Facefox has joined #ruby
Dreamer3__ has quit [Quit: Leaving...]
Dreamer3 has joined #ruby
frishi has joined #ruby
jbw_ has joined #ruby
roams has joined #ruby
stummi has left #ruby ["Verlassend"]
lolmaus has quit []
krusty_ar has quit [Ping timeout: 246 seconds]
banghouse has quit [Remote host closed the connection]
n1x has joined #ruby
qowaz has joined #ruby
mdw_ has quit [Remote host closed the connection]
<vectorshelve>
shevy: u wont ? :D
n1x has left #ruby [#ruby]
mengu has joined #ruby
jimeh has quit [Quit: bye]
iocor has quit [Quit: Computer has gone to sleep.]
railrubix has quit []
jonathanwallace has joined #ruby
mdw has joined #ruby
<shevy>
vectorshelve if I'd had a need for it sure. but I don't :P right now I am writing on a small game, which I'll eventually convert into something gamebox-ready
workmad3 has quit [Ping timeout: 252 seconds]
dhruvasagar has quit [Ping timeout: 252 seconds]
Jackneill has joined #ruby
<dekroning>
i'm currently in irb/pry and I would like to remove a class, e.g. class Foo; end I want to remove the Foo class so I can't do Foo.new anymore
Facefox has quit [Ping timeout: 244 seconds]
<banisterfiend>
dekroning: Foo = nil
dhruvasagar has joined #ruby
<banisterfiend>
is the easy way
<Tasser>
dekroning, remove_const Foo
<banisterfiend>
u can do some BS with const_remove or whatever, but u dont need to
<Tasser>
ehh :Foo
<Hanmac>
banstisterfiend: yours can cause a warning
workmad3 has joined #ruby
<banisterfiend>
Hanmac: he's just doing it in pry/irb, it doesnt matter
selvakumaran_ has quit [Ping timeout: 246 seconds]
zii has quit [Read error: Connection reset by peer]
<Ethan>
o.o
<Ethan>
HARRO RUBIANS!
<Ethan>
rubyists? rubians? same difference.
marcin has quit [Quit: Page closed]
<apeiros_>
different sameness
<Ethan>
I should seriously work on my Ruby
<Ethan>
I haven't coded in over two months.
djdb has quit [Remote host closed the connection]
umttumt has joined #ruby
Kn|t3 has quit [Quit: Kn|t3]
krusty_ar has joined #ruby
Kn|t3 has joined #ruby
<Xethron>
Ok, I have a really stupid question
djdb has joined #ruby
Progster has joined #ruby
<Xethron>
I installed ruby a while back. And now my system crashed. Installed Fedora 16 again, but cant seem to get ruby up and running again....
red-panda has joined #ruby
dhruvasagar has quit [Ping timeout: 244 seconds]
<JonnieCache>
Xethron: how are you going about installing it?
<Xethron>
After quite some time I got the basics there. But when I run the ruby script, it gives an error now, which it never did before... "/home/xethron/nanobot/config.rb:16: warning: found = in conditional, should be =="
<JonnieCache>
thats a warning not an error
mdw has joined #ruby
<Xethron>
also: Cannot load bcrypt library. Make sure the bcrypt-ruby gem is installed.
<JonnieCache>
its probably because youre using a newer ruby that includes that warning
<JonnieCache>
it says youre doing an assignment in a conditional, which is likely a mistake
ephemerian has joined #ruby
<Xethron>
JonnieCache, ah, ok
<JonnieCache>
the second one is kinda self explanatory, no?
Konboi has quit [Remote host closed the connection]
<Xethron>
JonnieCache, yes, but how do I get it on there?
<JonnieCache>
gem install bcrypt-ruby
<Xethron>
ah
<JonnieCache>
or, if youre using bundler, add it to the Gemfile
<Xethron>
I tried installing it with yum :/
<Ethan>
don't use your OS's package manager to install gems
<Ethan>
they're usually out of date
flype has joined #ruby
<JonnieCache>
ruby and OS package managers in general often dont get on
vlad_starkov has quit [Remote host closed the connection]
RoUS has quit [Remote host closed the connection]
Vert has quit [Read error: Connection reset by peer]
simao_ is now known as simao
`brendan has quit [Ping timeout: 244 seconds]
`brendan has joined #ruby
BiHi has joined #ruby
IrishGringo has joined #ruby
nilg` has quit [Remote host closed the connection]
chson has quit [Remote host closed the connection]
williamherry has quit [Remote host closed the connection]
Cork has joined #ruby
Guedes has quit [Read error: Connection reset by peer]
<Cork>
is it possible to extend so you can use else in a proc function?
<Cork>
myfunc { do this } else { do this }
yugui is now known as yugui_zzz
cek has joined #ruby
carloslopes has joined #ruby
<cek>
hi. solve a mistery: self.ass = 123 ArgumentError: wrong number of arguments (1 for 2)
jrist-afk is now known as jrist
<cek>
how do you pass that 2 args?
ilmenite has quit [Ping timeout: 246 seconds]
vitoravelino`afk is now known as vitoravelino
pu22l3r has joined #ruby
<apeiros_>
Cork: what is it supposed to do?
ilmenite has joined #ruby
<apeiros_>
cek: read the backtrace.
<Cork>
apeiros_: its a function that does some calculations based on the arguments, and if the data it looks up matches it calls the proc
<Cork>
apeiros_: i would like to be able to have an expressive if it doesn't match
koskoz has joined #ruby
<Cork>
i know i can pass two procs, but that looks a bit unintuitive when you see the code
<cek>
seems like impossible task to me when assignment arity is 2
<apeiros_>
Cork: you could do: my_func match: -> { do this }, no_match: -> { do that }
<apeiros_>
cek: read the backtrace.
<cek>
apeiros_, so what?
<apeiros_>
you didn't. or failed to.
<Cork>
apeiros_: true, does that mean it can't be done?
<cek>
ignore
<apeiros_>
cek: *shrug*
<apeiros_>
Cork: not with the syntax you suggest
<Cork>
ok, thx
<apeiros_>
you could try to define .else on Proc. but that's ugly and there's a good possibility that it's not carried over with &block
FND has left #ruby [#ruby]
* Cork
nods
<Cork>
was afraid of that, but though i should at least ask before throwing away the idea :)
<apeiros_>
cek: btw., once again you utterly fail to properly ask a question.
Kn|t3 has quit [Quit: Kn|t3]
iocor has joined #ruby
<apeiros_>
"hey, stuff no worky! solve me!"
nilg has quit [Remote host closed the connection]
<WhereIsMySpoon>
apeiros_: lol :p
Kn|t3 has joined #ruby
<Cork>
WhereIsMySpoon: just got to say, lovely nice :D
<Cork>
*nick
<apeiros_>
it's somewhat sad too, because always remember - there is no spoon…
<Cork>
:)
<apeiros_>
it's impressive how fast flash burns the battery…
<apeiros_>
it's like *nom,nom,nom*
passbe has quit [Ping timeout: 252 seconds]
hynkle has joined #ruby
<axiak>
cek: self.ass=(123, 456)
red-panda has quit [Remote host closed the connection]
<cek>
axiak, hehe, here you go: self.ass=(123, 456) SyntaxError: compile error (irb):99: syntax error, unexpected ',', expecting ')'
<WhereIsMySpoon>
apeiros_: thats why apple doesn't allow it on their devices mostly :)
<axiak>
oh well :P
<apeiros_>
WhereIsMySpoon: while I don't like the way, I do love the result - so much more power efficient videos on the web now.
<WhereIsMySpoon>
yea
<apeiros_>
axiak: the only way to call a foo= method with more than 1 arg is by using send
<apeiros_>
(with the sole exception being []=)
crankycoder has joined #ruby
<axiak>
makes sense
<apeiros_>
WhereIsMySpoon: but I'm fascinated by adobes complete failure to provide more efficient ways to stream videos
<WhereIsMySpoon>
apeiros_: it is a bit odd
eurbach has joined #ruby
<WhereIsMySpoon>
apeiros_: i can see adobe fading into obscurity in the next 5 years or so
<apeiros_>
WhereIsMySpoon: but adobe failed at so much things the last few years, it's amazing. my latest gripe: "Check for updates" in the flash player means "hey, there I open a browser window where you can compare a couple of numbers and then go to the downloads page!"
<WhereIsMySpoon>
or maybe 5-10
<WhereIsMySpoon>
adobe reader sucks
<WhereIsMySpoon>
flash will be replaced by html5
<apeiros_>
they still got their complete creative suite
<apeiros_>
indesign, illustrator & ps are still big.
<WhereIsMySpoon>
photoshop is good i guess
<WhereIsMySpoon>
and aftereffects
<apeiros_>
right.
<WhereIsMySpoon>
but theyre targeted towards a much smaller market than flash is
<apeiros_>
they do make more money with it.
tk___ has joined #ruby
<WhereIsMySpoon>
mm
<apeiros_>
flash doesn't make them money, it costs. it's a way to sell their productive tools. and they're currently working on html5 productive tools.
<apeiros_>
at least they've got that one right
<WhereIsMySpoon>
thats amusing
<WhereIsMySpoon>
instead of fixing flash
<WhereIsMySpoon>
theyre just dumping it
<apeiros_>
they should open it up
<WhereIsMySpoon>
:p
yugui_zzz is now known as yugui
<WhereIsMySpoon>
deffo
<WhereIsMySpoon>
wait no
<WhereIsMySpoon>
i dont want to die
<WhereIsMySpoon>
of horrible codes
<WhereIsMySpoon>
D:
<apeiros_>
developing flash isn't their selling point
<WhereIsMySpoon>
no but its prolly what they're most well known for
<WhereIsMySpoon>
at least imo
<cek>
okay, anyone else want to try?
<apeiros_>
iirc they wanted to do that at one point in time… wonder what went wrong. fear probably.
<WhereIsMySpoon>
cek: ?
<apeiros_>
cek: read the backtrace.
shevy has quit [Ping timeout: 265 seconds]
pk1001100011 has quit [Quit: Burn your gods and kill the king; Subjugate your suffering; Dead heart, in a dead world]
<cek>
looks like a parser bug to me allowing to specify multiple args for a "setter" method
<apeiros_>
oh wow, cek *really* failed to ask the question…
<apeiros_>
what he said: 15:02 cek: hi. solve a mistery: self.ass = 123 ArgumentError: wrong number of arguments (1 for 2)
<apeiros_>
what he wanted to say: self.ass = 123, 234 (or whatever 2nd arg)
<apeiros_>
lol
<apeiros_>
well, what did I expect…
<apeiros_>
and if he'd read he'd even gotten his answer… (15:16 apeiros_: axiak: the only way to call a foo= method with more than 1 arg is by using send)
uris has joined #ruby
erichmenge has joined #ruby
Markvilla has quit [Quit: Markvilla]
<apeiros_>
and for the fellow reader - not a parser bug either. allowing more than 1 arg would break parallel assignment.
Markvilla has joined #ruby
shevy has joined #ruby
vlad_starkov has joined #ruby
tcopp has joined #ruby
<deryl>
:)
<apeiros_>
hi deryl
<apeiros_>
how's rvm 2 coming along?
<deryl>
hi apeiros_ - seems to be ok. thats mpapis's puppy
<apeiros_>
ah, you're more involved with docs & support?
kaiwren has quit [Quit: kaiwren]
<deryl>
the internal dependence on zsh (static version) for rvm2 is taking it a direction i don't want to be involved in, so i'm not working on rvm2 at all. and yes, right now i'm more docs and support.
nipra has quit [Ping timeout: 244 seconds]
<apeiros_>
hu? rvm 2 will depend on zsh? I don't think I even have that installed. how came that choice to be?
carlyle has joined #ruby
<deryl>
:shrug: he wants to take shell scripting 'to the next level' and rvm2 will be using SMF (sm.beginrescueend.com) internally
Markvilla has quit [Client Quit]
Markvilla has joined #ruby
crankyco_ has joined #ruby
<apeiros_>
bdsm is wayne's baby, no?
<deryl>
and he feels that using zsh will allow for that. *I* think it abandons the bash crowd AND goes with something non-standard which can pretty much be expected everywhere (namely bash) even under windows bash is king (cygwin). and zsh doens't support all bashims.
<deryl>
yeah
<deryl>
yeah. bdsm is now SMF and is wayne's baby
<deryl>
rvm2 will be using it internally to make rvm2 modular. but a forcing of a dep to a specific shell.. not happy with that at all.
Jake232 has joined #ruby
<cek>
will it include a towel service?
crankycoder has quit [Ping timeout: 240 seconds]
<deryl>
even if its internal to rvm itself (as in for its coming command modules). plus with static, think of those of us with say 10 or 15 terminals open and running different commands in each. you just ballooned memory requirements.
<deryl>
but hey thats me. i don't want to trash rvm in any way. I like what they're going to do, I just don't like the implementation idea.
<apeiros_>
deryl: hm… yeah, I'm not so sure that depending on zsh is a good idea…
<deryl>
would that be an ideology or a methodology?
<apeiros_>
well, lets see how it pans out
<deryl>
i mean i totally get the modular design, and i;m all for that.. just reliance on zsh underneath (or even bash interally as a static i'd disagree) .. definitely not happy with that
<apeiros_>
deryl: yeah, I think similarly.
<deryl>
so as you say, we shall see
bglusman has joined #ruby
<deryl>
but rvm1 is going to pretty much stay as it is except for doc refinements and code fixes. rvm1 will still be valid for quite some time
<deryl>
*some* features from rvm2 might get backported, but i envision very few
<apeiros_>
in the worst case, there's also rbenv
denysonique has quit []
<deryl>
you know, i have no problem with rbenv as a tool. it does what it does.
<apeiros_>
well, ruby-build + rbenv
<deryl>
my problem is sstephenson himself.
deevilius has joined #ruby
<apeiros_>
I haven't used rbenv nor ruby-build, so I can't say anything about it. I just know there's a plan B in case rvm ceases to be a valid option for me.
<apeiros_>
what's the trouble with sstephenson? Did I miss some good drama?
<deryl>
I will NOT use a fucking thing that asshole makes, nor will I support his users, nor will I be kind to the assholes that use his tools that then decide to trash RVM (and usually just regurgitate sstephenson's bullshit FUD)
yugui is now known as yugui_zzz
<deryl>
so its a personal thing, nothing to do with his projects objectively, its him i refuse
<apeiros_>
^^
<banisterfiend>
deryl: what did he do to piss u off so much
<deryl>
apeiros_: he released rbenv in the first place with utter bullshit about RVM, trashed RVM in order to get publicity, and not a single solitary time asked for details about anything to include his 'rvm executes dangerous and arbitrary code' commentary
denysonique has joined #ruby
centipedefarmer has joined #ruby
arturaz has quit [Remote host closed the connection]
bglusman has quit [Ping timeout: 244 seconds]
arturaz has joined #ruby
Kn|t3 has quit [Quit: Kn|t3]
<cek>
have no idea what you're talking about. i was researching about rvm alternatives long time ago. rbenv is the first project that pops up in search
<deryl>
half truths about rvm internal operations, innuendos, and then we get the flood of regurgitators to the point we (mpapis, wayne, and I) all had to post commentaries in Issues, in blog posts, etc etc combatting his bullshit. At least its dying off now, people are seeing for themselves it was bullshit, so I'm glad for that. however as a human being, I choose not to use a friggin thing that jackass puts out. I'll find another way to do something if I have
<deryl>
to.
maesbn has quit [Remote host closed the connection]
deevilius has left #ruby [#ruby]
Kn|t3 has joined #ruby
Konboi has joined #ruby
<deryl>
cek thats fine. talk to wayne himself. trashed wayne and his project from release, etc etc. dont' take MY word for it, go ask wayneeseguin directly. hope you got some time
v0n has joined #ruby
<deryl>
ask mpapis as well.
ananthakumaran has joined #ruby
<deryl>
but anyways, i didn't mean for it to expand to something this big in here.
<deryl>
dropping it
albemuth has joined #ruby
<apeiros_>
deryl: I asked for it
<cek>
why would I ask someone? i'm fine with rvm branch we find stable and no intention of moving yet
<apeiros_>
deryl: so no need to feel bad about telling your thoughts :)
<apeiros_>
*so you shouldn't feel bad about…
PragCypher has joined #ruby
<deryl>
apeiros_: yeah i know, but i display my temper enough as it is in here and other related channels.
yugui_zzz is now known as yugui
<deryl>
firey is an understatement at times ;)
<cek>
deryl, well don't pay attention to trolls
<deryl>
cek yeah i do have that problem at times.
<cek>
just put them in ignore and you'll see the world changing to brighter place
<deryl>
hehe
<deryl>
you're a bit more laid back than i am. i'm still figuring out how to be. not my.. forte ;)
<apeiros_>
deryl: it's easy to say things in the aftermath, but still: I think you should have taken control of the fight by putting up a refutal site, which you should have linked to wherever somebody badmouthed rvm.
charliesome has quit [Read error: Connection reset by peer]
<deryl>
our bigger problem was the rbenv crowd bringing to the #rvm *channel* - daily combat against the FUD became needed because well, its our home channel.
<apeiros_>
banhammer
<apeiros_>
either they can put up a constructive dialogue or they can stay the f* out
<cek>
deryl, setup a bot that would devoice users using "rbenv" word
<deryl>
then you get the reputation of banning just because someone disagrees with you. so you almosthave to explain things real time lest other users lurk and be misinformed as well
<deryl>
cek naa, i don't have a problem with rbenv perse as a *project*
<cek>
deryl, well, it's like saying "fuck" in children channel.
<deryl>
its some of the user base and the creator. and rbenv does come up validly in conversations relating to rvm. like i do this in rbenv how do i do it in rvm'
<apeiros_>
deryl: no, it's legitimate to ban topics from a dedicated channel
mdw has quit [Remote host closed the connection]
<apeiros_>
compare how we pretty much ban rails as a topic in here too
<cek>
well, you devoice for 10 minutes, send a CTCP or how is it called message to the user explaining the problem.
<deryl>
in fact, a funny thing for me (i guess a getting even type funny) is that after we did all the documenting of the difference and combatted on blogs and stuff, we had quite a few leave rbenv and start using rvm.
<deryl>
s
<deryl>
o i guess it worked out for us in the long run to some degree
jimeh has joined #ruby
<apeiros_>
you can always set up an #rvm_vs_rbenv channel and do the bot thing cek said with a twist
<deryl>
hahah
<deryl>
i love you guys, chock full of ideas! muahaha
<deryl>
you're almost as evil as i am hehe
<apeiros_>
i.e., tell the user that rbenv is not discussed in #rvm, they should go to #rvm_vs_rbenv for that instead and remention will mean a ban.
rippa has joined #ruby
<cek>
this way, you protect your users and yourself from discussing the sensitive matter, you know
yugui is now known as yugui_zzz
koskoz has quit [Ping timeout: 265 seconds]
hemanth has quit [Read error: Connection reset by peer]
<deryl>
yeah, i had to walk away for about 3 weeks because I was getting a bit depressed and overly angry because it seemed i spent more time combatting than helping. was affecting my psyche
<apeiros_>
after all, #rvm is for people to get help with rvm, not to discuss why tool X is supposedly better.
<deryl>
wayne's too.
<deryl>
he was PISSED!
hemanth has joined #ruby
<apeiros_>
or how do you think it'd end when python users came in here going all wild about how python is better?
<apeiros_>
it'd be instaban
<deryl>
true
sailias has joined #ruby
PragCypher has quit [Quit: Leaving]
<deryl>
wayne isn't a big ban guy even if you're expressing a contrary opinion, but then again he's FAR more laid back and nicer than I am. So, because its his project and his channel, i follow his lead most of the time.
<apeiros_>
I'm open to constructive dialogue. but the moment it becomes harrassement, the focus is on protecting the channel
<deryl>
i may be a dev on the project, but he's still the creator
<deryl>
yeah
AxonetBE has quit [Ping timeout: 244 seconds]
yugui_zzz is now known as yugui
<deryl>
i hear you, and i agree with you
afallows has joined #ruby
<deryl>
should never have been needed int he first place. think that pisses me off most of all. there's MORE than enough room in this space for 2 projects like this, hell you could have 4 and still not be crowded.
AxonetBE has joined #ruby
<deryl>
there's more than one way to skin a cat, that does *not* include trashing other projects *just* to get publicity for your's
ilmenite has quit [Ping timeout: 246 seconds]
<apeiros_>
deryl: I think there's a vast difference between raising concerns and state why your solution is better, vs. just trash a project.
<deryl>
totally agree with that. all of us would have been fine with #1. sstephenson decided to go route #2
<deryl>
it *should* have been a debate between the two projects (hell think of how good a 3rd project built by both teams *together* with ideas from *both* would be!)
<WhereIsMySpoon>
im pretty sure if anyone did that for a project i worked extremely hard on i'd be instabanning people talking shit about it
<WhereIsMySpoon>
^^
PaciFisT has joined #ruby
nanderoo has joined #ruby
mdw has joined #ruby
fantazo has joined #ruby
Boohbah has quit [Remote host closed the connection]
<deryl>
WhereIsMySpoon: well where he was right, we agreed. If you're right, you're right. Its the FUD put into user's minds. Come on not everyone dumpster dives code to find out truth. the vast majority take whatever they hear as gospel especially where there is no response from the opposite side (which we even tried doing for awhile. no response, it will blow over, it just never did until we spoke up)
ken_barber has joined #ruby
Boohbah has joined #ruby
<deryl>
and while I am a big proponent of just ban the loudmouths, wayne isn't and its his channel. so refute refute refute
<WhereIsMySpoon>
:p
Doc_X has joined #ruby
ramblex has joined #ruby
<deryl>
anyways, more coffee and a cig
cj3kim has joined #ruby
<WhereIsMySpoon>
gotta get along with others in your project :)
<jonathancutrell>
I haven't asked in #algorithms yet, but they are pretty quiet over there, so I figured I'd ask here first.
<jacobw>
have you tried ##math also?
<digitalcakestudi>
aaaaa there is 666 people hexs on all of you!
<jonathancutrell>
jacobw: I have not - I'll hop over there.
wvms has quit [Quit: wvms]
chienpo has joined #ruby
ckrailo has joined #ruby
Prometheus has joined #ruby
nateberkopec has joined #ruby
porton has joined #ruby
<porton>
I know Python. Should I also study Ruby? Is anything in Ruby better than Python?
<rippa>
yes
<rippa>
language
<deryl>
learn ruby because you want to learn ruby
<jonathancutrell>
Haha
<jonathancutrell>
yeah.
<jonathancutrell>
Essentially they have the same functionalities for the most part
Progster has quit [Ping timeout: 245 seconds]
<deryl>
better / best is always subjective. (Python|Ruby) is best for some variable of 'best' or 'better'
<havenn>
porton: Use Ruby! Crush the Python! (Produced by the People's Committee for Revolutionary Re-education.)
<deryl>
s/variable/variant/
<jonathancutrell>
python is installed on more non-traditional machines (think robots; mostly because it is older)
<havenn>
Ruby has blocks. I rest my case.
<jonathancutrell>
but overall, ruby and python have generally the same running time and platform spread.
pr0zac0x2a has joined #ruby
robotmay has quit [Remote host closed the connection]
<jonathancutrell>
porton: also, why are you learning to program? If it's for the web, then look at specific web frameworks in both languages
hydrozen has quit [Quit: Computer has gone to sleep.]
<porton>
jonathancutrell: In fact I am a professional Web programmer, but incidentally do some programming on my own
<jonathancutrell>
porton: Rails/Sinatra/rack-based apps/EventMachine vs Django/Tornado etc
<jonathancutrell>
porton: Are you planning to pursue new jobs, or just get smarter?
<havenn>
Use Ruby to be happy.
<porton>
jonathancutrell: Just get a little smarter.
macmartine has joined #ruby
<jonathancutrell>
porton: Learn deeper python.
<jonathancutrell>
porton: Or, learn how to do more with python.
<deryl>
why be mono-language? learn both
<jonathancutrell>
deryl: Why learn both?
<deryl>
increase knowledge AND learn a new skill AND learn how to interface between the two
<jonathancutrell>
porton: It makes more sense to be an expert in one language than to be good in one and terribly mediocre or decent in another.
<deryl>
and single language knowledge can be limiting if for no other factor than being able to read how something is done
chrxn has quit [Ping timeout: 248 seconds]
macmartine has quit [Read error: Connection reset by peer]
<havenn>
jonathancutrell: Kinda like why you'd try vanilla and chocolate ice cream. Be a postmoderist hyperpolyglot!
wpaulson has quit [Ping timeout: 265 seconds]
<jonathancutrell>
havenn: Ha.
<deryl>
just because you know one language really really well, does nto imply that because you learn another you're going to be mediocre or terrible int he new one
<deryl>
s/nto/not
<jonathancutrell>
deryl: Unfortunately, it often does mean that.
<deryl>
usually due to lack of committment on the learner's part
<deryl>
and lack of practicing with throwaways
<jonathancutrell>
deryl: While I understand the benefits of learning more than one language, I think time is much better spent becoming great at the thing you are already good at than becoming knowledgable at the thing you are clueless about.
macmartine has joined #ruby
<deryl>
depends. self limitation can and sometimes is a good thing. but definitely not in all cases, or even in the majority of cases
<jonathancutrell>
deryl: Now, if you were to supplement your knowledge in one language with some kind of other thing (like, for instance, a strong understanding for cryptology or networking technology), then yes, widen your knowledge.
<havenn>
But maybe he reaaaallly loves chocolate, and has just only tried snake flavored ice cream.
Araxia_ has joined #ruby
<deryl>
i don;t see why you're so against someone learning more than one language actually
<jonathancutrell>
deryl: but the main differences between python and ruby are semantics, and learning semantics doesn't really make you that much more capable than you were in the beginning.
<deryl>
your logic path sort of stymies me
ilmenite has quit [Ping timeout: 246 seconds]
macmartine has quit [Remote host closed the connection]
<jonathancutrell>
deryl: I'm not against it; in fact, I do know a decent amount of ruby, python, php, and node-flavor JavaScript
macmartine has joined #ruby
<porton>
jonathancutrell: Have you wanted to say "syntax" instead?
kenperkins has quit [Quit: Computer has gone to sleep.]
<jonathancutrell>
porton: Well, semantics is more explanatory. Because there are different looping and data structures in ruby than in python
<deryl>
jonathancutrell: depends. sometimes a change to a more expressive syntax can change how you look at a problem. maybe something makes a bit more sense expressed a different way (and there is also the chance that you can't be as expressive using the syntax structure of a different language)
<deryl>
there are a whole slew of reasons for learning more than one language
porton has quit [Quit: Leaving]
<deryl>
same as with learning a different human vocal language
<jonathancutrell>
deryl: That would be more true if you were to learn, for instance, a functional programming language, versus a scripting/class-based language like ruby
<deryl>
i do not agree
<jonathancutrell>
deryl: Well, that's okay.
<deryl>
on the 'more true' part
<deryl>
well of course it is. this is an opinionated discussion. has been since the start :)
centipedefarmer has joined #ruby
hashpuppy has joined #ruby
<jonathancutrell>
deryl: to change from ruby to python, in most cases you can literally change function names and keywords and remove "end" from a file. Conceptually I can do the same thing with a computer re-compiler.
<jonathancutrell>
deryl: To change the solving of a problem from ruby to, say, erlang, or haskell, would take an entirely different set of changes.
<shevy>
except for certain parts like ... [for x in y where z is this and that]
<havenn>
def opinionated; [true, false].sample; end
<hashpuppy>
I want "class Job" with a name and filename var and a run method. i then want Job1 to inherit Job. then I'm going to add all Jobs to an array and iterate on them, calling job.run(). what's a good way to do inheritance or this type of interface in ruby?
<hashpuppy>
have class Job raise NotImplementedError on Run?
<jonathancutrell>
deryl: So learning a language in and of itself doesn't necessarily change the way you solve problems, unless that language at its conceptual core is different.
<shevy>
hashpuppy if you subclass, your child has all the methods the parent class has too
<deryl>
wow time to move back into the house. burning up out here. 22C with 64% humidity
<ramblex>
python list comprehensions are awesome
<deryl>
time to roll in
<hashpuppy>
yeah, but my parent is abstract
TheNumb has joined #ruby
koskoz has joined #ruby
<shevy>
what does that even mean :P
MasterIdler has quit [Quit: MasterIdler]
khakimov has joined #ruby
<shevy>
class Cat; end; class Garfield < Cat; end
<shevy>
def run; puts self.name+' runs away.'; end
<shevy>
already got that though. we call them ... modules
<hashpuppy>
shevy: gotcha. thanks
<hashpuppy>
i think i'll do that
the_jeebster has joined #ruby
bluOxigen has quit [Ping timeout: 265 seconds]
schovi has joined #ruby
moshee has quit [Ping timeout: 248 seconds]
ananthakumaran has quit [Quit: Leaving.]
fabrice31 has quit [Remote host closed the connection]
moshee has joined #ruby
davidcelis has joined #ruby
davidcelis has quit [Changing host]
davidcelis has joined #ruby
<shevy>
wow
<shevy>
just wow
<shevy>
stackoverflow:
<shevy>
class_eval(<<-END, __FILE__, __LINE__)
ph^ has quit [Remote host closed the connection]
ph^ has joined #ruby
amscotti has joined #ruby
amscotti has quit [Client Quit]
eurbach has quit [Quit: Leaving.]
<apeiros_>
shevy: normal here-doc syntax. the body of the here-doc starts only on the next line. as far as ruby is concerned, the string is in `<<-END`. you can treat that like any other string (i.e. chain methods etc.)
ananthakumaran has joined #ruby
jenglish has quit [Remote host closed the connection]
EskiMag has quit [Quit: EskiMag]
ph^ has quit [Ping timeout: 265 seconds]
rakm has joined #ruby
frogstarr77 has quit [Remote host closed the connection]
fjfish has quit [Remote host closed the connection]
williamcotton has joined #ruby
frogstarr78 has joined #ruby
savage- has joined #ruby
xaq has quit [Remote host closed the connection]
gilead_ has quit [Quit: Leaving]
zinjacoder_ has joined #ruby
moshee has quit [Ping timeout: 246 seconds]
robdodson has quit [Quit: robdodson]
moshee has joined #ruby
Ammar01 has quit [Quit: Leaving]
eywu has joined #ruby
senny has quit [Remote host closed the connection]
zinjacoder has quit [Ping timeout: 244 seconds]
bier has quit [Ping timeout: 244 seconds]
akemrir has quit [Quit: WeeChat 0.3.8]
yosafbridge has joined #ruby
ramblex has quit [Read error: Connection reset by peer]
dhruvasagar has joined #ruby
adeponte has joined #ruby
MasterIdler has joined #ruby
maletor has joined #ruby
IrishGringo has quit [Ping timeout: 244 seconds]
lorandi has joined #ruby
d-best has quit [Quit: Reconnecting]
d-snp has joined #ruby
bigfatfrock has left #ruby [#ruby]
kenperkins has joined #ruby
pr0zac0x2a has quit [Ping timeout: 244 seconds]
Johnny7956 has joined #ruby
alexim has joined #ruby
<Johnny7956>
Just a quick question - what is used in ruby for image processing?
Facefox has quit [Ping timeout: 244 seconds]
<Johnny7956>
Something kind of like the BitmapData class of AS3: help.adobe.com/en_US/FlashPlatform/reference/actionscript/3/flash/display/BitmapData.html is what I'm looking for
ramblex has joined #ruby
billiamii has joined #ruby
sspiff has quit [Remote host closed the connection]
Progster has joined #ruby
mneorr1 has joined #ruby
pr0zac0x2a has joined #ruby
DrShoggoth has joined #ruby
rippa has quit [Read error: Connection reset by peer]
rippa has joined #ruby
CheeToS has quit [Ping timeout: 248 seconds]
havenn has quit [Remote host closed the connection]
bier has joined #ruby
mneorr has quit [Ping timeout: 265 seconds]
yugui is now known as yugui_zzz
umttumt has joined #ruby
t0mmyvyo has joined #ruby
peanuts___ has joined #ruby
<peanuts___>
Hello all
<peanuts___>
I'm looking for a way to iterate on a letter though the alphabet
<peanuts___>
I know there is "a".next that gives "b"
tomb_ has quit [Quit: Computer has gone to sleep.]
<peanuts___>
but how to iterate by 5 letters by example ?
<axiak>
'a'.upto('z').each { |x| p x }
Facefox has joined #ruby
<axiak>
I don't know ruby, but that was my guess :P
mdw_ has quit [Remote host closed the connection]
<shevy>
whaaaat
<shevy>
why dont you know ruby
<shevy>
:(
mengu has quit [Quit: Konversation terminated!]
t0mmyvyo has quit [Client Quit]
<axiak>
I'm just starting
<shevy>
('a'..'z').to_a
<shevy>
hmm there is also .step
<axiak>
well you don't need the .to_a bit right?
<axiak>
if you're just iterating
<axiak>
('a'..'z').each { |x| p x } works
<peanuts___>
hum no
<peanuts___>
what I want it
<peanuts___>
it's to uncrypt a word
<axiak>
there's probably a tr in ruby for that...
<peanuts___>
by example I have "adasd" and it should correspond to "hello"
<axiak>
can you explain what you want your code to actually do
brianpWins has quit [Quit: brianpWins]
<axiak>
as opposed to saying "adasd" -> "hello"
<peanuts___>
I have a sentence like it "asdjasd askdja ieurisod aisduio iuoauf"
yankov has quit [Quit: yankov]
<peanuts___>
and inside I know by example I have the world "hello"
<axiak>
peanuts___: so do you want word-by-word translations?
<peanuts___>
so I want to take all the words with the same length of hello
<peanuts___>
and do the substitutions
<peanuts___>
by 1 letter next
<peanuts___>
2
<peanuts___>
until to find the solution
<peanuts___>
normally the algo to crypt it's very simple
<axiak>
I guess I don't understand, when would "adasd" correspond to "hello" ?
<peanuts___>
humm
<peanuts___>
it's a challenge for a job
<peanuts___>
the question is
<axiak>
can you link the challenge? :)
<peanuts___>
3. This text is scrambled with a very basic algorithm. It contains the word "question". The text of the question is inside, in French language:
<peanuts___>
Yr grkgr qr yn dhrfgvba rfg : nirm-ibhf hgvyvfr ebg13.pbz cbhe erfbhqer pr ceboyrzr?
<peanuts___>
so there is question inside the "secret" sentence
<axiak>
i see
<peanuts___>
it can only be the words dhrfgvba or ceboyrzr
<axiak>
it's probably dhrfgvba
fayimora has quit [Ping timeout: 248 seconds]
zomgbie has joined #ruby
<peanuts___>
I was just wondering if there was something in the Ruby API to iterate easily with letters
eywu has quit [Quit: Leaving.]
<peanuts___>
something like "a".next(2) => "c"
<shevy>
"a".next.next # => "c"
<peanuts___>
yes ...
<shevy>
no idea why next does not accept an argument
<peanuts___>
doesn't accept
<axiak>
probably because that doesn't make sense :P
<shevy>
oh
<shevy>
indeed
balki has quit [Remote host closed the connection]
<shevy>
.next 2 could also mean "return the next 2 characters"
tatsuya_o has quit [Remote host closed the connection]
tatsuya_o has joined #ruby
yankhates has joined #ruby
webusnix has quit [Quit: Ухожу я от вас (xchat 2.4.5 или старше)]
Vainoharhainen has quit [Ping timeout: 248 seconds]
zomgbie has quit [Ping timeout: 246 seconds]
yankhates has quit [Quit: leaving]
havenn has joined #ruby
mucker has quit [Quit: leaving]
yankhates has joined #ruby
mucker has joined #ruby
hadees has quit [Quit: hadees]
<peanuts___>
axiak, done I found
mucker has quit [Client Quit]
Facefox has quit [Remote host closed the connection]
mucker has joined #ruby
havenn has quit [Read error: Connection reset by peer]
Facefox has joined #ruby
Facefox has quit [Max SendQ exceeded]
<peanuts___>
they crypted the words by replacing the letter by the 13th next one
havenn has joined #ruby
<apeiros_>
peanuts___: that's called rot13
<apeiros_>
and String#tr - which somebody already mentioned - is a very easy way to "decrypt" that code.
yonggu has quit [Read error: Connection reset by peer]
brianpWins has joined #ruby
yonggu has joined #ruby
yankov has joined #ruby
<Johnny7956>
Sigma00: thanks. I've seen alot of people complain about rmagick but is it pretty standard?
tomb_ has joined #ruby
Araxia_ has quit [Ping timeout: 244 seconds]
<Sigma00>
Johnny7956: I have /no/ idea, sorry
<apeiros_>
Johnny7956: the problem with rmagick usually isn't rmagick but imagemagick.
Facefox has joined #ruby
Facefox has quit [Max SendQ exceeded]
tcopp has quit [Quit: Lost terminal]
quest88 has joined #ruby
cbuxton has joined #ruby
Nevrosis has joined #ruby
<Nevrosis>
geia sas
<Nevrosis>
xaax
Nevrosis has left #ruby [#ruby]
looopy has joined #ruby
<apeiros_>
o0
sbanwart has quit [Ping timeout: 265 seconds]
Eldariof-ru has quit [Ping timeout: 265 seconds]
davidcelis has quit [Ping timeout: 252 seconds]
<Johnny7956>
Hmm, surprisingly limited options there
Facefox has joined #ruby
hadees has joined #ruby
sbanwart has joined #ruby
sailias has quit [Ping timeout: 245 seconds]
adamkittelson has joined #ruby
heftig has joined #ruby
davidcelis has joined #ruby
workmad3 has quit [Ping timeout: 248 seconds]
blacktulip has joined #ruby
bradhe has quit [Remote host closed the connection]
qwerxy has quit [Ping timeout: 244 seconds]
Wry-mouth has joined #ruby
francisfish has joined #ruby
zomgbie has joined #ruby
brianpWins has quit [Quit: brianpWins]
c0rn_ has joined #ruby
Araxia_ has joined #ruby
tatsuya_o has quit [Remote host closed the connection]
dr_diamond has joined #ruby
dr_diamond has quit [Changing host]
dr_diamond has joined #ruby
brianpWins has joined #ruby
brianpWins has quit [Remote host closed the connection]
carloslopes has joined #ruby
brianpWins has joined #ruby
randomautomator has joined #ruby
bradhe has joined #ruby
zomgbie has quit [Ping timeout: 244 seconds]
Gurpartap has joined #ruby
tcopp has joined #ruby
<shevy>
Johnny7956 rmagick is kinda dead
<Gurpartap>
If a gem provides a cli command, and I want to call it programmatically, how do I set it's arguments programatically? (it uses optionparser, i believe)
<Johnny7956>
shevy, what would you recommend then?
mikepack has quit [Read error: Connection reset by peer]
<shevy>
hmm is this proper ...
<shevy>
Object.send :include, Foo
pablo_ has joined #ruby
peanuts___ has quit [Quit: Ex-Chat]
jrist is now known as jrist-afk
trend_ has quit [Quit: trend_]
mattonrails has joined #ruby
icooba has quit [Quit: icooba]
kenichi has joined #ruby
mikepack has joined #ruby
mikepack has quit [Read error: Connection reset by peer]
blacktulip has quit [Remote host closed the connection]
<apeiros_>
shevy: yes
Boohbah has quit [Ping timeout: 276 seconds]
Wry-mouth has quit [Remote host closed the connection]
akem has quit [Ping timeout: 240 seconds]
umttumt has quit [Remote host closed the connection]
jeer has quit []
wangr has quit [Ping timeout: 244 seconds]
Boohbah has joined #ruby
Gurpartap_ has joined #ruby
Progster has quit [Ping timeout: 240 seconds]
Gurpartap has quit [Disconnected by services]
Gurpartap_ is now known as Gurpartap
saschagehlich has quit [Quit: saschagehlich]
<Gurpartap>
So if there's a class that defines cli arguments with the "option" dsl (i guess using OptionParser), how do I set them manually, if I want to call a method in that class programmatically?
trend has joined #ruby
<Gurpartap>
Any ruby pro for this simple deal? ^
dr_diamond has quit [Quit: Bye !]
<shevy>
Gurpartap no idea how optionparser does it
<shevy>
I usually add a method when I need it to a class
centipedefarmer has quit [Quit: This computer has gone to sleep]
ackz has joined #ruby
weslly has left #ruby [#ruby]
Enekoos has joined #ruby
ukd1 has joined #ruby
havenn has quit [Remote host closed the connection]
keithcelt has quit [Remote host closed the connection]
jrist-afk is now known as jrist-mtg
mjb2k has joined #ruby
joel has joined #ruby
Markvilla has quit [Read error: Connection reset by peer]
sailias has quit [Ping timeout: 246 seconds]
Markvilla has joined #ruby
<joel>
I'm using threads in ruby (jruby) but I'm not quite understanding the join function. For every file I have, I start a thread to process that file while under X amount of total threads launched by me. I don't want to exit until all of my threads are done processing. Right now I'm just checking the list of total running threads. Is there a way with join where I can tell the main/parent thread...
<joel>
...not to exit?
<joel>
but also don't block, because you may need to launch more threads to keep processing files
<Paradox>
i would like an explanation of the join() as well
<Paradox>
i've always just sort of used it as a magic bullet and went wall-eyed when reading the documentation
<apeiros_>
joel: join stops your current thread until the thread you're joining is done
<apeiros_>
it doesn't stop any other thread, though.
<Paradox>
ah
<apeiros_>
so Array.new(10) { Thread.new do complex_calc end }.each(&:join) creates 11 threads (main thread + 10 in that array)
<Paradox>
thats a hell of a lot simpler than i thought
<joel>
apeiros_: right, so in this case calling join on a child thread would stop the parent thread, thus stopping more children thread from being made.
<apeiros_>
then stops the main thread until each of those 10 are done.
<apeiros_>
joel: yes, you join *after* you started all threads
<apeiros_>
joining immediately makes no sense.
<joel>
apeiros_: which doesn't work in this case, because I need to limit the amount of total threads. When one of my limit of two finishes, I want to start another.
<apeiros_>
e.g. Array.new(10) { Thread.new { complex_calc }.join } <-- this is stupid
<mjb2k>
joining is for when the parent cannot continue until the child has finished
<apeiros_>
joel: you're looking for a pool
jlogsdon has joined #ruby
<apeiros_>
joel: look into queues.
atmosx has joined #ruby
<shevy>
a parental pool
<shevy>
for childish children
Aristata has quit [Quit: Leaving.]
<mjb2k>
if you want to be able to create more threads while waiting on other threads to finish, I'm pretty sure joining is not what you want, unless you're joining on a thread-manager thread
Boohbah has quit [Remote host closed the connection]
centipedefarmer has joined #ruby
nightzpy_ has joined #ruby
<joel>
mjb2k: in which case I should probably just be using Queue from what I read about it.
<apeiros_>
generally you only join before exiting the app
<apeiros_>
otherwise you most likely do something wrong.
Boohbah has joined #ruby
Targen has quit [Quit: No Ping reply in 180 seconds.]
Targen has joined #ruby
stephenjudkins has quit [Quit: stephenjudkins]
hasrb has joined #ruby
nightzpy has quit [Ping timeout: 248 seconds]
tolland has left #ruby [#ruby]
jonathancutrell has left #ruby [#ruby]
graspee has joined #ruby
<joel>
yeah makes sense
<joel>
I need to stare at this queue doc a bit more so it makes sense to me.
<atmosx>
hello
<apeiros_>
joel: there's probably a thread pool gem
mneorr1 is now known as mneorr
tds has quit [Read error: Connection reset by peer]
<apeiros_>
yes. threads + queues are usually the building blocks of thread pools.
<apeiros_>
you feed the work to the queue, the worker threads shift the work off the queue, process it and push the result back on a 2nd queue
<joel>
apeiros_: gotchya
<joel>
thanks for the input everyone
<joel>
to work I go :)
andrewhl has joined #ruby
joel has quit [Quit: ChatZilla 0.9.88.2 [Firefox 12.0/20120420145725]]
axl_ has quit [Read error: Connection reset by peer]
<apeiros_>
but as said, you probably don't have to reinvent thread pools.
axl_ has joined #ruby
atmosx has quit [Ping timeout: 276 seconds]
mattonrails has quit [Remote host closed the connection]
alanp has quit [Ping timeout: 245 seconds]
balki has quit [Ping timeout: 245 seconds]
balki has joined #ruby
alanp has joined #ruby
tds has quit [Ping timeout: 245 seconds]
<mjb2k>
I've never used a Queue in ruby, but it looks like it's just a synchronized object, is there no way to explicitly synchronize in Ruby?
<mjb2k>
(I've actually done *very* little threading in ruby)
atmosx has joined #ruby
pdtpatrick has joined #ruby
IrishGringo has quit [Ping timeout: 244 seconds]
<apeiros_>
mjb2k: mutex, monitor
graspee has quit [Remote host closed the connection]
Axsuul has joined #ruby
<apeiros_>
if you build low level stuff, Thread.exclusive
tds has joined #ruby
srji has joined #ruby
havenn has joined #ruby
graspee has joined #ruby
AxonetBE has joined #ruby
<aces1up>
what is a good plugin that will convert text to the representative seconds? for instance if I want bi-daily I would want the amount of seconds for 12 hours or for string daily, i would want second for 24 hours
fulmato has joined #ruby
<mjb2k>
looks like Mutex covers typical usage, thanks
slainer68 has joined #ruby
<slainer68>
hi
suborbital1 has joined #ruby
xnm has joined #ruby
<slainer68>
is there a gem/lib to transform a timestamp in ms to a string format "HH:MM:SS" or I should do this manually ?
<mjb2k>
anybody know if MRI is going to allow parallel thread execution any time soon?
suborbital1 has left #ruby [#ruby]
workmad3 has quit [Ping timeout: 246 seconds]
suborbital has quit [Disconnected by services]
<mjb2k>
maybe Date in stdlib?
<xclite>
slainer68: TimeDate has something that does that I think
m_3 has quit [Ping timeout: 244 seconds]
kidoz has joined #ruby
<apeiros_>
slainer68: a number of ms is *not* a timestamp
<apeiros_>
that's a duration
<apeiros_>
time != duration.
<apeiros_>
and no, ruby does not have any duration or interval classes in core/stdlib
<slainer68>
apeiros_: you're right, i'm talking about duration, sorry :)
<apeiros_>
but it's trivial to do using divmod
<mjb2k>
oh, i misunderstood that, sorry
atmosx_ has joined #ruby
<apeiros_>
timestamps are the thing that e.g. Time.at accepts
uris has joined #ruby
AxonetBE has quit [Quit: Leaving.]
AxonetBE has joined #ruby
<apeiros_>
haha, ruby tops out at 2k threads :D
cmarques has joined #ruby
koskoz has joined #ruby
ringotwo has quit [Ping timeout: 252 seconds]
akem has joined #ruby
lorandi has quit [Quit: Leaving]
<mjb2k>
to format a duration in seconds, if you only need a resolution of seconds, how about pass it to Time and format out the time ignoring that the date happens to be in 1970 ?
<apeiros_>
mjb2k: don't. do. that.
<apeiros_>
instafail.
<apeiros_>
you end up using mktime and forgetting that you have a timezone… whoops
<apeiros_>
you end up suddenly having something > 24h… whoops
m_3 has joined #ruby
<apeiros_>
seriously. it's 3 lines of divmods to have sec, min, hours and days. 6 lines to have it in a method, including def+end
bglusman has quit [Remote host closed the connection]
<mjb2k>
ah yes, well that what happens with half thoughts, they give half answers (which are always wrong)
bglusman has joined #ruby
<apeiros_>
note that there is Time.utc which will avoid the TZ failure. it doesn't prevent the >24h failure, though.
<mjb2k>
yes you're right, it's really not that hard to get H:M:S from an int
bglusman has quit [Read error: Connection reset by peer]
axl__ has joined #ruby
axl__ has quit [Read error: Connection reset by peer]
bglusman has joined #ruby
kaiwren has joined #ruby
kaiwren has quit [Client Quit]
bglusman_ has joined #ruby
bglusman has quit [Read error: Connection reset by peer]
axl_ has quit [Ping timeout: 244 seconds]
dekroning has quit [Ping timeout: 265 seconds]
<apeiros_>
well, who knows. I hope to be able to take off for a month and work on https://github.com/apeiros/chronos/ full time during that month
<apeiros_>
I had it mostly done 4y ago, and then shit happened - I got hired :D
<apeiros_>
it absolutely beat the crap out of Date and DateTime back in 2008. I think it's still better today. and it includes duration & interval.
atmosx has quit [Quit: leaving]
atmosx_ has quit [Quit: leaving]
mohits has quit [Ping timeout: 240 seconds]
<mjb2k>
quite nice, good and *correct* time libraries are always appreciated
Eldariof-ru has quit []
<mjb2k>
I hate dealing with timezones
ph^ has quit [Remote host closed the connection]
<apeiros_>
yupp
axl_ has joined #ruby
<apeiros_>
DST is worse, though
ph^ has joined #ruby
<mjb2k>
oh yes
axl_ has quit [Read error: Connection reset by peer]
<apeiros_>
leap seconds are also quite a hassle
<daed>
i, too, hate dealing with timezones
<mjb2k>
I got lucky, though, on a recent project which our trainers use across 4 timezones, since we were on such a tight timeline to get it out, we ended up telling them all time are CST(or CDT) because that's where the main office is, deal with it
<shevy>
let's have only on timezone
<shevy>
*one
<daed>
mjb2k; that happened to us
sailias has quit [Quit: Leaving.]
<daed>
we just standardized on EST
<daed>
since 90% of the offices are there
<apeiros_>
that's what UTC is there for :-p
<apeiros_>
"oh-six-hundred zulu time!"
<mjb2k>
hey I'd love to just use UTC, but I'm in the minority on that one
<xargoon>
CET is the shit
<apeiros_>
well, about all date/time libs that support TZ usually work with utc internally.
<apeiros_>
timezones are just representational matter anyway.
<mjb2k>
first we need to get rid of daylight savings time, then we'll work on the 1 time zone thing next
<apeiros_>
nah, while TZ can be interfering, they're not much of a problem really.
<mjb2k>
yeah, moving forward I'm trying to get everything UTC, leave timezone in the presentation layer where it belongs, alas, legacy apps and databases...
<xargoon>
just store a timezone per user or whatever, and remembert to convert any times they enter to UTC
<xargoon>
remember*
<Paradox>
hah
<Paradox>
i had someone in #python argue with me that python is better for regular expressions than ruby
<Paradox>
hahaha
axl_ has joined #ruby
<shevy>
ok and did he say why
<Paradox>
yeah, he said you can make one really simply…
<Paradox>
uh…simpler than /.*/ ?
<Paradox>
lol
olrrai has joined #ruby
<shevy>
hmm speaking about regexes
<shevy>
warning: character class has duplicated range: /(.*)-([\d\.\w]+)/
<Paradox>
or %r{ } if that floats your boat
ringotwo has joined #ruby
<apeiros_>
and we care what some random idiot in some random place blabbers because?
<shevy>
I know someone here said \d is included by \w
<Paradox>
because it makes conversation
<shevy>
or vice versa?
<davidcelis>
shevy: yes, it is
<apeiros_>
shevy: yes, I told you that :)
<Paradox>
\w includes \d
<Paradox>
\d does not include \w
<davidcelis>
shevy: /w == [a-zA-Z0-9_]
<davidcelis>
\w*
<jlogsdon>
\w is any "word" character, \d is digits only
<jlogsdon>
efb twice!
<jlogsdon>
sweet
<shevy>
hmm and \d is ... 0,1,2,3,4,5,6,7,8 and 9?
Monofu has quit [Remote host closed the connection]
<jlogsdon>
what i love about guard is that its not specific to testing. you can use it to "guard" (monitor) any file/folder and do any action if things change
Monofu has joined #ruby
<jlogsdon>
and it integrates with a bunch of notification (toaster) platforms, so you can get immediate updates on what passed/failed without looking at hte console
snearch has joined #ruby
Monofu has left #ruby [#ruby]
emmanuelux has joined #ruby
Monofu has joined #ruby
eignerchris has joined #ruby
albemuth has quit [Quit: Computer has gone to sleep.]
albemuth has joined #ruby
<WhereIsMySpoon>
shevy: gimme a date and im there
<WhereIsMySpoon>
<3
workmad3 has joined #ruby
kenichi has quit [Remote host closed the connection]
Gurpartap has quit [Ping timeout: 245 seconds]
Monofu has quit [Client Quit]
yankhates has joined #ruby
TorpedoSkyline has quit [Ping timeout: 240 seconds]
bnagy has quit [Ping timeout: 256 seconds]
<mjb2k>
tests?? run it, does it work? Tested good ! lol
<davidcelis>
shevy: minitest
bnagy has joined #ruby
sepp2k has joined #ruby
kenichi has joined #ruby
nateberkopec has quit [Quit: Leaving...]
habib has joined #ruby
<habib>
Howcan i make SDL load?
jrist-mtg is now known as jrist
<habib>
it says "Load error: Couldn't load SDL
ukd1 has quit [Quit: ukd1]
tndrbt has joined #ruby
snearch has quit [Quit: Verlassend]
<habib>
HI Everyone. Help me to solve one problem
slainer68 has quit [Remote host closed the connection]
nanderoo has quit [Quit: Leaving.]
<habib>
i've installed rubygame gem
runa has joined #ruby
<runa>
heyas. what's the ruby 1.9 way to remove accents from accented letters?
<habib>
and when i'm trying to run someprogram using this lib it says that it couldn't load lib
geekbri has quit [Remote host closed the connection]
mayankkohaley has quit [Ping timeout: 265 seconds]
pu22l3r has joined #ruby
tcopp has left #ruby [#ruby]
wangr has quit [Ping timeout: 245 seconds]
EskiMag has joined #ruby
hatoishi has joined #ruby
d3c has joined #ruby
koskoz has joined #ruby
wunz has joined #ruby
hashpuppy has quit [Quit: hashpuppy]
Konboi has joined #ruby
tommyvyo has joined #ruby
xnm has joined #ruby
Morkel has joined #ruby
nilg has quit [Remote host closed the connection]
minijupe has quit [Quit: minijupe]
hatoishi has quit [Quit: leaving]
yankhates has joined #ruby
VictorMartins has quit [Quit: VictorMartins]
<rking>
Hrm. I'm writing a bit of a DSL (so that a physics guy can spec out some algorithms, and then I'll use his stuff as my test cases), and I want to give him the freedom to name vars like A_E (note the caps), but then later redefine them without warnings. How bad am I if I just wrap it in a silence_warnings do … end?
VictorMartins has joined #ruby
<rking>
I'd actually prefer to cherry-pick only the constant reassignment one.
<rking>
Oh wait, that's a Rails thing anyway.
yankhates has quit [Client Quit]
yankhates has joined #ruby
yxhuvud has quit [Ping timeout: 245 seconds]
andrewhl has quit [Remote host closed the connection]
<rking>
Boils down to setting $VERBOSE = nil.
Gavilan has joined #ruby
bglusman_ has quit [Remote host closed the connection]
Morkel has quit [Quit: Morkel]
bglusman has joined #ruby
runa has quit [Ping timeout: 244 seconds]
<RubyPanther>
rking: it depends somewhat on what you mean by "a DSL" as that has come to mean a wide variety of different things.
<rking>
Yep. Here's all I mean. I want the physics guy to say stuff like:
<rking>
r_r = 360; v = 5; A_E = 0.58; A_C = 0.613; function 'P_D', result: 123, units: 'kWh'
<rking>
(Semis would be actual newlines)
nateberkopec has quit [Quit: Leaving...]
<rking>
Then inside my implementation I'll run P_D as a method and assert that it returns 123 kWh
<apeiros_>
rking: can you get him to do c.r_r = 360, c.A_E = 0.58 etc.?
<rking>
But his vars use caps differently than ruby.
hemanth has quit [Read error: Connection reset by peer]
<apeiros_>
(c as in calculation, or whatever)
<rking>
apeiros_: I'd definitely rather not.
hemanth has joined #ruby
<apeiros_>
rking: how about: let do; r_r 360; A_E 0.58; …; end ?
<RubyPanther>
rking: so then you can just do like foo.instance_variable_set "@#{var_containing_string_r_r}", var_with_360
<apeiros_>
i.e., a block in which all assignments are done
nateberkopec has joined #ruby
<rking>
apeiros_: Possibly.
<RubyPanther>
And then you can allow a wide variety of naming
<rking>
I don't want him to have to worry about what's a const and not.
<rking>
I.e., he'll work it out by putting all the consts at the top and never touching them, then the caps/not-caps thing is only a Ruby custom, not actually his custom.
sailias has joined #ruby
sailias has quit [Client Quit]
<rking>
apeiros_: Oh wait, I missed what you were saying. You're suggesting method_missing?
nateberkopec has quit [Client Quit]
bglusman has quit [Ping timeout: 265 seconds]
<rking>
That would actually work just fine.
<apeiros_>
yes
<apeiros_>
it won't work with foo= methods, though
<rking>
Then we could have the ='s or not.
<apeiros_>
(since they need a receiver)
<rking>
Oh it won't?
<rking>
Aha.
trend has quit [Read error: No route to host]
<rking>
OK, I'm sure he can live without =. =)
<apeiros_>
no. x = y is always lvar assignment. X = y is always constant assignment.
trend has joined #ruby
<rking>
apeiros_, RubyPanther: Thanks. This is going to be a good thing.
<rking>
Then as he gets more advanced I'll throw in the idea of loops and stuff.
<rking>
"DSL"s FTW.
<rking>
OK, what about the assertions? What would be a nice looking syntax for it?
<rking>
function 'P_D', result: 123, units: 'kWh'
trend_ has joined #ruby
trend has quit [Read error: No route to host]
trend_ is now known as trend
<rking>
(Is what I was starting with. I'm sure it can be cleaned up a lot)
banghouse has quit [Remote host closed the connection]
netogallo has quit [Remote host closed the connection]
<apeiros_>
rking: take a look at the units gem too
<rking>
apeiros_: Oh, big thanks.
<rking>
I was literally sitting here thinking about how I wanted to handle units.
<apeiros_>
result: 123.kWh (not sure it works straight like that)
tatsuya_o has joined #ruby
<rking>
Because I can't be throwing around 14 and stuff.
<rking>
OK, perfect.
<shevy>
RubyPanther is back again!
<rking>
These Ruby types of people fail to impress me only rarely.
<rking>
(That's what I have shevy for.)
fulmato has quit [Ping timeout: 265 seconds]
pr0zac0x_ has joined #ruby
<shevy>
I am the secret weapon
<shevy>
when we are going to win a war, better don't use me
<apeiros_>
shevy: you're the secret BFG?
<shevy>
but when we are about to lose the war, pull out a shevy as the secret weapon!
<RubyPanther>
If I was a cartoon squirrel it would be even more fun.
<shevy>
when you aren't among the genius, but you don't want to be among the idiots either, you simply have to be ... different
Synthead has quit [Read error: Connection reset by peer]
pr0zac0x2a has quit [Ping timeout: 245 seconds]
pr0zac0x_ is now known as pr0zac0x2a
zommi has quit [Remote host closed the connection]
<RubyPanther>
Then you must be sub-genius.
kidoz has quit [Quit: Ухожу я от вас]
Markvilla has quit [Quit: Markvilla]
chson has quit [Remote host closed the connection]
`brendan has quit [Quit: - nbs-irc 2.39 - www.nbs-irc.net -]
srji_ has joined #ruby
ph^ has joined #ruby
EskiMag has quit [Quit: EskiMag]
Jackneill has quit [Read error: Connection reset by peer]
wvms has joined #ruby
<WhereIsMySpoon>
shevy: when are we going to get married?
srji has quit [Ping timeout: 265 seconds]
<apeiros_>
you found your spoon?
<shevy>
WhereIsMySpoon when you find your spoon
PaciFisT has quit [Quit: Leaving.]
Helius has joined #ruby
ZachBeta has joined #ruby
<WhereIsMySpoon>
shevy: you are my spoon <£
<WhereIsMySpoon>
*<3
* apeiros_
must go watch porn to get that pic out of his head…
timonv has joined #ruby
havenn has joined #ruby
Guedes has joined #ruby
Guedes has quit [Changing host]
Guedes has joined #ruby
<rking>
WhereIsMySpoon: How do you type "#"?
Konboi has quit [Remote host closed the connection]
<rking>
Hrm, Ruby'
<rking>
s doing something I don't understand: x = :a; 'b'+x
`damien has joined #ruby
<rking>
That fails because it can't convert Symbol into String, but there's a Symbol#to_s you can call explicitly.
villainous has joined #ruby
<apeiros_>
String#+ doesn't go and call to_s for you
<rking>
Right, but it does something.
<apeiros_>
it would call to_str for you.
<rking>
Aha.
<rking>
NoMethodError: undefined method `to_str' for 23:Fixnum
<rking>
So how does 'a'+23 work?
<apeiros_>
yes. that's why 'a'+23 won't work either.
<apeiros_>
it doesn't
<rking>
Oh, it doesn't.
<rking>
Hehe
<rking>
class Fixnum; def to_str; to_s end end # Ahh, Perl-like. =)
<`damien>
Hey all, I ran across a weird bit of ruby code today: "method_one and return or method_two". Wouldn't this always execute method_one and method_two and return the result of method_two?
jrist is now known as jrist-afk
havenn has quit [Remote host closed the connection]
hatoishi has joined #ruby
<shevy>
I guess it depends on what method_two does
<apeiros_>
`damien: no
<apeiros_>
evaluation order is: (method_one and return) or method_two
<`damien>
Interesting
<apeiros_>
so if method_one returns a falsy value, then method_two is executed. otherwise it return nil and does not execute method_two.
<apeiros_>
but it's horrible code.
<`damien>
I agree
<`damien>
Both methods have nil return values
<shevy>
hmm actually
<`damien>
So I just wanted a sanity check to see if I wasn't crazy
<shevy>
that code does not even run for me `damien
<apeiros_>
and whoever wrote that should be flayed alive if he put it into production code…
<apeiros_>
rails has tons of horrible code in it :(
<shevy>
hehehehe
<`damien>
Haha, I've seen some of irt
<`damien>
*it
<`damien>
I remember having a very interesting time fixing a bug for stale AR connections
<apeiros_>
worst thing I ever came across was a method that seemingly had an infinite recursion. upon inspection of the methods it called, I noticed that one of the methods it called *redefined* the calling method.
<`damien>
Oh god
<shevy>
haha
<shevy>
awesome!
<shevy>
that's what you call DYNAMIC CODE man
<`damien>
Last place I worked at we found a HTTP header that caused rails to error out :(
<shevy>
it'll all make sense after some bottles of beer :)
<apeiros_>
`damien: haha
looopy has joined #ruby
<`damien>
it was a valid header, too
carlyle has quit [Remote host closed the connection]
<apeiros_>
`damien: another issue we had: I think it was in 3.1, when we had sql containing binary data - the logger would crash
<`damien>
that being said, I both love and hate rails for it's magical goodness
<apeiros_>
I think that logger-patch is still in our codebase.
<`damien>
lolwut
<apeiros_>
yeah, the logger wrote utf-8. and it crashed because the binary data was obviously not valid utf-8.
<`damien>
Hah!
<`damien>
Don't get me started on UTF-8 issues
<shevy>
May The Love of Encoding be with us.
suborbital has joined #ruby
<`damien>
Fun fact, in ruby 1.9: String.new.encoding != "".encoding
<shevy>
I got two surprises so far... psych.rb complaining about invalid bytes when I try to write a .yml file
<shevy>
and the other one is a script that somehow no longer can find the proper lines in a file
<apeiros_>
ah well, the more annoying issue we had with encoding was oracle. it can't properly convert KD normalized utf-8 to iso-8859-1. And for fun's sake, file uploads in firefox use KD normalized filenames…
<shevy>
it worked fine on 1.8.7 :(
<`damien>
Haha
<`damien>
I recently started picking up C so I could take a closer look at the ruby internals
red-panda has quit [Remote host closed the connection]
hunglin1 has joined #ruby
<`damien>
C is turning out to be much easier to pick up than I was expecting
<Tasser>
`damien, I think jruby is kinda fun :-)
red-panda has joined #ruby
<shevy>
if C wouldn't have had pointers, it would be a really simple language
<`damien>
I love the idea of JRuby, but I work off a mac and Java on a mac is sadface
ph^ has quit [Remote host closed the connection]
hunglin has quit [Ping timeout: 248 seconds]
<`damien>
Apple and their funky java implementation
axl_ has joined #ruby
<Tasser>
huh?
ph^ has joined #ruby
<`damien>
Mac OS doesn't use sun java
<`damien>
or openjdk
<`damien>
it's their own distro
<mjb2k>
I thought they dropped all the funny Apple Java stuff
<apeiros_>
wtf google groups? I can see 8 (eight!) messages on a fully blown up windows on a 1440x900 screen… srsly, wtf?!?
<`damien>
not as far as I'm aware
<mjb2k>
i know they still repackage it, but I think all the customization to the jvm got left behind with PPC
<`damien>
Hm, I take that back
<`damien>
running java -version get's me java hotspot vm
<`damien>
Once I'm done with C i guess I'll start picking up JRuby/java
dhruvasagar has quit [Ping timeout: 265 seconds]
pr0zac0x2a has quit [Ping timeout: 248 seconds]
<mjb2k>
the PPC Mac Java was an embarrassment to all things binary
silentpost has quit [Ping timeout: 240 seconds]
<`damien>
Yeah
the_jeebster has quit [Quit: Leaving.]
<`damien>
Do you know if there's a way to get java 7 running on a modern mac?
hatoishi has left #ruby [#ruby]
<`damien>
I've never had luck getting the binaries to run properly
ph^ has quit [Ping timeout: 252 seconds]
<apeiros_>
`damien: there are plenty of VMs to my knowledge
grantbdev has joined #ruby
uris has quit [Ping timeout: 244 seconds]
kvirani has quit [Remote host closed the connection]
<`damien>
Do tell. The only one's I've seen are Sun's and OpenJDK
alanp_ has joined #ruby
<`damien>
Then again I'm not that familiar with the java landscape
uris has joined #ruby
pr0zac0x2a has joined #ruby
<apeiros_>
I'm not familiar with it either, but to my knowledge, oracles jvm should run on osx.
<Tasser>
runs just fine on linux, so I use jruby when possible/useful
banseljaj is now known as imami|afk
billiamii has quit []
v0n has quit [Quit: Quitte]
<bigoldrock>
Is there some way to re-use an object, calling one of its methods with a change to one of the variables?
yankhates has quit [Ping timeout: 245 seconds]
<Tasser>
bigoldrock, change the object, call again?
<bigoldrock>
I don't know how to do that without instantiating a new object
<Tasser>
what's the whole story?
<WhereIsMySpoon>
rking: its next to my enter key
<mjb2k>
I dont get to spend much time on my personal Mac and it's really behind in updates, so I haven't seen anything about Java 7 there
<WhereIsMySpoon>
i have a uk keyboard
<apeiros_>
bigoldrock: you're giving very little details… how do you expect us to answer?
balki has quit [Ping timeout: 245 seconds]
alanp has quit [Ping timeout: 245 seconds]
<bigoldrock>
sorry about that.
xnm has quit [Ping timeout: 244 seconds]
<shevy>
hey bigoldrock
<shevy>
can you change your nick to ...
<shevy>
bigoldduck?
<WhereIsMySpoon>
lol
apeiros_ is now known as proc{|x|x[]}
proc{|x|x[]} is now known as proc{|x|x[y]}
<proc{|x|x[y]}>
isn't this an awesome nick?
<WhereIsMySpoon>
o.o
<shevy>
bigoldrock well, I usually define a method called .reset if I have to reuse an object
<aces1up>
I have a module where I have declared an constant.. when I include it in a class and do MyModule::MyModuleConstant it keeps looking for it on the class I have included the module in. what am I doing wrong?
<shevy>
WhereIsMySpoon, he wants to reuse the same object
<bigoldrock>
shevy is right
<proc{|x|x[y]}>
bigoldrock: that depends on the API of HttpConnect
kah_ has joined #ruby
zinjacoder_ has quit [Ping timeout: 246 seconds]
<proc{|x|x[y]}>
you'd have to check the docs of it and see, whether it provides a setter for the password
<shevy>
aces1up, if you included the module in the class, why do you want to access it via Modulename:: still ?
Xaitec has joined #ruby
axl_ has quit [Quit: axl_]
shadoi has quit [Remote host closed the connection]
<proc{|x|x[y]}>
if not, you can go crazy on it and check in what ivar the pw is stored (likely in @password) and use instance_variable_set to assign a new value to it.
<proc{|x|x[y]}>
but that's generally not a good idea.
shadoi has joined #ruby
Xaitec has quit [Read error: Connection reset by peer]
<proc{|x|x[y]}>
bigoldrock: why do you wish to reuse the object anyway, instead of creating a new one?
<kah_>
I have a hash, multi-selecet, but when I submit it adds a "---" and a - between each part of the array, any idea why?
babonk has joined #ruby
<bigoldrock>
a better example is that I already have the connection and want another http uri
davidw has joined #ruby
<proc{|x|x[y]}>
kah_: what?
<proc{|x|x[y]}>
kah_: are you talking about a form on a website or something?
<bigoldrock>
now, use the same connection & obj with a new uri
alanp has joined #ruby
<kah_>
proc{|x|x[y]}: haha ok let me rephrase
<WhereIsMySpoon>
bigoldrock: as others have said, that depends if HttpConnect allows it
<proc{|x|x[y]}>
bigoldrock: same answer
balki has joined #ruby
<proc{|x|x[y]}>
kah_: you know, you *really* should not leave out like *all* relevant info (hint, that you're talking about a form *is* relevant, what framework you use *is* relevant, etc.)
<bigoldrock>
if it is my class, how do I make it allow this?
<kah_>
proc{|x|x[y]}: ah shit, I'm in the wrong one
<kah_>
should be in rails haha
<proc{|x|x[y]}>
bigoldrock: add a method that allows you to set the value
<shevy>
bigoldrock just add methods that do that for you
Helius has quit [Remote host closed the connection]
<proc{|x|x[y]}>
bigoldrock: e.g. often simply by having an attr_accessor for it
<WhereIsMySpoon>
make a method like HttpConnect::Reconnect(newUri)
<WhereIsMySpoon>
*new_uri
<bigoldrock>
cool, thanks!
tectonic has quit [Ping timeout: 244 seconds]
<WhereIsMySpoon>
which takes the previous pw/user that were stored
<proc{|x|x[y]}>
kah_: fail :-p
<WhereIsMySpoon>
and uses the new uri
<WhereIsMySpoon>
or smth
perry has quit [Ping timeout: 265 seconds]
tatsuya_o has quit [Remote host closed the connection]
ahuman has quit [Quit: No Ping reply in 180 seconds.]
perryh has joined #ruby
tectonic has joined #ruby
<shevy>
yeah
<shevy>
use smth
<shevy>
def smth
<shevy>
puts 'in smth now'
<shevy>
end
VictorMartins has quit [Quit: Sleeping]
srji_ has quit [Quit: leaving]
<mjb2k>
def jam
<mjb2k>
puts 'word'
<mjb2k>
end
davidcelis has joined #ruby
davidcelis has quit [Changing host]
davidcelis has joined #ruby
<shevy>
whoa
<shevy>
now we can do
<`damien>
Unrelated to my previous discussion: has anyone messed around with Goliath at all?
<shevy>
smth && jam
<shevy>
what is Goliath
<shevy>
and who picks such a non descriptive name :(
<`damien>
It's basically an EventMachine server that wraps callbacks in fibers
<`damien>
end goal being synchronous looking code that works asynchronously
davidw is now known as Guest31653
<davidcelis>
lol EventMachine
<`damien>
Don't diss da' EM
<`damien>
Granted I wouldn't want to be maintaining that thing
<`damien>
Codebase is gnarly
danheberden has quit [Quit: oh noes]
j0nathan_ has joined #ruby
DMKE has joined #ruby
danheberden has joined #ruby
zinjacoder_ has joined #ruby
<shadoi>
Celluloid::IO is a much cleaner implementation of the same goal.
<shadoi>
But Reel isn't quite done.
DrShoggoth has quit [Quit: Leaving]
<`damien>
Isn't Celluloid based on an actor pattern?
<shadoi>
Yes
<shadoi>
concurrency and actors
<`damien>
Neato. I've heard of it though I haven't really seen much usage of it in other projects I've come across
<shadoi>
It's still quite young.
<`damien>
Neat.
<`damien>
I hope they get somewhere. Concurrency in ruby is kinda painful through stuff like EM
<otters>
EM hurts
<shadoi>
yeah it's super nasty to try to bolt it on.
<`damien>
Tell me about it.
<`damien>
sintatra_async. I shall say no more.
<shadoi>
I'm currently converting all my EM servers to Celluloid::IO managed by a DCell node
<proc{|x|x[y]}>
o0
<proc{|x|x[y]}>
shadoi: what kind of EM servers do you have?
<shadoi>
DNS, TFTP, DB, DHCP
<proc{|x|x[y]}>
ah, TFTP you dabbled yesterday or today, no?
<`damien>
A DHCP server in ruby?
<`damien>
That sounds interesting
<`damien>
What do you use it for?
<proc{|x|x[y]}>
custom DNS server? why? you work for 37 signals? :)
<shadoi>
cloud provisioning stack
<mjb2k>
wait a minute, `damien, do say more about sinatra. I just ran across that recently and was looking forward to giving it a try for quick and easy REST services
babonk has left #ruby [#ruby]
<proc{|x|x[y]}>
mjb2k: sinatra is nice for smaller apps
<mjb2k>
is that not such a good idea?
<`damien>
mjb2k: Sinatra is great, and it's fine for small stuff
<proc{|x|x[y]}>
it's like 10min to learn
<`damien>
Yep
<`damien>
I love Sinatra
<shadoi>
proc{|x|x[y]}: all of the services use the same database, via zeromq, it makes everything much more reliable without having to juggle configuration files and tons of disparate backing stores.
jimeh has quit [Ping timeout: 244 seconds]
Guest31653 has quit [Ping timeout: 244 seconds]
<shadoi>
mjb2k: sinatra is great.
<proc{|x|x[y]}>
shadoi: ok… interesting choice, still. I mean writing those servers properly…
<`damien>
But if you have an API with more than a few resources you'd probably be better off with something like rails-api
bluenemo has joined #ruby
bluenemo has quit [Changing host]
bluenemo has joined #ruby
<mjb2k>
oh ok, I wasn't sure if you were saying it was something nasty of what
<`damien>
Oh, no
<`damien>
sinatra is fine
<proc{|x|x[y]}>
are there actually test suites to run a DNS server against?
d3c has quit [Quit: Quit]
<`damien>
the sinatra_async gem just bolts EM and async response methods to it
<`damien>
which gets painful
<`damien>
error prone
<mjb2k>
yea and I was only looking at it for small simple services
<`damien>
and buggy as all hell
anekos has quit [Remote host closed the connection]
<`damien>
Go for it!
<`damien>
I think Sinatra is an excellent example of some quality ruby code
<shadoi>
proc{|x|x[y]}: I only need enough functionality to provide PXE essentially. I've only implemented the bare essentials, which results in most of the services being about… oh… 200-ish lines of ruby. :)
anekos has joined #ruby
<`damien>
shadoi: I'm still curious, what's your use-case for a DHCP server in ruby/EM?
albemuth has quit [Quit: Computer has gone to sleep.]
<mjb2k>
we use Mule and Jersey at work and it can get a little irritating writing a book of xml just to get a simple service going
villainous has quit [Quit: villainous]
<shadoi>
actually I think I ripped EM out of the DHCP server… I'm still going to move it to celluloid::io so I can have some nice service control and management capabilities.
<`damien>
Hah!
<`damien>
And here I was hoping you had a nifty little DHCP app up your sleve
<shadoi>
There are a few DHCP and DNS servers written in ruby
Guedes has quit [Quit: Saindo]
<shadoi>
The TFTP options are quite a bit worse.
<`damien>
Do any of them have a nice admin GUI? That's mainly what I'd want out of a ruby based DHCP server.
<shadoi>
None.
<`damien>
That's a shame
ukd1 has joined #ruby
hadees has quit [Quit: hadees]
<`damien>
The DHCP interface for all the routers I've ever had is painful
<shadoi>
I'm planning to do a UI soon, but it'll be fairly focused on our product architecture, so probably not so generically useful.
<`damien>
Fair enough
<shadoi>
Maybe once I have more time (if ever) to open source it.
spinst3r has joined #ruby
<proc{|x|x[y]}>
shadoi: your company still need ruby coders? sounds like you're having a fun job :D
<`damien>
no worries, I was mainly just asking out of curiosity
spinst3r has quit [Client Quit]
<proc{|x|x[y]}>
(not a serious inquiry… still…)
<shadoi>
proc{|x|x[y]}: I would love to find some more people to work on this stuff, I need people with really solid operations/sysadmin knowledge.
<`damien>
proc{|x|x[y]}: any medium to large company that uses ruby for devops/sysadmin-y stuff will have lots of interesting use-cases for ruby
proc{|x|x[y]} is now known as apeiros
ramblex has quit [Quit: ramblex]
<apeiros>
meh, it's a fun nick, but I'm so not used to read it :D
<shadoi>
:)
<shadoi>
didn't realize it was you.
<`damien>
shadoi: what's your role at your current company? what kind of stack are you working with?
<apeiros>
also it somehow always puts my mind into ruby-parsing-mode, which messes with normal reading ;-)
Synthead has joined #ruby
Beoran_ has quit [Ping timeout: 246 seconds]
<shadoi>
apeiros: yeah! I kept trying to parse it myself.
<Synthead>
does net-sftp allow ports other than 22?
<shadoi>
`damien: cloudscaling.com
<apeiros>
shadoi: should I ever be looking for a new job, I'll probably try to contact you :D
<`damien>
lol webscale
<`damien>
What do you guys use for configuration management? chef? puppet?
<shadoi>
I basically build all our APIs, data-model and provisioning system to deploy openstack (or whatever else)
<shadoi>
chef, but I've been very careful to not tie ourselves to it.
hunglin1 has quit [Quit: Leaving.]
<`damien>
Chef is neat, but not so great at certain things
<shadoi>
yeah
<`damien>
Last place I worked at we spent a lot of time extending chef to deal with server clusters
<`damien>
and it's pretty much ignorant of topology in a server stack out of the box :(
pk1001100011 has quit [Ping timeout: 244 seconds]
<shadoi>
basically I ripped chef-server out of the mix and implemented a very simple version of their database.
<shadoi>
So I can feed the data to any config management tool
<`damien>
I've heard some interesting stuff about people putting together a combo chef-solo/mcollective setup