artOfWar has quit [Remote host closed the connection]
<tightwork>
getting rvm, rails, gem, bundler to work right is like chewing glass while jumping through a burning hoop into a bath of lemon juice
<Spooner>
ForSpareParts : have you checked "gem which" on one of the gems you've installed and checked if it is in an expected place? (~/.rvm/rubies/1.9.3...whatever/) ?
<Spooner>
I assume you are using 1.9.3?
erichmenge has joined #ruby
julio has quit [Ping timeout: 276 seconds]
<Spooner>
If you are on 1.8.7, then you need "require 'rubygems'" before ruby will see other gems so you can require them, which would explain your problem too.
bigkm has quit [Ping timeout: 255 seconds]
<ForSpareParts>
Spooner: It's all solid now. gem install without sudo did the trick. Now I'm having trouble requiring one of my own source files, though...
Berglund has quit [Quit: Computer died.]
tewecske has quit [Quit: Leaving.]
xaq has quit [Remote host closed the connection]
xorgnak has joined #ruby
<Spooner>
Use require_relative in 1.9.3. It doesn't include the file's directory any more.
<ForSpareParts>
Spooner: Ah, got it. Thanks!
baroquebobcat has quit [Quit: baroquebobcat]
Asher has joined #ruby
<Spooner>
Excellent!
bigkm has joined #ruby
jgrevich has quit [Ping timeout: 276 seconds]
verto|off is now known as verto
kvirani has joined #ruby
jgrevich_ has joined #ruby
<ForSpareParts>
And... "Sinatra has taken the stage." Wooooooooooooooooooooooooo
verto is now known as verto|off
Markvilla has quit [Quit: Markvilla]
benson has quit [Remote host closed the connection]
beakerma_ has quit [Remote host closed the connection]
ken_barber has quit [Remote host closed the connection]
mrsolo has quit [Quit: Leaving]
foolove has quit [Ping timeout: 245 seconds]
stephenjudkins has joined #ruby
beakerman has joined #ruby
Bosma has quit [Ping timeout: 252 seconds]
Bosma has joined #ruby
DarthGandalf has quit [Ping timeout: 245 seconds]
indian has quit [Quit: Leaving]
jarray52 has joined #ruby
ph^ has quit [Remote host closed the connection]
fayimora has quit [Quit: Busy…..zzzzz]
cbuxton has quit [Quit: Leaving.]
DarthGandalf has joined #ruby
yoklov has joined #ruby
wilmoore has quit [Remote host closed the connection]
wilmoore has joined #ruby
wilmoore has quit [Ping timeout: 250 seconds]
aantix has quit [Ping timeout: 246 seconds]
xorgnak has quit [Remote host closed the connection]
bowlowni has joined #ruby
Guest19743 has quit [Ping timeout: 248 seconds]
vertroa has quit [Read error: Connection reset by peer]
pdtpatrick has quit [Quit: pdtpatrick]
nadirvardar has quit [Quit: Computer has gone to sleep.]
Guedes has quit [Ping timeout: 255 seconds]
xorgnak has joined #ruby
neersighted has joined #ruby
stephenjudkins has quit [Quit: stephenjudkins]
Chryson has joined #ruby
davidcelis has quit [Quit: K-Lined.]
stephenjudkins has joined #ruby
BigFatFatty has left #ruby ["Leaving"]
ianbrandt has quit [Quit: ianbrandt]
jonathancutrell has joined #ruby
adamkittelson has quit [Remote host closed the connection]
xorgnak has quit [Remote host closed the connection]
hunglin has joined #ruby
sgronblom has quit [Ping timeout: 255 seconds]
xorgnak has joined #ruby
minijupe has joined #ruby
vertroa has joined #ruby
<ForSpareParts>
I'm trying to use the JSON gem to serialize data in a Sequel model from a MySQL database, but I'm getting the invalid byte sequence in UTF-8 error -- I know there are fixes for that, but I'm not sure how to access these strings as they're being created. Could anyone point me in the right direction?
nilg has quit [Remote host closed the connection]
jonathancutrell has quit [Quit: jonathancutrell]
cableray has joined #ruby
ringotwo has quit [Remote host closed the connection]
<Xethron>
oooooohhh-kay...
<Xethron>
I need help :(
wargasm has joined #ruby
<Xethron>
Think IRC Bot... I have a class with two functions. One function calls a whois. The bot handles the whois, and sends it to the second function...
<Xethron>
The second function changes a global var within the class...
ackz has joined #ruby
<Xethron>
Now... as I don't know when exactly this will happen, I set up a while loop, that checks when the global var will finally be set...
<Xethron>
However, first time I call the global var, it simply assumes it won't change... So once my second function changes it, the first function still views a cashed version...
Banistergalaxy has quit [Ping timeout: 276 seconds]
<Xethron>
How do I get it to reload the global var every time the while loop runs?
andrewhl has quit [Remote host closed the connection]
xorgnak has quit [Remote host closed the connection]
<Xethron>
ForSpareParts: There ya go. :P Hope it makes sense :)
jeff_sebring has joined #ruby
ByteCrunch has quit [Ping timeout: 248 seconds]
<Xethron>
@irc.raw( "whois #{nick}" ) sends a whois to IRC... def whois( hash ) gets called once a whois is recieved from the server...
<dekz>
If require can find the item in $LOAD_PATH, why can't autoload?
greasegum has quit [Ping timeout: 244 seconds]
savage- has quit [Ping timeout: 244 seconds]
chimkan_ has quit [Quit: chimkan_]
Bosox20051 has joined #ruby
<dekz>
I have added my lib dir to the front of $LOAD_PATH, require can find it, but autoload thinks there is an unitialzed constant when using it
superjoe has left #ruby ["Leaving"]
<Xethron>
ForSpareParts: If I set the initual sleep to like, 5 seconds... And the whois function sets the global hash before the while... It reads it and skips the while. But once in the while loop, it doesn't matter if the global var is set. The function never sees it.
jgrevich_ is now known as jgrevich
<ForSpareParts>
Xethron: I'm pretty new to Ruby myself, so I might be missing something -- what's failing to update? And at what point in the code?
<Spooner>
Xethron : The only global variables start with $ - you can't have "global variable in a class"
ByteCrunch has joined #ruby
headius has joined #ruby
<Spooner>
I think you mean an instance variable (starts with @)
<Xethron>
Spooner, ah, soz, yea :$
<Xethron>
pretty new to ruby myself
<Xethron>
ForSpareParts: ok, once @whois[nick.downcase] is called, it gets cashed within the current function
<burgestrand>
Xethron: you can’t have line #23, more or less.
mvangala_home has quit [Ping timeout: 255 seconds]
<burgestrand>
Xethron: your so-called caching.
oooPaul has joined #ruby
oooPaul has quit [Client Quit]
<burgestrand>
Xethron: or, you could but the workaround to doing that would probably be more ugly.
Hanmac has quit [Read error: Operation timed out]
mvangala_home has joined #ruby
xorgnak has joined #ruby
<Xethron>
burgestrand: the problem is, I send a message to the server, and then I have to wait for multiple lines to return, and then somehow inject that back into the called function... And depending on internet speed, that time may change
<Xethron>
So, technically I call mywhois = whois.get("nickname")
<Spooner>
You are perhaps better passing a block to get and using that as a callback? You seem to be working around a lot of problems that aren't there :)
<Xethron>
Spooner: a block?
<Xethron>
and then I try to stall the whois.get("nickname") till I get the whois from the server... And once recieved, continue with the function that called it
<ForSpareParts>
Xethron: I wondered if you were doing something like that.
<ForSpareParts>
Xethron, basically, (Spooner, correct me if I'm wrong) you should be passing around a bit of code and calling that when your data comes back, instead of waiting on your data to continue execution.
<Xethron>
Spooner, lemme try this
<Spooner>
ForSpareParts: Yes, that is what I'm meaning. No point waiting around, but I am not sure of the use case - e.g. whether you expect to get a lot of #get calls before the first one returns, for example (I'm also not entirely sure how the irc object even knows how to call back to whois, but...).
jarray52 has quit [Changing host]
jarray52 has joined #ruby
<Spooner>
Might be easier to tell irc to call back to the block without calling #whois at all.
mvangal__ has joined #ruby
andrewhl has joined #ruby
xorgnak has quit [Remote host closed the connection]
jarray52 has quit [Read error: Operation timed out]
xorgnak has joined #ruby
eywu has quit [Quit: Leaving.]
jarray52 has joined #ruby
beakerman has quit [Read error: Connection reset by peer]
chimkan_ has joined #ruby
jarray52 has quit [Changing host]
jarray52 has joined #ruby
jbohn has quit [Quit: Leaving...]
beakerman has joined #ruby
mvangala_home has quit [Ping timeout: 276 seconds]
apok_ has joined #ruby
ringotwo has joined #ruby
mvangala_home has joined #ruby
Hanmac has joined #ruby
yfeldblum has joined #ruby
headius has quit [Quit: headius]
krzkrzkrz has joined #ruby
zeen has joined #ruby
Guedes has joined #ruby
Banistergalaxy has joined #ruby
apok has quit [Ping timeout: 276 seconds]
mvangala_home has quit [Remote host closed the connection]
axl_ has quit [Quit: axl_]
apok_ has quit [Ping timeout: 276 seconds]
mvangala_home has joined #ruby
mvangal__ has quit [Ping timeout: 255 seconds]
krz has quit [Ping timeout: 276 seconds]
krzkrzkrz is now known as krz
<Xethron>
Spooner: don't think its working
<Spooner>
There are any number of reasons it might not be working :)
<Xethron>
lol
<Xethron>
I know
<Xethron>
:/
<Xethron>
lemme read up what a callback is
pdtpatrick has joined #ruby
<Spooner>
Does it call your whois and give you a notification? Because if it isn't you probably arent' setting up the callback to that properly, never mind the callback to the original caller.
krusty_ar has joined #ruby
nari has joined #ruby
shiki has quit [Remote host closed the connection]
zemanel has quit [Quit: Remote hottie closed the connection]
<Xethron>
Yes... all the functions seem to be running
sendoushi has joined #ruby
robozahn_ has joined #ruby
k_89 has joined #ruby
minijupe has quit [Quit: minijupe]
<Xethron>
Spooner: ok...
<Xethron>
it runs through the "get" statement... and I recieve a whois from the server...
KTMBoID has joined #ruby
Speed has quit [Quit: When two people dream the same dream, it ceases to be an illusion.]
<Xethron>
But in the @whois.get arguments do |hash|... it doesn't enter that...
<Spooner>
mm
<Xethron>
Umm, its not in the same file though
<Xethron>
Its two different classes
<Spooner>
You've lost me.
<Xethron>
Does that make a difference?
<Xethron>
lol...
<Spooner>
No, because the do-end gets passed into the &block parameter.
<Xethron>
ah
<Xethron>
:/
robozahn has quit [Ping timeout: 265 seconds]
<Spooner>
You get "@irc.notice( "Xethron", "Whois Recieved" )" run though?
<Xethron>
Yes
<Xethron>
But only after it run through the entire get statement
<Spooner>
Yes, as it would be expected to.
<Xethron>
I put a notice at the end of the get statement... and I get that notice first... and then I get "Whois Recieved"
<Xethron>
ah
<Xethron>
Ok
<Spooner>
I don't understand at all then, I'm afraid. If it defineitely gets to "@callback.call hash" then it must be calling something, or there'd be an error raised :D
ringotwo has quit [Remote host closed the connection]
headius has quit [Quit: headius]
<Xethron>
ok, in my dev.rb, I have this function that calles the functions in my whois.rb
khakimov has quit [Quit: Computer has gone to sleep.]
KTMBoID has quit [Read error: Connection reset by peer]
Bosox20051 has quit [Write error: Connection reset by peer]
<Spooner>
That should work fine, as far as I can tell.
mahmoudimus has quit [Quit: Computer has gone to sleep.]
<Xethron>
:(
* Xethron
slaps the thing
jeff_sebring has quit [Quit: Leaving]
shadoi has quit [Quit: Leaving.]
josefig has quit [Ping timeout: 276 seconds]
<Spooner>
It looks nicer than the old code though. It doesn't work any _worse_ and it looks better. Can't argue with that :P
fantazo has quit [Remote host closed the connection]
<Xethron>
haha
<Xethron>
indeed it does :P
sendoushi has quit [Remote host closed the connection]
<Xethron>
Thanks for helping with the code neatness
delinquentme has quit [Quit: Leaving]
<Spooner>
Maybe someone can appear to put you out of your misery. I'm tired, and about to go to bed, so I might have made a painful mistake. Sorry.
voodoofish430 has quit [Quit: Leaving.]
obryan has joined #ruby
manizzle has quit [Ping timeout: 246 seconds]
<Xethron>
Spooner, no, thank you... You pointed me in the right direction
<Xethron>
Looking up callbacks now
gmci has quit [Read error: Connection reset by peer]
AlbireoX`Laptop has joined #ruby
cakehero has quit [Quit: Computer has gone to sleep.]
adamkittelson has joined #ruby
digitalcakestudi has joined #ruby
rvmeier has quit [Quit: Saliendo]
gmci has joined #ruby
<Xethron>
whoa
krz has quit [Ping timeout: 246 seconds]
<Xethron>
ok, I think I now know less about callbacks :/ Shit makes no sense :(
mucker has quit [Ping timeout: 276 seconds]
ryan0x2 has joined #ruby
igotnolegs has joined #ruby
iamjarvo has joined #ruby
ZachBeta has joined #ruby
<burgestrand>
Xethron: what are you doing?
<Xethron>
burgestrand... I have NO idea :D
<Xethron>
:P
<burgestrand>
Xethron: ^^
<Xethron>
gimme a min, gonne try something quick
<Xethron>
If this works, I'm the smartest man alive... But I strongly believe it won't work
niklasb has quit [Ping timeout: 246 seconds]
ringotwo has joined #ruby
Guedes has quit [Ping timeout: 276 seconds]
savage- has joined #ruby
<Xethron>
burgestrand: Didn't work :(
kvirani has quit [Remote host closed the connection]
<Xethron>
Ok... lets see if I can explain this nicely
shadoi has joined #ruby
<Xethron>
I have a IRC parser, that captures a whois once its sent... At anytime the server decides to send me whois info, it gets caputred and sent to my whois function
burgestrand has quit [Quit: Leaving.]
<Xethron>
So this is entirely seperate from calling a whois...
<Xethron>
So in essence, what I wish to accomplish, is, call a whois, place the function on halt untill I recieve the whois from the server (The time can vary according to connection speed... Hell, the server might even never return the whois info)
<Xethron>
and then get the info, and continue the function
<Xethron>
so that I can process it in whatever way I wish
<X-Jester>
so what's happening? the whois function is asynchronous?
<X-Jester>
your whois call is returning immediately?
<Xethron>
X-Jester, well, that depends on the server and connection speed... But yes... It should return within 2 seconds one could assume
radic has quit [Read error: Operation timed out]
<X-Jester>
i'mt rying to figure out where it's breaking down
savage- has quit [Remote host closed the connection]
<X-Jester>
did you *write* this whois function, or are you using one from a gem?
<Xethron>
Ok... Lemme try and do this
LBRapid has joined #ruby
mvangala_home has quit [Remote host closed the connection]
chson has quit [Remote host closed the connection]
<Xethron>
In my first try, I tried to create a while loop, that will loop until the whois function sets the var...
verto is now known as verto|off
<X-Jester>
right, but are you, in your own code, putting whois out to the server and waiting for the response? or are you using an irc implementation from someplace else?
<Xethron>
Now apart from being VERY ineffective...
<Xethron>
X-Jester, yes...
<X-Jester>
that's not yes or no
cableray has quit [Quit: cableray]
<Xethron>
I am sending a whois to the server, and then waiting for a response
apok has joined #ruby
<X-Jester>
which is a series of numerics, yes?
<Xethron>
However, sending to the server, and waiting for a response are two different things
bairui has joined #ruby
<Xethron>
So... I'm not sure how to make a function "wait" for a response...
<Xethron>
Ok... Lemme try pastebin all this code...
<X-Jester>
right, so you're wanting to get IRC 318 back
cantonic has quit [Quit: cantonic]
<X-Jester>
and pass that back to the caller
<X-Jester>
yes?
<Xethron>
yes... But I'm not sure how to pass that to the caller function...
<bairui>
do you guys know of a general purpose bisect tool (similar in nature to that of vcs tools, like git bisect but not limited to finding an offending commit, but rather able to be provided with a test driver)?
jhunter has quit [Ping timeout: 255 seconds]
vertroa has quit [Remote host closed the connection]
sent-hil has joined #ruby
<sent-hil>
damn time libraries are slow, i'm getting 100% decrease in response time when I took out DateTime.parse
<sent-hil>
is that normal?
digitalcakestudi has quit [Quit: Leaving.]
<graspee>
are you calling it like 50 times a second or something?
<sent-hil>
graspee: prob. more
sgronblom has quit [Ping timeout: 246 seconds]
<graspee>
for what reason?
<graspee>
if you're processing a ton of dates from somewhere, fair enough, but if you're checking while someone is typing in a text entry field or something...
<sent-hil>
so i can compare the times and throw out the values not within the time range
<sent-hil>
a whole lot of fb insights data
<X-Jester>
Xethron: one improvement you might make ruby-style is to pass a block of code to the whois function
<X-Jester>
and have the whois function 'yield' a hash of data
ghaydarov has joined #ruby
radic has joined #ruby
<graspee>
sent-hil: when you say response time, what are you responding to? some kind of user input while processing these dates?
<Xethron>
X-Jester, yeah, thats what I have NO idea to do... I read up online... But after I tried it... Everything just went haywire :P
vectorshelve has joined #ruby
<vectorshelve>
Class A Class << self what is the meaning of this in ruby ?
<X-Jester>
alright, so you really just want a synchrnous whois function
<sent-hil>
graspee: api response time, i take a whole lot of fb insights data, find the right insights, do more processing and show some basic metrics, i.e. growth, best/worst time etc.
<Xethron>
but that didn't work
jhunter has joined #ruby
cakehero has joined #ruby
<sent-hil>
guess i'll have to move the date comparison to mongodb or somewhere else
<Xethron>
X-Jester: Yeah, I just want to return what is grabbed by the "whois" function with the "get" function
<graspee>
i'm not sure what fb is if it's not facebook hehe
joekarma has quit [Quit: joekarma]
<X-Jester>
what are the chances that whois will cause the whole irc handler to freeze while it's waiting?
<sent-hil>
graspee: yea Facebook :)
<graspee>
oho is this some kind of evil Orwellian plan then?
<Xethron>
X-Jester: Doubt that will ever happen
<Xethron>
X-Jester, every plugin (like the whois plugin) runs in a thread
<X-Jester>
Xethron: is whois running on another thread?
<X-Jester>
ah, ok
brokenshakles has joined #ruby
<sent-hil>
graspee: lol hardy
noganex has quit [Ping timeout: 276 seconds]
<brokenshakles>
Is it possible to reference variables inside of a String interpolation field? Specifically var = %x[shell command]
nilg has joined #ruby
<vandemar>
same as in quoted string #{expr}
LBRapid has quit [Quit: Farewell.]
<brokenshakles>
I'm sorry, I dont quite understand the response.
noganex has joined #ruby
wilmoore has joined #ruby
<Xethron>
X-Jester, so umm, got any ideas?
<brokenshakles>
Will var = %x [shell command $OPTION] work?
<bairui>
so, i'll assume that's a "no". Fair enough. Then, i'd like to build one using ruby. To achieve this, I (assume I) will need to move (possibly large numbers of) files (or directories) in and out of a (possibly many) directory, running the supplied 'test' at each move to narrow down an offending file (or dir). My questions are: what libs should I be looking at for the file movement? is creating a tempfile
<bairui>
directory sufficient as storage for the moved-aside files (providing i check that target for sufficient space)?
ringotwo has quit [Remote host closed the connection]
<vandemar>
brokenshakles: %x[command #{OPTION}] just like strings where you could do puts "these are the options: #{OPTION}"
<vectorshelve>
what is the difference between !obj and !!obj in ruby
stefanp_ has joined #ruby
<X-Jester>
Xethron: thinking
<Xethron>
lol
<X-Jester>
Xethron: one possible idea i have is to actually have a collection shared between irc and whois
<X-Jester>
so, as @irc gets the numerics, it's building a hash of the user info in a hash, and whois is sleeping until that hash entry is complete or it gives up and deletes it
<vandemar>
vectorshelve: one is the logical opposite of the other
<vectorshelve>
vandemar: u mean !!(item.name =~ /imported/) or (item.name =~ /imported/) are same ?
<Xethron>
X-Jester, thats EXACTLY what I need...
<Xethron>
But how do I get it to sleep?
<X-Jester>
is your original pastebin not sleeping?
cantonic has joined #ruby
<Xethron>
yes... and then it goes into a while... that sleeps every few seconds
<vandemar>
vectorshelve: no they are not necessarily the same. many things evaluate to true in logical context, nil and false both evaluate to false, but !!(value) is always true or false
<X-Jester>
let me back out of ruby for a second and throw bad computer science at you
<X-Jester>
when you spawn off a worker thread to go off and do some stuff, you use thread signaling to tell the caller you're done
<Xethron>
However, seems like, as soon as I call instance variable, it kinda "cashes" it for that thread...
<vectorshelve>
vandemar: ok
<X-Jester>
the caller then 'waits' for a signal (different than sleeping)
<vandemar>
vectorshelve: you're guaranteed that !obj and !!!obj are identical though... I think...
<Xethron>
and once the "whois" function updates it... It doesn't reload it
<X-Jester>
sleeping is for a finite period of time, waiting is awaiting a signal
<vectorshelve>
vandemar: thanks mate
stefanp has quit [Ping timeout: 265 seconds]
<Xethron>
X-Jester, ok, makes sense
<Xethron>
So I need to find out how to make a thread that waits for a signal to continue?
<X-Jester>
i.e. i see some (not IRC-related) examples that suggest you can 'call' whois by waiting for an item to 'pop off' of the queue (which blocks), and having a 318 message or other fallback mechanism 'pop' an item on to the queue when the whois is complete
ringotwo has joined #ruby
socomm has quit [Quit: WeeChat 0.3.7]
Ionic` has quit [Ping timeout: 244 seconds]
nilg has quit [Read error: Operation timed out]
manizzle has joined #ruby
IcyDragon has joined #ruby
<X-Jester>
also, i mistakenly said 'pop' when i meant 'enq'
<Xethron>
whoa... ok, I am getting my head around this... Ummmm...
paradoja has quit [Remote host closed the connection]
IceDragon has quit [Ping timeout: 276 seconds]
<Xethron>
yeah
mahmoudimus has joined #ruby
<X-Jester>
Xethron: so here's how i see this going
<brokenshakles>
Is every thing between the brackets in a %x[] declaration treated as a single command?
obryan has quit [Ping timeout: 250 seconds]
subbyyy has joined #ruby
<vandemar>
brokenshakles: it's passed to a shell. %x[a; b] will run both a and b in sequence
jarred has joined #ruby
<X-Jester>
brokenshakles: only if you quote-escape the command
<Xethron>
X-Jester, I owe you like a huge pack of biltong or a 6 pack of beer or something
<X-Jester>
Xethron: did you get a good idea sorted?
<brokenshakles>
vandemar, yes but %x[a
<brokenshakles>
b]
<Xethron>
X-Jester, not yet no... Still trying to make sense of this... But holy crap you've spent so much time helping me :P
<brokenshakles>
is treated as a single line?
<X-Jester>
brokenshakles: %x["ls -l"] is different than %x[ls -l]
<brokenshakles>
I see, whats the difference?
<X-Jester>
the first example looks for the command executable named "ls -l"
<X-Jester>
the second example executes the "ls" command with the "-l" argument
<brokenshakles>
I see.
cantonic has quit [Quit: cantonic]
<X-Jester>
if you want to run two commands from %x[], you can separate them by commas
<X-Jester>
but quote escapes don't work like you'd think they do.
<vandemar>
brokenshakles: why don't you load up irb and try these things out instead of asking?
<X-Jester>
Xethron: sec, trying to drum up an example
flip_digits has joined #ruby
abra has quit [Ping timeout: 276 seconds]
ryan0x2 has quit [Remote host closed the connection]
<X-Jester>
Xethron: i can't yet see how using this system a queue won't cause deadlock if a 318 is never returned
gtuckerkellogg has quit [Quit: Computer has gone to sleep.]
<Xethron>
X-Jester, I'll figure that out... :P
<Xethron>
I'll set a timer that does that automatically after x seconds...
<X-Jester>
i also don't know precisely how we'd avoid stacked whois commands
<Xethron>
I kinda need stacked whois commands :/
<X-Jester>
for example, if whois foo and whois bar are both executed before a 318 is ever received, i'm not too sure what to do about that
<X-Jester>
maybe this is a bad approach
<Xethron>
umm... X-Jester: no... In my parser, it samples the data according to the nickname
<X-Jester>
right, but as it stands right now, we're looking at a single shared queue which is just a dumb stack of push/pops
<Xethron>
ok
<Xethron>
Once I see how it works I'll try adding multiple queue's or something...
<X-Jester>
you basically need both classes to have the same reference to a queue, then having your sleep timer execute queue.deq, and the 318 parser doing a queue.enq
<X-Jester>
er, "replacing your sleep timer with queue.deq"
<X-Jester>
i did this in C# once but i used delegates and callbacks and such
<X-Jester>
i'm not rubywise enough to know how to do this off the top of my head
<Xethron>
X-Jester, ok
<Xethron>
I'm gonne play a bit
<X-Jester>
cool, good luck
jesly__ has joined #ruby
<Xethron>
Ill post you the working code in a bit :P
vectorshelve has quit [Ping timeout: 245 seconds]
stephenjudkins has quit [Quit: stephenjudkins]
Progster has joined #ruby
areil has joined #ruby
morodin has joined #ruby
darren_ has quit [Remote host closed the connection]
<Xethron>
X-Jester: mind a pm?
Progster has quit [Ping timeout: 252 seconds]
verbad has joined #ruby
mockra has joined #ruby
IcyDragon has quit [Quit: ~ヾ(^∇^)]
nedbat has quit [Ping timeout: 250 seconds]
erichmenge has quit [Quit: Be back later]
cloud|office has joined #ruby
Rizzle has joined #ruby
wilmoore has quit [Remote host closed the connection]
erichmenge has joined #ruby
wilmoore has joined #ruby
ViperMaul has quit [Ping timeout: 245 seconds]
erichmenge has quit [Client Quit]
BMF has joined #ruby
banister`bina has quit [Remote host closed the connection]
blazes816 has quit [Quit: Leaving]
cakehero has quit [Quit: Computer has gone to sleep.]
jeff_sebring has joined #ruby
wilmoore has quit [Ping timeout: 244 seconds]
sgronblom has joined #ruby
richardcreme has quit [Read error: Connection reset by peer]
ViperMaul has joined #ruby
cakehero has joined #ruby
Rizzle has quit [Ping timeout: 252 seconds]
sent-hil has quit [Remote host closed the connection]
mikepack has joined #ruby
bnagy has joined #ruby
ananthakumaran has joined #ruby
emmanuelux has quit [Ping timeout: 252 seconds]
jhunter has quit [Ping timeout: 276 seconds]
savage- has joined #ruby
jrajav has quit [Quit: The best darkness is strange and surprising]
gmci has quit [Quit: Computer has gone to sleep.]
jhunter has joined #ruby
wpaulson has joined #ruby
robbyoconnor has joined #ruby
sebicas has quit [Quit: sebicas]
richardcreme has joined #ruby
zodiac1111 has joined #ruby
robbyoconnor has quit [Remote host closed the connection]
jhunter has quit [Ping timeout: 255 seconds]
robbyoconnor has joined #ruby
wilmoore has joined #ruby
savage- has quit [Remote host closed the connection]
<jumpingcloud>
oh that's so cool. It worked. i got it!
Tomasso has quit [Ping timeout: 252 seconds]
<Xethron>
:D
<Xethron>
jumpingcloud: Awesome... You're dream inside your dream came alive? :P
<vandemar>
jumpingcloud: running a ssh command on the remote host, or chaining objects somehow?
iamjarvo has joined #ruby
banister`bina has joined #ruby
minijupe has quit [Ping timeout: 250 seconds]
<jumpingcloud>
hmm so, it's just simply an object inside another object but it took me forever to figure out a good way (good tool) to create an ssh session inside an ssh session and run commands on either server.
<jumpingcloud>
i ended up using require 'net/ssh'
Banistergalaxy has quit [Ping timeout: 250 seconds]
<jumpingcloud>
man ruby is so awesome i don't know what to do about it.
Solnse has joined #ruby
<jumpingcloud>
=D thanks all !!
Solnse has quit [Client Quit]
savage- has joined #ruby
<Xethron>
lol jumpingcloud :) You sound about as happy as I do now :D
<Xethron>
Got my threading to work :D
<Xethron>
woot woot
banister`bina has quit [Remote host closed the connection]
<Xethron>
All thanks to X-Jester... The smartest man on earth :P
Ethan has joined #ruby
Ethan has quit [Client Quit]
Ethan has joined #ruby
<Xethron>
lol... {^_^}_ What a interesting nick
sent-hil has joined #ruby
azm has quit [Ping timeout: 255 seconds]
savage- has quit [Remote host closed the connection]
a_a_g has joined #ruby
byronb has joined #ruby
byronb has quit [Excess Flood]
jesly__ has joined #ruby
krz has joined #ruby
yoklov has quit [Quit: computer sleeping]
nilg has joined #ruby
Chryson has quit [Quit: Leaving]
Banistergalaxy has joined #ruby
MasterLambaster has joined #ruby
devbug has left #ruby ["To the moon!"]
codezombie has quit [Read error: Connection reset by peer]
mxweas has joined #ruby
Araxia has quit [Quit: Araxia]
subbyyy has quit [Quit: Leaving.]
zodiac1111_ has joined #ruby
k_89 has quit [Ping timeout: 255 seconds]
minijupe has joined #ruby
banister`bina has joined #ruby
banister`bina is now known as banisterfiend
zodiac1111 has quit [Ping timeout: 276 seconds]
ananthakumaran has quit [Quit: Leaving.]
bglusman has quit [Remote host closed the connection]
<Xethron>
Ok, I wanne do a regex to find if a string contains smilies....Is it possible for me to save the smilies in an array?
cloud|office has quit [Read error: Connection reset by peer]
brokenshakles has quit [Ping timeout: 250 seconds]
savage- has joined #ruby
Bosma has quit [Ping timeout: 255 seconds]
darren has joined #ruby
jesly__ has quit [Ping timeout: 276 seconds]
k_89 has joined #ruby
BMF has quit [Remote host closed the connection]
xscc has joined #ruby
xscc has quit [Read error: Connection reset by peer]
mikepack has quit [Remote host closed the connection]
savage- has quit [Remote host closed the connection]
<bnagy>
I guess you could
<bnagy>
it would be a fairly efficient regex though
<bnagy>
well.. for 'standard' smileys I guess
otters has quit [Quit: WeeChat 0.3.8]
noyb has joined #ruby
<bnagy>
/[:;8][-]?[)(DoS]/ etc
k_89 has quit [Ping timeout: 252 seconds]
beha has joined #ruby
beha has quit [Client Quit]
Ethan has quit [Ping timeout: 276 seconds]
ananthakumaran has joined #ruby
jesly__ has joined #ruby
julio has joined #ruby
lolmaus has joined #ruby
mehlah_ has quit [Quit: Leaving...]
savage- has joined #ruby
ryanf has joined #ruby
AndChat| has joined #ruby
Banistergalaxy has quit [Ping timeout: 276 seconds]
khakimov has quit [Quit: Computer has gone to sleep.]
ryanf has quit [Ping timeout: 255 seconds]
ryanf has joined #ruby
maletor has quit [Quit: Computer has gone to sleep.]
gtuckerkellogg has joined #ruby
MasterLambaster has quit [Quit: MasterLambaster]
Asher has joined #ruby
vlad_starkov has joined #ruby
<jumpingcloud>
Xethron: Congrats! that's awesome! on the threading!
<Xethron>
jumpingcloud, thanks :)
<jumpingcloud>
bnagy: thanks for you help last night. I figured out my problem!
<jumpingcloud>
bnagy: i ended up putting an instance of net/ssh inside an instance of net/ssh
tagrudev has joined #ruby
Eldariof-ru has joined #ruby
oscardelben has quit [Quit: oscardelben]
iamsuger2 has joined #ruby
greasegum has quit [Read error: Operation timed out]
iamsuger2 has quit [Client Quit]
mxweas has quit [Quit: Leaving...]
mxweas has joined #ruby
yours_truly has joined #ruby
mehlah_ has joined #ruby
Nisstyre has quit [Ping timeout: 246 seconds]
yours_truly has quit [Read error: Connection reset by peer]
Nisstyre has joined #ruby
djdb has joined #ruby
* Xethron
wonders what happened to X-Jester... He should share in my victory
hunglin has quit [Quit: Leaving.]
dg73 has joined #ruby
iamjarvo has quit [Quit: Computer has gone to sleep.]
dg73 has quit [Client Quit]
ryanf has quit [Quit: broken pipes |||]
manizzle_ has joined #ruby
maesbn has joined #ruby
MasterLambaster has joined #ruby
bluOxigen has quit [Ping timeout: 276 seconds]
timonv has joined #ruby
mathie has joined #ruby
beekor has joined #ruby
sent-hil has quit [Remote host closed the connection]
mathie has quit [Client Quit]
timonv has quit [Remote host closed the connection]
gtuckerkellogg has quit [Quit: Computer has gone to sleep.]
elhu has joined #ruby
nopolitica has joined #ruby
aces23up has quit []
<Xethron>
bnagy: You're a genious!
graspee has quit [Quit: leaving]
jesly__ has quit [Ping timeout: 276 seconds]
LowKey has quit [Read error: Connection reset by peer]
elhu has quit [Quit: Computer has gone to sleep.]
czl has joined #ruby
CaptainJet has quit []
julio has quit [Ping timeout: 255 seconds]
darren has quit [Remote host closed the connection]
Zolrath has joined #ruby
Zolrath has quit [Client Quit]
Morkel has joined #ruby
n1x has joined #ruby
tonini has joined #ruby
JohnBat26 has joined #ruby
minijupe has quit [Quit: minijupe]
chussenot has joined #ruby
vlad_starkov has quit [Remote host closed the connection]
Nisstyre has quit [Ping timeout: 276 seconds]
tvw has joined #ruby
adamkittelson has quit [Remote host closed the connection]
mehlah_ has quit [Quit: Leaving...]
baphled has joined #ruby
<Xethron>
bnagy: so... lets say I have the regex: [>]?[:;8xX][-]?[)(dDoO0S$Ppqc|\\/]|[:]['][(]|[D][:]|d-_-b|\b[0oO][_\.]?[0oO]\b|[\\/]?[0Oo][\\/]|[\\/][0Oo]
<Xethron>
How do I get which smilies where in the regex?
<Xethron>
Like how do I return them?
Nisstyre has joined #ruby
<Xethron>
Coz I want to count how many of earch smily was said... and also remove them from the string
mehlah has joined #ruby
hoelzro|away is now known as hoelzro
apok has quit [Quit: apok]
robozahn_ has quit [Ping timeout: 265 seconds]
mahmoudimus has quit [Quit: Computer has gone to sleep.]
mmokrysz has joined #ruby
chimkan_ has quit [Read error: Connection reset by peer]
chimkan has joined #ruby
jarred has quit [Quit: jarred]
apeiros_ has joined #ruby
savage- has quit [Remote host closed the connection]
jesly__ has joined #ruby
davidpk has joined #ruby
aces23up has joined #ruby
tatsuya_o has joined #ruby
<aces23up>
how do http transparent proxies work? i'm trying to code on on my own, as far as I can tell I need to see the basic auth headers
<aces23up>
but what other headers are needed?
sepp2k has joined #ruby
mmokrysz has left #ruby [#ruby]
<Xethron>
nvm, I found out how :P
<hoelzro>
aces23up: you're talking about a "standard" proxy and not a reverse proxy, yes?
andrewhl has quit [Read error: Connection reset by peer]
andrewhl has joined #ruby
fayimora has joined #ruby
<aces23up>
hoelzro well i guess my real question is how to libraries like net::http communicate with a proxy provider that uses authentication, from what I can see net::http sets authentication header with username and password, but how is the get or post url set?
Zolrath has joined #ruby
<aces23up>
hoelzro any ideas?
dangerousdave has joined #ruby
<hoelzro>
aces23up: well, I don't know net::http, but the request sent to a standard proxy usually looks like this, I think:
<hoelzro>
aces23up: a transparent proxy usually means that the client is not aware of the proxy; is that what you mean?
<aces23up>
hoelzro yes
<aces23up>
I think I was getting confused on the get portion.
<hoelzro>
oh, ok
<aces23up>
thinking that should be going to the proxy provider ip/port but i forgot, http is just a protocol.
<hoelzro>
well, you probably need to configure your firewall or your router to use the proxyh
<aces23up>
that runs over an existing connection.
<hoelzro>
but I've never set up a transparent proxy myself
Rochefort has joined #ruby
<aces23up>
ok, so all I really need to do, is connect to my proxy provider via normal tcp connection then send the proper headers basically.
<hoelzro>
I think so
elhu has joined #ruby
<aces23up>
i mean roughly.. prolly alot of tweaks need to be made for other things etc.
<aces23up>
hoelzro cool.. weird I had that in my head, just needed to talk it out.
<hoelzro>
aces23up: you might also want to search around to see how others do it
dankest has joined #ruby
aganov has joined #ruby
AndChat| has quit [Ping timeout: 276 seconds]
chussenot has quit [Quit: chussenot]
tatsuya_o has quit [Remote host closed the connection]
g4 has joined #ruby
pentax has joined #ruby
<Xethron>
ok... I want to do two regex functions at once... I want to return all the smilies as well as delete them from the string. I would prefer to do this with one regex as to not use to mucjh processing...
Poapfel has joined #ruby
<Xethron>
mystring.scan(/regex/) and mystring.gsub(/regex/, "").
<pentax>
Hello. Is there a server that serves *.erb files?
<Xethron>
Or should I just do it in two seperate go's
wilmoore has quit [Remote host closed the connection]
billiamii has quit [Read error: Connection reset by peer]
<pentax>
aganov: perfect. Thank you very much
baphled has quit [Ping timeout: 246 seconds]
umttumt has joined #ruby
chichou has joined #ruby
bgupta has quit [Ping timeout: 244 seconds]
Maniacal has quit [Ping timeout: 246 seconds]
dankest has quit [Read error: Connection reset by peer]
fayimora has quit [Quit: Busy…..zzzzz]
SegFault1X|work2 has quit [Ping timeout: 245 seconds]
fantazo has joined #ruby
grillo has quit [Ping timeout: 248 seconds]
SegFaultAX|work2 has joined #ruby
AnswerGuy has quit [Ping timeout: 265 seconds]
mxweas has quit [Ping timeout: 252 seconds]
AnswerGuy has joined #ruby
piotr_ has joined #ruby
wang has quit [Ping timeout: 265 seconds]
kylemcgill has joined #ruby
wang has joined #ruby
oddraisin has quit [Ping timeout: 265 seconds]
oddraisin has joined #ruby
mxweas has joined #ruby
jesly__ has quit [Ping timeout: 276 seconds]
bluOxigen has joined #ruby
maletor has joined #ruby
grillo has joined #ruby
dhruvasagar has joined #ruby
Pathou has joined #ruby
alek_b has quit [Ping timeout: 246 seconds]
banisterfiend has quit [Read error: Connection reset by peer]
christopherlee has quit [Ping timeout: 250 seconds]
shikamaru has quit [Remote host closed the connection]
alienvenom has quit [Ping timeout: 250 seconds]
alienvenom has joined #ruby
christopherlee has joined #ruby
shikamaru has joined #ruby
banisterfiend has joined #ruby
pentax has left #ruby [#ruby]
jeff_sebring has quit [Quit: Leaving]
arkiver has joined #ruby
tatsuya_o has joined #ruby
bgupta has joined #ruby
igotnolegs has quit [Quit: Computer has gone to sleep.]
pskosinski has joined #ruby
jimeh has joined #ruby
venkatk_ has joined #ruby
<Xethron>
jumpingcloud: just found out its not exactly working yet :'(
andrewhl has quit [Remote host closed the connection]
brian- has quit [Ping timeout: 245 seconds]
brian- has joined #ruby
Criztian has joined #ruby
robozahn has joined #ruby
BiHi has joined #ruby
k_89 has joined #ruby
Markvilla has joined #ruby
mehlah has quit [Quit: Leaving...]
gtuckerkellogg has joined #ruby
mengu has joined #ruby
fantazo has quit [Remote host closed the connection]
gtuckerkellogg has quit [Ping timeout: 276 seconds]
timonv has joined #ruby
cloaked1 has joined #ruby
sgronblom has joined #ruby
<tommylommykins>
hmm, I know this isn't the rails channel, but since that requires registering, could anyone give a oneline answer to this? What's the best free online web tutorial for rails?
<Hanmac>
it is this channel: #rubyonrails you are looking for
blacktulip has joined #ruby
<tommylommykins>
the rails channel erquires registering before you can talk
* tommylommykins
hoped he could get away with that question because it should just need a one line answer :s
mehlah has joined #ruby
mehlah has quit [Client Quit]
<Hanmac>
i uses ruby for more then 6years and i never used rails ... so this channel is not designed for your question
Criztian has quit [Remote host closed the connection]
nadirvardar has joined #ruby
<tommylommykins>
sure, I use ruby as a general purpose scripting language too :)
* tommylommykins
didn't mean to cause offense
BRMatt has quit [Ping timeout: 248 seconds]
arturaz has joined #ruby
BRMatt has joined #ruby
jgrevich has quit [Quit: jgrevich]
<Hanmac>
first learn ruby, when you managed that, you could do rails too ... if you try it backwards it may very fail
<tommylommykins>
< tommylommykins> sure, I use ruby as a general purpose scripting language too :)
* tommylommykins
already knows ruby quite well
blacktulip has quit [Remote host closed the connection]
jhunter has quit [Ping timeout: 246 seconds]
und3f has joined #ruby
jesly__ has joined #ruby
vlad_starkov has joined #ruby
jhunter has joined #ruby
blacktulip has joined #ruby
arkiver has quit [Ping timeout: 255 seconds]
TPFC-SYSTEM has joined #ruby
vlad_starkov has quit [Remote host closed the connection]
nadirvardar has quit [Quit: Computer has gone to sleep.]
cezar has quit [Client Quit]
<bnagy>
maybe ary.delete_at ary.index("b")
gtuckerkellogg has joined #ruby
chussenot has joined #ruby
Criztian has joined #ruby
burgestrand has joined #ruby
kennyvb has joined #ruby
<\rs>
how to mimic the behavior of `ldapsearch -D xxx -w yyy' in Net::LDAP ? conn.bind_as? but i got #<OpenStruct code=32, message="No Such Object">
<Xethron>
bnagy: Like always, genius!
<Xethron>
Thanks
[Neurotic] has quit [Quit: dinner time]
vlad_starkov has joined #ruby
fermion has joined #ruby
habib has joined #ruby
<habib>
hey everyone. how are you?))))
mxweas has quit [Ping timeout: 250 seconds]
<bnagy>
I'm thuper, thanks for asking!
<workmad3>
bnagy: were you reading the solutions me and apeiros_ were giving for that yesterday? :P
czl has quit [Read error: Connection reset by peer]
bullicon has joined #ruby
<bnagy>
workmad3: no?
<workmad3>
bnagy: :)
<workmad3>
bnagy: I'm just naturally suspicious ;)
czl has joined #ruby
<bnagy>
why, is there a better way? That was the first thing that sprang to mind
<workmad3>
bnagy: that's the way I came up with, but we were dealing with an array of items to delete and apeiros_ gave a more time-efficient solution in that instance
nari has quit [Ping timeout: 245 seconds]
<habib>
can someone please remind me where to post a part of code to show u?
<workmad3>
bnagy: it was more just the repetition of an almost identical question ;)
<bnagy>
habib: gist or pastie or codepad
<workmad3>
habib: gist > pastie > *
<workmad3>
:)
<apeiros_>
I give solutions?
<apeiros_>
I thought I only gave riddles
<habib>
bnagy, workmad3 thnx!
<workmad3>
apeiros_: well, they started as riddles in the form 'does this code actually do what I say it does?' ;)
<abstrusenick>
how do you do debugging when there is more than 1 rails instance on development?
<apeiros_>
nonono, those weren't riddles, those were distractions
<workmad3>
:)
<apeiros_>
and exercises for the reader
<apeiros_>
clearly
cloud|office has joined #ruby
<apeiros_>
do I really have to tag all of them? sheesh…
<apeiros_>
;-)
<workmad3>
apeiros_: oh, of course :)
<bnagy>
abstrusenick: sounds like a job for #rubyonrails
<workmad3>
bnagy: he asked in #rubyonrails what to do with more than 1 ruby instance...
<apeiros_>
(we're lucky to have such an excellently exercising reader - that is workmad3)
<habib>
code on demand
<workmad3>
habib: consider it demanded
mdstunthamster has joined #ruby
<cloud|office>
I have this array, how can I only take out the values that are refered by remarks?
<cloud|office>
[{"remarks"=>"Theses are my remarks"}, {"remarks"=>"these are my second remarks"}, {"remarks"=>"these are my 3rd remarks"}, {"remarks"=>"these are my 4th remarks"}]
maletor has quit [Quit: Computer has gone to sleep.]
<bnagy>
looks like someone is just raising a naked runtimeerror
ephemerian has joined #ruby
<bnagy>
cloud|office: uh you can't really 'take out' just the values, you could set them all to nil or something though
<bnagy>
ary.each {|h| h['remarks']=nil}
<cloud|office>
couldnt I store them into some other array ?
<workmad3>
habib: well, if you look at the exception stacktrace, you can see it's throwing an error on the line: @icon = Gosu::Image.new(@window, "player.png", true)
jimeh has quit [Quit: bye]
<habib>
workmad3, hm. interesting
<workmad3>
habib: so I'd suggest you check the documentation and/or source for that class and see if you're using it incorrectly... the error itself gives no help beyond a location because, as it says, it's an 'unknown error'
<workmad3>
habib: and it helps if you learn to read stack traces... all of that information is right there and quite visible ;)
* workmad3
sometimes wonders if he should start a paid stacktrace reading service...
<habib>
workmad3, it solved!!! thnx!))
<workmad3>
habib: what were you doing wrong? ;)
<habib>
workmad3, the name of png file))))))
<workmad3>
habib: :D
<habib>
it was ball, not player
<workmad3>
heh
berserkr has joined #ruby
<bnagy>
great api :S
<workmad3>
bnagy: it seems fantastic doesn't it :)
catphish has joined #ruby
<workmad3>
bnagy: I wonder what else it'll give unknown errors for :)
<habib>
workmad3, what is stack traces btw? is it output messages with errors?
jumpingcloud has quit [Ping timeout: 276 seconds]
flype has joined #ruby
<catphish>
what is the correct way to post UTF8 www-form-urlencoded data using net/http
<apeiros_>
bnagy: should I search for the pastie/gist again?
<workmad3>
habib: on your '400 pastie, look at lines 6 to the end
<apeiros_>
oh, gists are listed in date order, so that was an easy one…
<banisterfiend>
anyone here ever seen "Error: fiber called across stack rewinding barrier" ??
<workmad3>
habib: that's the error and stacktrace
<workmad3>
banisterfiend: no... but that sounds awesome :D
<banisterfiend>
hehe
<bnagy>
apeiros_: oic... what's 'lut' as a variable name? :)
<banisterfiend>
workmad3: it's actually preventing me from doing something awesome :/
<workmad3>
banisterfiend: I'm guessing your fiber tried to call outside of itself during an exception stack unwind
Rochefortes has joined #ruby
<apeiros_>
bnagy: look up table
<apeiros_>
insert "-" as necessary
jumpingcloud has joined #ruby
lkba has quit [Quit: Bye]
<bnagy>
:<
<cloud|office>
workmad3: thanks, that solved my problem :)
<apeiros_>
it may also be the first part of lut gholein
<workmad3>
cloud|office: heh :) I wondered what you were referring to for a second then :)
<cloud|office>
he he
<banisterfiend>
workmad3: no exceptions afaict. I'm using a fiber as input object, and it works fine until the input is a "next" which advances execution
<workmad3>
banisterfiend: ah, that'll be it
<habib>
workmad3, hm. it's difficult to understand) as i c it's a place where the program stuck?
<workmad3>
banisterfiend: I think 'next' throws a symbol, which is caught by the enumerator isn't it?
<banisterfiend>
i dont see why it would matter though
Vert has joined #ruby
kylemcgill has quit [Remote host closed the connection]
<workmad3>
habib: yes, it's the place where the error occured
<habib>
or an explanation of error?
<banisterfiend>
workmad3: oh could be, i dont remember
<workmad3>
habib: and also the stack of calls that were in-progress at the time
<banisterfiend>
workmad3: you've looked at ruby-debug's implementation of 'next' ?
<workmad3>
banisterfiend: nope
<workmad3>
banisterfiend: I've never used any actual debugging tools in ruby beyond initial plays with them when I was first learning :)
<habib>
workmad3, ah.. i c now. g thnx. and u say that it's possible to learn about stack traces?
Rochefort has quit [Ping timeout: 276 seconds]
<workmad3>
habib: you basically just need to learn to look at them :)
<workmad3>
habib: if you look down a stacktrace for the first instance of your code on it, you get where the problem occured
<workmad3>
habib: it's not always correct... but it's always a starting point :)
chichou has quit [Ping timeout: 276 seconds]
arkiver has joined #ruby
wallerdev has quit [Quit: wallerdev]
<workmad3>
habib: and I have to say, it's something I (and others) get annoyed about at times :) people come in, give a stacktrace that is pointing to their error, give the code, and ask us to read the stacktrace to tell them where the error occured... and I know sometimes it's because people are just learning, so we try to be patient, but if you see someone get a bit snappy and irritable about it I hope you can understand our perspective too ;)
<shevy>
habib, try to keep things simple
<shevy>
when everything is simple, it will be simple to fix any problem that comes up
<workmad3>
shevy: if only that were always true :(
<habib>
workmad3, thnx. ofcourse i understand))) u and shevy doing great and very usefull job.
araujo has joined #ruby
<habib>
and other ppl helping around
<shevy>
workmad3, hehe
<shevy>
I hate complexity
<habib>
i hate complex nums))
gtuckerkellogg has quit [Quit: Computer has gone to sleep.]
<workmad3>
shevy: I hate complication myself
<workmad3>
shevy: interesting things can happen with complexity... but complication is just annoying
<workmad3>
habib: complex numbers are awesome things
<workmad3>
habib: and much simpler than their name implies ;)
<habib>
yeah and also.... you helping not to only english speaking ppl. so sometimes we just don't understand words cos it's the first time we hear it. but u doing things great
jesly__ has quit [Ping timeout: 276 seconds]
Rochefort has joined #ruby
<shevy>
habib, keep english simple :-)
<workmad3>
habib: well, lets put it this way... you can write english a lot better than I can write your language :P
<shevy>
but english is pretty easy
<workmad3>
shevy: hahahahaha
<shevy>
other languages are much more difficult
<shevy>
you have only "the"
<shevy>
in german, you have "der", "die", "das"
<shevy>
I dont even know what the chinese have
<hoelzro>
shevy: Chinese doesn't have articles
<hoelzro>
but it has something close, called "measure words"
<hoelzro>
of which there are 214 (I think)
<shevy>
ack
snearch has joined #ruby
<habib>
yeah in russian there are no articles . we use articles only if needed. not always
Rochefortes has quit [Read error: Operation timed out]
<habib>
like. we don't say "a table"
nilg has quit [Remote host closed the connection]
<habib>
it's just table. and if i want to say that it's some unknown table we add "some" = "some table?\"
abstrusenick has quit [Quit: abstrusenick]
<habib>
i'm keeping english simple... but adding a lot of ")" ))))))))))))))
abstrusenick has joined #ruby
<workmad3>
habib: yeah... you don't need them :)
<habib>
is it annoying?
<workmad3>
habib: a bit confusing
jimeh has joined #ruby
<habib>
ok then :)
Rochefortes has joined #ruby
<workmad3>
habib: what are you trying to use them fore though?
<workmad3>
*for
<habib>
curves?
<workmad3>
the parentheses, yes
<habib>
expressive emotions
<workmad3>
ah, so sort of like a :) but stronger? :)
<habib>
yeah. when i want to say not just simple smile but very strong long smile with gladness and happyness)
\rs has left #ruby ["WeeChat 0.3.8"]
<workmad3>
habib: yeah... I think it's because you keep dropping the : part :)
Rochefort has quit [Ping timeout: 255 seconds]
<workmad3>
habib: disembodied smiles and grins are odd outside of a lewis carrol novel
tonini has quit [Remote host closed the connection]
<habib>
yes i drop eyes cos it's by defaults:) who saw someone without eyes:) except disabled ppl
abstrusenick has quit [Quit: abstrusenick]
greyEAX has quit [Remote host closed the connection]
abstrusenick has joined #ruby
jesly__ has joined #ruby
abstrusenick has quit [Client Quit]
<shevy>
russians hate the ")" character, that is why they keep on hitting at it on their keyboard
<shevy>
:P
<shevy>
and why they don't like lisp
<habib>
haha yeah))) no way)
greyEAX has joined #ruby
<shevy>
(foo(bar 'bla'))
<habib>
btw i allways wonder why in so many examples of code they use "foo bar"? what is foo bar actually?
Rochefortes has quit [Remote host closed the connection]
<hoelzro>
habib: they're just fake variable names
<catphish>
The origins of the terms are not known with certainty, and several anecdotal theories have been advanced to identify them. Foobar may have derived from the military acronym FUBAR and gained popularity because it is pronounced the same.
<Tasser>
The origins of the terms are not known with certainty, and several anecdotal theories have been advanced to identify them. Foobar may have derived from the military acronym FUBAR and gained popularity because it is pronounced the same.
ramblex has joined #ruby
<hoelzro>
Tasser: that's *exactly* what catphish said
<shevy>
!
<catphish>
funny how google works :)
<shevy>
you guys are all just copy pasting monsters :(
<habib>
btw what IDE is ok in linux ?
<shevy>
they all suck
cantonic has joined #ruby
<banisterfiend>
habib: emacs
<habib>
haha)) so i use sublime text and emacs
<shevy>
eclipse and netbeans are huge, slow and unwieldy
<habib>
GVim scarring me
<habib>
netbeans doesn't support ruby anymore
<shevy>
gvim sucks more than vim too
* hoelzro
likes Vim
<banisterfiend>
habib: can u pls start putting the : in yoru smiles, faces refusing to show their eyes is suspicious
<Tasser>
catphish, wikipedia direclty :-P
<habib>
lol:)
<Tasser>
banisterfiend, and will be shot on sight?
<shevy>
only in the USA
g0rd0n has joined #ruby
robozahn has quit [Quit: Lost terminal]
robozahn has joined #ruby
sabu_ has joined #ruby
<sabu_>
does anyone have experience using yajl-ruby to parse a large json file in chunks?
kaiwren has joined #ruby
Spooner has joined #ruby
dhruvasagar has quit [Ping timeout: 255 seconds]
Tomasso has joined #ruby
justsee has joined #ruby
shiki has quit [Ping timeout: 252 seconds]
gtuckerkellogg has joined #ruby
gtuckerkellogg has quit [Client Quit]
mneorr1 has joined #ruby
<_br_>
sabu_: Just a comment, but maybe you want to look into Oj. Seems that the Oj parser is much faster.
mneorr has quit [Ping timeout: 256 seconds]
Arafangion has joined #ruby
<Arafangion>
I tried to use Win32API, and was annoyed at how little documentation there seemed to be in the api reference.
<Arafangion>
Is there a better place I should be checking for documentation? (Eg, so that I can use Win32API::new correctly)
<shevy>
this is always the problem with ruby things
<shevy>
docu sucks
<Arafangion>
It does seem to, yes.
mobilegamelabs has joined #ruby
<Arafangion>
shevy: It took me an hour to figure out how to find out the windows version.
<Arafangion>
So annoying, I ended up using Win32API, but that had hurdles of its own.
x0F has quit [Disconnected by services]
x0F_ has joined #ruby
x0F_ is now known as x0F
<mobilegamelabs>
hi
jhchabran_ is now known as jhchabran
<mobilegamelabs>
i am familiar with php. i am going to developer a small stock analysis software. what programming language should i use?
cousine has joined #ruby
<mobilegamelabs>
i need to use multi-thread features like an ascii GUI.
<Arafangion>
mobilegamelabs: Wrong question.
<mobilegamelabs>
wrong question?
<Arafangion>
mobilegamelabs: Why are you starting with that question?
<sabu_>
_br_: thanks
<Arafangion>
mobilegamelabs: Also, why do you assume that an ascii GUI requires multiple threads?
<mobilegamelabs>
Arafangion: want to know if ruby is good for that. if not, what programming language else yyou could suggest
<Arafangion>
mobilegamelabs: Most programming languages will be suitable for that, to be honest, the issue is what your requirements are.
<Arafangion>
mobilegamelabs: And your skillset.
<mobilegamelabs>
Arafangion: i need to have some programming running and an ASCII panel check the progress
<mobilegamelabs>
Arafangion: i need to have some programs running and an ASCII panel to check the progress
<Arafangion>
mobilegamelabs: Just about any language will let you do that.
<mobilegamelabs>
like i want to fetch trading records of a few stocks at the same time
nopolitica has left #ruby [#ruby]
<mobilegamelabs>
Arafangion: but i guess php cannot do this because it doesn't have multi-thread
<hoelzro>
mobilegamelabs: you don't need multithreading to monitor several processes
<hoelzro>
an event loop would probably suit you better
<Arafangion>
Agreed.
mneorr1 has left #ruby [#ruby]
<hoelzro>
however, I think using PHP for such a task, event loop or no, is silly.
<hoelzro>
</two-cents>
<Arafangion>
Agreed, although still doable.
czl has quit [Read error: Connection reset by peer]
anderse_ has joined #ruby
justsee is now known as justsee|away
<Arafangion>
mobilegamelabs: But if you're wondering, ruby is a fine choice.
czl has joined #ruby
<shevy>
mobilegamelabs, well, split up the problems into smaller problems and solve them
jesly__ has quit [Ping timeout: 276 seconds]
<shevy>
you said ASCII GUI. start there :D
<workmad3>
hehe ascii GUI
<workmad3>
bit of a contradiction :P
<Arafangion>
Actually, I would consider the requirements first.
<Arafangion>
Especially the data... How you get the data and pull it back out.
<mobilegamelabs>
Arafangion: thanks. is ruby easy with mysql?
<mobilegamelabs>
yes ascii GUI
ananthakumaran1 has joined #ruby
<_br_>
Are there any other interesting "containers" besides json, yaml, xml ?
ananthakumaran1 has quit [Read error: Connection reset by peer]
<shevy>
lots of things he wants to do
<Arafangion>
iirc, finance crap often requries java and/or C++ libraries depending on your service provider.
<workmad3>
ascii UI makes sense... ascii GUI, not so much
<mobilegamelabs>
i pull the data from mysql and internet
<shevy>
_br_ .ini files :)
ananthakumaran1 has joined #ruby
<_br_>
shevy: ahh XD
<workmad3>
_br_: bson
<mobilegamelabs>
workmad3: ah ok. ascii UI :P
<shevy>
.ini files are not so bad actually
<Arafangion>
mobilegamelabs: Google: mysql ruby
<mobilegamelabs>
Arafangion: thanks
<_br_>
workmad3: right! good one.. thx
<workmad3>
_br_: also, CSV
dhruvasagar has joined #ruby
<Arafangion>
mobilegamelabs: I personally prefer postgresql or sqlite3, depending on requirements, though.
<workmad3>
_br_: and that's all just text-data containers suitable for various structures :)
<_br_>
workmad3: True, I was just curious because I am writing a api and I already support json and xml. I was wondering if I need to support more...
<mobilegamelabs>
Arafangion: yes actually i want sqlite
<workmad3>
_br_: are you considering things like video data containers?
<mobilegamelabs>
it's more convenient
<_br_>
workmad3: not exactly but there are images etc.
<workmad3>
_br_: json and xml are the 'typical' ones... it really depends on what structure your data takes though
<workmad3>
_br_: for example, being able to upload or retrieve CSV is really, really useful for tabular data
<_br_>
hm I see
cousine_ has joined #ruby
<workmad3>
_br_: being able to get an ini file through an api though... I guess it would make a certain amount of sense for KV data, but you can mangle that in fine with JSON or XML nowadays with less confusion :)
ananthakumaran has quit [Ping timeout: 255 seconds]
<workmad3>
_br_: let the data structure guide you ;)
venkatk_ has quit [Read error: Connection reset by peer]
<_br_>
Alot of good points, thanks for the feedback, I'll dig deeper into this :)
cousine has quit [Read error: Connection reset by peer]
<catphish>
hmm, request.set_form_data works very differently in 1.8 vs 1.9 :(
venkatk_ has joined #ruby
Foxandxss has joined #ruby
Morkel has quit [Quit: Morkel]
<Arafangion>
Sadly, speaking about ruby vs php...
<Arafangion>
The php "win32api" is better documented than ruby.
kpshek has joined #ruby
<Muz>
Free software, fix it.
<Arafangion>
Muz: Gotta understand it first!
<Muz>
Well, the code's so beautifully written, it's all self-documenting. Right? ¬_¬
<Arafangion>
shevy: Alas, as best as I can tell, there is almost no other way to determine the windows version.
<banisterfiend>
shevy: glory of opensource is you can fix it, rather than just complain :)
<shevy>
banisterfiend, the "fix" means to rewrite the whole shit
<Arafangion>
banisterfiend: It's a Hard Problem.
<banisterfiend>
no, it probably just means to put a more rubyish wrapper around it
<banisterfiend>
it's not that hard
<shevy>
well, one could alias the method names
<shevy>
that's what ruby-gtk did
<banisterfiend>
Arafangion: lots of opensource projects are hard, doesnt mean you should stop at that point :) hard ones can be fun
<shevy>
the [], 'N' parts in initialize still suck, there would have to be a better way
<shevy>
hmmm wait
<shevy>
a.Call() can not become a.call() right?
<Arafangion>
shevy: Call's already aliased to call.
<shevy>
oh it can
<shevy>
thought all objects had it, not only procs
dhruvasagar has quit [Ping timeout: 240 seconds]
areil has quit [Remote host closed the connection]
<shevy>
ok good
<Arafangion>
banisterfiend: Python's struggled with this a lot, too.
<shevy>
1% suck reduction is an improve
<Arafangion>
banisterfiend: The current solution in python-land, is to promote 'cython', which is a python that is directly compiled to C and then compiled as a python module.
jesly__ has joined #ruby
<banisterfiend>
Arafangion: curious, why cant you just wrap the current API in a more rubyish wrapper?
Speed has joined #ruby
Speed has quit [Changing host]
Speed has joined #ruby
<Arafangion>
banisterfiend: Because that wouldn't improve the api.
<shevy>
you can make things better, but it will always show that it is built on a world of suck
<Arafangion>
banisterfiend: The API is the least of teh problems with it.
<Muz>
That's just like building a city on sand.
tchebb has quit [Ping timeout: 264 seconds]
<Muz>
Or rather than handing some a turd, you're handing them a polished turd.
<Muz>
At the end of the sday, it's still a steaming pile of shit.
<shevy>
oh btw Arafangion are you using windows most of the time?
<shevy>
lol Muz
<banisterfiend>
Arafangion: interesting, whtat's the main issue with it
<Arafangion>
banisterfiend: The most serious problem is the utter lack of documentation of any kind, which could be improved, but it's still sucky - the other, almost as serious problem, is that you have zero type checking, with at best, a seg fault, and at worst, weird and obscure memory corruption if you get the slightest thing wrong.
<Arafangion>
shevy: Define "using".
<mobilegamelabs>
hey
<mobilegamelabs>
can someone suggest me a web site about ruby vs python?
<Arafangion>
shevy: I'm a windows developer... But most of the stuff I do is in a windows VM running on mac os x. :) At home I use mac and linux.
<shevy>
Arafangion "working on" most of the time
<Arafangion>
mobilegamelabs: What's the point?
<shevy>
hmm ok
<Arafangion>
shevy: "workign on", most definitely windows.
<mobilegamelabs>
Arafangion: i am considering which to use
<shevy>
yeah
<Arafangion>
mobilegamelabs: Either, although python does have, imho, better documetnation.
<Arafangion>
mobilegamelabs: But the ruby language is better.
<shevy>
even if you have a horrible API, at least provide good documentation
<Muz>
mobilegamelabs: here's a spoiler. Any ruby dev will suggest using Ruby, any seasoed python dev will suggest using python.
<Muz>
Just pick one.
<mobilegamelabs>
Arafangion: thanks!
<shevy>
mobilegamelabs, for me it was an old interview with matz
<mobilegamelabs>
Muz: yes :P
<Arafangion>
mobilegamelabs: Given muz's spoiler, try to guess which dev I am!
<kalleth>
Arafangion: oh god, why would you do that to yourself
<kalleth>
Muz: ruby and python can do the same things, it really doesn't matter which you choose :)
<Arafangion>
kalleth: Money. :)
<kalleth>
is there a domain where python is more appropriate than ruby or vice versa, though?
<mobilegamelabs>
shevy: thanks! matz?
<kalleth>
i'm interested
<shevy>
mobilegamelabs: yeah. what matz said in that interview kinda convinced me
<vandemar>
kalleth: scientific computing perhaps
ramblex has joined #ruby
<kalleth>
vandemar: is it faster?
<mobilegamelabs>
scientific computing why?
* kalleth
noaxetogrind
<shevy>
lol
<vandemar>
kalleth: there are *tons* of projects using python for stuff like bioinformatics and other areas in math/physics
* Arafangion
seconds that.
<kalleth>
vandemar: yeah, i'm looking for _why_ that over ruby, though -- what's the reason that python is more appropriate for the domain
<mobilegamelabs>
yes
<Arafangion>
Python's very, very easy to understand, profile and optimise, and runs on almost anything, as well.
<kalleth>
(because everyone else uses it is, i guess, a valid answer)
<vandemar>
kalleth: mindshare and existing libraries/modules is a perfectly good reason imo, without some deeper _why_
<Arafangion>
Sadly, the syntax functionality's more limited.
<kalleth>
interesting
<kalleth>
that makes sense :)
<mobilegamelabs>
is there any feature/lack of the feature that makes one not to use ruby?
<kalleth>
i'm a firm believer in matching your requirements to your language, and i'm not a ruby zealot by any means... I've just yet to code anything in a domain where I
<shevy>
Arafangion how do you feel about indent btw?
<kalleth>
think ruby isn't appropriate
<kalleth>
;P
<vandemar>
OTOH jruby is viable if there's a java library for what you want.
<Arafangion>
shevy: I used to love it.
Rochefort has joined #ruby
<shevy>
and you no longer do? or what changed
<Arafangion>
shevy: Now, I'm ambivalent, but they fixed a major bug in python 3 - you can now no-longer mix tabs and spaces. That was just pure evil.
Guedes has joined #ruby
Guedes has joined #ruby
Guedes has quit [Changing host]
<shevy>
hehehe
<kalleth>
oh i do that all the time
<kalleth>
just to see my colleagues twitch when they svn up
<kalleth>
;P
<shevy>
I gave up on tabs when I noticed I tend to mix them
<Arafangion>
kalleth: I would kill you if you did that to my python projects.
* Arafangion
is *half* kidding.
<kalleth>
Arafangion: i wrote a script to turn random sets of 4 spaces into a single tab in all .py codefiles
<Arafangion>
kalleth: So once python's interpreting it... It only sees spaces.
greasegum has joined #ruby
<kalleth>
i'm not a python dev
<kalleth>
i have no idea wether it would have run or not after i'd munged it
<kalleth>
i just thought it would be funny ;p
<Arafangion>
kalleth: Python is the reason why I always use whitespace-mode.
<kalleth>
;)
<Arafangion>
But that's only used for defining blocks. It's otherwise insensitive to whitespace.
arietis has joined #ruby
<_axx>
Hey guys, is it possible, to declare a method as and instance and class method at the same time?
<_axx>
*as an
<Arafangion>
_axx: Why?
<banisterfiend>
_axx: in modules, yes, using module_function
<shevy>
banister knows his things
gregorg_taf has joined #ruby
<_axx>
i have a function that i like to use like Model.method('String') and as an instance variable if i have a = Model.first a.method - the method checks if it hast self.field or a string passed to it
`gregorg` has quit [Read error: Connection reset by peer]
<banisterfiend>
_axx: aside from that you can use some tricks: class Hello; body = proc { "puts hello world #{self}" }; define_method(:instancemethod, body); define_singleton_method(:classmethod, body); end
Lachryma` has joined #ruby
<_axx>
nice!
xbob has quit [Ping timeout: 246 seconds]
<Mon_Ouie>
Or just define an instance method that calls the class method
<_axx>
Mon_Ouie: that sound's more like an solution i guess
<banisterfiend>
_axx: Mon_Ouie: that's not a true instance method then as it wouldn't modify state in the instance (ivars etc :P)
<_axx>
Mon_Ouie: if i do that, how do i pass the instance object to the class method?
dhruvasagar has joined #ruby
br4ndon has joined #ruby
Mon_Ouie has quit [Ping timeout: 252 seconds]
fabrice31 has joined #ruby
<raluxgaza>
Hi guys, I have an array of arrays, when I try to change say; array[2][3] = "A", instead of ONLY row [2] column [3] to change, all column [3] in each row changes, please how can I ensure ONLY row[2] column[3] is affected?
wpaulson has joined #ruby
<shevy>
what
<Hanmac>
raluxgaza then your array is builded wrong
<shevy>
raluxgaza, upload your current code to pastie.org pls
<Hanmac>
net me guess ... you use the same variable multible times?
<Hanmac>
without reseting it with an new sub array?
<raluxgaza>
Hanmac: yes i did
<Hanmac>
and that is excactly the problem .. go and read how objects work in ruby
liluo has quit [Ping timeout: 255 seconds]
shiki has quit [Remote host closed the connection]
<raluxgaza>
okay thanks Hanmac
<shevy>
raluxgaza they are all the same, so modifying one means modifying "all" of them
<Hanmac>
shevy: he use something like this: ary = []; subary = []; ary << subary; subary.clear; ary << subary;
<catphish>
is a multidimensional array actually a series of individual objects?
Bofu2U has joined #ruby
Mon_Ouie has joined #ruby
Mon_Ouie has joined #ruby
sabu_ has quit [Ping timeout: 245 seconds]
<catphish>
ie you can pass a a subarray elsewhere and modify it
<catphish>
why am i asking
<catphish>
irb
<Hanmac>
catphish an subarray is an object too, so it is not copied when you copy'ed it to the mainary ... its still one object
xbob has joined #ruby
<catphish>
yeah, subarrays are separate objects and can be passed individually by reference
bullicon has quit [Quit: Computer has gone to sleep.]
_bart has quit [Quit: _bart]
<Hanmac>
catphish this works too: ary = []; ary << ary;
<raluxgaza>
shevy: Hanmac, yes I now understand that I have to create a new array for each append thanks for your insight guys
<catphish>
i'd like to think matz found that the hard way
<dorei>
hello, can I have 2 methods with the same name but different number of arguments?
<catphish>
no
bluenemo has joined #ruby
<catphish>
but you can have one method that counts the arguments and calls other methods accordingly
kvirani has joined #ruby
<dorei>
so, the only way is just one method definition like def x(*args) ?
wvms has quit [Read error: Connection reset by peer]
<banisterfiend>
dorei: Yeah
wvms has joined #ruby
wpaulson has joined #ruby
<Arafangion>
dorei: That's not actually a bad thing,b tw.
<banisterfiend>
dorei: though if u wanted to be a pig, u could fake that feature i think
<dorei>
a pig?
<banisterfiend>
you'd use the method_added hoook, save the UnboundMethod object
<banisterfiend>
and have a general method(*args) that automatically delicated to the current UnboundMethod based on arity
<banisterfiend>
delegated
<banisterfiend>
correct*
<banisterfiend>
jeez
timonv has quit [Remote host closed the connection]
avdotia has quit [Read error: Connection reset by peer]
Morkel has joined #ruby
avdotia has joined #ruby
Markvilla has quit [Read error: No route to host]
<Mon_Ouie>
banisterfiend: I think if you need to use instance variables, etc. defining the method both for the class and the instance doesn't really make sense — just like module_function is used for stateless stuff
<banisterfiend>
Mon_Ouie: i probably agree with u. Wb btw, where did u go?
Markvilla has joined #ruby
tbrock has joined #ruby
<Mon_Ouie>
Nowhere, I was trying to access some files on an external drive, and found no other way than to actually put it in my computer
<tbrock>
hey guys, i'm trying to invoke a rake task and it isn't getting run, its in a different namespace
krusty_ar has quit [Read error: Connection reset by peer]
lxsameer has quit [Read error: Operation timed out]
lxsameer has joined #ruby
sendoushi has quit [Read error: Connection reset by peer]
gry has quit [Quit: gone]
sendoushi has joined #ruby
lxsameer has quit [Max SendQ exceeded]
yfeldblum has left #ruby ["Leaving"]
gavilan2 has left #ruby [#ruby]
lxsameer has joined #ruby
krusty_ar has joined #ruby
fbernier has joined #ruby
odigity has joined #ruby
<odigity>
fairly new to ruby, could use a pointer for a challenging string/regex problem if anyone's up
<Bofu2U>
Sounds like a good way to start the day.
<odigity>
:)
<Bofu2U>
Now watch me fail horribly.
<Bofu2U>
and... go.
<odigity>
I'm building a library for doing double-entry account. each account has a human-readonable name (like "Accounts Receivable")
<Spooner>
The answer is /[:win!:]/
fflush has joined #ruby
<odigity>
but in your code, you're going to watch to refere to specific accounts by name for doing things like defining the "pay_my_secretary" method
<odigity>
so, I want to create a config file where the developer can pre-define the tree of accounts he wants to create for his bookkeeping system, and give us a symbol (:accounts_receivable) in additional to a pretty name, that he can use to fetch the account model later
<odigity>
but, you might want to create accounts dynamically, say, one for each employee (bad example, but that's not important)
<odigity>
so I thought - ah ha! I'll let someone put placedholders in the string, and that will a) let them look up the account via :symbol plus named args for the placeholders (very readable), and I can also convert those strings into regexes for a rake task that ensures the only accounts in the database are ones that match the specified patterns in the config file
raluxgaza has quit [Remote host closed the connection]
<odigity>
and I even managed to stumble across ruby's str % arg operator, where the string gets formatted using the arg (or args), which is perfect for the first part
a_a_g has quit [Quit: Leaving.]
<odigity>
but I can't think of an elegant/safe way to use the same definition string to generate the regex
<Spooner>
I think we need a more solid example. I'm not really sure what you are trying to match.
<odigity>
Not sure if I explained the problem adequately; you tell me.
<odigity>
let me put an example together in a gist and come back
<Spooner>
Thanks.
Doc_X has quit [Remote host closed the connection]
<odigity>
and thank you for your patience
Doc_X has joined #ruby
<Bofu2U>
yeah, I was going to just let you keep going - wasn't sure if it was just that my addy's didn't kick in yet. :)
flype has joined #ruby
liluo has joined #ruby
spinagon has quit [Ping timeout: 244 seconds]
wvms has joined #ruby
Doc_X has quit [Client Quit]
<Bofu2U>
I was expecting a "trying to parse this ID out of HTML source using regex" :)
Doc_X has joined #ruby
joch_n has joined #ruby
crankycoder has joined #ruby
erichmenge has quit [Quit: Be back later]
jprovazn has quit [Ping timeout: 246 seconds]
fermion has joined #ruby
robbyoconnor has quit [Read error: Connection reset by peer]
sepp2k1 has joined #ruby
wangr has joined #ruby
LBRapid has quit [Quit: Computer has gone to sleep.]
<odigity>
it's annoying how long it took to type up an explanation of what started in my head as a simple tech question.
<crisewng>
I am not a politician haha .
<odigity>
basic string tokenizing, essentially
jprovazn has joined #ruby
<odigity>
Spooner Bofu2U - sorry, should have included your names above to catch your attention. I finished the explanation gist: https://gist.github.com/3181983
<Spooner>
I saw it. It isn't so much a regex request as an entire system design question by the looks of it :)
<fowl>
looks like a homework assignment
<odigity>
well, it comes down to is there an existing technique for structuring and tokenizing a string, such that I can then use the parts to produce a) a matching regex and b) plug in values to complete the string
<odigity>
(from the same original source string, to avoid redundancy)
obryan has quit [Read error: Connection reset by peer]
<odigity>
as an example, if I could access the ruby functionality that does the tokenization for string interpolation (before it actually substitutes the values produced by the expressions), then I could reassemble either a string or regex from those parts
maxfilipovich has joined #ruby
vectorshelve has quit [Quit: Page closed]
<odigity>
I suppose I could write my own parser with a regex that looks for #{}, but the user would have to use single quotes to prevent ruby from getting to it before I do
chson has quit [Remote host closed the connection]
kvirani has quit [Remote host closed the connection]
<Spooner>
I'm not sure, if you have the strings, you can't create both a printf formatter and a regex from it. I am not sure why you want to look at strings with #{} in them.
Nies has quit [Quit: Saliendo]
<odigity>
so, what method would you use to achieve the results I described?
<Spooner>
for example, rather than pass: "Payroll - #{name}", why not pass ["Payroll", name] and then you can build both output and regex?
<odigity>
assuming concatenation is what is desired is less flexible than letting users indicate placement directly within the string
obryan has joined #ruby
<Spooner>
Hmm, maybe I'm not following.
obryan has quit [Read error: Connection reset by peer]
<odigity>
what if there was more string literal after the #{name}?
<fowl>
what a weird way to do things
<odigity>
I'm open to better ways...
<fowl>
you might want Payroll - name Jan 15 2012 for example
<odigity>
that's right
<fowl>
odigity, payroll is a type of account, a sub account maybe, but a type (CLASS) its own
<odigity>
in this case, it's just a name
<fowl>
its not the ruby way to build data into string then parse the strings
hashpuppy has quit [Quit: hashpuppy]
<odigity>
so what is the ruby way in this case?
ttilley is now known as ttilley_off
* Spooner
agrees with fowl.
<fowl>
Payroll.new('Jack Smith')
<fowl>
store payroll/account objects which hold the value of the account, history, owner, dates, whatever you need them to
<odigity>
I'm using generic account objects. I'm not implementing a class for each different type of account when they only differ by name in terms of their functionality, that's too inflexible
fermion has joined #ruby
<fowl>
if you need to get "Payroll - Jack Smith" later you can just make the to_s method do that
<odigity>
would have to add a class to add an account. that's like adding a class every time you add a user to a system, rather than just adding a row for them in the User table
<X-Jester>
s/add/instantiate
<fowl>
what do you mean? you already have the class Account
<odigity>
yes. one class called Account
<fowl>
what is Account then? is it not an Account?
<X-Jester>
instantiating multiples of a class to represent your data is a normal thing
<odigity>
your questions are not making sense to me
arietis has quit [Remote host closed the connection]
<Spooner>
So every account is completely bespoke?
erichmenge has joined #ruby
jimeh has quit [Ping timeout: 246 seconds]
uris has joined #ruby
<odigity>
it's a bookkeeping system. there are dozens of account objects, each with a different name having meaning to the accountants
<X-Jester>
lots of people even put them in collections
<X-Jester>
odigity: that is precisely what OO is about
<odigity>
but all of class Account
br4ndon has joined #ruby
<Spooner>
There is no standardisation whatsoever? So you can't have Payroll, PettyCash, Expenses beign types of Account?
jondot has joined #ruby
<odigity>
there is no reason to implement different types, they don't differ in functionality. all accounts behave the same. they have a balance, you credit and debit them, that's it
<odigity>
they only differ in name, and hence in meaning to the accountants
arietis has joined #ruby
<fowl>
Account.new('Payroll')
<odigity>
you debit one account, credit another
<X-Jester>
so why again are you not willing to instantiate all of your accounts from a single class called Account?
<X-Jester>
you just said they're all the same schema
lxsameer has quit [Ping timeout: 250 seconds]
<odigity>
I am. I never saaid I'm not. again, I don't understand where you're getting these questions
<DarkFoxDK>
Anyone here have a suggestion as to why Resolv::DNS, would be returning a different result than dig on the same server. (Resolv returns nothing).
<odigity>
there is only one Account class
<X-Jester>
nobody is asking you to make multiple classes
joshman_ has quit [Quit: Computer has gone to sleep.]
<X-Jester>
from what i've seen, they're suggesting you define a class and pass instances around
<odigity>
fowl suggested I use "Payroll.new0", and everyone seemed to agree that that solved my problem, which it didn't
<odigity>
I guess I still haven't explained myself adequately, although I've really tried and thought I did
Hien has quit [Quit: leaving]
<odigity>
there is one Account class, and many accounts with different names. some you can define staticly in advance, like 'Cash'. there's only one 'Cash' account. that's easy
<odigity>
but some are dynamically generated, and so their names need to be dynamically generated, but with a pattern
<fowl>
so you only have accounts for one person?
krusty_ar has quit [Remote host closed the connection]
<X-Jester>
write, that's still not a problem
<odigity>
fowl - you understand I'm not talking about user accounts, right? this is about accounting, as in accountants, money, finances
kaiwren has quit [Ping timeout: 255 seconds]
kaiwren_ is now known as kaiwren
<fowl>
haha yeah i understand
<fowl>
good luck
<odigity>
nevermind, this is just too frustrating
<X-Jester>
define an accessor/mutator for @name, and after you .new the class, run the name method to set it
<X-Jester>
your setname method can take a string with tokens and do whatever you choose
<odigity>
I know that. that wasn't the question.
<odigity>
did you read the gist?
_bart has joined #ruby
krusty_ar has joined #ruby
Hien has joined #ruby
<X-Jester>
i did, is this college homework?
<odigity>
no
<_br_>
*facepalm* does anyone know how to merge two Nokogiri::XML::Builder objects?
<odigity>
why would you think that?
_bart has quit [Remote host closed the connection]
crisewng has quit [Quit: Leaving.]
<X-Jester>
just read that way is all
<fowl>
it looks like it was written by some old java fart who doesnt know what do in ruby
<X-Jester>
anyway, please don't take this as pointless criticism, but what seems to be missing from your data model is correct typing
jumpingcloud has quit [Ping timeout: 255 seconds]
<odigity>
gee, thanks, fowl
<X-Jester>
each attribute of an object should be its own type whenever possible
<odigity>
I don't understand
<X-Jester>
instead of getting accounts by "Payroll - John Smith", it should be myclass.department and myclass.name, where department should probably be an enum
<X-Jester>
or at least, an id rather than a string
verbad has joined #ruby
<odigity>
I don't want to create a whole type system just to replace the simple need to generate patterned strings
<odigity>
the only difference is the name, not the functionality
<X-Jester>
between accounts?
<odigity>
yes
<X-Jester>
i would hope that your accounts all have unique differences
<X-Jester>
other than just a name
<odigity>
I've been saying that since the beginning
<odigity>
why?
lxsameer has joined #ruby
<odigity>
all accounts are the same. they're just a container for a balance, and you add and substract, that's it
dv310p3r has joined #ruby
<X-Jester>
using your example, their balances are unique
<odigity>
why would you hope/expect differently?
cousine_ has quit [Remote host closed the connection]
<X-Jester>
because if i were banking and someone told me my account was exactly the same as someone else's except for the display name, i'd be worried
<odigity>
you are making no sense
<X-Jester>
yeah, it's me that's the problem
<nedbat>
odigity: it seems like you want a factory function that can do the string manipulation, and create an Account instance.
<X-Jester>
you obviously don't need my help
<odigity>
I'm just about done with this conversation. I suppose it could be me that's the problem here, but I don't see how. it's pretty simple, and I keep explaining it over and over, and everyone keeps mistinterpreting it in different ways over and over ans asking nonsensical follow ups
verto|off is now known as verto
<fowl>
odigity, line 30 involves iterating over every account(name), applying String#% to it and checking for equality, who wrote this stuff?
<odigity>
I wrote it
beekor has left #ruby ["Leaving"]
<_br_>
never mind. found a hack. ___send___ :insert, xmlnode o.O
<nedbat>
odigity: or maybe you want a hash that maps account names to account instances?
<odigity>
that's exactly right. that's the first thing anyone's said to indicate the understand a single thing I've explained, thank you
<odigity>
but I don't want to be limited to defining static strings, I want to be able to define name PATTERNS
linoj has joined #ruby
LBRapid has joined #ruby
lxsameer has quit [Max SendQ exceeded]
<odigity>
and use those same patterns for a) assembling the name literal when looking up an account (using named args for the variable bits), and b) assembling a regex to match the pattern to ensure there are no accounts in the DB that don't match the list in the config file
<fowl>
how is a string pattern that checks for "payroll - name" better than just storying arrays ['payroll', name]
<odigity>
I already explained above, a simple array just allows for concatenation, not in-string placement
<odigity>
if you wanted something like "some literal text #{var here} some more literal text", it would get really ugly
<fowl>
['payroll', 'bob'].join ' - '
<nedbat>
odigity: you want a factory function to create the instances, and a class method to find them. I can't help more than that, I'm a ruby newby
Markvilla has joined #ruby
<odigity>
I'd rather talk to nedbat, he's only the person who seeems capable of comprehension
<odigity>
nedbat, I know - I'm trying to explore the implementation of those methods
<fowl>
odigity, thats because you don't make any sense, pookie :)
<X-Jester>
odigity: since you're going to be a dick, you seem to be the only idiot who thinks this is a good way of representing data in code
<odigity>
funny how nedbat seems to get it, and yet is a noov
<odigity>
noob
<odigity>
I've asked for a better way, X-Jester, but rather than suggest something that makes sense, everyone keeps misunderstanding the purpose
<X-Jester>
yeah
<fowl>
X-Jester, nah, classes are no good, packing things in strings is leet
lxsameer has joined #ruby
lxsameer has quit [Changing host]
lxsameer has joined #ruby
<X-Jester>
you just want to write a glob of "stringly typed" code
<X-Jester>
and we're telling you not to
<X-Jester>
you don't comprehend how what we're telling you helps, and you think that means we don't understand your problem
<nedbat>
odigity: i agree with the others that if you have structured information like "user", it should be stored in its own attribute, even if you also have it in the name
<X-Jester>
the difference is, your problem and "what you are trying to do" aren't as locked together as you think
ron has joined #ruby
<X-Jester>
so go make your bad string token code without our help
* ron
<-- knows very little about ruby, just trying to install an app.
robozahn_ has joined #ruby
<fowl>
ron, you're missing a header
<fowl>
you probably need the -dev versions of the library (postgres?)
<ron>
fowl: great, I have no idea what to do with that.
<Bofu2U>
Any cleaner way to see if a var is one of 3 numbers instead of a == 1 || a == 2 || a == 3? [1,2,3].include? a looks like one of the closest I've found, wondering if there's anything better, etc.
<ron>
all I did was 'bundle install' because some other error message told me to do so. I have no idea what I'm doing :)
<odigity>
names are not types
<odigity>
oh forget it
<hoelzro>
Bofu2U: (1..3).include? a
<Bofu2U>
hoelzro, not always in a row, also applies to strings
<odigity>
all this whole conversation has accomplished is make me angry instead of enthusiastic
lolmaus has quit []
seitensei has quit [Remote host closed the connection]
<fowl>
go sit in the corner odigity !
<ron>
fowl: ideas? :)
<Bofu2U>
hoelzro, ex: a == "this" || a == "that" || a == "shiz"
<fowl>
ron, you need the pg libraries install through your package manager
<Bofu2U>
ron, what OS?
<hoelzro>
{ this: true, that: true, shiz:true}.has_key? a
<hoelzro>
that would probably work
<ron>
Bofu2U: Centos
<Bofu2U>
ron: yum install postgresql-devel
* Bofu2U
crosses fingers
robozahn has quit [Ping timeout: 265 seconds]
<ron>
hmm, let'see ;)
<Bofu2U>
hoelzro, got ya, thanks for the path. I'll see what I can find out.
lxsameer has quit [Ping timeout: 272 seconds]
<Bofu2U>
doing the whole var == "thing" || times 4-5 gets a little... yeah
<fowl>
Bofu2U, %w[this that shiz].include? a
chussenot has quit [Quit: chussenot]
<Bofu2U>
fowl, would fail on multi-word strings though, right?
<ron>
Bofu2U: well, what do you know... ;)
<Bofu2U>
"answer 1", "answer 2", etc
<Bofu2U>
ron, depending on your next line, could be a lot or nothing.
<Bofu2U>
:)
<ron>
Bofu2U: true ;)
<fowl>
Bofu2U, yea in that case you can't use %w[] use ['answer 1', ]
n1x has quit [Ping timeout: 256 seconds]
gtuckerkellogg has joined #ruby
<Bofu2U>
fowl, got ya. Alright, cool.
chussenot has joined #ruby
<Bofu2U>
Do you know if using something like that would be equivilent to an if/elsif or just straight if's?
<Bofu2U>
(just thinking speed wise)
greasegum has quit [Read error: Operation timed out]
<ron>
Bofu2U: aha! different error :)
fflush has joined #ruby
<Bofu2U>
ron, progress at least. hit me.
<ron>
something about rmagick
kexwork has joined #ruby
<ron>
need a pastebin or is that enough?
<fowl>
yeah but if you have some_huge_array.map { |x| ['this', 'that', 'shiz'].include? x } remember it will create a new array and 3 new strings each iteration
<Bofu2U>
fowl, understood, thanks for the heads up. For really large ones I'd probably avoid the method, but figured I'd ask regardless.
<fowl>
so if its not going to change you could just create it outside the loop and that should shave some time off (maybe)
lxsameer has joined #ruby
lxsameer has quit [Changing host]
lxsameer has joined #ruby
<Bofu2U>
perfect.
stopbit has joined #ruby
<Bofu2U>
yeah I do a lot of calcs like that, already save it outside - just wanted to see if it made sense to do something like that in the comparison vrs the other
venkatk_ has quit [Quit: This computer has gone to sleep]
<JonnieCache>
basically, fuck rails. ive had enough
<JonnieCache>
at the new job im going to lobby for sinatra all the way
<Bofu2U>
JonnieCache, good morning to you too.
<Bofu2U>
:)
s1n4 has joined #ruby
<JonnieCache>
sorry its very hot in the office right now
* Bofu2U
puts on his Robe and Wizard hat.
<ron>
Bofu2U: COMPLETE!
<Bofu2U>
ron, glad I could help. I'm sure I'll see you over in the Mongo room eventually. :)
<ron>
Bofu2U: I'm in the mongo room all the time :)
<Bofu2U>
I'm newer to it, but it's fun so far.
<ron>
Bofu2U: though what do my current problems have to do with mongo? ;)
<Bofu2U>
Absoloutely nothing, just saw you in there.
<Bofu2U>
:)
chussenot has quit [Ping timeout: 272 seconds]
<i0n>
how do you pass the output of a def with arguments to an array?
<ron>
Bofu2U: haha :)
emmanuelux has joined #ruby
<ron>
anyways, thanks for the help Bofu2U and fowl, always nice to meet people who help on IRC ;)
joshman_ has joined #ruby
<Bofu2U>
i0n, example?
<i0n>
file = method "argument"
<Bofu2U>
ron, anytime.
<ron>
have a good one!
ron has left #ruby ["Leaving"]
<i0n>
arr2=method.clone "argument"
rbanffy has joined #ruby
<Bofu2U>
must not be awake enough yet :( sorry
ron has joined #ruby
vlad_starkov has quit [Remote host closed the connection]
<THE_GFR|WORK>
I have a site written in ruby it's ruby 2.1, upgraded to ruby 3.1 now my PDFs are all messed up, prawn messesed everything up with formatting and more etc, but the major beef I have over that, because that can be fixed are the page effects I have. I have a series of tables where they highlight but, the effects are not working currently with 3.1 but they work when I save out the 2.1 HTML page
<THE_GFR|WORK>
any ideas?
<blazes816>
you mean rails, not ruby
<blazes816>
try #rubyonrails
lxsameer has quit [Read error: Connection timed out]
<THE_GFR|WORK>
yea?
<THE_GFR|WORK>
sorry
<blazes816>
np
<blazes816>
ruby 2 is still a fantasy
<THE_GFR|WORK>
ok I'll go there thanks
lxsameer has joined #ruby
lxsameer has quit [Changing host]
lxsameer has joined #ruby
<catphish>
i was going to ask about ruby 2
<catphish>
is it not go yet?
<blazes816>
it's in progress
carloslopes has joined #ruby
<catphish>
who's writing it?
<nedbat>
i'm curious why 1.9 wasn't labelled 2, considering how many ways it won't run valid 1.8 code.
<blazes816>
uh, matz I guess? I'm not too hip to scene
<fowl>
catphish, the code is slowly appearing on the stone tablets
<blazes816>
and a bunch of others obviously
<blazes816>
nedbat: given the proposals I've seen for 2, 1.9 changes were nothin
<catphish>
nedbat: it's a different version, its rare that version numbrs make much sense in open source projects :)
<catphish>
look at linux 3.0
<catphish>
vs linux 2.6
rushed has quit [Quit: rushed]
xaq has joined #ruby
rushed has joined #ruby
<nedbat>
catphish: i'm just used to the python model, where backward compatibility within 2.x seems to take precedence over all sorts of other concerns.
<fowl>
nedbat, you should forget about 1.8
<banisterfiend>
nedbat: it's just that ruby's versioning system is different
bier has joined #ruby
<banisterfiend>
nedbat: 1.7, 1.8, 1.9 are major versions
<blazes816>
usually in x.y, y denotes a stable api
<catphish>
ruby has such a thing on minor revisions, not major ones, and even then its pretty weak
<banisterfiend>
major releases with breaking changes
bluenemo has joined #ruby
bluenemo has quit [Changing host]
bluenemo has joined #ruby
<nedbat>
banisterfiend: so within 1.8.x and 1.9.x you'd expect backward compatibility?
<catphish>
ruby 2.x should convert all code to highly optimized c and compile it before my eyes :)
<banisterfiend>
nedbat: yeah mostly
<nedbat>
banisterfiend: "mostly"? Where is it allowed to break?
<catphish>
i actually went with .map{|x,y| "#{CGI.escape(x.to_s)}=#{CGI.escape(y.to_s)}"}.join('&')
scriabin has quit [Quit: Lost terminal]
<shevy>
what is set_form_data, is that a rails thing?
<catphish>
never though of to_s'inf the nils
<shevy>
hehe
<workmad3>
shevy: I think it's a net/http thing
<shevy>
nil is not very useful
<catphish>
nil is extremely useful
<workmad3>
shevy: not everything that does HTTP stuff is rails-based :P
PaciFisT has joined #ruby
<shevy>
then why do you to_s them
chussenot has joined #ruby
<catphish>
because the server im pushing to is broken :)
<catphish>
and doesn't understand nil
<shevy>
workmad3, yeah, I kinda lost tracks. the ruby cgi module I don't like much, it seems way too cumbersome to build something useful with .cgi in my opinion :(
bdnelson has joined #ruby
lxsameer has joined #ruby
lxsameer has quit [Changing host]
lxsameer has joined #ruby
<workmad3>
shevy: yeah, I'd agree :)
apeiros_ has quit [Remote host closed the connection]
<catphish>
rack gtw
<shevy>
all my web stuff is in .cgi files btw
<catphish>
*ftw
<workmad3>
shevy: nowadays with ruby, I'd suggest starting with a rack app rather than cgi scripts
<shevy>
so I wanna switch to something else... but what...
Pathou has quit [Quit: Page closed]
<shevy>
hmm
<catphish>
rack
<Tasser>
or sinatra
bbttxu has joined #ruby
ackz has joined #ruby
fantazo has joined #ruby
verto is now known as verto|off
<catphish>
sinatra if your stuff needs templates etc
<catphish>
but usually i just give in and use rails for that :)
<shevy>
with rails, I have this nagging fear that, once I switch, I can't switch to anything else
<shevy>
workmad3 I dont really know what that does
<workmad3>
shevy: it sends the string 'Hello World' as the body of a response
ciastek has joined #ruby
ackz has left #ruby [#ruby]
aganov has quit [Remote host closed the connection]
<workmad3>
shevy: and what do you mean, 'can't switch to anything else'?
<shevy>
when everything is connected to the rails ecosystem
<shevy>
active*everything and stuff
<shevy>
M/V/C to infinity
<shevy>
I am scared of that :(
<workmad3>
shevy: it's just a framework... it does stuff for you
<workmad3>
shevy: creating a web app with rails doesn't prevent your from then writing a web app with something else, or doing shell scripting, or anything like that...
<kalleth>
i have personally used sinatra and rails for web apps in ruby
<kalleth>
i have also used daemon-kit and 'raw ruby code' to create processes in ruby
<workmad3>
shevy: it's difficult to switch a rails web app away from rails, yes, I'll admit that's quite common
n1x has quit [Ping timeout: 272 seconds]
<ciastek>
should unpacking instance variable with splat operator work?
<workmad3>
shevy: I'm not fully convinced that providing that sort of switch is exactly a valid use-case with a framework though :P
<shevy>
ciastek dont think so. * only puts things into an array
JohnBat26 has quit [Ping timeout: 240 seconds]
<shevy>
workmad3 yeah hmm...
apeiros_ has joined #ruby
<ciastek>
shevy: or gets them out of array
<shevy>
rack seems simpler
<shevy>
ciastek: how?
<workmad3>
ciastek: foo(*@bar) works fine for me
<workmad3>
ciastek: what ruby version are you on?
<shevy>
with rack, do the files have to be "foo.ru" ?
<shevy>
or could I use a foo.rb too
<shevy>
or is .ru not valid ruby code
<workmad3>
shevy: no, only the rackup file is .ru
<workmad3>
shevy: it's valid ruby code, but rackup runs it with a different top-level object
fflush has joined #ruby
<shevy>
cool
<workmad3>
shevy: similar to a Rakefile :)
<fflush>
bonjour tout le monde
asobrasil has joined #ruby
SQLStud has joined #ruby
<shevy>
fflush baguette
<ciastek>
shevy: instead of calling some_method(arg1, arg2) you can do: args=[arg1,arg2]; some_method(*args);
Bosma has joined #ruby
Xaitec has joined #ruby
<fflush>
shevy: j'ai ne comprend pas
<Xaitec>
hi all
<ciastek>
workmad3: ruby 1.9.3
<workmad3>
ciastek: odd
<ciastek>
workmad3: maybe it's rails' magic
bglusman has quit [Ping timeout: 264 seconds]
<workmad3>
ciastek: no, it's basic ruby syntax
<workmad3>
ciastek: rails doesn't alter ruby syntax
<shevy>
yet
<shevy>
:)
<shevy>
rails 5.0 will be its own language
<workmad3>
shevy: I doubt it ever will tbh :P
<Xaitec>
I am trying to learn ruby and some one said the best way is to help with an open source project
enroxorz has joined #ruby
<Xaitec>
any one has any?
enroxorz has quit [Changing host]
enroxorz has joined #ruby
vertroa has joined #ruby
<i0n>
a = [list] ; for i in a do puts a.split(/\//) end
maletor has joined #ruby
savage- has joined #ruby
<i0n>
im getting a nomethoderror for this? im not sure the proper syntax for splitting inside a for loop i guess?
<ciastek>
workmad3: i tried again and it works. looks like my fault. :)
<ciastek>
workmad3: thx
<workmad3>
ciastek: typo? :D
maesbn has quit [Remote host closed the connection]
<fowl>
i0n, we dont use the for block very much in ruby, its better to use an iterator like #each or #map
<ciastek>
workmad3: thx again
Morkel has quit [Quit: Morkel]
<Spooner>
Xaitec : Not sure it is best for learning the basics, but for intermediate skill it makes sense. Just look on github.com if you want to read or work on any open source Ruby projects that interest you. Difficulty is probably finding one appropriate in complexity to your skill level.
<i0n>
fowl: could you show me a code example?
ken_barber has joined #ruby
tk__ has quit [Quit: ばいばい]
<i0n>
fowl: basically i need for loop through an array grab the index [4] and jam this into another array
carlyle has joined #ruby
<Xaitec>
Spooner: i know the basics i did some C# before
<fowl>
%w[a0x b0f g0f].map { |x| x.split('0') }
carloslopes has quit [Quit: Leaving.]
<Spooner>
i0n More likely that "list" is the method it isn't finding.
<Xaitec>
Spooner: i just want to learn best practices. With a project i get real word problens and a team that can help if i hit a wall
<fowl>
Spooner, if a is an array you cant call split on it
<Spooner>
i0n and your code should probably be rubified: a = [list]; a.each {|i| i.split /\// }
<workmad3>
shevy: btw, haven't you used the splat operator to turn an array into an argument list before?
dinamicex1 has joined #ruby
<Spooner>
fowl true, I assumed it was a typo for i.split
Maniacal has quit [Ping timeout: 264 seconds]
ckrailo has joined #ruby
cakehero has joined #ruby
<Spooner>
i0n I missed the puts out, but forgive me :)
mpereira has quit [Ping timeout: 250 seconds]
enroxorz has left #ruby ["Leaving"]
twinturbo has quit [Quit: twinturbo]
apok has joined #ruby
apeiros_ has quit [Remote host closed the connection]
<Spooner>
Xaitec : Most light work on open source seems to be more fork->patch->pushrequest. That goes on a lot more than actually formally joining a team, except on the big projects.
Arafangion has quit [Read error: Connection reset by peer]
<Spooner>
No, you want map for that way of printing: pp a.map {|i| i.split /\//}
<workmad3>
Xaitec, Spooner: it's quite common even on big projects to do patches and pushrequests rather than join the team... joining the team tends to mean you're making a significant time commitment and are probably being paid by a company interested in funding open source dev to do so
zodiac1111_ has quit [Ping timeout: 250 seconds]
<Spooner>
Or: a.each {|i| puts i.split(/\//) }
<Spooner>
Depending on how you want to do it.
<i0n>
grab the index [4] and jam this into another array
<Spooner>
workmad3 : True, casual push-requests are for all projects, but formal groups are more common on large projects.
<workmad3>
Xaitec: basically, find a project you think is useful or that you like, find the bug or issues list for it, and try to fix bugs and issues on it :)
maletor has quit [Quit: Computer has gone to sleep.]
prtksxna has joined #ruby
wvms has quit [Ping timeout: 252 seconds]
<dinamicex1>
Hi! Can you recommend me some Ruby on Rails tutorials to start with? I've never used Ruby nor Ruby on Rails. (I prefer video tutorials and "learn by doing" )
savage- has quit [Remote host closed the connection]
xaq has quit [Read error: Connection reset by peer]
<catphish>
i'd love to be insulted by linus personally :)
<workmad3>
catphish: start contributing to git then ;)
<workmad3>
catphish: it's a bit easier than trying to contribute to the linux kernel :)
Eldariof-ru has quit [Read error: Operation timed out]
<catphish>
i really should look into git more closely since much of my business depends on it :)
xaq has joined #ruby
<Xaitec>
catphish: well my issue is that i need a project that will help me touch various aspects of ruby. basically i need something to work on
<workmad3>
catphish: if you really want to get insults flowing... contribute to git using C++ :D
<Xaitec>
lol @ catphish
berserkr has quit [Quit: Leaving.]
<Spooner>
You are better off finding a project that you use and fixing the things that annoy you about it or adding things you need, rather than picking one at random.
<workmad3>
^^
erichmenge has joined #ruby
<workmad3>
Xaitec: welcome to the online development community... we don't tell you what you should work on, you need to work out for yourself what you want to work on
kaiwren has quit [Quit: kaiwren]
<workmad3>
Xaitec: if you want to be told what to do... get a job at a nice, big company, or go to school :)
<catphish>
i have pushed patches to ruby libraries, but they've never been accepted because i refuse to write a test to demonstrate that something obviously broken is in fact broken
<Xaitec>
workmad3: lol
apeiros_ has joined #ruby
<workmad3>
catphish: the point is frequently more to provide a regression test IMO :)
linoj has joined #ruby
<catphish>
for example mikel's mail library believes that a line containing any amount of whitespace separates headers from body
<Xaitec>
Thanks for all the help guys i'll try to think of a small project that i can use personally and work from there
<nedbat>
catphish: you need the test to prove that you fixed it, adn that no one in the future breaks it.
<Xaitec>
What do you guys recomend that i use to create gems??
<any-key>
Vim
<catphish>
Xaitec: the gem command
<catphish>
and a good text editor
<i0n>
if i puts a.each i get a enumerable::enumerator
ttilley_off is now known as ttilley
<catphish>
correct, each is an enumerator
<Spooner>
i0n yes.
<any-key>
i0n: each returns an enumerator
<any-key>
it will also take a block/lambda to apply for each item
<catphish>
if you want to run something on each item you need to make a block
prtksxna has quit [Remote host closed the connection]
<i0n>
i see very good, i think im understanding blocks
<any-key>
hooray!
<i0n>
starting to understand*
<any-key>
blocks are just lambdas
<any-key>
which are just code
mehlah has joined #ruby
<i0n>
lambda lambda lambda
<i0n>
bad joke sryu
<any-key>
ruby is a functional programming language in that you can treat code as data
<workmad3>
any-key: you can't quite treat code as data
<workmad3>
any-key: because you can't do much in the way of manipulating it
<i0n>
so a.each { |i| i.split (/\//) }
hunglin has quit [Quit: Leaving.]
<workmad3>
any-key: not in the way you can in a language like LISP
<i0n>
the |i| is called what?
<any-key>
workmad3: well, yes, but you can still use lambdas and the like, and you can metaprogram
indian has joined #ruby
indian has quit [Changing host]
indian has joined #ruby
<any-key>
but yeah everything is lesser than lisp's ability to functional program
<workmad3>
any-key: yeah, but that's not the same as treating code as data ;)
<any-key>
workmad3: close enough!!!
<any-key>
i0n: a block
<workmad3>
any-key: :)
<workmad3>
any-key: and blocks are closer to procs than lambdas btw (in ruby terms, where a proc and a lambda are similar but not the same)
<any-key>
blocks are the best thing to ever happen though, and they're one of my fave things about ruby
<any-key>
workmad3: I use lambda in the general sense, but yeah there are very subtle differences
verbad has quit []
<Spooner>
i0n You need to look up the difference between #map and #each - you seem to be using them the wrong way around.
julio_ has joined #ruby
jprovazn is now known as jprovazn_away
ciastek has left #ruby [#ruby]
<Spooner>
i0n : Also, your #find returns an array, but then you try to use #split directly on it, rather than the strings inside it, because you place that result into another array, a.
<dinamicex1>
Spooner: Someone recommended me railscasts.com, but he also told me that i must have some knowledge of ruby before I start with railscasts
jgrevich has joined #ruby
xorgnak has quit [Remote host closed the connection]
<Spooner>
You really need to have some knowledge of Ruby before learning Rails, certainly, but you asked for Rails tutorials, not Ruby ones.
verbad has joined #ruby
<any-key>
some people jump into rails without really knowing ruby, and it bites them in the ass later
<i0n>
Spooner: thats why i was thinking a for loop was what i needed to do, grab the strings out of the array, split them and jam them into a new array.
<dinamicex1>
Ok. Then can you also give me some tutorial for ruby?
<Xaitec>
i agreee with Spooner
<any-key>
plus ruby is awesome and useful beyond rails
mpereira has joined #ruby
<any-key>
dinamicex1: I hear good things about codeacademy
<Spooner>
I used Ruby before someone thought of Rails and I'll use it long after Rails has been forgotten :)
<i0n>
im just trying to get away from perl so do my shell in ruby, no intentions of any rails work.
jameshyde has joined #ruby
<jameshyde>
how to download a gem file?
<any-key>
waitnvmd they have no ruby tutorials
<jameshyde>
not install it
<i0n>
gem install gemname?
<i0n>
oh
<xclite>
jameshyde the source probably has a link to the file online somewhere?
<any-key>
jameshyde: installing it downloads the gemfile, you can find it in the ruby gems dir
<Spooner>
jameshyde : gem fetch a_gem
<dinamicex1>
I know their site. But last time I used it the only had some sort of online IDE for ruby, not a tutorial for learning the language
<dinamicex1>
They had a tutorial only for javascript
<jameshyde>
Spooner: Thanks!
lxsameer has quit [Ping timeout: 244 seconds]
mengu has quit [Quit: Konversation terminated!]
fflush has joined #ruby
blazes816 has joined #ruby
<Spooner>
i0n not sure what your aim is to pull them out of an array to put them into another. I suspect you might want to use Array#flatten
<shevy>
workmad3 yeah but only in method definitions so far
bluOxigen has quit [Ping timeout: 244 seconds]
lxsameer has joined #ruby
Vert has quit [Ping timeout: 252 seconds]
bdnelson has quit []
<workmad3>
shevy: yeah, that's not quite the same :)
<shevy>
for some reason, I never had the need to do:
<shevy>
foo(*variable)
<shevy>
so far
<shevy>
hmmm
cbuxton has joined #ruby
<jameshyde>
in gem, is there equivalent command as "rpm -qi" to see a downloaded gem file version?
<any-key>
jameshyde: gem list
<any-key>
it'll show you all of your installed gems and their version numbers
Gab0 has joined #ruby
hoelzro is now known as hoelzro|away
<jameshyde>
any-key: I am asking to check version for a gem file, not installed gem package
<any-key>
rubygems.org
<any-key>
go look there
<any-key>
it'll show you everything you've ever wanted ever
<workmad3>
shevy: certain things, it can be pretty good for... for example, you can use it to do a thin ruby-wrapper around a system call with 'system("command", *ARGV)' :)
<blazes816>
jameshyde: not that I know
<jameshyde>
I am talking about a file downloaded and renamed, I could untar it, and look at metadata.gz file, but there must be a better way than this.
ForSpareParts has quit [Disconnected by services]
<blazes816>
jameshyde: I know what you're saying, but I've never seen it with gems
<jameshyde>
ok thanks
ForSpareParts has joined #ruby
newbie has joined #ruby
<Xaitec>
whats the best way to read in cli arguments and options?
<Spooner>
Xaitec : slop gem
newbie is now known as Guest88336
<workmad3>
jameshyde: afaik, you need to unzip it and look at the specification or metadata
<jameshyde>
workmad3: yeah, that's what I just mentioned
<workmad3>
jameshyde: yeah, I was just saying that afaik, there isn't another way
<ForSpareParts>
Uninstalled 1.8.7 when connected to my machine over ssh and installed 1.9.3, but when I got back to my computer and used the terminal directly, ruby was still 1.8.7. Any idea why?
<ForSpareParts>
Ubuntu 12.04, if it matters.
axl_ has joined #ruby
mvangala has quit [Remote host closed the connection]
zz_chrismcg is now known as chrismcg
<xclite>
ForSpareParts: Did you verify that ruby was 1.9.3 over ssh after installing?
apok has quit [Quit: apok]
<Xethron>
Whats the best way to break a string up into an array of words?
bowlowni has quit [Remote host closed the connection]
benson has joined #ruby
indian has quit [Read error: error:1408F10B:SSL routines:SSL3_GET_RECORD:wrong version number]
mvangala has joined #ruby
<ForSpareParts>
Could anybody suggest a way to completely remove 1.8.7? I thought I had added it over rvm, but rvm tells me it's already gone.
<Spooner>
ForSpareParts Is it installed via apt-get or rvm?
TheDeadSerious has quit [Quit: Leaving.]
indian has joined #ruby
<blazes816>
my guess is at once via each
<blazes816>
at least*
<Spooner>
What does 'rvm list' tell you?
bluenemo has quit [Remote host closed the connection]
chrxn_ has joined #ruby
bigzed has joined #ruby
SuperSonicSound has joined #ruby
<ForSpareParts>
ruby-1.9.3-p194
bbttxu has quit [Read error: Operation timed out]
<ForSpareParts>
that's the only one.
<ForSpareParts>
Although it does say "Default ruby not set.
<ForSpareParts>
"
<blazes816>
what does "which ruby" give?
mpereira has quit [Ping timeout: 255 seconds]
<ForSpareParts>
/usr/bin/ruby
<Spooner>
'rvm default 1.9.3' and/or 'rvm 1.9.3' should fix that.
<bigzed>
Hey guys, does anyone of you know a gem to write your own custom shell in ruby? So you can interactively query your own ruby program with a DSL you created?
<blazes816>
ForSpareParts: yeah, it's not uninstall from apt. I imagine you tried that, yes?
bequick has quit [Ping timeout: 250 seconds]
<lectrick>
So a class's class method "new" actually calls the instance method "initialize".
<Spooner>
lectrick : Indeed, after it has created a new object.
<ForSpareParts>
blazes816, I did, yeah. It was, at one point, installed via apt, but I --purge remove'd it a while back, grabbed a version from rvm
dr_diamond has joined #ruby
dr_diamond has quit [Changing host]
dr_diamond has joined #ruby
<lectrick>
Spooner: So Object.new (or some internal implementation) actually does the allocation, and then calls "initialize" on the new object with the parameters passed into new?
nedbat has quit [Disconnected by services]
kexwork has quit [Quit: WeeChat 0.3.2]
minijupe has joined #ruby
<shevy>
bigzed dont think so
<Spooner>
Yep, something like that.
<ForSpareParts>
Also, Spooner, both of those commands give me: RVM is not a function, selecting rubies with 'rvm use ...' will not work. Please visit https://rvm.io/integration/gnome-terminal/ for a solution.
<blazes816>
ForSpareParts: I don't think it uninstalled correctly. tends to happen. Using rvm should like Spooner mentioned should override it.
nedbat_ has joined #ruby
<blazes816>
ForSpareParts: did you follow the 15s long process on the page?
<Spooner>
ForSpareParts : You aren't getting rvm initialised properly in your shell. You need to 'source ~/.bash_profile' - that is where rvm usually puts init code, but that doesn't always seem to run (at least I have had a similar problem).
Vert has joined #ruby
arturaz has quit [Ping timeout: 276 seconds]
<ForSpareParts>
blazes816, process?
<ForSpareParts>
Spooner, Should I add that to my bashrc?
chussenot has quit [Remote host closed the connection]
<Xethron>
blazes816, awesome, but I want to capture IRC words... and JUST the word. So no !?@#$%... also,some people do this!And,this I would like to capture different words too.heh
nateberkopec has joined #ruby
<Xethron>
blazes816: smilies are removed beforehand (well, those that I know about anyway)
<ForSpareParts>
I did source on ~/.rvm/scripts/rvm -- what next?
<blazes816>
that will be much more difficult
<ForSpareParts>
Ruby is still 1.8.7
<blazes816>
why do you need them as an array of words?
<workmad3>
Xethron: ok, so you'll want to do something like str.split(/[^\w]/).reject(&:empty?)
<blazes816>
ForSpareParts: did you do "rvm use 1.9" successfully?
<ForSpareParts>
Thank you, blazes816. Internet points for you.
BiHi has quit [Read error: Operation timed out]
ianbrandt has joined #ruby
<blazes816>
ah yeah!
codespectator has quit [Ping timeout: 244 seconds]
jesly__ has joined #ruby
bullicon has joined #ruby
jamiejackson has joined #ruby
nedbat has quit [Ping timeout: 245 seconds]
arturaz has quit [Ping timeout: 272 seconds]
timonv has quit [Remote host closed the connection]
Rizzle has joined #ruby
ephemerian has quit [Quit: Leaving.]
BiHi has joined #ruby
brasten has joined #ruby
<shevy>
code code code...
chrxn_ has joined #ruby
<shevy>
rewrite rewrite rewrite
bluenemo has joined #ruby
bluenemo has quit [Changing host]
bluenemo has joined #ruby
<Spooner>
ppawel : You could just eval it? \fs29 str = '#{variable}'; eval "\"#{str}\""\fs29
<workmad3>
shevy: refactor, refactor, refactor
ViperMaul has quit [Ping timeout: 276 seconds]
the_jeebster has joined #ruby
moted has quit [Remote host closed the connection]
darren_ has joined #ruby
greasegum has joined #ruby
wallerdev has joined #ruby
chussenot has quit [Quit: chussenot]
moted has joined #ruby
sonkei has joined #ruby
mahmoudimus has joined #ruby
codespectator has joined #ruby
zemanel has joined #ruby
pdtpatrick has joined #ruby
robozahn_ has quit [Ping timeout: 265 seconds]
<ForSpareParts>
Is there a working debugger for 1.9.3? ruby-debug19 installed successfully, but it's crashing -- undefined symbol: ruby_current_thread
<Hanmac>
ppawel you could try "%<name>s" and use "string % hash"
indian has quit [Ping timeout: 252 seconds]
<Spooner>
ForSpareParts : I think "debugger" is current
sameerynho has quit [Ping timeout: 252 seconds]
azm has quit [Ping timeout: 255 seconds]
sameerynho has joined #ruby
<ForSpareParts>
Cool, I'll try that.
<Spooner>
ForSpareParts : Pry is pretty useful too, but in a different way.
erichmenge has quit [Quit: Be back later]
<ForSpareParts>
Googled that. Sounds cool -- might look into it. I don't have a ton of experience with writing my code from a REPL, though.
Asphyxiated|Dk has joined #ruby
sonkei has quit [Quit: leaving]
<Spooner>
It isn't necessarily done like that. It is more useful (in terms of debugging) to have it open a repl at specific points or on exception.
erichmenge has joined #ruby
sonkei has joined #ruby
kaiwren has joined #ruby
kaiwren has quit [Client Quit]
bbttxu has joined #ruby
tvw has quit [Ping timeout: 246 seconds]
<Asphyxiated|Dk>
so i am missing some (a lot) of gems for this program and i am slowly getting them installed with 'gem install <gem>' but it states to run 'bundle install' to install missing gems but when i run that it says 'command not found: bundle', I do have the bundle gem installed.... im not sure if this has to be done as root though, i have been doing it as a normal user.. anyone offer any help?
apok has joined #ruby
<Spooner>
Depends how Ruby is installed. If you installed it as root (e.g. via apt-get) then you need to sudo with gem. If you installed it with rvm to ~/rvm/rubies/whatever, then you own it and should NOT sudo gem.
minijupe has quit [Quit: minijupe]
sonkei has quit [Client Quit]
bluenemo has quit [Remote host closed the connection]
<Asphyxiated|Dk>
Spooner: ok, i run gentoo so it was installed through portage as root
sendoushi has quit [Remote host closed the connection]
axl__ has joined #ruby
bluOxigen has joined #ruby
<jamiejackson>
rake question: i can add prerequisites like this: task :war => ["assets:clean", "assets:precompile"]
<Spooner>
You probably need to sudo gem install bundler then. Not sure where it is beign installed to if you don't.
linoj has joined #ruby
jesly__ has quit [Ping timeout: 244 seconds]
<jamiejackson>
but how do i do the same if it's a two-part task? (the second colon is a syntax error): task :war:clean => ["clean_all"]
<apeiros_>
jamiejackson: that doesn't exist
<apeiros_>
namespace :war do task :clean do … end end
sonkei has joined #ruby
<apeiros_>
a task name of foo:bar means the task name is bar. the foo is only the namespace (can be nested)
axl_ has quit [Ping timeout: 255 seconds]
axl__ is now known as axl_
codespectator has quit [Quit: Computer has gone to sleep.]
<Spooner>
Asphyxiated|Dk : Though installing via rvm or equivalent is easier in a lot of ways (no more sudo) and makes it possible to have multiple installs (e.g. 1.9.3 and 1.8.7)
sonkei has quit [Client Quit]
sonkei has joined #ruby
<jamiejackson>
that helps, thanks apeiros_
billiam has joined #ruby
wallerdev has quit [Quit: wallerdev]
LBRapid has quit [Quit: Farewell.]
Maniacal has quit [Remote host closed the connection]
werdnativ has quit [Quit: werdnativ]
LBRapid has joined #ruby
workmad3 has quit [Ping timeout: 250 seconds]
k_89 has quit [Ping timeout: 250 seconds]
qwester has joined #ruby
virunga has joined #ruby
Russell^^ has joined #ruby
<lectrick>
We had something fail and the monitoring software failed, raising the eternal question, "who monitors the monitoring software?"
ppawel has quit [Read error: Operation timed out]
TPFC-SYSTEM has joined #ruby
sonkei has quit [Quit: leaving]
sonkei has joined #ruby
bglusman has joined #ruby
elhu has quit [Ping timeout: 252 seconds]
MasterIdler_ has joined #ruby
<blazes816>
I smell a startup...
devdazed has joined #ruby
johnlcox has joined #ruby
julio_ has quit [Read error: Connection reset by peer]
mehlah has quit [Read error: Connection reset by peer]
k_89 has joined #ruby
chimkan has quit [Ping timeout: 244 seconds]
chimkan_ is now known as chimkan
riginding has joined #ruby
riginding has quit [Client Quit]
riginding has joined #ruby
<Hanmac>
lectrick, if the monitoring software is not monitored, does it then exist?
mrbrdo has joined #ruby
<lectrick>
Did you ever read that bit about how humans can't just be materialist because if they were then they'd be a quantum observer and the interaction between a quantum observer and a quantum observed collapses the wave function meaning it's impossible?
<mrbrdo>
I moved some processing from a single-threaded app to multiple threads (Thread.new) and it seems I am having some sort of memory leak (usage keeps increasing from 500MB up to 1000 MB where I am capped on my server). Any idea what I could look at? It's fairly complex so I can't put a simple example online, but I can say I am using nokogiri and mechanize
* lectrick
digresses off the deep end
<mrbrdo>
oh and I am using mongo also
<Hanmac>
lectrick this is ecactly the reason why we need to kick the observers ass :P
Guedes has quit [Ping timeout: 272 seconds]
prtksxna has joined #ruby
paradoja has joined #ruby
lxsameer__ has joined #ruby
kenichi has joined #ruby
ppawel has joined #ruby
revans has joined #ruby
tfittsy is now known as tfitts
devdazed has quit [Quit: Computer has gone to sleep.]
stephenjudkins has joined #ruby
sameerynho has quit [Ping timeout: 246 seconds]
thephrase94 has joined #ruby
ramblex has quit [Ping timeout: 264 seconds]
tommyvyo has quit [Quit: Computer has gone to sleep.]
BiHi has quit [Quit: Computer has gone to sleep]
jesly__ has joined #ruby
banghouse has quit [Remote host closed the connection]
stat1x has quit [Remote host closed the connection]
stat1x has joined #ruby
wallerdev has joined #ruby
kidoz has joined #ruby
SphericalCow has joined #ruby
artOfWar has joined #ruby
esuzuki has joined #ruby
esuzuki has left #ruby [#ruby]
prtksxna has quit [Ping timeout: 255 seconds]
maxfilipovich has left #ruby [#ruby]
ak5 has joined #ruby
Eldariof-ru has joined #ruby
<ak5>
hi, I want to get into rails, seems like it's pretty awesome. Any good books I need to get?
<shevy>
ak5 the railsers are on #rubyonrails
<Bofu2U>
Have you tried the guide yet?
<Muz>
#rubyonrails may have more suggestions than the overwhelming response you've got here.
* Bofu2U
retracts statement
* Muz
shakes fist at shevy
<shevy>
Muz I really should start learning rails
<davidcelis>
shevy: no
<Muz>
shevy: I often think that too.
<Muz>
(That you should start learning rails.)
monkegjinni has quit [Remote host closed the connection]
<shevy>
davidcelis lol
<apeiros_>
ak5: I think rubyonrails.org mentions a couple of books
systest has joined #ruby
<apeiros_>
also has a list of relevant resources
kvirani has quit [Remote host closed the connection]
<apeiros_>
also check screencasts (peepcode et al)
<davidcelis>
ak5: Since you STILL haven't joined #rubyonrails and asked there, Rails 3 In Action is a good book: http://manning.com/katz/
<davidcelis>
ak5: But I hope you know Ruby first. Please do not start learning Rails unless you have a grasp on Ruby.
<ak5>
I am not so quick, thanks though
<ak5>
davidcelis: oh, I was kinda hoping to be able to wing it with my knowledge of python :D
<ak5>
davidcelis: so what is a good ruby point of entry?
<davidcelis>
I always forget the name of the book...
<Bofu2U>
write a bot that randomly texts your cell phone thoughout the day reminding you to learn more Ruby
<ak5>
but "the book" exists?
<Bofu2U>
...at least that's how I got started :x
<davidcelis>
"The Ruby Programming Language" ?
<davidcelis>
The Well-Grounded Rubyist is also good
fflush has joined #ruby
seitensei has quit [Remote host closed the connection]
<ak5>
davidcelis: so I should go with o'reilly?
<shevy>
nono
<davidcelis>
"Programming Ruby" (i.e. The Pickaxe Book) is a good reference, but not really a good learning guide
<shevy>
start with rails first
<davidcelis>
shevy: stop
<shevy>
if you learn ruby first, you may never want to learn rails
<blazes816>
which is a good thing
<shevy>
lol
<ak5>
wait... what?
monkegjinni has joined #ruby
Progster has joined #ruby
<davidcelis>
Don't listen to them; don't learn Rails first. It's a framework built on Ruby. If you don't know Ruby and try to learn Rails, a lot of shit is just gonna seem like magic
<blazes816>
not that rails is awful, but learning how to decide what you need and when is important
<shevy>
well you asked #ruby ak5 :-)
<ak5>
isn't rails just a webframework for ruby, like django is for python
jrajav has joined #ruby
<davidcelis>
\Yes
tiripamwe has joined #ruby
<davidcelis>
And just like that, you should know Python before learning Django
lorandi has quit [Ping timeout: 264 seconds]
nedbat has joined #ruby
<ak5>
yes, that's what I thought, too :)
<blazes816>
yes, I did not mean to imply not to learn ruby first.
<blazes816>
definitely do
<davidcelis>
I see a lot of people suffer through Rails and not really understand what they're doing because they don't know Ruby
<davidcelis>
Hell, I was one of those people
<davidcelis>
I do not recommend it
br4ndon has quit [Quit: Lorem ipsum dolor sit amet]
jgarvey has joined #ruby
<Muz>
To be fair, given the amount of magic and syntactic wank than Rails introduces, even well-seasoned Ruby devs have moments of "what the fuck".
<Muz>
*that
manizzle_ has quit [Read error: No route to host]
manizzle has quit [Read error: No route to host]
<Muz>
Knowing Ruby beforehand helps make some semblance of order out of the mess.
<davidcelis>
Sure, moments
mehlah_ has quit [Quit: Leaving...]
dankest has joined #ruby
jgrevich has quit [Quit: jgrevich]
kyle__ has left #ruby [#ruby]
<davidcelis>
Huh, I wonder why "Rails is in #rubyonrails" got removed from the topic
lkba has quit [Ping timeout: 272 seconds]
<davidcelis>
Just noticed that when fflush opped
<systest>
ak5, came late to the thread but if you're looking for an entry book, I'm enjoying "Beginning Ruby, From Novice to Professional" by Peter Cooper. + http://rubykoans.com/
<Muz>
davidcelis: presumably to stop such an "us & them" mentality about ruby-purists and rails users.
<ak5>
great, thanks a lot guys
<davidcelis>
Muz: excellent
<Muz>
Presumably.
<davidcelis>
Muz: presumably excellent
zeromodulus has joined #ruby
* Muz
nods and goes home for the day.
<fflush>
that's was the intention
<davidcelis>
I dislike that mentality. I program in Rails, but I still consider myself a Ruby purist. Some Rails "conventions" are whack and I avoid them
<systest>
which leads to my question, does .. string1=string_orig; string1<<"more stuff" .. modify string_orig, but .. string1+="more stuff" .. does not?
<systest>
s/ does/why does/
blazes816 has quit [Quit: Leaving]
<shevy>
rails is like a flag
stephenjudkins has quit [Ping timeout: 244 seconds]
cakehero has quit [Quit: Computer has gone to sleep.]
sonkei has joined #ruby
<Muz>
They both share the same ID as they both represent the same thing in memory. << modifies that item in the space in memory, which both "orig" and "string" refer to. With +=, a new item is returned and assigned to string, so doing string += "foo"; string.object_id; orig.object_id; would return two differing items
<Muz>
At least, that's my "simple" representational way of thinking about it.
<shevy>
I like that Muz uses a '.' to finish his sentences
<fowl>
lol how weird
tommyvyo has joined #ruby
gmci has quit [Quit: Computer has gone to sleep.]
chimkan has joined #ruby
<Muz>
shevy: not always.
<shevy>
it shows dedicated effort
<shevy>
I can see the '.' but it's kind of staring at me ...
k_89_ has joined #ruby
<masak>
it is how people have traditionally ended sentences. I believe the Romans didn't do that, but it's been common since.
EricKamsky_ has quit [Quit: EricKamsky_]
voodoofish430 has joined #ruby
lxsameer__ has quit [Ping timeout: 252 seconds]
lxsameer__ has joined #ruby
k_89 has quit [Ping timeout: 272 seconds]
<shevy>
man
<shevy>
if cesar would have just been able to use IRC ...
<apeiros_>
he'd have trolled so hard
sebicas has joined #ruby
bashdy has joined #ruby
jamiejackson has quit [Ping timeout: 245 seconds]
dorei has quit [Ping timeout: 245 seconds]
kirun has joined #ruby
Goles has joined #ruby
burgestrand1 has joined #ruby
burgestrand has quit [Ping timeout: 276 seconds]
ak5 has quit [Read error: No route to host]
<shevy>
hahaha :)
bashdy has quit [Client Quit]
jarray52 has left #ruby [#ruby]
Araxia has joined #ruby
dv310p3r has quit [Read error: Connection reset by peer]
Progster has quit [Read error: Operation timed out]
mvangala has quit [Remote host closed the connection]
bglusman_ has joined #ruby
bglusman has quit [Read error: Connection reset by peer]
systest has quit [Quit: Leaving]
manizzle_ has joined #ruby
hynkle has joined #ruby
<lectrick>
How do I test whether a constant is defined in a class, programmatically?
<apeiros_>
const_defined?
<apeiros_>
quite surprising, I know :-p
ramblex has joined #ruby
<lectrick>
aha ty
<lectrick>
lol
<apeiros_>
lectrick: all introspective methods of ruby reside in Module and Object
<any-key>
that's the last thing I would have tried
czl_ has quit [Ping timeout: 244 seconds]
<shevy>
indeed
<apeiros_>
and all module related ones reside (obviously) in Module, all object related ones reside (obviously too) in Object
<shevy>
include SomeModule if Object.const_defined? :SomeModule
drupin has joined #ruby
Lachryma` has quit [Quit: Leaving]
<apeiros_>
you're well advised to read the whole docs of: Kernel, Object, Module, Class. Also a good idea are: Enumerable, Comparable, String, Symbol, Hash, Array - about in that order
<any-key>
I think Enumerable is one of the most important docs to read
lxsameer__ has quit [Read error: Connection timed out]
sonkei has joined #ruby
jesly__ has joined #ruby
ppawel has quit [Ping timeout: 240 seconds]
uris has joined #ruby
lxsameer__ has joined #ruby
manizzle has quit [Remote host closed the connection]
manizzle_ has quit [Remote host closed the connection]
CptJeanLucPicard has joined #ruby
manizzle has joined #ruby
<CptJeanLucPicard>
Anyone here good with sinatra and slim?
<davidcelis>
lol slim
<shevy>
linecache19 (0.5.12) with native extensions -- Build failed drupin: try to download it manually and look at the *.log file
kvirani has joined #ruby
<CptJeanLucPicard>
davidcelis: why the lol @ slim?
<shevy>
CptJeanLucPicard beam me up!!!
<CptJeanLucPicard>
crap.
CptJeanLucPicard is now known as enroxorz
<davidcelis>
slim is just weird to me
<enroxorz>
sometimes i forget to get out of my novelty nicks
<drupin>
shevy: manually how
<davidcelis>
the syntax doesn't seem as good as haml
<davidcelis>
it may be more terse, but it's not as readable
<davidcelis>
bad tradeoff IMO
cantonic has quit [Quit: cantonic]
<shevy>
drupin it must have downloaded that .gem file somewhere
<enroxorz>
davidcelis: its the same syntax minus %
<davidcelis>
no
<shevy>
I dont use RVM so I wont know, but in default ruby all .gem files are in SITE_DIR cache/
<enroxorz>
its really readable
<drupin>
yes
codora has joined #ruby
<enroxorz>
i dont know where you are cominng from when it comes to slim not being readable
<drupin>
shevy: yes ok
xaq has quit [Read error: Connection reset by peer]
<davidcelis>
enroxorz: definite not the same syntax; there are also no shortcuts for ID and class
kenichi has quit [Remote host closed the connection]
<davidcelis>
the HTML attribute delimiters are just whitespace
jesly__ has quit [Ping timeout: 272 seconds]
<davidcelis>
which is weird if you want to have a one line HTML element that just displays text and has an equals sign
xaq has joined #ruby
<davidcelis>
i do like the logic-less bit, that's nice
<enroxorz>
im not getting into a debate between haml and slim here, jsut hoping someone else might help me with a question i had.
<davidcelis>
then why did you get into a debate?
<blazes816>
i don't think davidcelis is open to debate on this :)
<blazes816>
from the sound of it
<i0n>
shevy: actually picard didnt beam anyone, he called on o'brien to do that.
<i0n>
shevy: ;)
<enroxorz>
because im a sucker for a debate, davidcelis
<davidcelis>
blazes816: false
<lectrick>
How can I test whether a constant is a class or not without actually const_getting it? (because it then starts to autoload it and throws a loaderror... rails sigh)
darren has joined #ruby
<enroxorz>
maybe i should go back to haml...
<apeiros_>
lectrick: you can't
<apeiros_>
a constant is just that - a constant
<apeiros_>
it can reference *any* object
<apeiros_>
it doesn't even have to be neither a class nor a module. it could just as well be a string, an integer or whatever.
tiripamwe has quit [Ping timeout: 255 seconds]
<lectrick>
yeah, I want the constants that are not classes or modules. I just want the ones which are values.
<enroxorz>
davidcelis: your right man. let me switch it all from slim to haml because i know the naswer with haml
sonkei has quit [Ping timeout: 246 seconds]
<davidcelis>
User = "lol trixed u"
<lectrick>
apeiros_: ^
<apeiros_>
lectrick: before they're loaded they aren't defined
emmanuelux has joined #ruby
<apeiros_>
so that makes no sense to begin with
stat1x has quit [Ping timeout: 240 seconds]
<lectrick>
apeiros_: well, i have a situation where const_defined? is returning true, but const_get then tries to autoload it and it fails... which also makes no sense
<apeiros_>
lectrick: that can't possibly be…
<shevy>
i0n man, been about 20 years since I saw a full episode
<lectrick>
by "but const_get" I meant "but then a call to const_get..."
<shevy>
I watched youtube bloopers about it a few months ago though
<apeiros_>
if a constant is defined, autoload won't by triggered by getting that const…
Criztian has quit [Read error: Connection reset by peer]
<Hanmac>
lectrick dont trust autoload ... it might be removed someday
<shevy>
\o/
<apeiros_>
lectrick: pass the second arg to const_defined?
emmanuelux has quit [Read error: Operation timed out]
<shevy>
Hanmac, we will drink a beer that day ok?
<apeiros_>
you're probably seeing an "inherited" constant
<i0n>
shevy: all seasons are on netflix for steaming =)
Guedes has joined #ruby
kvirani has quit [Remote host closed the connection]
eywu has quit [Quit: Leaving.]
bluenemo has quit [Remote host closed the connection]
<shevy>
!!!
<aszurom>
have you seen the bluray remastered TNG?
<shevy>
my grand plan is to reduce the amount spent sitting before my computer
<blazes816>
shevy: wrong profession
eywu has joined #ruby
<any-key>
he could always stand instead
<blazes816>
true
<blazes816>
I forget about Agile programming
<shevy>
well
<shevy>
I tell you
<any-key>
hehe
<shevy>
if I stand, I won't stay
<shevy>
I am only helpless when sitting
devdazed has joined #ruby
<shevy>
but standing is too difficult
audiodude has joined #ruby
<shevy>
also I have to fix a bug but I don't wanna
<any-key>
#firstworldproblems
<shevy>
yeah
<any-key>
#swag
tiripamwe has joined #ruby
<any-key>
#define
<blazes816>
shevy: get that chair the programmer in grandma's boy uses
TPFC-SYSTEM has quit [Quit: TPFC-SYSTEM]
iamjarvo has joined #ruby
<shevy>
I dont know that chair
minijupe has joined #ruby
<shevy>
a robotic chair, now that would be something
<lectrick>
apeiros_: so if i had a module or class "o", and I wanted to get the values of any constants in it, I'm trying to do o.constants(false).map{|c| o.const_get(c, false) } ... and i'm getting a load error as it's still trying to autoload something somehow.
<apeiros_>
lectrick: but then o."c" isn't yet const_defined?
<apeiros_>
only o is
<apeiros_>
that's different from what you said
ananthakumaran1 has joined #ruby
CoverSlide has joined #ruby
<lectrick>
apeiros_: so the result of o.constants(false) are only things that are definitely defined, right?
<lectrick>
inside o
<sernin>
Is there a reason to use regexp.match(str) vs. str.match(regexp) ?
ananthakumaran has quit [Ping timeout: 252 seconds]
<lectrick>
sernin: pretty sure ruby doesn't care
<any-key>
neither do I
<any-key>
;)
<sernin>
Yeah, the result is the same, but y'know, trying to learn what other Rubyists prefer to do
<shevy>
hmm
<shevy>
the second is probably slower
w400z has joined #ruby
<any-key>
I always use str.match
mrbrdo has quit [Quit: mrbrdo]
<sernin>
I've been using str.match pretty universally as well
carlyle has quit [Remote host closed the connection]
<any-key>
it makes more sense that way
<any-key>
and =~ is also your friend
carlyle has joined #ruby
cantonic has joined #ruby
<sernin>
is there a benefit performance wise to using the operator?
jwmann has joined #ruby
jwmann has quit [Max SendQ exceeded]
jwmann has joined #ruby
jwmann has quit [Client Quit]
<apeiros_>
lectrick: hm, actually, that should be the case, yes…
<apeiros_>
odd…
jwmann has joined #ruby
jwmann has quit [Max SendQ exceeded]
<apeiros_>
lectrick: well, can't help with the miracle anymore, gotta d3
<shevy>
sernin, dont think so
<lectrick>
apeiros_: wait! d3 sux!
jwmann has joined #ruby
<shevy>
but Array.new is slower than []
<shevy>
and Hash.new is slower than {}
<lectrick>
apeiros_: it's such a fucking skinner box
<lectrick>
apeiros_: but what's happening is that module ActiveSupport::Cache defines a constant MemCacheStore which will try to load a nonexistent gem if it's called and I can't seem to rescue from the error. bah i'll figure it out
lxsameer has joined #ruby
lxsameer has quit [Max SendQ exceeded]
daniel_hinojosa has quit [Ping timeout: 264 seconds]
lxsameer has joined #ruby
brianpWins has joined #ruby
Araxia has quit [Read error: No route to host]
Araxia has joined #ruby
sonkei has joined #ruby
verbad has joined #ruby
stat1x has joined #ruby
mehlah has quit [Quit: Leaving...]
TheShadowFog has quit [Remote host closed the connection]
arkiver has joined #ruby
lorandi has quit [Quit: Leaving]
yoklov has joined #ruby
Progster has joined #ruby
eywu has quit [Quit: Leaving.]
yoklov has quit [Client Quit]
xaq has quit [Read error: Connection reset by peer]
xaq has joined #ruby
czl has joined #ruby
krusty_ar has quit [Read error: Connection reset by peer]
czl has quit [Read error: Connection reset by peer]
czl has joined #ruby
czl has quit [Read error: Connection reset by peer]
yoklov has joined #ruby
wmoxam_ has joined #ruby
krusty_ar has joined #ruby
wmoxam_ has quit [Client Quit]
Markvilla has joined #ruby
paval has joined #ruby
paval has quit [Client Quit]
bullicon has joined #ruby
kidoz has quit [Quit: Ухожу я от вас]
gmci has joined #ruby
techhelp has joined #ruby
<abdulkarim>
How do I perform `column` wise operation in ruby? e.g. I need to emulate this shell script in ruby `cat ~/.zsh_history | cut -f2 -d ";" | cut -f1 -d " "` [without backticks ofcourse ;)]
davidpk has quit [Quit: Computer has gone to sleep.]
pdtpatrick has quit [Quit: pdtpatrick]
ananthakumaran1 has quit [Quit: Leaving.]
khakimov has joined #ruby
Markvilla has quit [Quit: Markvilla]
<audiodude>
abdulkarim: use split(';') and split(' ')
<audiodude>
file.each do |line| line.split(';')[2] is the same as your first cut
lxsameer has quit [Quit: Leaving]
pdtpatrick has joined #ruby
paradoja has quit [Ping timeout: 240 seconds]
pdtpatrick has quit [Client Quit]
pdtpatrick has joined #ruby
cloaked1 has quit [Ping timeout: 245 seconds]
kvirani has joined #ruby
eywu has joined #ruby
crankycoder has quit [Remote host closed the connection]
snearch has joined #ruby
<zaargy>
sorry to be vague but i'm trying to scrape a site with mechanize and when i use my browser i see data as %26nbsp%3Be but when i use mechanize %C2%A0e...i guess an encoding problem? any tips on how to approach this?!
sebicas has left #ruby [#ruby]
<zaargy>
oh hold on i think i see the problem
<zaargy>
i geuss the above won't matter too much
<abdulkarim>
audiodude: I tried that but the second split gives an error
<abdulkarim>
wait i'll pastebin my script
<audiodude>
oh duh
<audiodude>
because f2 would become [1]
vertroa has quit [Read error: Connection reset by peer]
<audiodude>
split creates an array that is indexed from 0
<audiodude>
whereas cut operates from 1
<audiodude>
go ahead and pastebin it, it'll take a look
<withnale>
that last one gives me exactly what I want using simple arrays . Now I need to work out how to make it compare the REXML elements based on REXML attribute names
skrewler has joined #ruby
skrewler has quit [Client Quit]
lxsameer has joined #ruby
lxsameer has quit [Changing host]
lxsameer has joined #ruby
<Hanmac>
what about this: list.select.with_index {|i,idx| list.index(i) != idx}
lxsameer has quit [Max SendQ exceeded]
lxsameer has joined #ruby
<withnale>
think i'll have to wrap a mock around this function and put # voodoo tags around it.
cdidd has joined #ruby
thone_ has quit [Read error: Operation timed out]
ciopte7 has joined #ruby
<withnale>
Hanmac: the first one works, if there are duplicates, I want both duplicates to remain
<withnale>
the select_with_index only gives me one instance
sgronblom has quit [Ping timeout: 255 seconds]
carlyle has quit [Ping timeout: 272 seconds]
<Spooner>
Hanmac : That does the same as my first version. a.select.with_index {|i,idx| a.index(i) != a.rindex(i)} is the same as my second one, which gives the required result.
<Hanmac>
Spooner i thought with_index may be faster then index & rindex
<Spooner>
Or a.reject {|i| a.count(i) == 1 } for the shortest, if far from the fastest.
thone has joined #ruby
<Spooner>
Hanmac : Yeah, but it gives a different result. Clarity might be better than speed though. Depends on the application.
cjlicata has quit [Remote host closed the connection]
<Hanmac>
what about: a.reject {|x| a.one?{|y| y == x} }
bglusman_ has quit [Remote host closed the connection]
<withnale>
I think the last one is the most readable - my lists only have around 100 elements in and it's not time critical code.
<withnale>
written them all down tho.
<withnale>
thanks a lot. saved me a lot of typing
nadirvardar has quit [Ping timeout: 250 seconds]
<Spooner>
withnale : You could put all the versions into a case rand(n)) just so they aren't lost for posterity :P
<withnale>
hehe
<withnale>
that'll mess with the cukes
krz has quit [Quit: krz]
<withnale>
ok. dumb question. How do I get count to count based on an attribute of the object?
<withnale>
say for example i.attribute['name'] ?
nadirvardar has joined #ruby
verto|off is now known as verto
the_jeebster has quit [Quit: Leaving.]
ppawel has joined #ruby
joshman_ has quit [Quit: Computer has gone to sleep.]
daniel_hinojosa has joined #ruby
<Spooner>
a.count {|i| i.attribute['name'] }
chimkan has quit [Quit: chimkan]
chimkan_ has joined #ruby
awarner has quit [Remote host closed the connection]
thephrase94 has quit [Quit: Leaving]
fraser has joined #ruby
mmealling has joined #ruby
chimkan_ has quit [Ping timeout: 255 seconds]
bbttxu has quit [Quit: bbttxu]
bluOxigen has quit [Ping timeout: 272 seconds]
<mmealling>
If I'm using StringValueCStr to get a C string from a VALUE does the result need to be freed? Is it mallocing space or is it returning a pointer that Ruby's garbage collector will handle?
eregon_ is now known as eregon
wvms has joined #ruby
MasterIdler has joined #ruby
MasterIdler has quit [Client Quit]
mrwalker has quit [Remote host closed the connection]
balki_ has joined #ruby
balki has quit [Read error: Connection reset by peer]
krz has joined #ruby
MasterIdler_ has quit [Ping timeout: 246 seconds]
ph^ has quit [Remote host closed the connection]
ttilley_off is now known as ttilley
axl_ has quit [Quit: axl_]
Banistergalaxy has quit [Ping timeout: 252 seconds]
ttilley is now known as ttilley_off
kirun has quit [Quit: Client exiting]
<Hanmac>
mmealling hm i dont know, but you could write a test *.so file ... and when you give them a string you could look if the string is still intact after you delete the result of CStr
Banistergalaxy has joined #ruby
BrianE has joined #ruby
* Hanmac
is now trapped in a sheep counting loop
dev_ryan70 has joined #ruby
ReTFEF has quit [Changing host]
ReTFEF has joined #ruby
ReTFEF is now known as TheTFEf
TheTFEf is now known as TheTFEF
pskosinski has quit [Ping timeout: 255 seconds]
wangr has quit [Read error: Operation timed out]
<abdulkarim>
(1...4).last #=>4. Shouldn't it be 3?
<mmealling>
hanmac, thanks.... doing that test now.
<Tasser>
abdulkarim, ... vs. ..
<Spooner>
You want #min, #max
<Spooner>
first/last are the actual numbers used to define it, not the limits.
<abdulkarim>
Spooner: ohk. And I thought I just found a bug in Ruby #noob :|
samuel02 has quit [Remote host closed the connection]
<Spooner>
It isn't very clear; I've fallen for it before.
dev_ryan70 has quit [Remote host closed the connection]
beneggett has quit [Ping timeout: 255 seconds]
billiam has quit [Ping timeout: 255 seconds]
michaelmartinez has joined #ruby
MatthewGA_ has joined #ruby
headius has quit [Quit: headius]
verto is now known as verto|off
stopbit has quit [Quit: Leaving]
cbuxton has quit [Quit: Leaving.]
statix_ has joined #ruby
brianpWins_ has joined #ruby
nadirvardar has quit [Ping timeout: 252 seconds]
stat1x has quit [Ping timeout: 252 seconds]
beneggett has joined #ruby
mxweas has quit [Quit: Computer has gone to sleep.]
Caius has quit [Ping timeout: 252 seconds]
nadirvardar has joined #ruby
ppawel has quit [Ping timeout: 246 seconds]
<nedbat>
Spooner: what is the difference between .last and .end?
i0n has quit [Quit: Lost terminal]
MatthewGA has quit [Ping timeout: 252 seconds]
drPoggs has quit [Ping timeout: 245 seconds]
lupine_85 has quit [Ping timeout: 246 seconds]
brianpWins has quit [Ping timeout: 252 seconds]
brianpWins_ is now known as brianpWins
[Neurotic] has joined #ruby
<Spooner>
nedbat : Nothing. there is first and last and begin and end and min and max. Begin and end seem very poor choices since they are keywords. There is an #excludes_end? to tell you if the end value is included or not, but not a #excludes_last? :D
Criztian has quit [Remote host closed the connection]
<vandemar>
.end doesn't seem to be defined for arrays. does it work for anything except ranges?
<nedbat>
Spooner: i was surprised to see that ruby often had two names for the same thing. what is the philosophy/reason behind that?
sendoushi has quit [Remote host closed the connection]
<dankest>
Wait, I'm confused now: why does [1..4].max => 3?
minijupe has joined #ruby
<Spooner>
No, (1..4).max => 4
<dankest>
Ok
<Spooner>
(1...4).max => 3
Criztian has joined #ruby
<dankest>
gotcha.
<dankest>
what does the triple ellipses mean?
<Spooner>
nedbat I have no idea. We just like lots of ways to do the same thing in Ruby for some reason.
<heftig>
dankest: excluding the end
Zolrath has quit [Quit: Computer has gone to sleep.]
<heftig>
so 1...4 includes 3.99999999…, but not 4
<Spooner>
I think of .. => up-to and ... => up-to-but-not-including
<dankest>
Spooner: heftig got it, thank you!
<dankest>
yeah
sebicas has left #ruby [#ruby]
<dankest>
that makes good sense
darren has quit [Remote host closed the connection]
<heftig>
1...Float::INFINITY :)
<Spooner>
It includes it, but #max is the last one you'll hit when you iterate.
Criztian has quit [Read error: Connection reset by peer]
ciopte7 has quit [Quit: ciopte7]
sendoushi has joined #ruby
fraser has quit [Quit: Leaving]
Berglund has joined #ruby
billiam has joined #ruby
Markvilla has joined #ruby
chichou has joined #ruby
AlbireoX`Laptop has joined #ruby
jjbohn has quit [Ping timeout: 252 seconds]
monkegjinni has quit [Remote host closed the connection]
mpereira has quit [Ping timeout: 255 seconds]
yxhuvud has quit [Ping timeout: 255 seconds]
billiam| has joined #ruby
billiam has quit [Read error: Connection reset by peer]
christopherlee has quit [Quit: Leaving]
Gavilan has joined #ruby
heftig has quit [Ping timeout: 245 seconds]
heftig has joined #ruby
billiam| has quit [Read error: Connection reset by peer]
beneggett has quit [Quit: Computer has gone to sleep.]
billiam has joined #ruby
sendoushi has quit [Remote host closed the connection]
devdazed has quit [Quit: Computer has gone to sleep.]
billiam has quit [Read error: Connection reset by peer]
billiam| has joined #ruby
ramblex has quit [Ping timeout: 250 seconds]
khakimov has joined #ruby
drbawb has joined #ruby
workmad3 has quit [Ping timeout: 246 seconds]
Z_Mass has quit [Ping timeout: 272 seconds]
ttilley_off is now known as ttilley
khakimov has quit [Client Quit]
chimkan has quit [Quit: chimkan]
robbyoconnor has joined #ruby
jondot has quit [Quit: Leaving]
<shevy>
is
<shevy>
if ! foo
Guedes has quit [Ping timeout: 272 seconds]
<shevy>
the same as
<shevy>
if !foo
<shevy>
?
<burgestrand>
no, one has a space in it
<shevy>
lol
<shevy>
hmm perhaps I should give up on if ! and use unless instead
<Ionic`>
unless shevy
Speed has quit [Quit: When two people dream the same dream, it ceases to be an illusion.]
greyEAX has quit [Ping timeout: 276 seconds]
chrisbolton has quit [Quit: chrisbolton]
lxsameer has quit [Quit: Leaving]
daftspunk has joined #ruby
<daftspunk>
hello all. i am pretty infatuated with php, i am also results driven so couldnt care less for the politics. can someone give me a really nerdy reason why i should be learning ruby?
Spooner has quit [Ping timeout: 255 seconds]
heftig has quit [Ping timeout: 245 seconds]
vitoravelino is now known as vitoravelino`afk
<nedbat>
daftspunk: ruby is built on a much strong foundation than PHP, which has all sorts of weird magic and edge cases.
<cmyers>
daftspunk: ruby is a modern language with many benefits like duck typing, flexible, concise, self-documenting syntax, and plentiful libraries
heftig has joined #ruby
<nedbat>
cmyers: "self-documenting"?
<cmyers>
ruby calling out PHP's edge cases is the pot calling the kettle black, in some ways, but PHP is one black fucking kettle.
nari has joined #ruby
<cmyers>
ruby problems are mostle in libraries that are still immature, not core language features, for example.
jrajav has joined #ruby
<cmyers>
self-documenting code is code whose function is obvious due to the way it is written
ddouglas has joined #ruby
<cmyers>
your comments should say WHY, not WHAT. what, in a good language, is obvious.
<daftspunk>
i thought that would come down to your choice of naming regardless of the language, how is ruby any different?
<cmyers>
variable names are not the only things that impact readability
<daftspunk>
so the syntax is more aligned with english language?
<cmyers>
flexible syntax can allow code structure which is simply easier to follow. Ruby's blocks are a great example
ForSpareParts has quit [Quit: Leaving]
Speed has joined #ruby
Speed has quit [Changing host]
Speed has joined #ruby
<ddouglas>
excuse me guys, I just dropped in, what is the other language that we're comparing ruby to? Or are you doing that
<cmyers>
my_array.each |x| { puts "The ID of #{x.name} is #{x.id}" }
<nedbat>
cmyers: many people find rich and flexible syntax confusing, and means the language has a longer learning curve.
<cmyers>
it is obvious what the above does
<nedbat>
ddouglas: php
<cmyers>
even if you have never seen ruby before
<nedbat>
cmyers: nothing is obvious at first glance.
<cmyers>
nedbat: then you don't know enough programming languages =)
kenichi has quit [Remote host closed the connection]
<ddouglas>
not much of a contest really...maybe in the mind of a business person, but even then php's userbase has been trending downward for at least the past year or two
<nedbat>
cmyers: is that even right? Shouldn't the |x| be inside the {} ?
<daftspunk>
foreach ($array as $x) echo "The ID of {$x->name} is {$x->id}";
<daftspunk>
i'm not seeing it
nadirvardar has quit [Ping timeout: 244 seconds]
<nedbat>
cmyers: i'm a total newb, sorry if i'm wrong.
<cmyers>
nedbat: you might be right
<cmyers>
I don't write a lot of ruby
<cmyers>
it is irrelevant to my point which way is correct.
<ddouglas>
anyway, this is my first time here, nice to see an active channel
<cmyers>
daftspunk: that code is also very self-documenting
<nedbat>
cmyers: I just think claims of "obvious" are vvery difficult to support.
<daftspunk>
ddouglas: that is my main concern, php does appear to be losing popularity
<nedbat>
daftspunk: if you're going by ppopularity, why not python?
ringotwo has quit [Remote host closed the connection]
<daftspunk>
popular for me is mainstream not coder's choice
vitoravelino`afk is now known as vitoravelino
<ddouglas>
In less progressive states its more popular haha...seriously though, I was talking to a ruby developer a few days ago about the different regions of florida (for example) when it comes to developer populations
<jrajav>
cmyers has the right idea, but he's a little too ambitious with it. You should certainly write self-documenting code, but some minimal understanding of the language is still expected from the reader
<ddouglas>
I think the real enemy is xml
<jrajav>
Most people unfamiliar with Ruby would have no idea what the pipe characters mean, or that puts means print to stdout
<nedbat>
jrajav: the pipes to enclose a list of names is pretty unusual...
johnlcox has quit [Ping timeout: 255 seconds]
davidpk has quit [Quit: Computer has gone to sleep.]
<cmyers>
The best arguments about php are arguments against. If I was thinking about eating some food, it is far easier to say why I'd rather NOT eat a plate of shit, than to describe why some tasty carrots are the best choice. So no discussion comparing PHP to any language would be complete without one of hte many gems available out there - here is one for people's edification: http://me.veekun.com/blog/2012/04/09/php-a-fractal-of-bad-design/
<jrajav>
Others might be confused about the inline #{} expressions or what, precisely, .each does
<daftspunk>
pipes is type casting? ruby |x| php (array)$x is that right?
<cmyers>
jrajav: fair enough - but I still think your first guess would be right
<jrajav>
Even a very simple statement isn't necessarily "obvious," however clear it may seem to someone with a solid, basic understanding of the language
<cmyers>
pipes are just passing a variable to a block of code
<daftspunk>
ah
<nedbat>
daftspunk: no, the pipes enclose the variables passed into the block. So much for obvious.
<cmyers>
daftspunk managed to write an equivalent statement in a language he was familiar with one hte first try. I believe that supports my assertion
nadirvardar has joined #ruby
<nedbat>
cmyers: fair enough.
<daftspunk>
cmyers: that arguement falls flat, see: mcdonalds. lots of people eat plates of shit and mcdonalds do very well ;)
<jrajav>
cmyers: I named that first because when I first found Ruby that was my first big stumbling block. I was wondering what these weird symbols in pipes were, since I didn't see them referenced anywhere else except there at the start of the block. It's one of several features designed to be clear and intuitive *after* an introduction to their purpose
<cmyers>
I suppose "obvious" was a poor choice of words for me anyways =)
kpshek has quit []
virunga has quit [Quit: Sto andando via]
<cmyers>
daftspunk: depends if you qualify success by measuring mcdonalds income, or people's health/happiness
<daftspunk>
touche
<nedbat>
daftspunk: how did you choose ruby as the alternative to php?
<daftspunk>
github tbh more and more projects are in ruby
<cmyers>
as a developer, I would require my managers provide a signed legal document affirming that they have read and understood every word of http://me.veekun.com/blog/2012/04/09/php-a-fractal-of-bad-design/ before I let them force me to use PHP as a development tool.
<cmyers>
(and the economy'd still have to be pretty bad)
sebicas has joined #ruby
CaptainJet has quit []
uris has quit [Quit: leaving]
emmanuelux has joined #ruby
<havenn>
nedbat: Ruby is to PHP as Godfather OG is to Mexibrick. The choice is... clear.
<daftspunk>
i think aswell speed is important, i just assume that ruby is faster than php because it is more thought out. but this is just an assumption i am not sure is true
savage- has quit [Read error: Operation timed out]
<nedbat>
havenn: i have no idea what half those words mean :)
<daftspunk>
^
savage- has joined #ruby
piotr_ has quit [Ping timeout: 246 seconds]
<jrajav>
Speed is rarely as important as you think it is.
<cmyers>
speed is difficult to compare in general terms. Specific tasks are highly variable. jruby is great at threading, for example, but incurs JVM startup time, cruby is great at fast startup but probably less good at heavily threaded code
<jrajav>
Don't optimize early.
<cmyers>
also, jrajav is spot on.
<jrajav>
That said, if you *are* making a performance-intensive application, Ruby might not be the best choice
<nedbat>
daftspunk: summary of the above comments: It might not be faster.
<jrajav>
Don't write a video encoder with it
blazes816 has quit [Quit: Leaving]
<cmyers>
also, don't write a 50 million hit a day website on rails. But then again, having a 50-million hit a day website written in rails is a pretty good problem to have (see: twitter)
<nedbat>
daftspunk: seriously, also consider python.
<daftspunk>
well that was the other side of my assumption, with all the convenience that ruby offers with it's librarys, perhaps this is at sacrifice to its execution time?
<havenn>
daftspunk: Try both, use what you find beautiful.
<jrajav>
Most developers are more concerned with instance performance than they really should be. What you should be a *lot* more concerned with is making algorithm choices that result in asymptotic performance improvements, and if you have trouble after that, THEN go looking at much less likely problem areas like the language or interpreter
SQLStud has quit [Read error: Connection reset by peer]
<cmyers>
I don't care for python's syntax, but it is purely personal preference. I agree python is a suitable alternative to ruby in most ways and has benefits and drawbacks in comparison.
<cmyers>
(just as a 2nd opinion =)
<nedbat>
cmyers: yeah, the two are so close in so many ways.
ZachBeta has quit [Quit: Computer has gone to sleep.]
monkegjinni has quit [Remote host closed the connection]
monkegjinni has joined #ruby
<ddouglas>
If I had an array of values (say, all of the 50 states) and wanted to match my db table ('Locations') against that list of names, how might I do that? The matching part I mean
adeponte has joined #ruby
<ddouglas>
Hey adeponte, If I had an array of values (say, all of the 50 states) and wanted to match my db table ('Locations') against that list of names, how might I do that? The matching part I mean
opus has joined #ruby
<adeponte>
ddouglas: What do you mean by match? Do you want to make sure they both contain 100% the same states.
<adeponte>
ddouglas: or do you just care that the missing ones from one are added to the other
<adeponte>
ddouglas: if you are using ActiveRecord and you get back the results from the query to get the states
Chryson has joined #ruby
<shevy>
daftspunk ruby code is poetry, php code is cursing
<shevy>
daftspunk did you read matz' old famous interview yet?
monkegjinni has quit [Remote host closed the connection]
<adeponte>
ddouglas: that result is array like so you might be able to do a merge. If it isn't array like enough you can send it through map and then merge them