Ontolog has quit [Read error: Operation timed out]
DrShoggoth has joined #ruby
two_OMind1 has joined #ruby
cdavaz has quit [Read error: No route to host]
cdavaz has joined #ruby
<two_OMind1>
who am I?
<Iszak>
So I have this gem i want to install, but apparently it's not for my platform. I want to force install it, I've tried -f but it still doesn't install. Help?
DrShoggoth has quit [Read error: Connection reset by peer]
davidpk has joined #ruby
two_OMind1 has left #ruby ["JOIN #ruby"]
cdavaz is now known as Ontolog
jimeh has quit [Ping timeout: 248 seconds]
jfelchner has quit [Ping timeout: 244 seconds]
soulcake has joined #ruby
fgsda has quit [Ping timeout: 252 seconds]
mrsolo has quit [Quit: Leaving]
Iszak has quit [Quit: Page closed]
<ctor>
If I have previously defined @url, @method, and @data as strings, what is wrong with this statement? url = url + method=='GET'? '&'+data : ''
<mdszy>
you have to put the @ signs
<ctor>
Even though they were previously defined with the @ signs?
<mdszy>
Yes.
<ctor>
k
<mdszy>
That's the name of the variable
<mdszy>
that's like saying
<mdszy>
my_variable
<mdszy>
you define it as
<mdszy>
and trying to use it as
<mdszy>
this_is_my_variable
xaq has quit [Read error: Connection reset by peer]
krzkrzkrz has joined #ruby
<ctor>
I see. When do you use a variable without the @?
<mdszy>
When it's a local variable
<mdszy>
@-variables are instance variables
xaq has joined #ruby
<mdszy>
used inside of classes
<ctor>
oooh
<mdszy>
if this isn't inside of a class, you shouldn't have any @-sign
<mdszy>
brb
<ctor>
It is, but I'm writing each line out in irb to test something
<ctor>
I left out the class part
fflush has quit [Quit: fflush]
ackz has quit [Quit: Leaving...]
krz has quit [Ping timeout: 244 seconds]
krzkrzkrz is now known as krz
mwilson_ has quit [Excess Flood]
mwilson_ has joined #ruby
<mdszy>
back
<ctor>
The example I used to figure this out was confusing. So class foo // @var = '' // def bar(var) //end //end refers to the wrong var?
<mdszy>
ctor: They're different variables. var is just the argument passed to bar(). @var is nothing.
<mdszy>
One sec, I'll have an example in just a minute
<mdszy>
brb again
mrdodo has joined #ruby
<ctor>
k
Husel has joined #ruby
<mdszy>
back
chriskk has quit [Ping timeout: 246 seconds]
ckrailo has quit [Quit: Computer has gone to sleep.]
<mdszy>
ctor: Variables that are arguments to methods are never initalized first
<mdszy>
and they shouldn't be instance variables
RORgasm has joined #ruby
<mdszy>
in ruby, you don't need to initalize variables like that
csamuelson has joined #ruby
jobicoppola has quit [Client Quit]
theskyisdrunk has quit [Quit: Leaving.]
<ctor>
suppose this file will be passed around and the guy wants me to set a few variables at the start of the class that users can alter and will propagate throughout
<ctor>
Will that work?
<ctor>
That's why I have @var after class, then passed as an argument to defs
ViperMaul has quit [Read error: Connection reset by peer]
samuelkadolph has quit [Ping timeout: 265 seconds]
jchauncey has quit [Client Quit]
csamuelson is now known as Rious
samuelkadolph has joined #ruby
alup has quit [Ping timeout: 244 seconds]
alup has joined #ruby
chriskk has joined #ruby
zrail|home has joined #ruby
syamajala has quit [Remote host closed the connection]
kenichi has quit [Remote host closed the connection]
Boondox has quit [Quit: Leaving]
maltray has joined #ruby
locriani has joined #ruby
<maltray>
Hello guys, I was wondering, is there any kind of let for rspec in ruby (not rails)?
<maltray>
I tried googling about it but its damn hard to find something that's not related to rails lol
<mdszy>
maltray: A testing framework?
<maltray>
mdszy no, let, you know.. when i write tests on rails with rspec im allowed to use let(:something) { this is what it has}
<maltray>
but i dunno why i cant do that just in ruby
<mdszy>
Oh, I have no clue then.
monkegjinni has quit [Remote host closed the connection]
MatthewGA has quit [Ping timeout: 246 seconds]
M3nti0n is now known as M3nti0n|off
<maltray>
i need like fixtures, but meh, its hard to try to find something that's JUST for ruby and not for ruby on rails
<mdszy>
maltray: another framework? :P
<maltray>
also, google wouldnt take my + !rails like i used sometimes lol
<maltray>
you mean changing rspec?
eywu has quit [Quit: Leaving.]
<maltray>
mdszy; thats not what i want to do though, as im a noob in ruby im making this project to get better, too :)
Ontolog has quit [Read error: No route to host]
<maltray>
and in my job we use rspec for testing so i thought it would be a good idea to use it here
<mdszy>
Ah
<mdszy>
I don't use Rspec
Dave has joined #ruby
sei has joined #ruby
Dave is now known as Guest81473
hakunin_ has joined #ruby
Markvilla has joined #ruby
BeLucid has joined #ruby
hayer has joined #ruby
KylieBrooks has quit [Read error: Connection reset by peer]
stefanp_ has quit [Read error: Connection reset by peer]
stefanp has joined #ruby
stefanp has joined #ruby
dangerousdave has quit [Read error: Connection reset by peer]
hakunin has quit [Read error: Connection reset by peer]
BeLucid_ has quit [Read error: Connection reset by peer]
<hayer>
Why is the tryruby.org so slow? I mean, really sloooow..
<mdszy>
hayer: Solution: IRB
<hayer>
IRB? Interactive Ruby Bashshell? >_>
indeterminate has quit [Ping timeout: 265 seconds]
<hayer>
mdszy
<mdszy>
Interactive Ruby
<mdszy>
it's like Tryruby
<mdszy>
but on your computer
<mdszy>
unless you're on windows
oscardelben has joined #ruby
<mdszy>
in which case I don't understand why you're trying to use Ruby
<hayer>
the problem is that i want to follow the tutorial.. >_>
<mdszy>
well then you're stuck with it, or find a real tutorial
<hayer>
any links or tips?
iamjarvo has quit [Quit: Computer has gone to sleep.]
<ctor>
mdszy: just got back from a phone call. In the example you linked you put the variable in the initialization for the user to alter.. What was the my_class_instance part? A demonstration of something else?
<mdszy>
hayer: Look up Mr. Neighborly's Humble Little Ruby Book
<mdszy>
hayer: I used that book, love it to death
<mdszy>
ctor: That means that if you have like
<mdszy>
my_class_instance = MyClass.new
emmanuelux has quit [Ping timeout: 246 seconds]
hrs_ has joined #ruby
<mdszy>
you can do
<mdszy>
my_class_instance.var = "whatever"
<mdszy>
and you can change the value of @var in MyClass
<ctor>
Ah
<mdszy>
ctor: If you don't understand the very basics of Ruby, you should just look up a book about it.
<mdszy>
there are a bunch of free ones online
<ctor>
Will do.
linoj has quit [Quit: linoj]
tiripamwe has quit [Quit: Leaving]
* ctor
will rtfm.
tiripamwe has joined #ruby
<mdszy>
good idear
artOfWar_ has quit [Ping timeout: 250 seconds]
ryanf has quit [Quit: leaving]
g_rotbart has quit [Read error: Connection reset by peer]
schickung has joined #ruby
g_rotbart has joined #ruby
maltray has quit [Quit: Leaving]
sebicas has quit [Quit: sebicas]
manizzle_ has quit [Read error: Operation timed out]
niklasb has quit [Read error: Operation timed out]
Markvilla has quit [Quit: Markvilla]
hibariya_ has joined #ruby
Osum has quit [Ping timeout: 255 seconds]
Markvilla has joined #ruby
wmoxam has joined #ruby
maletor has joined #ruby
Markvilla has quit [Client Quit]
shadoi has quit [Ping timeout: 248 seconds]
adamkittelson has joined #ruby
apok_ has joined #ruby
Z_Mass has quit [Quit: Leaving]
Araxia has joined #ruby
apok has quit [Read error: Operation timed out]
sei has quit [*.net *.split]
chson has quit [*.net *.split]
angelixd has quit [*.net *.split]
bowlowni_ has quit [*.net *.split]
jmccune has quit [*.net *.split]
Poapfel has quit [*.net *.split]
anothervenue has quit [*.net *.split]
udante has quit [*.net *.split]
Fretta has quit [*.net *.split]
idoru has quit [*.net *.split]
pk1001100011 has quit [*.net *.split]
wangr has quit [*.net *.split]
hilolih has quit [*.net *.split]
RichieEvans has quit [*.net *.split]
alindeman has quit [*.net *.split]
Y_Ichiro has quit [*.net *.split]
zaiste has quit [*.net *.split]
mahlon has quit [*.net *.split]
RubyPanther has quit [*.net *.split]
piggybox has quit [*.net *.split]
UNIXgod has quit [*.net *.split]
sernin has quit [*.net *.split]
Sou|cutter has quit [*.net *.split]
jord has quit [*.net *.split]
jmeeuwen has quit [*.net *.split]
joast has quit [*.net *.split]
rakm has quit [*.net *.split]
ping-pong has quit [*.net *.split]
ahuman has quit [*.net *.split]
thorncp has quit [*.net *.split]
preller has quit [*.net *.split]
Tasser has quit [*.net *.split]
tightwork has quit [*.net *.split]
tris has quit [*.net *.split]
rudle has quit [*.net *.split]
offby1 has quit [*.net *.split]
bnagy has quit [*.net *.split]
faulkner has quit [*.net *.split]
FlyingFoX has quit [*.net *.split]
verto has quit [*.net *.split]
c0rn has quit [*.net *.split]
preller has joined #ruby
preller has quit [Changing host]
preller has joined #ruby
kevinbond has left #ruby [#ruby]
Poapfel has joined #ruby
bbloom has joined #ruby
apok_ has quit [Ping timeout: 244 seconds]
<bbloom>
I'm trying to wrap my head around encoding.h; how do I go from wchar_t* to a string VALUE ?
SheikPunk has joined #ruby
SheikPunk has quit [Client Quit]
maletor has quit [Ping timeout: 246 seconds]
Osum has joined #ruby
ben_alman has quit [Excess Flood]
<Ethan>
bbloom: uh
khakimov has joined #ruby
frogstarr78 has joined #ruby
frogstarr78 has quit [Client Quit]
stephenjudkins has quit [Quit: stephenjudkins]
afd__ has quit [Quit: No Ping reply in 180 seconds.]
afd__ has joined #ruby
ben_alman has joined #ruby
pdtpatrick_ has joined #ruby
cakehero has joined #ruby
mucker has quit [Quit: leaving]
maletor has joined #ruby
anothervenue has joined #ruby
hilolih has joined #ruby
chson has joined #ruby
sernin has joined #ruby
bowlowni_ has joined #ruby
alindeman has joined #ruby
sei has joined #ruby
jmccune has joined #ruby
zaiste has joined #ruby
Fretta has joined #ruby
jord has joined #ruby
RichieEvans has joined #ruby
wangr has joined #ruby
mahlon has joined #ruby
angelixd has joined #ruby
Y_Ichiro has joined #ruby
pk1001100011 has joined #ruby
piggybox has joined #ruby
RubyPanther has joined #ruby
Sou|cutter has joined #ruby
jmeeuwen has joined #ruby
joast has joined #ruby
rakm has joined #ruby
UNIXgod has joined #ruby
verto has joined #ruby
thorncp has joined #ruby
tightwork has joined #ruby
faulkner has joined #ruby
offby1 has joined #ruby
tris has joined #ruby
ping-pong has joined #ruby
rudle has joined #ruby
bnagy has joined #ruby
ahuman has joined #ruby
FlyingFoX has joined #ruby
Tasser has joined #ruby
c0rn has joined #ruby
cbuxton has joined #ruby
ctor has quit [Excess Flood]
maletor has quit [Max SendQ exceeded]
cbuxton has left #ruby [#ruby]
ctor has joined #ruby
alindeman is now known as Guest78592
maletor has joined #ruby
fgro has joined #ruby
EstanislaoStan has joined #ruby
CreativeEmbassy has joined #ruby
savage- has joined #ruby
fgsda has joined #ruby
williamcotton_ has joined #ruby
jarred has quit [Quit: jarred]
indian has quit [Read error: Operation timed out]
maletor has quit [Ping timeout: 250 seconds]
adamkittelson has quit [Remote host closed the connection]
wmoxam has quit [Ping timeout: 246 seconds]
seoaqua has joined #ruby
Husel has left #ruby [#ruby]
iamjarvo has joined #ruby
seanstickle has quit [Quit: Nihil sub sole novum]
<EstanislaoStan>
So I'm creating a text adventure. And I was thinking about making a simple Command class that requires a "name" argument. Then making all my other command classes inherit from that. So if I want a player to be able to type go and go in a certain direction, I need to make a class for that, whereas before I was just making a method that would do that. That seems like more work, and I'm wondering
<EstanislaoStan>
why I would even need a class for all these things when I'm probably going to only create one object of most of the general stuff like go, or attatck and such. So should I make classes for each type of command?
<EstanislaoStan>
*attack
<fowl>
EstanislaoStan, you could use prototypes or something other than classes if you want
<EstanislaoStan>
I guess I'm trying to just keep a consistent way of dealing with player commands. The problem is that the logic that deals with player commands is extremely varried. The only common ground is that the logic always deals with the text input of the player (of course). But since I want a help commmand that lists all the available commands I need a way to add the names of all the commands to an array,
<EstanislaoStan>
preferably not inputing them all by hand. I feel like there's a more eloquent solution. I'm not familiar with prototypes. Could those do this?
nwest has joined #ruby
manizzle has joined #ruby
Taranis has joined #ruby
<fowl>
EstanislaoStan, you need to keep track of your commands then, keep them in a hash or track them as you instatiate them
<fowl>
instantiate
krz has quit [Quit: krz]
choffstein has quit [Remote host closed the connection]
maletor has joined #ruby
brianpWins has joined #ruby
noganex has quit [Ping timeout: 248 seconds]
zrail|home is now known as zrail
noganex has joined #ruby
<EstanislaoStan>
Right, but to put them all in a hash I'd have to make them objects, right? Which would require seperate classes for each command. So would it just be easier to manually add the command name to an array?
savage- has quit [Remote host closed the connection]
snearch has joined #ruby
cuppsy has quit [Read error: Operation timed out]
Ethan has quit [Ping timeout: 255 seconds]
snearch has quit [Read error: Connection reset by peer]
pu22l3r has quit [Remote host closed the connection]
davidpk has joined #ruby
snearch has joined #ruby
codezombie has joined #ruby
CodeVision has quit [Ping timeout: 246 seconds]
cuppsy has joined #ruby
codezombie has quit [Client Quit]
CodeVision has joined #ruby
<Ionic`>
hmmm
<Ionic`>
how do I break out of two loops?
jgrevich has quit [Read error: Connection reset by peer]
TorpedoSkyline has quit [Ping timeout: 244 seconds]
<Ionic`>
mhpf, probably not that easy
<davidcelis>
break * 2
<Ionic`>
that's working?!
<davidcelis>
try
Rizzle has quit [Read error: Connection reset by peer]
<banisterfiend>
haha
anothervenue has quit [Read error: Connection reset by peer]
cdavaz has joined #ruby
cdavaz is now known as Ontolog
<Ionic`>
nah, not really
<davidcelis>
Ionic`: my bad, sorry
<Ionic`>
it's ok, I wouldn't have expected this
twock has quit [Quit: Lost terminal]
<Ionic`>
I'll just conditionally break in the outer loop too
anothervenue has joined #ruby
gnychis has joined #ruby
<fowl>
use a variab
<Ionic`>
nice
<Ionic`>
another bug fixed
<gnychis>
I am trying to use the JSON class in a simple ruby script, and I did "sudo gem install json" (which installed it), but it fails to load when I do "require 'json'" in my script. If I do "require 'json'" within irb, it works just fine
<Ionic`>
gnychis: well make sure you're using the correct ruby version?
jerius has joined #ruby
<fowl>
inb4 ruby 1.8 and no require'rubygems'
jgrevich has joined #ruby
<gnychis>
sorry i didn't understand that, fowl
<Ionic`>
gnychis: require "rubygems" for ruby 1.8 before json
<gnychis>
got it, that worked, thanks!
dnyy has quit [Remote host closed the connection]
<Ionic`>
y/w
<Ionic`>
actually, thanks to fowl
<fowl>
gnychis, im obliged to tell you that 1.8 is old and 1.9 is muchos bettero
dnyy has joined #ruby
dnyy has quit [Read error: Connection reset by peer]
univers has quit [Remote host closed the connection]
kyktommy has quit [Quit: kyktommy]
voodoofish430 has quit [Quit: Leaving.]
ananthakumaran has quit [Quit: Leaving.]
Vert has quit [Remote host closed the connection]
dhruvasa1ar has joined #ruby
dhruvasagar has quit [Read error: Connection reset by peer]
Dreamer3 has joined #ruby
jarred has joined #ruby
k_89 has joined #ruby
robert45 has joined #ruby
<robert45>
hi guys, does anyone know how to solve this?: "/usr/local/lib/site_ruby/1.8/rubygems/custom_require.rb:36:in `gem_original_require': no such file to load -- new_relic/recipes (LoadError)"
Progster has quit [Ping timeout: 248 seconds]
RichieEvans has quit [Read error: Connection reset by peer]
a_a_g has quit [Quit: Leaving.]
RichieEvans has joined #ruby
RichieEvans has quit [Client Quit]
yonggu has joined #ruby
td123 has joined #ruby
dnyy has quit [Remote host closed the connection]
mayankkohaley has quit [Ping timeout: 248 seconds]
robert45 has quit [Quit: • IRcap • 8.6 •]
RainbowD_ has joined #ruby
RainbowD_ is now known as RainbowDashh
yonggu has quit [Remote host closed the connection]
yonggu has joined #ruby
banisterfiend has quit [Remote host closed the connection]
AlbireoX` has quit [Remote host closed the connection]
ryanf has quit [Ping timeout: 248 seconds]
cantonic_ has joined #ruby
cantonic_ is now known as cantonic
_br_ has quit [Quit: Bye, thanks for all the fish.]
ryanf has joined #ruby
_br_ has joined #ruby
RainbowDashh has quit [Quit: SLEEP MODE. I NEED A MORE CREATIVE MESSAGE FOR MY DUMB LID CLOSING.]
perryh_away is now known as perryh
banisterfiend has joined #ruby
<jarred>
Why doesn't MRI throw an error when I have instance variables on a module that I extend in a class?
dnyy has joined #ruby
<banisterfiend>
jarred: why should it
<jarred>
because the methods are class methods, since they're being extended (and not included) into a class, right?
<jarred>
Is it that, since modules are objects, they can have instance methods?
<jarred>
er
<jarred>
instance variables
<banisterfiend>
jarred: why does that mean they cant have instance variables
<banisterfiend>
jarred: no, the instance variables belong to the object that invokes the method provided by the module
<banisterfiend>
not to the module itself, unless it's a class method on the module
<jarred>
Because what instance does a class refer to?
<jarred>
Does everything have an instance then?
<jarred>
(Except maybe the class that everything else inherits from)
DrShoggoth has joined #ruby
<banisterfiend>
jarred: i dont quite knoew what u mean...i think u should read a book on the ruby OOP model cos there appears to be a lot of confusion there ;)
<banisterfiend>
jarred: it is tricky initially, but invest some time learning how it all fits together
wilmoore has quit [Remote host closed the connection]
<jarred>
banisterfiend: Yeah, I probably should. I understand where classes/instances fit in, it's pretty standard OOP, but modules are where it gets unusual
ryanf has quit [Quit: broken pipes |||]
<banisterfiend>
jarred: actually classes/instances in ruby have a few other quirks that make them different to normal OOP systems.
<banisterfiend>
jarred: for example eigenclasses/classmethods probably aren't what u think they are
<banisterfiend>
jarred: i mean 'class methods' probably arent what uthink they are, in ruby
westoque has joined #ruby
<jarred>
Ah I see
wilmoore_ has joined #ruby
<jarred>
Yeah, I think you're right -- that'd at least partly answer my question re: modules
<banisterfiend>
jarred: if i was to tell u that 'class methods are really instance methods on the metaclass' would that mean anything? :P
yxhuvud has joined #ruby
snearch has quit [Quit: Verlassend]
ryanf has joined #ruby
oscardelben has quit [Quit: oscardelben]
<jarred>
banisterfiend: Well, now the question is, what are metaclasses? From reading briefly on Wikipedia, it sounds like, in reality, since everything is an object in Ruby, metaclasses are the object that classes inherit from. So, class methods don't exist in Ruby because everything is an object, so metaclasses are a compromise so that everything is still an object, and we still have the niceties that classes provide. Is that correct (It doesn't
<jarred>
question has a yes/no answer, but a mostly right/mostly wrong answer)
<banisterfiend>
jarred: not that classes inherit from but from which they're instances of
<jarred>
ohhh
<jarred>
Yeah
<jarred>
That makes more sense
MatthewGA has quit [Ping timeout: 248 seconds]
<banisterfiend>
jarred: kind of, ultimately a class is an instance of the Class class
<banisterfiend>
jarred: and a module is an instance of the Module class
<jarred>
makes sense
<jarred>
Well, now it does
<jarred>
But
<jarred>
If you'd said that initially, it'd be confusing
<banisterfiend>
jarred: but all classes also have a unique class which they're instances of, which is a subclass of Class
Morkel has joined #ruby
<banisterfiend>
jarred: so really it goes like this: MyClass --> (MyClass) ===> Class
<banisterfiend>
where --> means 'instance of' and ===> means 'inherits from'
<banisterfiend>
jarred: (MyClass) is used to denote the metaclass for MyClass
<banisterfiend>
jarred: the resaon you have a (MyClass) is so that you can define methods unique to MyClass. If you didn't have (MyClass) (the metaclass) and just defined the so-called 'class methods' for MyClass directly on Class itself, then all classes would get them
ananthakumaran has joined #ruby
<banisterfiend>
but i want it so if i define a class method on MyClass that it exists only for MyClass
Ionic` has quit [Ping timeout: 244 seconds]
_justin has joined #ruby
<jarred>
And, that'd happen because the methods would actually be defined on Class?
luckman212 has joined #ruby
<jarred>
(Methods that are on every class)
<banisterfiend>
jarred: Yeah, so all classes would get them
Z_Mass has joined #ruby
<banisterfiend>
since all classes are instances of Class
<banisterfiend>
but only MyClass is an instance of (MyClass)
ananthakumaran1 has joined #ruby
ananthakumaran2 has joined #ruby
ananthakumaran1 has quit [Read error: Connection reset by peer]
<jarred>
I see
westoque has quit [Quit: westoque]
ananthakumaran has quit [Ping timeout: 244 seconds]
<jarred>
Thanks for explaining this
ananthakumaran has joined #ruby
ryanf has quit [Quit: broken pipes |||]
stepnem has quit [Ping timeout: 265 seconds]
andrewhl has quit [Remote host closed the connection]
<bbloom>
Is this the right channel to get help with writing C extensions for MRI?
<banisterfiend>
bbloom: Yea
ananthakumaran2 has quit [Ping timeout: 240 seconds]
<bbloom>
great. I'm trying to figure out how to convert a wchar_t* to a VALUE
xaq has quit [Remote host closed the connection]
ananthakumaran1 has joined #ruby
ananthakumaran has quit [Ping timeout: 246 seconds]
<bbloom>
encoding.h is somewhat overwhelming and has minimal documentation
savage- has joined #ruby
ananthakumaran has joined #ruby
maletor has quit [Quit: Computer has gone to sleep.]
Eldariof-ru has joined #ruby
zeromodulus has quit [Ping timeout: 246 seconds]
ananthakumaran1 has quit [Read error: Connection reset by peer]
ananthakumaran has quit [Client Quit]
ananthakumaran has joined #ruby
mxweas_ has joined #ruby
banisterfiend has quit [Remote host closed the connection]
zeromodulus has joined #ruby
mengu has quit [Ping timeout: 246 seconds]
vectorshelve has joined #ruby
mayankkohaley has joined #ruby
williamcotton_ has quit [Quit: williamcotton_]
zommi has joined #ruby
Z_Mass has quit [Quit: Leaving]
knirhs is now known as Shrink
liuchong has joined #ruby
maletor has joined #ruby
liuchong has quit [Client Quit]
byte_muse has joined #ruby
byte_muse has left #ruby [#ruby]
ryanf has joined #ruby
quest88 has quit [Quit: quest88]
medik has quit [Ping timeout: 248 seconds]
nari has quit [Ping timeout: 245 seconds]
<ctor>
Does anyone here have experience using the curb library?
rushed has left #ruby [#ruby]
DrShoggoth has quit [Quit: Leaving]
krz has quit [Quit: krz]
wilmoore_ has quit [Remote host closed the connection]
mxweas_ has quit [Quit: Computer has gone to sleep.]
g_rotbart has quit [Read error: Connection reset by peer]
djdb has joined #ruby
g_rotbart has joined #ruby
PaciFisT1 has joined #ruby
PaciFisT has quit [Read error: Connection reset by peer]
pdtpatrick_ has quit [Quit: pdtpatrick_]
tagrudev has joined #ruby
Eldariof-ru has quit []
nari has joined #ruby
a_a_g has joined #ruby
mahmoudimus has joined #ruby
fgsda has joined #ruby
lolmaus has joined #ruby
RichieEvans has joined #ruby
hemanth has quit [Read error: Connection reset by peer]
RichieEvans has quit [Client Quit]
RichieEvans has joined #ruby
nopolitica has joined #ruby
Fretta has quit [Quit: Fretta]
ryanf has quit [Quit: broken pipes |||]
igotnolegs has quit [Quit: Computer has gone to sleep.]
pdelgallego has joined #ruby
cads has joined #ruby
jarred_ has joined #ruby
abra has quit [Remote host closed the connection]
nopolitica has quit [Quit: Leaving.]
jarred has quit [Ping timeout: 244 seconds]
jarred_ is now known as jarred
zeromodulus has quit [Ping timeout: 248 seconds]
abra has joined #ruby
zeromodulus has joined #ruby
mahmoudimus has quit [Quit: Computer has gone to sleep.]
luckman212_ has joined #ruby
fgsda has left #ruby ["Leaving"]
nilg has joined #ruby
luckman212 has quit [Ping timeout: 248 seconds]
RichieEvans has quit [Quit: RichieEvans]
RichieEvans has joined #ruby
artOfWar has joined #ruby
TPFC-SYSTEM has joined #ruby
artOfWar_ has joined #ruby
mahmoudimus has joined #ruby
JohnBat26 has joined #ruby
stepnem has joined #ruby
artOfWar has quit [Ping timeout: 246 seconds]
perryh is now known as perry
wilmoore has joined #ruby
<Hanmac1>
bbloom did you still has your wchar_t* problem?
Hanmac1 is now known as Hanmac
bigkevmcd has quit [Remote host closed the connection]
_pdelgallego has joined #ruby
pdelgallego has quit [Read error: Connection reset by peer]
_pdelgallego is now known as pdelgallego
nalbion_ has joined #ruby
bigkevmcd has joined #ruby
_pdelgallego has joined #ruby
pdelgallego has quit [Read error: Connection reset by peer]
_pdelgallego has quit [Client Quit]
itnomad has quit [Quit: Leaving]
berkes has joined #ruby
ryanf has joined #ruby
MissionCritical has quit [Ping timeout: 248 seconds]
medik has joined #ruby
dhruvasa1ar has quit [Ping timeout: 252 seconds]
Ontolog has quit [Quit: Ontolog]
Spooner has joined #ruby
Spooner has quit [Client Quit]
dhruvasagar has joined #ruby
Tricks has quit [Read error: Connection reset by peer]
Tricks has joined #ruby
Guest46122 has quit [Ping timeout: 255 seconds]
socomm has quit [Ping timeout: 248 seconds]
tiripamwe has joined #ruby
jarred has quit [Quit: jarred]
banisterfiend has joined #ruby
elhu has joined #ruby
lolmaus has quit []
tonini has joined #ruby
nalbion_ has quit [Quit: Page closed]
workmad3 has quit [Ping timeout: 252 seconds]
lewis1711 has joined #ruby
mockra has quit [Remote host closed the connection]
Rochefort has joined #ruby
<lewis1711>
is there any good reason to not just obj#dup then add methods, "prototype" style, if I feel like it matches the problem better? more than one way to do it and all that
heftig has quit [Ping timeout: 272 seconds]
lolmaus has joined #ruby
heftig has joined #ruby
schickung has quit [Quit: schickung]
<RichieEvans>
can someone the why I should use rails instead of just writing the code myself and uploading them to my server.
<banisterfiend>
heftig: rejoin #pry
<banisterfiend>
RichieEvans: lol, same answer applies to whether u should use any library :P
<banisterfiend>
RichieEvans: why use ruby instead of writing your own langauge ? :)
baphled_ has joined #ruby
socomm has joined #ruby
<RichieEvans>
I was thinking rails was going to be this crazy hard "thing"
<fowl>
lewis1711, do what you feel, i write scripts without classes for the hell of it
etehtsea has joined #ruby
tiripamwe has quit [Ping timeout: 244 seconds]
<RichieEvans>
banasterfiend would you say query is to programming javascript easier as rails is to web develop easier?
<RichieEvans>
jquery*
tiripamwe has joined #ruby
<banisterfiend>
RichieEvans: ask fowl, he knows more about web dev than i
<RichieEvans>
I just came across this stack overflow page
ananthakumaran has quit [Ping timeout: 240 seconds]
<banisterfiend>
heftig: join pls
<heftig>
banisterfiend: sorry, still banned :p
<banisterfiend>
oh
<banisterfiend>
haha
MissionCritical has joined #ruby
<banisterfiend>
heftig: try now
savage- has quit [Remote host closed the connection]
fgro has joined #ruby
crates has quit [Remote host closed the connection]
hoelzro|away is now known as hoelzro
crates has joined #ruby
td123 has quit [Ping timeout: 252 seconds]
flippingbits has joined #ruby
mohits has joined #ruby
mohits has quit [Changing host]
mohits has joined #ruby
fgro has quit [Ping timeout: 250 seconds]
noyb has quit [Ping timeout: 248 seconds]
hashar has joined #ruby
baphled_ has quit [Ping timeout: 250 seconds]
wobr has joined #ruby
artOfWar_ has quit [Ping timeout: 244 seconds]
liuchong has joined #ruby
<liuchong>
:-S
Eldariof-ru has joined #ruby
liuchong has left #ruby [#ruby]
kidoz has quit [Quit: Ухожу я от вас]
Asher has quit [Read error: Connection reset by peer]
Asher has joined #ruby
apeiros_ has joined #ruby
piotr has joined #ruby
g_rotbart has quit [Remote host closed the connection]
jimeh has joined #ruby
Progster has joined #ruby
Cork has quit [Ping timeout: 245 seconds]
hilolih has quit [Remote host closed the connection]
ryanf has quit [Ping timeout: 246 seconds]
Cork has joined #ruby
jprovazn_away is now known as jprovazn
wilmoore has quit [Remote host closed the connection]
saschagehlich has joined #ruby
robotmay has joined #ruby
timonv has joined #ruby
arkiver has joined #ruby
zz_chrismcg is now known as chrismcg
ephemerian has joined #ruby
subbyyy has quit [Quit: Leaving.]
perry is now known as perryh_away
gani has joined #ruby
roolo has joined #ruby
lolmaus has quit []
Progster has quit [Ping timeout: 240 seconds]
eurek has joined #ruby
Squee-D has quit []
jimeh has quit [Quit: bye]
workmad3 has joined #ruby
mahmoudimus has quit [Quit: Computer has gone to sleep.]
elhu has quit [Ping timeout: 252 seconds]
jimeh has joined #ruby
Markvilla has joined #ruby
arturaz has joined #ruby
elhu has joined #ruby
[Neurotic] has quit [Quit: Leaving]
shellox_ has joined #ruby
<shellox_>
hi
schickung has joined #ruby
<shellox_>
i asked already in #sinatra, but whats the alternative to send_data now? send_data is deprecated now, but what should I use instead?
mengu has joined #ruby
lkba has quit [Ping timeout: 248 seconds]
alta has quit [Ping timeout: 264 seconds]
lkba has joined #ruby
eurek has quit [Quit: Computer has gone to sleep.]
akem has quit [Ping timeout: 246 seconds]
<fowl>
shellox_, you should probably just wait for an answer from #sinatra
vlad_starkov has joined #ruby
baphled__ has joined #ruby
<shellox_>
fowl: figured it out
<shellox_>
found a new helper in the sinatra source code :P
<shellox_>
for attachments
k_89 has quit [Quit: Leaving]
k_89 has joined #ruby
yonggu has quit [Quit: yonggu]
eurek has joined #ruby
lkba has quit [Quit: Bye]
ZachBeta has joined #ruby
thone_ has joined #ruby
arkiver has quit [Ping timeout: 246 seconds]
thone has quit [Ping timeout: 246 seconds]
gtuckerkellogg has joined #ruby
Steve10111 has joined #ruby
Steve10111 has left #ruby [#ruby]
richo has joined #ruby
richo has quit [Changing host]
richo has joined #ruby
saschagehlich has quit [Quit: saschagehlich]
grekkos has joined #ruby
grekkos is now known as Guest16141
dhruvasagar has quit [Ping timeout: 265 seconds]
dhruvasagar has joined #ruby
tiripamwe has quit [Ping timeout: 248 seconds]
tiripamwe has joined #ruby
Guest16141 has quit [Ping timeout: 240 seconds]
Berglund has joined #ruby
_justin has quit [Ping timeout: 244 seconds]
lolmaus has joined #ruby
tatsuya_o has joined #ruby
ryanf has joined #ruby
baphled__ has quit [Read error: Connection reset by peer]
baphled_ has joined #ruby
Tricks has quit [Remote host closed the connection]
mneorr has joined #ruby
ryanf has quit [Ping timeout: 248 seconds]
davidpk has quit [Quit: Computer has gone to sleep.]
piotr has quit [Ping timeout: 246 seconds]
mdstunthamster has joined #ruby
seoaqua has quit [Ping timeout: 252 seconds]
dhruvasagar has quit [Ping timeout: 240 seconds]
dhruvasagar has joined #ruby
seoaqua has joined #ruby
RichieEvans has quit [Quit: RichieEvans]
RichieEvans has joined #ruby
maletor has quit [Quit: Computer has gone to sleep.]
tonini has quit [Remote host closed the connection]
snearch has joined #ruby
Emmanuel_Chanel_ has joined #ruby
Emmanuel_Chanel has quit [Read error: Operation timed out]
seoaqua has quit [Ping timeout: 248 seconds]
<lewis1711>
"invalid multibyte char (US-ASCII)" gets thrown in jruby in 1.9 mode, but not in 1.8 mode. that's a step backwards..
<lewis1711>
(yes, I realise # encoding: utf-8)
Markvilla has quit [Quit: Markvilla]
seoaqua has joined #ruby
FlyingFoX has quit [Ping timeout: 240 seconds]
FlyingFoX has joined #ruby
sailias has joined #ruby
dhruvasagar has quit [Ping timeout: 252 seconds]
tk_ has joined #ruby
_justin has joined #ruby
<shevy>
the whole encoding idea was a step backwards
blacktulip has quit [Ping timeout: 252 seconds]
dhruvasagar has joined #ruby
<Hanmac>
yeah ... why isnt utf-8 the default encoding :'(
<banisterfiend>
Hanmac: some japanese reason, japs didnt like it being the default
berkes has quit [Quit: Ex-Chat]
RichieEvans has quit [Quit: RichieEvans]
RichieEvans has joined #ruby
<apeiros_>
lewis1711: no. it's not a step backwards.
<apeiros_>
but yes, it means people have to crawl out of their hole of ignorance.
<apeiros_>
if you want the old behavior, set all defaults to binary and have happy but broken code
<lewis1711>
whtat's wrong with utf-8 default then
ttyp123 has joined #ruby
thecreators has quit [Ping timeout: 248 seconds]
<fowl>
too hip
<apeiros_>
I'd be for it. but it only applies to a cultural region.
<drizz>
lol @ encoding “being a step backwards”
<lewis1711>
crawling out of the whole of ignorance was very dramatic btw, you should write poetry
Rochefort has quit [Remote host closed the connection]
lolmaus has quit []
<apeiros_>
lewis1711: sadly it relatively accurately describes the state of coders vs. encodings.
sailias has quit [Quit: Leaving.]
<ttyp123>
find . -type f | ruby -e "\$stdin.readlines.each {|file| result = File.open(file.chomp).readlines.join.gsub(/\\n/, 'MY_NEW_LINE').gsub(/....c3284d.*c3284d.../, '').gsub(/MY_NEW_LINE/, \"\\n\"); File.open(file.chomp, \"w\").puts result} when i run this command on a php file, it replaces the string with MY_NEW_LINE. i just want to replace it with a space .
<fowl>
wouldn't be a problem if the rest of the world would use ASCII
<fowl>
whats the point of inventing computers if you can't force your ideologies on others
<lewis1711>
so utf-8 isn't international enough, but ASCII is? I don't get it
* apeiros_
hands lewis1711 some <sarcasm> tags
<fowl>
lewis1711, ASCII is the perfect level of internationality
<richo>
morse code
<richo>
it's easier to convert to binary
<apeiros_>
fowl: because it contains the full charset the majority of people on this planet use? :)
<richo>
uses less bandwidth too
<lewis1711>
why am I surprised that noone could clearly explain the issue and instead resorted to sarcasm
<Hanmac>
ttyp123 your code does not look good ... File.open(file.chomp).readlines.join.gsub ... replace this with File.read(file.chomp).gsub
thecreators has joined #ruby
<lewis1711>
*not surprised
<apeiros_>
lewis1711: explain what issue? you said you already have the solution.
<fowl>
apeiros_, people who advocate unicode are the same people who advocate foreign aid and equality, FIE ON THAT, I say
<apeiros_>
FIE?
<lewis1711>
why is utf-8 a bad default for strings
<drizz>
it isnt
<apeiros_>
lewis1711: already answered
<apeiros_>
11:41 apeiros_: I'd be for it. but it only applies to a cultural region.
<fowl>
apeiros_, its a real word
<Hanmac>
ttyp123 and when you use open, use the block form ... open(...) { .. }
<lewis1711>
that was a pretty poor answer. so poor I don't feel compelled to ask more, or care
<apeiros_>
fowl: you're being mighty ignorant there.
<fowl>
apeiros_, that's what i do, i make an ass of myself on the internet then tell people where i'm from
<fowl>
its my shtick
<ttyp123>
Hanmac, is that the reason it is replacing my string with MY_NEW_LINE ?
<apeiros_>
fowl: be happy that ascii contains all characters your language uses. note however that it covers all characters of less than 10% of used written language.
<fowl>
yes yes im sure you miss your umlauts and snowman glyphs
<apeiros_>
fowl: you miss spanish, french, german, chinese, japanese and a whole lot of others.
<apeiros_>
so yes, you're indeed making an ass out of you if you're seriously on "ASCII for everyone!!!"
<drizz>
who cares, ISO-8859 FTW
lolmaus has joined #ruby
<apeiros_>
oh my
<Mon_Ouie>
And even English texts may use non-ASCII characters: —, …
* apeiros_
checks calendar whether it's global ignorance day…
zawzey has joined #ruby
<banisterfiend>
apeiros_: dont u think it's about time we deprecated german, french, spanish though
<apeiros_>
banisterfiend: if, then I'd be for deprecating english as well. lojban!
<banisterfiend>
no one understand that shit anyway, except for the germans, french spanish... everyone should speak 'murcan
<lewis1711>
clearly you want utf-16
<fowl>
apeiros_, those countries should be happy enough that they have the priviledge of building *and* using our technology
<drizz>
amen to that!
<apeiros_>
lewis1711: utf-8 and utf-16 have the same set of displayable characters.
<lewis1711>
and they don't cover some alphabet?
* apeiros_
assumes fowl is trolling
<fowl>
apeiros_, <3
<drizz>
UTF-8 covers just about everything
TheNumb has quit [Remote host closed the connection]
<lewis1711>
evidently it doesn't
<apeiros_>
lewis1711: utf-8 and utf-16 only differ in how the characters are represented by bytes.
<ttyp123>
Hanmac, ?
<lewis1711>
please be vaguer
<lewis1711>
this is too concrete
RichieEvan has joined #ruby
<apeiros_>
lewis1711: unicode (the characters displayable by all utf-* encodings) has some issues with some asian languages. you'll have to google for it
<lewis1711>
right. you could've said that in the first place
<apeiros_>
as far as I understood it though it is a problem that should be solved by using fonts, not by adding characters to unicode
<apeiros_>
lewis1711: if you'd asked in a way that I'd understood what you were asking for…
<lewis1711>
fair enough
RichieEvan has quit [Client Quit]
RichieEvans has quit [Quit: RichieEvans]
<shevy>
the asians need to adopt english
<lewis1711>
utf is a braoder brush then ASCII anyway, surely a better default even if it's not quite there
<shevy>
if it is such a better default why aren't we all using it already
<apeiros_>
lunch time, cya
<drizz>
we are
<lewis1711>
I am in many things..
<shevy>
sounds like perfect happiness achieved
<lewis1711>
what;s the alternative anyway
RichieEvan has joined #ruby
<shevy>
the alternative is to simplify
<fowl>
hep tep rog
<ttyp123>
what does the MY_NEW_LINE tag do in this command?
<shevy>
what command
RichieEvan has quit [Client Quit]
ephemerian has quit [Read error: Operation timed out]
<ttyp123>
find . -type f | ruby -e "\$stdin.readlines.each {|file| result = File.open(file.chomp).readlines.join.gsub(/\\n/, 'MY_NEW_LINE').gsub(/....c3284d.*c3284d.../, '').gsub(/MY_NEW_LINE/, \"\\n\"); File.open(file.chomp, \"w\").puts result} this one
<ttyp123>
what does the MY_NEW_LINE tags do ?
<Hanmac>
ttyp123 i dont know 100% but i looks like that is an holder, so that the newline is not replaced ...
<shevy>
this seems to replace newlines with the word MY_NEW_LINE and then lateron replace it again
<Hanmac>
but imo the line is a bit shitty
<shevy>
yeah
gani has left #ruby ["leaving.."]
<fowl>
some perl junky wrote that no doubt
<fowl>
that file never gets closed btw
<fowl>
i guess it does after execution
<fowl>
nvm
<shevy>
ttyp123: it is not a "tag", it is just the word that gets to replace the newlines
keymone has joined #ruby
<shevy>
does not really seem to be very elegant
<shevy>
isn't readlines splitting on every newline it finds anyway?
<ttyp123>
so if i replace "MY_NEW_LINE" with " " what will happen?
<shevy>
then something else could happen
<shevy>
depends on the .gsub(/....c3284d.*c3284d.../, '') part
medik has quit [Ping timeout: 244 seconds]
Gate has quit [Read error: Operation timed out]
KarlHungus has quit [Read error: Operation timed out]
<ttyp123>
the objective is to remove <!--c3284d--> and <!--/c3284d-->
Criztian has joined #ruby
<shevy>
html attack :D
<ttyp123>
and everything in between
monkegjinni has joined #ruby
<ttyp123>
shevy, Yes
<shevy>
build a new string with the content you need?
<shevy>
File.readlines('bla.html').each {|x| array << x if @may_we_append}, then toggle the @may_we_append depending on whether c32 was found or not. would be one way to solve this
<ttyp123>
i wanna delete that code from all .html files
<shevy>
this is ruby. (1) collect all .html files (2) pass them through a common method that does precisely that
saschagehlich has quit [Ping timeout: 246 seconds]
saschagehlich_ is now known as saschagehlich
<shevy>
I tend to bundle these methods in some .rb files and then invoke the method from bash. one alias I have is something like "ruby -r /Scripts/foo.rb -e"
<shevy>
then I usually do "rinvoke method_name_here"
<shevy>
(where "rinvoke" is that alias to ruby -r etc...)
<ttyp123>
i didnt write that code :( it was a code provided by someone to remove the HTML attack script.. it works for .html files but it does not work for .php files
<ttyp123>
it leaves a string called "MY_NEW_LINE" in php files
<ttyp123>
but it works fine for .html files
<shevy>
ok then you know one thing
<shevy>
the first .gsub works and inserts that
<shevy>
but it fails to replace those strings afterwards
rohit has quit [Read error: Connection reset by peer]
Guedes has joined #ruby
Guedes has quit [Changing host]
Guedes has joined #ruby
`brendan has quit [Quit: - nbs-irc 2.39 - www.nbs-irc.net -]
fixl has joined #ruby
linoj has quit [Quit: linoj]
bier|tp has quit [Ping timeout: 246 seconds]
Markvilla has quit [Quit: Markvilla]
bier has quit [Ping timeout: 244 seconds]
schickung has quit [Read error: Connection timed out]
schickung has joined #ruby
Rochefort has joined #ruby
<shevy>
sorry was eating
tatsuya_o has quit [Remote host closed the connection]
LennyLinux has joined #ruby
<shevy>
the problem is that you use code that you do not understand
<shevy>
first thing that you ought to do is - put that ruby code into a proper file
<ttyp123>
i agree
<shevy>
then modify it until you understand it
<shevy>
otherwise, you are always just chasing-the-rock here without catching it
<shevy>
.gsub is really simple to understand
<shevy>
it will replace something globally, on a string
<shevy>
that string can be huge, like a file
tatsuya_o has joined #ruby
<shevy>
and you can chain multiple .gsub one after the other
zawzey has quit [Quit: zawzey]
<shevy>
so when you modified the string before, with some .gsub already, of course you can then get results such as "MY_NEW_L_NEW_LINE"
<ttyp123>
hummmm
<shevy>
as I wrote before, one way to solve this is to use .each instead and build a new string
<shevy>
and when you notice that your line has #c3284d# as string, dont append
<shevy>
ignore the following lines too
bier|tp has joined #ruby
bier has joined #ruby
<shevy>
until you encounter #/c3284d#
<shevy>
this is really simple ruby
<shevy>
if line =~ /#c3284d#/
Icoin has joined #ruby
<shevy>
if line =~ /\/#c3284d#/
<shevy>
opening, respectively closing
<shevy>
you should read a ruby tutorial at least once ;)
mayankkohaley has quit [Ping timeout: 252 seconds]
<Gadgetoid>
Use the power of Google!
zawzey has joined #ruby
_bart has quit [Quit: _bart]
<ttyp123>
shevy, I was tring to do find replace using sed but could not get the regex right.. so I asked someone to do it for me .. he preferred ruby :(
<shevy>
I would too
<ttyp123>
the only issue with sed was that it did not work unless u get the regex perfectly i tried to put this entire code into a string to do a match find replace but it did not work out
<shevy>
ruby gives you something unified, whereas with UNIX you must understand a million different programs
<shevy>
well regexes are not that easy, so that is understandable
arkiver has joined #ruby
resure has joined #ruby
<shevy>
if you dont wanna learn ruby, try to use sed perhaps :)
<Gadgetoid>
Ruby is a bit of an OTT way to handle something that core utils can do
<ttyp123>
yes and on top of that google lists the site as having malware.. so screwed
<shevy>
who defines what is a core util?
<shevy>
debian? :>
resure has quit [Client Quit]
<Gadgetoid>
shevy: the people who made and maintain the GNU core utils for the GNU side of GNU/Linux?
<shevy>
awk is provided standalone in ftp://ftp.gnu.org/gnu/gawk/gawk-4.0.1.tar.gz, sed ftp://ftp.gnu.org/gnu/sed/sed-4.2.1.tar.gz, coreutils ftp://ftp.gnu.org/gnu/coreutils/coreutils-8.17.tar.xz
<shevy>
yeah, if awk and sed would be included in coreutils but it is not ;P
<ttyp123>
shevy :( not able to modify that script also it does not delete stuff between #c3284d# and #/c3284d#
<shevy>
ttyp123 well.
vectorshelve has quit [Ping timeout: 245 seconds]
WhereIsMySpoon has quit [Changing host]
WhereIsMySpoon has joined #ruby
dhruvasagar has quit [Ping timeout: 248 seconds]
schickung has quit [Read error: Connection timed out]
hoelzro is now known as hoelzro|away
stefanp has joined #ruby
stefanp has quit [Changing host]
stefanp has joined #ruby
Gavilan has left #ruby [#ruby]
indian has joined #ruby
indian has quit [Changing host]
indian has joined #ruby
schickung has joined #ruby
dhruvasagar has joined #ruby
<shevy>
ttyp123: http://pastie.org/4249278 this should work. it is not perfect yet, just a proof of concept
khakimov has quit [Quit: Computer has gone to sleep.]
stefanp_ has quit [Ping timeout: 265 seconds]
<ttyp123>
shevy, i save that as a file and execute it?
<ttyp123>
how do i use it?
chrismcg is now known as zz_chrismcg
<shevy>
yes you should save it as .rb file
<shevy>
well try it with a test script
<shevy>
let's say the test script is the data you pastied and a few extra lines
<shevy>
so we have test.rb and test.txt ok
<shevy>
"ruby test.rb test.txt"
<shevy>
if you use a proper shebang entry you can do
<shevy>
"./test.rb test.txt"
<shevy>
you can give it a better name
<shevy>
"replace_attack_lines.rb"
<shevy>
it will remove the test.txt file though
<shevy>
and will create a new one
<shevy>
but I think what you really need to do is, either learn sed or ruby. it wont work well if you ever need to make modifications, and you dont know what you are doing
<ttyp123>
i agree on that part of i dont know what i am doing
<ttyp123>
:(
<shevy>
we all have been at that point
<ttyp123>
i think u r right.. for a long term solution i am gonna learn this a bit
<shevy>
sometimes we still are at that point too
<shevy>
with ruby, I can be lazy. I dont have to learn awk sed or any of the classical unix tools at all. I simply write what I need in ruby
<shevy>
the only tradeoff I can see is speed, which does not bother me much
<ttyp123>
hummmm is it a pain to learn? i tried python and perl but ... didnt go pretty far
<shevy>
(and the initial cost of writing)
<shevy>
depends
<shevy>
if you understand the basic concepts of programming already, then it should not be too hard
<shevy>
it takes quite some time to really get good with it though
ZachBeta has quit [Quit: Computer has gone to sleep.]
<sky\>
couple errors in the 'gsl' gem installation. never mind, are there other ways of linking to the GSL ?
hashar has joined #ruby
<fowl>
sky\, ffi is an option
cakehero has joined #ruby
Guest62684 has joined #ruby
tiripamwe has quit [Read error: Connection timed out]
<ttyp123>
fowl, this is probably OT but where can i hire someone to write such a script for me?
tiripamwe has joined #ruby
<ttyp123>
i just cant seem to get the script working on .htaccess files and some .php files
Progster has joined #ruby
zawzey has quit [Quit: zawzey]
<gtuckerkellogg>
RMagick keeps crashing my mac :(
<banisterfiend>
gtuckerkellogg: stop using it
<banisterfiend>
:)
<gtuckerkellogg>
i have :)
k_89 has quit [Ping timeout: 244 seconds]
<gtuckerkellogg>
but I'm trying to stictch together an animation for a presentation on Monday, and I *thought* a little script would do it
dhruvasagar has quit [Ping timeout: 265 seconds]
<gtuckerkellogg>
it's not a Ruby problem; it's surely a combination of my igorance and ImageMagick complexity. I'm just grousing
vectorshelve has joined #ruby
mvangala_home has joined #ruby
mvangala_home is now known as mvangala
dhruvasagar has joined #ruby
TPFC-SYSTEM has quit [Quit: TPFC-SYSTEM]
mvangal__ has joined #ruby
_bart has joined #ruby
<JonnieCache>
rmagick sucks
mbuf has quit [Quit: ERC Version 5.3 (IRC client for Emacs)]
<m4rtijn>
i have a general question about project & file organization - I have the following setup: https://gist.github.com/3104659 -- now I would like a general "config" class which reads the yml and makes all the config vars available in my paypal_report.rb .. where should I put it?
<m4rtijn>
also this config class should be available for other classes in my project
<JonnieCache>
gtuckerkellogg: if you only need to do thumbnails then ImageScience is good
hashar is now known as hasharDeadmau5
<gtuckerkellogg>
unfortunately, i need to make an animation
<m4rtijn>
gtuckerkellogg: use html5 for basic animation..
mneorr has joined #ruby
<JonnieCache>
or just use svg and then some tool that renders it out
<fowl>
gtuckerkellogg, use gosu
mvangal__ has left #ruby [#ruby]
<JonnieCache>
anything but imagemagick man that thing is a behemoth
lkba has joined #ruby
<gtuckerkellogg>
that it is
<JonnieCache>
its a shame because its a really cool bit of software
<fowl>
ttyp123, im not sure, you could try a freelance site
Bofu2U has joined #ruby
<JonnieCache>
but it seems like its just ballooned over the years and nobodys had any chance to do much in the way of architecting
mvangala has quit [Ping timeout: 246 seconds]
Ionic` has joined #ruby
<Progster>
I realized I'm really not a fan of unless statements. The amount of time I spend in my head trying to parse them is infinitely longer than if !something
<JonnieCache>
it really depends on what the something is
<JonnieCache>
if it ends up looking like an english sentance then it can be good
kyktommy has joined #ruby
<Progster>
unless user.admin? is less readable to me than if !user.admin?
<JonnieCache>
agreed
<m4rtijn>
anyone who can help me with my file organisation thingie?
<JonnieCache>
however, `unless user.is_an_admin?` looks quite good to me
<JonnieCache>
but not everyone names methods like that
<Progster>
I dunno. I don't like unless statements as beginning blocks. I think I can tolerate them at the end of a statement when they make sense
<JonnieCache>
m4rtijn: in lib/paypal_report/config.rb
phromo has joined #ruby
<JonnieCache>
or just lib/config.rb depending on taste
d3vic3 has quit [Ping timeout: 252 seconds]
chson has quit [Remote host closed the connection]
<m4rtijn>
JonnieCache: what if I build a lib/worldpay_report.rb next
<JonnieCache>
well maybe you should have a module called reports
phromo has quit [Client Quit]
<JonnieCache>
and a dir called lib/reports
<JonnieCache>
with both the paypal one and the worldpay one under it
<sky\>
does anyone else here use GSL with ruby ?
<m4rtijn>
Johnie, i do
<JonnieCache>
go on github and look how your favourite gems organise their code
jsime has joined #ruby
<JonnieCache>
its not a super strict thing
d3vic3 has joined #ruby
<JonnieCache>
the interpreter doesnt care where the files are, the directory structure is there for your benefit
<m4rtijn>
JonnieCache: k, thanks
<m4rtijn>
yes, we need a general project directory template for all future projects
<m4rtijn>
5 proggrammers here, so far programming php .. switching to ruby gradually
<m4rtijn>
and i need to setup some guidelines
<JonnieCache>
well if you're making a gem, `bundle gem` at the command line spits out a template for that
<m4rtijn>
k
<JonnieCache>
and there are various templates out there on github for different types of project
<JonnieCache>
the main thing is that the dir structure should follow the namespacing of the classes
<JonnieCache>
otherwise you will go crazy trying to keep track of things
Markvilla has joined #ruby
kyktommy has quit [Quit: kyktommy]
g0bl1n has joined #ruby
yugui is now known as yugui_zzz
SpaceAviator has joined #ruby
sepp2k has joined #ruby
yugui_zzz is now known as yugui
bburton has joined #ruby
andrewhl has joined #ruby
rowanu has joined #ruby
mdszy has joined #ruby
liluo has joined #ruby
owned_ has quit [Ping timeout: 246 seconds]
indian has quit [Ping timeout: 248 seconds]
sailias has quit [Ping timeout: 246 seconds]
vectorshelve has quit [Quit: Page closed]
yugui is now known as yugui_zzz
bier|tp has quit [Read error: Operation timed out]
StretchedALot has quit [Quit: H. Rollins Shells (817) 504-9915]
StretchedALot has joined #ruby
StretchedALot has quit [Client Quit]
pk1001100011 has quit [Ping timeout: 240 seconds]
zawzey has joined #ruby
dv310p3r has joined #ruby
robbyoconnor has quit [Ping timeout: 246 seconds]
n1x has joined #ruby
pk1001100011 has joined #ruby
n1x has left #ruby [#ruby]
liluo_ has joined #ruby
tiripamwe has quit [Remote host closed the connection]
liluo has quit [Ping timeout: 246 seconds]
cakehero has quit [Quit: Computer has gone to sleep.]
StretchedALot has joined #ruby
uris has joined #ruby
choffstein has joined #ruby
lewis1711 has quit [Quit: Leaving.]
erichmenge has joined #ruby
gokul has joined #ruby
bbttxu has joined #ruby
dhruvasagar has quit [Ping timeout: 248 seconds]
StretchedALot has quit [K-Lined]
ananthakumaran has joined #ruby
jimeh has quit [Ping timeout: 248 seconds]
yonggu has joined #ruby
dhruvasagar has joined #ruby
niklasb has quit [Ping timeout: 246 seconds]
liluo_ has quit [Remote host closed the connection]
yonggu_ has joined #ruby
yonggu has quit [Ping timeout: 246 seconds]
SeySayux has quit [Ping timeout: 265 seconds]
choffstein has quit [Remote host closed the connection]
dv310p3r has quit [Ping timeout: 246 seconds]
jimeh has joined #ruby
_justin has quit [Ping timeout: 246 seconds]
dv310p3r has joined #ruby
ananthakumaran has quit [Quit: Leaving.]
whitenoise has joined #ruby
yonggu_ has quit [Ping timeout: 248 seconds]
whitenoise has quit [Changing host]
whitenoise has joined #ruby
awarner has joined #ruby
SeySayux has joined #ruby
Markvilla has quit [Quit: Markvilla]
yonggu has joined #ruby
carlyle has joined #ruby
Markvilla has joined #ruby
elhu has quit [Ping timeout: 240 seconds]
owned_ has joined #ruby
Guest62684 has quit [Ping timeout: 265 seconds]
indian has joined #ruby
choffstein has joined #ruby
elhu has joined #ruby
hunglin has joined #ruby
hunglin has left #ruby [#ruby]
Markvilla_ has joined #ruby
hunglin has joined #ruby
a_a_g has quit [Quit: Leaving.]
wallerdev has quit [Quit: wallerdev]
a_a_g has joined #ruby
Sgeo has joined #ruby
<lectrick>
So yesterday I was confused about protected methods due to this test case: class Master; protected; def secret; puts "hi"; end; end; class Servant < Master; end; s = Servant.new; s.secret
Markvilla has quit [Ping timeout: 246 seconds]
Markvilla_ is now known as Markvilla
a_a_g has quit [Client Quit]
<lectrick>
It turns out that "protected" just means subclasses can access those methods *from within themselves* but you as a user still don't have access to that method
Sgeo_ has quit [Ping timeout: 244 seconds]
gregorg has quit [Read error: Connection reset by peer]
Cork has quit [Read error: Operation timed out]
cjlicata has joined #ruby
_justin has joined #ruby
Cork has joined #ruby
<shevy>
does not sound as if protected is very useful
chson has joined #ruby
carlyle has quit [Ping timeout: 246 seconds]
sailias has joined #ruby
Sgeo has quit [Quit: Leaving]
ttilley_off is now known as ttilley
obryan has joined #ruby
johnlcox has joined #ruby
yonggu_ has joined #ruby
rohit has joined #ruby
yonggu has quit [Ping timeout: 240 seconds]
ackz has joined #ruby
Fretta has joined #ruby
<JonnieCache>
depends how your like to do your OO i suppose
dinkytoy has joined #ruby
hunglin has left #ruby [#ruby]
pu22l3r has joined #ruby
mahmoudimus has joined #ruby
gokul has quit [Quit: Leaving]
macmartine has joined #ruby
williamcotton_ has quit [Read error: Connection reset by peer]
williamcotton_ has joined #ruby
mahmoudimus has quit [Client Quit]
xnm has joined #ruby
rohit has quit [Ping timeout: 246 seconds]
cloud|windoze has joined #ruby
mahmoudimus has joined #ruby
hunglin has joined #ruby
strife25 has quit [Quit: Computer has gone to sleep.]
shevy has quit [Ping timeout: 248 seconds]
bier has joined #ruby
uris has quit [Read error: Connection reset by peer]
DarkFoxDK has quit [Read error: Operation timed out]
quest88 has joined #ruby
oscardelben has joined #ruby
quest88 has quit [Client Quit]
dexterous has joined #ruby
wargasm1 has left #ruby [#ruby]
robbyoconnor has joined #ruby
dexterous has left #ruby [#ruby]
jshsu has quit [Ping timeout: 246 seconds]
hoelzro has quit [Ping timeout: 272 seconds]
pradeepto has quit [Ping timeout: 245 seconds]
SirFunk has quit [Ping timeout: 245 seconds]
robbyoconnor has quit [Read error: Connection reset by peer]
kevinbond has joined #ruby
Markvilla has quit [Quit: Markvilla]
joshman_ has joined #ruby
<Gadgetoid>
Is packing 4 numbers ranging from 0-3 into a single unsigned int really as simple as: [0,1,2,3,2,1,3,2,3,2,1,3].each_slice(4){|slice| packed<<slice.join.to_i(4)}
kevinbond has left #ruby [#ruby]
xnm has quit [Ping timeout: 246 seconds]
dhruvasagar has quit [Ping timeout: 244 seconds]
pradeepto has joined #ruby
dhruvasagar has joined #ruby
DarkFoxDK has joined #ruby
jshsu has joined #ruby
xaq has joined #ruby
tagrudev has quit [Remote host closed the connection]
pu22l3r has quit [Remote host closed the connection]
daniel_hinojosa has quit [Read error: Operation timed out]
chazu has joined #ruby
kvirani has joined #ruby
mucker has joined #ruby
djdb has quit [Remote host closed the connection]
mucker has quit [Client Quit]
mucker has joined #ruby
mvangala_ has quit [Remote host closed the connection]
internet_user has joined #ruby
pdtpatrick_ has joined #ruby
<chazu>
hey folks, dunno if anybody here is a user of the Sequel gem, but...
SpaceAviator has quit [Ping timeout: 252 seconds]
akem has joined #ruby
akem has quit [Changing host]
akem has joined #ruby
sky\ has left #ruby [#ruby]
<chazu>
If i need to join two tables based on an id nested in an attribute, like so: recipients => { ids => 1,2,3, } } how would one do that?
<chazu>
well, how would one do that with one hit to the db, i guess...
<chazu>
>_<
yonggu_ has joined #ruby
<gogiel>
chazu: ids is string?
SegFaultAX has joined #ruby
<chazu>
ids is a key inside of a yaml-serialized hash
Helius has quit [Remote host closed the connection]
centipedefarmer has joined #ruby
pygospa has quit [Disconnected by services]
TheRealPygo has joined #ruby
<chazu>
if that makes sense
yonggu has quit [Ping timeout: 265 seconds]
nopolitica has joined #ruby
<chazu>
aw, heck i'll just hit the db n times for each record XD
bluOxigen has joined #ruby
Vert has joined #ruby
blueOxigen has quit [Ping timeout: 255 seconds]
apok has joined #ruby
k_89 has joined #ruby
ckrailo has joined #ruby
<gogiel>
chazu: so, you want to write sql join, yes?
pu22l3r has joined #ruby
<gogiel>
i don't get what you want to do
<shevy>
I never used Sequel so I have no idea
headius has joined #ruby
<chazu>
gogiel, shevy: yeah, sorry if i'm not explaining very well. i have messages and users. messages has attribute 'recipients', with a key 'ids', an array of user ids. i want to join messages to users on the value of that key of a serialized attribute.
<chazu>
but i'd prefer to hit the db once for each message.
cads has joined #ruby
<gogiel>
recipients is in db?
<gogiel>
you use serialzie :recipients, Array ?
<gogiel>
if yes it's possible to do it with one query in more advanced db like pg, but you'll need some advanced sql and subselect in it
davidcelis has quit [Ping timeout: 250 seconds]
<chazu>
gogiel: yes it is serialized, but...sounds like i should just hit the db n+1 times, honestly T_T...or pull the data via activerecord
<chazu>
gogiel: Thanks for the analysis ^_^...
<gogiel>
chazu: if it's not time critical it's better to do more queries in this case
brianpWins has quit [Quit: brianpWins]
wvms has quit [Read error: Connection reset by peer]
hasharDeadmau5 is now known as hasharDeCrecy
<chazu>
gogiel: yeah, its not time critical, i'm just being difficult on myself ^_^...and you guys
<chazu>
thanks again
wvms has joined #ruby
<gogiel>
chazu: i'm just curious, why don't you use has_many?
<JonnieCache>
also activerecord has support for key-value columns now
<JonnieCache>
so you dont even have to serialise anything
binaryplease has quit [Quit: WeeChat 0.3.8]
binaryplease has joined #ruby
mengu has quit [Quit: Konversation terminated!]
<gogiel>
JonnieCache: can you provide more details?
<chazu>
gogiel: I'm not sure myself, but when this was designed i suppose they wanted to address messages to individuals and groups, so theres recipients hash with multiple keys...
robotmay has quit [Remote host closed the connection]
Helius has joined #ruby
LennyLinux has quit [Remote host closed the connection]
<sernin>
Scope question. Do 'do' blocks create a new scope within a method?
<hoelzro>
sernin: yes
<banisterfiend>
sernin: they're closures
<hoelzro>
but
<sernin>
That would explain quite a bit
Beoran_ has joined #ruby
theRoUS_ has joined #ruby
<banisterfiend>
sernin: so they close over variabls defined outside it, but variables defined just inside it stay inside it
<hoelzro>
if you refer to variables that exist within the enclosing scope, the enclosing scope's variables are used
apok has quit [Quit: apok]
<banisterfiend>
sernin: you can also, if u want, specifically tell ruby to shadow outer variables rather than close over them insidet hte block
<banisterfiend>
by using { |;x, y| .. }
<banisterfiend>
semicolon
<hoelzro>
but only in 1.9
mneorr has quit [Quit: Leaving.]
<banisterfiend>
1.8 can eat a dick at this point
<sernin>
Agree with that.
brianpWins has joined #ruby
davidcelis has joined #ruby
davidcelis has quit [Changing host]
davidcelis has joined #ruby
<sernin>
I had a rather hilarious misstep earlier, using IO.foreach(file, 'r') -- lo and behold, all my lines were split on the 'r' character. That was interesting.
<shevy>
ttyp123: remember to try to understand how it is done. (1) read in the data (2) modify the data (i.e. by building a new array) (3) storing the result
<shevy>
that class can be improved
<shevy>
for instance, you can feed it some directories
<shevy>
Dir.glob('/tmp/*.html')
<shevy>
you can start irb and test how this is done
<shevy>
Dir.entries is easier
benson has joined #ruby
<shevy>
same if you use sed btw
<shevy>
but I gave up on the UNIX tools myself. ruby won me over
<banisterfiend>
sernin: still dotn understand sorry
<banisterfiend>
gotta go now anyway, im sure someone will help you :)
<banisterfiend>
night
<sernin>
banisterfiend: its a hash that needs to be passed around a lot and processed.
savage- has joined #ruby
<shevy>
I take it that sernin is no newbie :)
savage- has quit [Remote host closed the connection]
<sernin>
i come from the faraway land of Perl.
<shevy>
good old perl
<shevy>
I remember my first book about regexes was a perl book
savage- has joined #ruby
<sernin>
You should see the regex I composed for this custom apache log. It's a whopper.
<shevy>
sadly, I never again read a book about regexes... so named captures and the like are still unbeknown to me
elhu has quit [Quit: Computer has gone to sleep.]
<blazes816>
sernin: longest regex in a perl script wins!
<shevy>
I dunno, I find regexes tax my brain too much. I need too much time to process them when they get complicated
pdtpatrick_ has joined #ruby
<shevy>
props to the guys with bigger brains
hydrozen has quit [Quit: Computer has gone to sleep.]
<sernin>
That's the /x flag. But this scope thing is driving me mad.
cdavaz has joined #ruby
<ij>
What do you guys think about def x; do_things.tap do; do_something_else; end; end <-- construction to do else after things, but return things?
mneorr has joined #ruby
<sernin>
is there a bad-ruby way of saying 'fuck this, make it a global'
<shevy>
dunno. $foo ?
<ij>
sernin: There are global variables.
<shevy>
$foo = 5
<apeiros_>
Constants and $globals are global in ruby
<apeiros_>
ij: I see nothing wrong with it. why?
ianbrandt has joined #ruby
<apeiros_>
ij: though, personally I use {} if I care about the return value
<ij>
apeiros_: I've got a nazi mentor, just checkin.
dhruvasagar has quit [Ping timeout: 246 seconds]
yankhate1 has joined #ruby
yankhate1 has quit [Client Quit]
ewag has quit [Remote host closed the connection]
dhruvasagar has joined #ruby
<shevy>
ij: dunno, .tap still confuses me
<ij>
What exactly confuses you?
TheRealPygo has quit [Quit: leaving]
<blazes816>
shevy: it just returns what you tap
<shevy>
why I would need it for instance
mdszy has quit [Quit: bye for now]
<ij>
It's actually a let.
<Mon_Ouie>
Nothing wrong with it per se, but sometimes it's used really weirdly. Like [].tap { |ary| (do stuff that could have been done using #map here…) }
<shevy>
^^^
<ij>
map
tcopp has joined #ruby
<ij>
Mon_Ouie: Gimme an example.
<ij>
Well if someone uses it incorrectly it's their fault.
Icoin has quit [Read error: Connection reset by peer]
<ij>
Searching for guidelines? :]
rekenerd has joined #ruby
kenichi has joined #ruby
<Tyr0>
need help with cvcircle
fridim_ has quit [Ping timeout: 246 seconds]
rekenerd has quit [Read error: Connection reset by peer]
jarred has joined #ruby
t0mmyvyo has joined #ruby
rudyl313 has left #ruby [#ruby]
rekenerd has joined #ruby
<shevy>
never heard of opencv before
<ij>
Tyr0: Isn't there #opencv or something?
<Tyr0>
its intel's open source object detection library
jeff_sebring has quit [Quit: Leaving]
dhruvasa1ar has quit [Ping timeout: 244 seconds]
<Tyr0>
ij: yeah, I'm asking there too, but my trouble's still related to ruby :)
jarred_ has joined #ruby
adeponte has joined #ruby
<ij>
I see. :]
Testy has joined #ruby
jarred has quit [Ping timeout: 245 seconds]
jarred_ is now known as jarred
<Testy>
Does anyone know how to fail an entire test suite from the startup method using Test-Unit?
Juul has joined #ruby
andrewhl has joined #ruby
workmad3 has quit [Ping timeout: 250 seconds]
idoru has joined #ruby
Gate_ is now known as Gate
rcrossan has joined #ruby
<rcrossan>
checking for anyone with experience using watir/ruby with jenkins. My question is more with the Jenkins Config with Rake plugin 1.7 where you enter Ruby Installation information. I'm getting a message under the text box "It seems that ruby gems is not installed" no matter what I enter in there. If I leave it blank it says "Is not a directory"
Hertz has quit [Read error: Connection reset by peer]
Gate has quit [Changing host]
Gate has joined #ruby
btanaka has joined #ruby
blazes816 has quit [Quit: Leaving]
punkrawkR has joined #ruby
tewecske has joined #ruby
jonatha__ has quit [Remote host closed the connection]
rekenerd has quit [Read error: Connection reset by peer]
mistofvongola has joined #ruby
jonathanwallace has joined #ruby
arturas has joined #ruby
tzvi|work has quit [Remote host closed the connection]
strife25 has joined #ruby
mpereira has quit [Ping timeout: 244 seconds]
mpereira has joined #ruby
shadoi has quit [Quit: Leaving.]
liluo has joined #ruby
bier has joined #ruby
kn330 has joined #ruby
shadoi has joined #ruby
ilyam has joined #ruby
niklasb has quit [Ping timeout: 244 seconds]
fermion has quit [Quit: P]
nopolitica has joined #ruby
S1kx has joined #ruby
S1kx has joined #ruby
_justin has joined #ruby
liluo has quit [Remote host closed the connection]
<shevy>
oh man
<shevy>
I'd wish I could omit "end" in if/else clauses
Eldariof-ru has joined #ruby
<Mon_Ouie>
How about using ternary expressions if it's simple enough?
<shevy>
hmm. it kind of works, it's a bit different for my ruby style though. some of my method names are quite long, I need to read to the right side of the screen in that case
<shevy>
I like to keep things on the left side, visually, if possible
<shevy>
if foo
<shevy>
bla
<shevy>
else
<shevy>
ble
rekenerd has joined #ruby
<shevy>
# hmmm still 4 lines :\
<shevy>
5 lines with end
sebastorama has joined #ruby
rekenerd has quit [Read error: Connection reset by peer]
blazes816 has joined #ruby
shadoi has quit [Quit: Leaving.]
maletor has quit [Ping timeout: 265 seconds]
maletor has joined #ruby
savage- has quit [Read error: Connection reset by peer]
kparaju has joined #ruby
<gogiel>
foo ? bla: ble . clear and simple
<gogiel>
you can put some newlines and make it 3 lines
kparaju has left #ruby ["Ex-Chat"]
jarred has quit [Ping timeout: 248 seconds]
jarred has joined #ruby
jparkton has quit [Ping timeout: 244 seconds]
jparkton has joined #ruby
<iamjarvo>
what should i look up if i want to build a relationship with arrays
_justin has quit [Ping timeout: 246 seconds]
<iamjarvo>
is there some type of pattern
ringotwo has quit [Remote host closed the connection]
Guedes has quit [Read error: Operation timed out]
TheHypnotist- has joined #ruby
<hoelzro>
iamjarvo: what do you mean?
Criztian has joined #ruby
<iamjarvo>
hoelzro basically i have this data set and i want to get a relationship between them, so say you have [[1meter, 100cm] [100cm, .001km]] i want to go from meter to km
<iamjarvo>
please do not straight out tell me the answer
<iamjarvo>
give like strategies or thing si should look up
bier has quit [Remote host closed the connection]
ringotwo has joined #ruby
Speed is now known as Speedq
Speedq is now known as Speed
stephenjudkins has joined #ruby
<hoelzro>
iamjarvo: so you want to find a member where its first element is equal to a lookup key, and find another member where its first element is equal to the second of the first member, and return the second element of the result?
jsime has quit [Quit: Leaving]
<hoelzro>
or do something along those lines?
<hoelzro>
if the latter, I would use a Hash
nateberkopec has joined #ruby
bier has joined #ruby
<iamjarvo>
hoelzro so there will be more than two in the parent array. how would you go back up the chain? use something that keeps querying from the bottom up?
TheHypnotist- has quit [Read error: Connection reset by peer]
TheHypnotist- has joined #ruby
_justin has joined #ruby
<TheHypnotist->
hmm, suggestions for compiling ruby 1.9.3 without ssl support? (cross compiling it for arm)
shavus has quit []
beakerman has quit [Remote host closed the connection]
* mdszy
crosses fingers, hopes this doesn't murder his machine
Deele has joined #ruby
<mdszy>
I should probably do this in C or Haskell or something
<Hanmac>
mdszy what are you trying todo?
* mdszy
installs ghc :v
<mdszy>
Hanmac: A fibonacci sequence of the numbers from one to four million
jfelchner has joined #ruby
<mdszy>
I think that Haskell's lazy typing would be best for this
<canton7>
millions? that's going to be pretty quick whatever language you do it in, I would have thought
<mdszy>
and whenever I try to do this in C, I get a segfault from the size of the array.
<mdszy>
canton7: Maybe it's just the way I'm doing it. It's not just the fibbonacci number, it's an array of the sequence
Helius has joined #ruby
<Mon_Ouie>
Enumerator.new { |y| a, b = 0, 1; loop { y << a; a, b = b, a + b } }
<mdszy>
I dunno, I just did it in Ruby and it hung
<mdszy>
I'm just gonna try it in Haskell, give me an excuse to try to learn it better XDF
<mdszy>
*XD
<burgestrand>
mdszy: there’s an example of it in haskell somewhere that allows you to exploit multiple cores of your computer (and it uses memoization as well) — a naive implementation in haskell is easy but also very slow
lxsameer has quit [Quit: Leaving]
<cek>
yes it was
cek has quit [Quit: жопа диридай диридиридай]
<mdszy>
ah
<mdszy>
I'm not very experienced in Haskell at all
<mdszy>
Heck
<mdszy>
I still don't know what a monad is
Juul has quit [Ping timeout: 248 seconds]
jsime has joined #ruby
<burgestrand>
people have the same issues with monads that new rubyists have with symbols
<canton7>
finding the fibonacci numbers under 4000000 takes a very small amount of time in ruby. Finding the first 4000000 leads to an out of memory error :P
<burgestrand>
it’s not all that complicated, just new
mdszy has quit [Quit: bye for now]
lkba has quit [Ping timeout: 255 seconds]
whiterabbit has joined #ruby
<sepp2k>
burgestrand: Given the fact that calculating all fibonacci numbers below 4 million already runs incredibly fast using one core, I'd imagine parallelizing it would introduce more overhead than it would safe time.
Juul has joined #ruby
whiterabbit has left #ruby [#ruby]
savage- has joined #ruby
<burgestrand>
sepp2k: it does for smaller amounts of numbers, but once you reach a certain threshold (was around ~40k on my machine) it was more and more beneficial
<burgestrand>
strangely enough
<burgestrand>
(considering all numbers depend on the ones before them)
iamjarvo has joined #ruby
kevingra` has quit [Ping timeout: 244 seconds]
jslvk has joined #ruby
sdwrage has quit [Quit: geekli.st/programmer]
Speed has left #ruby ["Leaving channel."]
timonv has quit [Remote host closed the connection]
Hanmac has quit [Ping timeout: 250 seconds]
jslvk has quit [Client Quit]
hoelzro is now known as hoelzro|away
<burgestrand>
eh, 40, not 40k :P
ringotwo has joined #ruby
Hanmac has joined #ruby
jmdeldin has left #ruby ["ERC Version 5.3 (IRC client for Emacs)"]
etehtsea has joined #ruby
Helius has quit [Remote host closed the connection]
btanaka has quit [Remote host closed the connection]
bier has joined #ruby
nopolitica has quit [Quit: Leaving.]
lkba has joined #ruby
Eldariof-ru has quit []
nopolitica has joined #ruby
pu22l3r has quit [Ping timeout: 240 seconds]
nilg has quit [Remote host closed the connection]
Tricks has joined #ruby
nilg has joined #ruby
Targen has quit [Ping timeout: 246 seconds]
tatsuya_o has quit [Remote host closed the connection]
<burgestrand>
superjoe: that’s not the constructor.
<shevy>
TheHypnotist-: what is that and why. require 'rubygems' works?
blazes816 has quit [Ping timeout: 250 seconds]
<superjoe>
burgestrand, let me rephrase. the point is to be able to say a = A.from_foo(3) and get an a object which has a read-only field foo equal to 3.
k_89 has quit [Quit: Leaving]
asobrasil has joined #ruby
<superjoe>
your code does not produce that API
<shevy>
well perhaps you can remove the setter method before you deliver that object
<superjoe>
whoa
mrdodo has quit [Remote host closed the connection]
<shevy>
something like remove_method(:field=) ... somehow. not sure
<burgestrand>
superjoe: I don’t see the problem. I just showed you a way to achieve what you want, I didn’t write it for you.
reuf has joined #ruby
reuf has quit [Client Quit]
<shevy>
burgestrand: that * in the initialize method... that means something like "disregard all input, we dont need it anyway"?
<burgestrand>
And yeah, you could remove the method after instantiation as well. The difference is that only the factory would return objects with the setter removed. All other instantiation would still have it.
<burgestrand>
shevy: yeah, it means "we accept any number of arguments, but ignore it"
<shevy>
awesome
richo_ has quit [Ping timeout: 260 seconds]
<shevy>
never saw that before
<burgestrand>
shevy: and later, when calling "super" (with no paren) it’ll pass those arguments along
<burgestrand>
shevy: in other words, useful for overriding new if you don’t care about the arguments
richo has joined #ruby
<burgestrand>
superjoe: point is, it’s super simple to adjust the example I gave you to do what you want.
<superjoe>
I see now, thanks.
fermion has joined #ruby
<superjoe>
don't really see why we need the weird arg parsing and super though
fermion has quit [Client Quit]
<shevy>
hehe
stephenjudkins has quit [Quit: stephenjudkins]
kevinfagan has joined #ruby
<shevy>
weird arg parsing... :D
<burgestrand>
superjoe: it’s because I’ve overriden the A.new method.
<shevy>
wicked black voodoo magic
<superjoe>
right I don't see why you'd do that either
<burgestrand>
superjoe: *shrug* just my first thought when I wrote the example.
<TheHypnotist->
shevy: the error is from a fresh ruby installation. (ruby 1.9.3p194 (2012-04-20 revision 35410) [arm-linux-uclibcgnueabi]) <internal:gem_prelude>:1:in `require': cannot load such file -- rubygems.rb (LoadError) from <internal:gem_prelude>:1:in `<compiled>'
<shevy>
ack
QaDeS has joined #ruby
<shevy>
that is a weird error
<burgestrand>
TheHypnotist-: no worries, you don’t need to require rubygems in 1.9 :)
<superjoe>
burgestrand, it scares me that your first thought is to write it in a more complicated fashion
<shevy>
ohhhhh
<burgestrand>
superjoe: I’m a complicated person
<shevy>
superjoe: that is what ruby trains folks :P
<shevy>
I can never remember offhand which of the *eval methods to call
hynkle has quit [Read error: Connection reset by peer]
mdszy has joined #ruby
<superjoe>
I've noticed that. It makes reading code a bitch.
<shevy>
Fixnum.class_eval { def number; self; end }
<Hanmac>
TheHypnotist: did you realy type rubygems.rb ? ... with the .rb?
<burgestrand>
superjoe: I didn’t read too much into what your code sample was meant to do (people write crap code samples anyway). I just tried to analyze the actual problem and did the least amount of effort to display a solution.
<shevy>
I think he did :D
<TheHypnotist->
burgestrand: silly question probably but? should it return that error when trying to use the cli by typing just 'ruby' at the bash prompt?
<shevy>
wait
<shevy>
you type only "ruby", right?
<TheHypnotist->
yep shevy
<burgestrand>
TheHypnotist-: now it’s beginning to sound like a broken ruby installation
<shevy>
then it should not do anything
<shevy>
the default is to wait
<TheHypnotist->
okies, thats probably my fault. tried to cross compile it for arm
<shevy>
when I do "ruby", it waits for input
<shevy>
hmm and python starts that python shell thing
<shevy>
oh. perl behaves like ruby. it also waits
<burgestrand>
TheHypnotist-: I don’t do my ruby compilation manually, I’m afraid I can’t help you much. I’ve seen a similar error before but can’t recall how it was resolved.
<TheHypnotist->
that's fair enough
<shevy>
and lua behaves like python
<TheHypnotist->
thanks to you both for thinking about it
<burgestrand>
iamjarvo: inside start you have a new variable scope.
<shevy>
yeah I think burgestrand is right, something is odd with the compiled ruby you got. I remember I once had a similar error... with internal thing-messages
<burgestrand>
iamjarvo: rates does not exist inside start
<shevy>
iamjarvo: what is the name
<iamjarvo>
whats the name of the ruby?
<shevy>
oh right
<shevy>
change it to RATES everywhere and it works
<shevy>
or @rates or $rates
<shevy>
iamjarvo: no, the name of the local variable you had. but I see your code is so short, easy to notice
<Mon_Ouie>
I'd go with a constant for that kind of stuff
<iamjarvo>
hrm id always thought it would be able to access it seems like every thing would have the same scope there
<iamjarvo>
I'm not defining a new rates in start
<TheHypnotist->
shevy, bugger :( I was hoping it wouldn't be tooo much of a pain to setup. I will have a look into it though, if I solve, will let you both know
<iamjarvo>
so with def start rates is looking for a rtes that local to start
<Mon_Ouie>
Methods aren't closures in Ruby, therefore they do not have access to local variables from the environment where they were defined
khakimov has joined #ruby
aces1up has joined #ruby
<aces1up>
hey all I would like to hook the require call.. where is this located? Basically I would like to make a splash screen and show what dependencies are being requires during boot of my app.
Vert has quit [Ping timeout: 252 seconds]
reuf has joined #ruby
bradhe has joined #ruby
<iamjarvo>
Mon_Ouie reason I'm getting the error is when i am loading the the file again its redefining the constant
<iamjarvo>
so figured it out :)
mrdodo has quit [Remote host closed the connection]
bowlowni_ has quit [Remote host closed the connection]
cakehero has quit [Quit: Leaving...]
bowlowni has joined #ruby
rcrossan has quit [Quit: ChatZilla 0.9.88.2 [Firefox 13.0.1/20120614114901]]
bowlowni has quit [Read error: Connection reset by peer]
bowlowni has joined #ruby
yoklov has joined #ruby
_justin has quit [Ping timeout: 246 seconds]
workmad3 has quit [Ping timeout: 244 seconds]
nachtwandler has quit [Quit: leaving]
s0ber_ has joined #ruby
MatthewGA has quit [Quit: Leaving]
crankycoder has quit [Remote host closed the connection]
<canton7>
given the HTML in str1 is invalid, I can't massively blame it. It looks like it's making the best, valid, alternative it can
<bricker88>
canton7: What is invalid about it?
mneorr has quit [Quit: Leaving.]
<canton7>
you can't have a <p> inside a <p> ?
ghvandoorn has joined #ruby
<canton7>
if you asked it to parse the str as XML, I doubt it would care. However, you asked for HTML, so methinks it'll start applying validation rules
maletor has quit [Ping timeout: 250 seconds]
<bricker88>
canton7: hmmm
<bricker88>
canton7: Thanks for the help, I didn't realize that was invalid html
richo_ has quit [Ping timeout: 260 seconds]
wangr has quit [Ping timeout: 240 seconds]
mengu has joined #ruby
richo has joined #ruby
maletor has joined #ruby
JustinCampbell has quit [Remote host closed the connection]
JustinCampbell has joined #ruby
<Eiam>
if i have something like x = [{'a'=>2}] is there a less syntatically moronic looking way to get 'a' other than x.first.first.first, or x.first.keys.first ?
jfelchner has quit [Ping timeout: 244 seconds]
<Eiam>
i spiral out into worse things like x.first.collect(&:first).flatten
bluOxigen has joined #ruby
<sernin>
How do I set an optional argument for a method? e.g. def foo(x,y) -- y may be nil
<sernin>
or do I set a default value with ||= or something of that ilk
<sernin>
equivalent to python's func(arg,*args,**kwargs) sort of thing, that collects other method arguments but doesn't complain if not present
<bricker88>
canton7: My problem (which I was trying to solve with those extra p tags) is that nokogiri is placing \n's between nodes when I run .to_html on it
<Eiam>
sernin: def foo(x,*y)
balki_ is now known as balki
<sernin>
Eiam: thanks, obviously a google-able thing but I'm stuck browserless atm
<bricker88>
canton7: Which causes layout issues on inline-block elements :-/
<ohcibi>
i have an example class Bla with a method '===' and a method 'bla', i now can do things like b = Bla.new; b === b but not b bla b (only b.bla b or b.bla(b) would be valid) can someone explain me why === doesnt need the . after b?
workmad3 has joined #ruby
rowanu has quit [Remote host closed the connection]
<bricker88>
dang, even to_s does it
<canton7>
bricker88, that's a problem? Anyway, there seems to be some saveoptions stuff you can do
khakimov has quit [Quit: Computer has gone to sleep.]
mdpatrick has joined #ruby
<burgestrand>
ohcibi: some operators can be used infix, there’s a list of them somewhere
mdpatrick has quit [Remote host closed the connection]
mdpatrick has joined #ruby
mrdodo has joined #ruby
mpereira has quit [Ping timeout: 252 seconds]
<bricker88>
canton7: yes, it's a problem if there are newlines in some cases, particularly with inline-block, because browsers suck and stuff. I see the save options, thank you
jstotz has joined #ruby
banghouse is now known as banghouseAFK
<canton7>
the last whitespace browser issue I know of was the IE newline bug, back in IE5 or so :S
jstotz has quit [Client Quit]
<burgestrand>
ohcibi: can’t find it ^^
chomp has quit [Quit: Leaving]
<ohcibi>
burgestrand: it was more a theoretical question... the infix keyword is satisfying for me to google... thx 8-))
<burgestrand>
:)
TorpedoSkyline has joined #ruby
sailias has quit [Ping timeout: 252 seconds]
AlbireoX` has joined #ruby
hynkle has quit [Quit: Computer has gone to sleep.]
tagrudev has joined #ruby
tagrudev has quit [Client Quit]
zeromodulus has quit [Ping timeout: 246 seconds]
mrdodo has quit [Remote host closed the connection]
Gavilan has joined #ruby
jgrevich has quit [Read error: Connection reset by peer]
<Mon_Ouie>
You only need one element, no need to keep all the previous items in memory
sebastorama has quit [Quit: Computer has gone to sleep.]
<mdszy>
true
<mdszy>
but I needed the array for testing
<mdszy>
and I just decided to keep it in there
<canton7>
I one-lined it, though it's rather ugly and about the most inefficient method possible. Enumerator.new{ |y| i=0; loop{ i+=1; y << i unless (2..Math.sqrt(i)).any?{ |j| i % j == 0 } } }.take(10001).last
<mdszy>
I tested to make sure that the array given by primes(6) was, in fact, the first six prime numbers
<Mon_Ouie>
Why? You can test if prime(6) is the 6th element and same for a few other values
* mdszy
shrugs
<mdszy>
it worked
<mdszy>
that's all that really matters XD
<mdszy>
I'm just completing some Project Euler challenges
<mdszy>
I'll only ever have to use this code once
yxhuvud has quit [Ping timeout: 246 seconds]
zeromodulus has joined #ruby
<ohcibi>
i'm just calculating the 10020002. prime number because of you
<mdszy>
XD
<ohcibi>
it takes long, even with require 'prime'
<Hanmac>
but be carefull ... some prime numbers are illegal
<ohcibi>
Hanmac: they sold a book on amazon, it contained 1000 unknown primenumbers
chson has quit [Remote host closed the connection]
stephenjudkins has quit [Ping timeout: 244 seconds]
TorpedoSkyline has quit [Quit: Computer has gone to sleep.]
wargasm has joined #ruby
hasrb has quit [Remote host closed the connection]
jfelchner has joined #ruby
stephenjudkins has joined #ruby
nateberkopec has quit [Quit: Leaving...]
RichGuk has joined #ruby
mdpatrick has quit [Quit: mdpatrick]
wargasm has quit [Ping timeout: 252 seconds]
jarred has quit [Quit: jarred]
heeton has joined #ruby
banseljaj is now known as imami|afk
sebicas has joined #ruby
jarred_ has joined #ruby
asobrasil has left #ruby [#ruby]
minijupe has quit [Quit: minijupe]
cbuxton1 has joined #ruby
cbuxton has quit [Ping timeout: 255 seconds]
jonathanwallace has joined #ruby
balki_ has joined #ruby
alanp_ has joined #ruby
bbttxu has quit [Quit: bbttxu]
_justin has joined #ruby
minijupe has joined #ruby
wargasm has joined #ruby
billiam has quit [Read error: Connection reset by peer]
alanp has quit [Ping timeout: 265 seconds]
balki has quit [Ping timeout: 265 seconds]
`brendan has quit [Quit: - nbs-irc 2.39 - www.nbs-irc.net -]
kenichi has quit [Remote host closed the connection]
JustinCampbell has joined #ruby
dv310p3r has quit [Ping timeout: 246 seconds]
Criztian has quit [Remote host closed the connection]
fbernier has joined #ruby
kirun_ has joined #ruby
IcyDragon has joined #ruby
mneorr has joined #ruby
DrShoggoth has quit [Quit: Leaving]
choffstein has quit [Remote host closed the connection]
IceDragon has quit [Ping timeout: 248 seconds]
workmad3 has quit [Ping timeout: 252 seconds]
jonathanwallace has quit [Remote host closed the connection]
kirun has quit [Ping timeout: 272 seconds]
banghouseAFK is now known as banghouse
codezombie has quit [Quit: Leaving...]
codezombie has joined #ruby
heeton has quit [Quit: Leaving.]
minijupe has quit [Quit: minijupe]
headius has quit [Quit: headius]
zemanel has quit [Read error: Connection reset by peer]
zemanel has joined #ruby
heeton has joined #ruby
Stalkr_ has joined #ruby
<Stalkr_>
Hey all
tiripamwe has joined #ruby
snearch has quit [Quit: Verlassend]
<Stalkr_>
Anyone able to help me with a simple rubygems (loaderror)?
vpitriumph has joined #ruby
jparkton has left #ruby ["%"]
<vpitriumph>
Total channel newbie here so I don't know etiquette, what's the proper way to ask a technical question?
<Mon_Ouie>
The golden rule is, don't ask for permission to ask a question
IcyDragon is now known as IceDragon
<Mon_Ouie>
Other than that, just explain your problem and show your code if needed
fayimora has joined #ruby
Osum has quit [Quit: Lost terminal]
<vpitriumph>
Well in that case. I'm using ActiveRecord outside of rails. It works pretty well. I have one table that has a primary key on it, and when I attempt to 'save' an object to that table that field doesn't show up at all in the corresponding sql query. Nor can I set it in the Ruby object itself.
ringotwo has quit [Remote host closed the connection]
<vpitriumph>
If that field is not a primary key in the database, everything works swimmingly
heeton has quit [Quit: Leaving.]
carlyle_ has quit [Remote host closed the connection]
apeiros_ has joined #ruby
<davidcelis>
that's part of activerecord
<davidcelis>
typical AR tables just have one primary key field, which is ID, and they don't allow you to mess with it
<davidcelis>
other columns are made keys via indices
Croms has quit [Read error: Connection reset by peer]
Dennis_ has joined #ruby
<davidcelis>
or are a MUL key type
<davidcelis>
rather than PRI
<vpitriumph>
This also happens when the column is set to be unique.
<rking>
Some day people are going to marvel that Python was ever popular.
<davidcelis>
dang
<davidcelis>
that is some javascript shit right there
<davidcelis>
though everyone's right
<davidcelis>
using `is` is pretty dum
Spooner has joined #ruby
<vpitriumph>
Is there something other than AR that I should be using for ORM if I'm not going to be using it to build my actual tables and hence not building the indecies I need. Or is there a way I can fake the indecies to make AR happy and achieve PK functionality?
heeton has quit [Client Quit]
<pk1001100011>
You will never achieve my functionality (boss)
<davidcelis>
i dont think i'd recommend using AR outside of Rails
zeromodulus has quit [Ping timeout: 248 seconds]
<davidcelis>
i like DataMapper
zemanel has quit [Quit: Remote hottie closed the connection]
<vpitriumph>
Should DataMapper be able to handle the situation I'm describing? Long story short is I'm mucking around with an already existing DB.
<Stalkr_>
God damn, this is annoying. If I sudo, I get error because I can't load rubygems. If I don't sudo, I get error because port 443 is reserved :-/
<Mon_Ouie>
Well, it *is* related to RVM
<Stalkr_>
I will go ask them :D
<Stalkr_>
Just #rvm?
burgestrand has quit [Quit: Leaving.]
<Mon_Ouie>
Since it's about being able to use RVM-installed rubies as super user
Stalkr_ has quit [Changing host]
Stalkr_ has joined #ruby
centipedefarmer has quit [Quit: This computer has gone to sleep]
krusty_ar has quit [Remote host closed the connection]