<dominikh>
zedUNDginger: that is the kind of stuff that, quite frankly, should get you banned from this place.
<zedUNDginger>
dominikh: remember to tell frank when he's online
<dominikh>
oh, I have other people in mind to tell about this, don't worry.
<injekt>
zedUNDginger: dude really?
<zedUNDginger>
dominikh: remember to fill out the form correctly when you hand it to the principle
slyphon joined #ruby-lang
slyphon joined #ruby-lang
dhruvasagar joined #ruby-lang
<slyphon>
man
<zedUNDginger>
principal*
<slyphon>
fuck haskell
* slyphon
just read the wikipedia article on monads
<slyphon>
what a bunch of weenies
Marco joined #ruby-lang
dr0id joined #ruby-lang
the_great_cornho joined #ruby-lang
brianpWins joined #ruby-lang
laszlokorte joined #ruby-lang
<andrewvos>
wtf is this?
<andrewvos>
warning: imgur link above contains naked fat guy.
<the_great_cornho>
thanks
<zedUNDginger>
andrewvos: btw, you hsould check out 'who's afraid of virginia woolf'
<zedUNDginger>
andrewvos: young elizabeth taylor vs youngish richard burton
<rue>
andrewvos: That's the part you found offensive?
<rue>
zedUNDginger: Told you, you need your hangout channel… clean it up OR ELSE
<rue>
Shoulda clearly gone to bed. My decision to stay up because I've a race in the morning was clearly a bit misguided
<zedUNDginger>
rue: do you have a punishment under that white lace?
<rue>
Sure do
<zedUNDginger>
spank me with a mechanical corset
mqt joined #ruby-lang
<rue>
That sounds really ineffective
<zedUNDginger>
rue: why did you think it was a good idea to stay up all night before the race?
<zedUNDginger>
r u playing chariots of fire on repeat
seydar joined #ruby-lang
<seydar>
ahoy
<seydar>
not a ruby question, but a general programming one
<seydar>
how do i determine the red, green, and blue for a color gradient?
<zedUNDginger>
seydar: google for linear interpolation
<dominikh>
tbh, the RGB system isn't the easiest for color gradients
<seydar>
dividing the max number (0xFFFFFF or for me 0xFF0000) doesn't work
<seydar>
dominikh: yeah that's what i'm discovering
<seydar>
zedUNDginger: thank you, i will
<dominikh>
seydar: you might enjoy HSL/HSV more
<shevy>
what
<shevy>
HIV
<seydar>
dominikh: ah, i saw that listed as an option but didn't know what it was
<samuelkadolph>
Nice one
<drbrain>
OOPS!!!
<injekt>
sure about that?
<samuelkadolph>
Butterfingers
<injekt>
haha
<drbrain>
tricky space bar
<injekt>
those space bars!
<seydar>
drbrain: ...
<rue>
Group psychology
was kicked by drbrain: zedUNDginger
<injekt>
lol
<shevy>
lol
<seydar>
so confused at what is happening
<injekt>
unexpected naked dudes are not cool, amirite
<andrewvos>
You are correct.
<mksm>
yeah only chicks are ok
<mksm>
:D
<shevy>
overweight chicks for mksm
<drbrain>
injekt: you can cut that down to "naked is not cool"
<injekt>
drbrain: true this
<injekt>
'unexpected naked is not true, amirite'
<seydar>
dominikh: to be clear, gradients in RGB are difficult and i'm not just being stupid?
<injekt>
true?
<injekt>
shit I've been writing too much ruby today
<andrewvos>
Still, no need to ban EVERYONE.
<seydar>
injekt: what drbrain meant to say was "naked is awesome"
<shevy>
every gradient surely follows some pattern
<drbrain>
seydar: yes, naked is awesome, but not in this channel
<dominikh>
seydar: well, they're possible, but harder than necessary, yes. they're easy if you have to gradiate between two base colors though. so red->green is easy, e.g.
<rue>
There's #nudie
<injekt>
oO
<rue>
(That's the sound of a thousand IRC clients joining a channel)
<seydar>
actually it's just me there
<shevy>
I don't go into channels advertized by rue
<shevy>
but he follows me :(
<seydar>
hahaha
<andrewvos>
shevy: Not since last time. *shudder*
<rue>
Oh come on, it wasn't that bad
<rue>
A little spaghetti and everyone goes crazy
* andrewvos
stares off into the distance, with a dead look in his eyes.
<seydar>
i heard rue once led someone into a channel so dark that he was kicked out of north america
<seydar>
and that's why he's in finland
<seydar>
<insert dark in here you are likely to be eaten by a rue joke/>
<seydar>
rue: why do you choose to go sleepless the night before races?
<rue>
Incurable stupidity?
<seydar>
dominikh: thank you so much, i have a nice lil two-base gradient
x0F_ joined #ruby-lang
<seydar>
rue: you're not the first person to do that. kid in my ROTC unit last year would do that
<rue>
I am too the first!
<rue>
No-one shall take the glory
<seydar>
i'm sorry you're the first
<rue>
Indeed.
<dominikh>
seydar: glad I could help
aasmith joined #ruby-lang
laszlokorte left #ruby-lang
<Marco>
seydar: 14
m0wfo joined #ruby-lang
<Marco>
seydar: no, I don't
macmartine joined #ruby-lang
phlipper joined #ruby-lang
snafoo joined #ruby-lang
snafoo joined #ruby-lang
EvilJStoker joined #ruby-lang
<seydar>
Marco: unfortunately you have now given away a lot of personal information, but your secret is safe with me
<seydar>
Marco: do you know any kids who went to highschool in hanover?
<seydar>
i'm gonna freak him out in the spring
<seydar>
i'll pretend i've been stalking him for 8 months
tenderlove joined #ruby-lang
<rue>
Good plan
heftig joined #ruby-lang
RomyEatsDrupal joined #ruby-lang
<RomyEatsDrupal>
hi room… hope you all are well. i wrote a ruby code, then tried to call it in rib via "require file.rb" or "-r file.rb" but i get the following error:
<RomyEatsDrupal>
Help would be appreciated, thank you.
<lianj>
require 'file.rb'
<rue>
Drop the .rb, too. If you just write require file.rb it assumes file is an identifier, to which you're sending the method rb
<rue>
Whereas "file.rb" is a String
<RomyEatsDrupal>
Thank you, lianj , it worked when i wrapped it in single quotes and took out the .rb
shevy joined #ruby-lang
kitallis joined #ruby-lang
<RomyEatsDrupal>
hm…. i am running into problems still. it appears that require 'file' doesn't work on some files
<RomyEatsDrupal>
so i bought the book 'ruby by example' by kevin baird, typed up one his examples, tried invoking that file via IRB, which didn't work, so i actually downloaded the source code and tried to do require on his code, but i ran into the following error:
<RomyEatsDrupal>
LoadError: cannot load such file -- 1_99bottles
<RomyEatsDrupal>
from /usr/lib/ruby/1.9.1/rubygems/custom_require.rb:36:in `require'
<RomyEatsDrupal>
from (irb):1
<RomyEatsDrupal>
from /usr/bin/irb:12:in `<main>'
<shevy>
where is the file "1_99bottles.rb"
<RomyEatsDrupal>
in the directory from which i ran the Irb
<RomyEatsDrupal>
if it would help you all, i would be happy to provide you a join.me screenshare code so you can see how i'm trying to do this, so long as you don't laugh too hard at my girlish terminal
<RomyEatsDrupal>
weird...
<shevy>
RomyEatsDrupal, if you start irb from the directory, from which that .rb file is
<shevy>
then "require 'name_of_rb_file.rb'" will work
<shevy>
I don't know what is join.me, but require 'foobar.rb' works in my IRB here
<shevy>
RomyEatsDrupal you can also try the absolute path to it
<shevy>
require "/bla/ble/1_99bottles.rb"
<RomyEatsDrupal>
will try once more
<lianj>
shevy: "if you start irb from the directory, from which that .rb file is"
<lianj>
he uses 1.9. it will not work
<RomyEatsDrupal>
join.me is a screen sharing utility BTW
<lianj>
-I. is needed
<shevy>
ah
<RomyEatsDrupal>
*she :P
<RomyEatsDrupal>
Ruby coders are girls too
<lianj>
pssh, there a no girl on irc
<shevy>
lianj, but using -I not from within a .rb script or?
<RomyEatsDrupal>
i'm usually the only girl in tech meet ups, sigh
<RomyEatsDrupal>
i'm the only girl in linux meet ups… and sys admin meet ups :(
<lianj>
pssh
<lianj>
shevy: no, on commandline
<RomyEatsDrupal>
so lianj how would i get it to work? require -l ?
<shevy>
:(
<shevy>
I feel old and outdated with my 1.8.x
<lianj>
no but irb -I. -rfoo
<lianj>
shevy: you are :)
<RomyEatsDrupal>
shevy: i was sticking with 1.8 forever until I purchased the book 'The Well Grounded Rubyist' which requires 1.9
<RomyEatsDrupal>
so I finally downloaded 1.9… took FOREVER with my Debian virtual machine because the maintainers of Debian/Ruby have some issues, sigh...
<RomyEatsDrupal>
irb -l
<RomyEatsDrupal>
from /usr/lib/ruby/1.9.1/irb/init.rb:18:in `setup'
<RomyEatsDrupal>
from /usr/lib/ruby/1.9.1/irb.rb:53:in `start'
<RomyEatsDrupal>
from /usr/bin/irb:12:in `<main>'
<RomyEatsDrupal>
more errorz :(
<shevy>
hmm
<lianj>
"I" not "l"
<shevy>
hehe
<RomyEatsDrupal>
capitol i as in igloo?
<shevy>
you didn't do a capital i there
<lianj>
RomyEatsDrupal: heh, yes
<shevy>
hmm lianj, would require "./foobar.rb" work?
<RomyEatsDrupal>
eugh! does that mean something is configured incorrectly?
<RomyEatsDrupal>
i am highly averse to the idea of having to type out the ./ all the time :(
<RomyEatsDrupal>
<------- linux n00b
<shevy>
RomyEatsDrupal it probably just means that 1.9.x is using a different approach now, compared to 1.8.x
<lianj>
shevy: no
<RomyEatsDrupal>
i am using two Ruby books, one for 1.9 and one for 1.8
<lianj>
RomyEatsDrupal: you just have to understand how require work. ie, how it looks for files
<ryanf>
yes, it's because 1.9 no longer keeps . in the load path
<ryanf>
require './filename' is wrong though
<ryanf>
it will only work as long as you start the script from the directory it's in
<shevy>
why? on linux it works the same
<lianj>
require looks for the file inside all directory that are in ruby -e 'p $LOAD_PATH'
<shevy>
aha
<shevy>
it won't work with the full, absolute path?
<lianj>
1.9 stop putting "." inside your $LOAD_PATH
<lianj>
thats why you can/must add it via -I. for example
<ryanf>
it's better to use require_relative or else require File.expand_path('../filename', __FILE__)
<ryanf>
the former is only 1.9, latter is backwards compatible with 1.8
<lianj>
or that ^
<RomyEatsDrupal>
lianj: so every time i fire up IRB i have to do irb -I?
<ryanf>
obviously require_relative is nicer
<shevy>
hmm
<ryanf>
RomyEatsDrupal: no, you should just not expect . to be in the load path
<shevy>
require_relative reads nicer than File.expand_path
hagabaka joined #ruby-lang
hagabaka joined #ruby-lang
<RomyEatsDrupal>
ryanf: i'm new to the Linux system, so I guess when you say load path I'm kind of confused
<ryanf>
if you really want it there you can just put $:.unshift('.') at the top of your file, but they took it out for a reason
<ryanf>
sorry
<ryanf>
the load path is the list of places ruby will look for a file when you use require
<RomyEatsDrupal>
<--------- is a super tech n00b girl
<ryanf>
in 1.8, that list includes the directory you're in
<ryanf>
but in 1.9 it doesn't, because it's unpredictable
<RomyEatsDrupal>
wow
<lianj>
$:.unshift(File.expand_path('.'))
<ryanf>
it means that if you run a script that's like ~/bin/my_script.rb, but it requires a file that also happens to exist in the directory you're in, stuff breaks
<ryanf>
or has security issues
<ryanf>
yeah lianj that is better
<shevy>
security hmm
<RomyEatsDrupal>
so when i am running examples from 1.8 and 1.9 , what would be the best, most uncomplicated way to require files?
<shevy>
:)
<ryanf>
I'd probably just put lianj's last message at the top of your file tbh
<ryanf>
not a good idea for "real" code, but for just doing examples it's not going to hurt anything
<shevy>
it reads ugly though
Marco joined #ruby-lang
<RomyEatsDrupal>
ah, i see. so maybe i should have lianj 's code snippet pasted on my desktop at all times? so i can just paste that into my files?
<bnagy>
I usually do require File.dirname(__FILE__) + '/something'
<bnagy>
still ugly, but at least you know what's going on
<shevy>
yeah I like that one a bit more
<lianj>
i like -Ipath/where -Irequire/should -Ilook/in
<RomyEatsDrupal>
bnagy: you mean i just type 'rib' and then require File.dirname(__FILE__) + '/myrubyscript' ?
<RomyEatsDrupal>
sorry, IRB. stupid autocorrect
tallship joined #ruby-lang
<bnagy>
yes
<lianj>
RomyEatsDrupal: just do irb -I. and then require 'yourscript'
<bnagy>
well that means the user has to know to run the interpreter with the correct -I args, which I don't like, personally
<bnagy>
but yeah it's not really tht big a deal
<lianj>
File.dirname('(irb)') + '/foo' is funny too. then you can just do './foo'
<lianj>
shevy wins!
<lianj>
but should still move to 1.9 ;)
<shevy>
lianj, I have my masterplan ready
<shevy>
all my german umlauts will be moved into a standalone yaml file
<RomyEatsDrupal>
thanks, guys! :D i guess the easiest thing for me to do, for now is just type the -I when I fire up IRB
<lianj>
for 2012?
<shevy>
for the time being, I will then just ignore that file
<RomyEatsDrupal>
IRB -I
<shevy>
lianj, nah, I tested it. the yaml issue is the last thing that prevented me from switching
<shevy>
so when my yaml files are correct, all my config things work, so I can switch!!!
<lianj>
shevy: yea, but it was no ruby issue :)
<shevy>
oh damn
<shevy>
its 03.12.2011, you are right, that will be close ...
<shevy>
well, perhaps early 2012 then ;)
Dreamer3 joined #ruby-lang
<RomyEatsDrupal>
anywayz… did anyone here ever check out the book 'Well Grounded Rubyist'? it has the most awesome illustration on the cover (though I bought it b/c it was backed up with stellar reviews… that and it was Black Friday and Barnes n Nobles had sent me 30% off and I decided to treat myself to an awesome Ruby book versus clothes :P)
<mitchty>
day month year /twitch
<lianj>
RomyEatsDrupal: or try: echo 'require "irb/autocompletion"; $:.unshift(Dir.pwd)' >> $HOME/.irbrc
<RomyEatsDrupal>
hmmm
<RomyEatsDrupal>
sounds risky
<shevy>
hehehe
<shevy>
RomyEatsDrupal, press the red button
<lianj>
trust me :)
<RomyEatsDrupal>
i feel… risky
<RomyEatsDrupal>
lol
<RomyEatsDrupal>
alright
<RomyEatsDrupal>
done
<shevy>
>> means "append"
<RomyEatsDrupal>
now what?
<shevy>
now you should have a .irbrc file in your home directory
<RomyEatsDrupal>
oh yes, i've used that before :D
<shevy>
and that should be loaded every time you start IRB
<RomyEatsDrupal>
so i don't have to type the -I each time i start IRB?
<lianj>
ok. now your irb has autocompletion, try pressing <tab>, AND the -I. thing is done automatically
<shevy>
hopefully not, but ask lianj
<RomyEatsDrupal>
hm, it looks like the -I is automatic, but the tab autocompletion doesn't seem to work
<RomyEatsDrupal>
ahh… you think it's because i need to open up a new terminal?
<shevy>
hmm
<shevy>
type "Di"
<shevy>
then press the TAB key
<shevy>
any result?
<RomyEatsDrupal>
i know sometimes when one makes edits, they need to fire up a new session
<shevy>
well restart irb hehe
<RomyEatsDrupal>
hehe
<shevy>
but that with the TAB key *should* work
<shevy>
there was once a kind of ruby-shell, which used ncurses, and had coloured drop-down boxes, which you could navigate to select what you wanted
<RomyEatsDrupal>
aaaahhhhhhh……. here are my observations
<RomyEatsDrupal>
it worked!!!! but it appends a ./ before the file name! :)
<RomyEatsDrupal>
i am having so much fun teaching myself ruby. i'm located in NYC but instead of going out Friday night I decided to have the most awesome exciting Ruby date with myself and my two new Ruby books :D :D
<shevy>
imperator I always have to think of star wars when I read your nick
<RomyEatsDrupal>
Yeah, i"m an active member of the New YOrk Drupal community
<lianj>
RomyEatsDrupal: did you try the autocompletion? enter irb. in there type "1." then press tab twice. it will show you all methods that the number "1" allows you to call
<imperator>
well I went out AND came back and coded ruby! nyah!
<RomyEatsDrupal>
lianj: when i enter IRB and type 1 and press tab twice, i get, actually a listing of ALL my ruby files in my directory, but with a ./ in front of each file
<shevy>
hmm
<RomyEatsDrupal>
thanks… that pic of me was earlier, taken in California
<shevy>
wait
<shevy>
"1" or "1."
<imperator>
RomyEatsDrupal, yes, but, did you have beer?
<RomyEatsDrupal>
imperator: beer where?
<RomyEatsDrupal>
you should see my 99bottles ruby script
<imperator>
at the data visualization talk!
<RomyEatsDrupal>
every time i write those scripts, i always change "Beer" to "milk"… because i NEVER drink beer :D
<shevy>
what, do you visualize beer
<imperator>
bnagy, gonna add trollop as a dev dependency
<RomyEatsDrupal>
trollop is an awesome word
<RomyEatsDrupal>
my friends and i use to call each other that
<RomyEatsDrupal>
now we just call each other s**** and s******
<imperator>
shevy, my nick reminds you of star wars?
<shevy>
yeah imperator
<shevy>
that evil guy... not the one with the black mask, the old man
<RomyEatsDrupal>
but no imperator i didn't have any beer… afterwards i ate falafels , went to a cafe, and started to read ruby. then i got sleepy, took the subway home, and got confused while doing ruby scripts inside the subway lol… decided i was going to hit you guys up when i arrived back into the apartment
<RomyEatsDrupal>
where is everyone located, by the way?
<shevy>
I actually think I never watched any of the star wars movie to the end
<lianj>
at the coworking house here, most drupal guys migrated to rails when i introduced them to it
<RomyEatsDrupal>
I NEED to learn ruby FAST! and apply!!!!
<imperator>
RomyEatsDrupal, there you go
<imperator>
my former co-worker *hated* drupal
<imperator>
because basically some schlub in the office would install it without knowing wtf he was doing, and he'd end up having to maintain the thing
<shevy>
write a replacement for drupal in ruby!
<lianj>
replace 42 million drupal modules?
<imperator>
shevy, sure, i'll get right on that
<RomyEatsDrupal>
:(
<RomyEatsDrupal>
i've a feeling puzzlenode.com is over my capabilities :(
<postmodern>
lianj, sounds like you should write a PHP parser, IN RUBY! :)
<imperator>
drupal is php right?
<RomyEatsDrupal>
just yesterday i taught myself attribute accessors
<shevy>
think so imperator but I meant RomyEatsDrupal, not you!
<RomyEatsDrupal>
sorry imperator i' not going to click on your link i'm still stuck on this blonde cheerleader
<RomyEatsDrupal>
she has a belt with stars on it :P
<bnagy>
I know quite a few poles and none I would describe as 'hip' :/
<shevy>
hehe
<bnagy>
gthen again the only 'hip' I really know anything about is the bit that keeps my legs from falling off
<shevy>
man
<shevy>
what about hip hop !
<imperator>
bnagy, you german?
<shevy>
baggy pants, fancy looks, silly dances
<bnagy>
nein
<lianj>
shevy: is that the php compiler?
<shevy>
hehe
<shevy>
Fanta4!
<bnagy>
australian, although I've been out for almost 10 years now
<RomyEatsDrupal>
sigh .. . i am so depressed… this Mendicant University sounds so awesome but I am afraid I'm too much of a noob to be able to solve those puzzles… sigh :(
<RomyEatsDrupal>
bnagy: i'm looking at 12 right now
<RomyEatsDrupal>
it looks so interesting
workmad3 joined #ruby-lang
<bnagy>
they give you the vignere key which makes it a bit wimpy
<bnagy>
you could solve it just by knowing the length of the key
<imperator>
gem install vigenere
<bnagy>
as it is you could just try caesar shifts on the key until you hti something in /usr/dict/words
<bnagy>
then the rest is mechanical
<bnagy>
more fun is to split the cipher into keylen partitions, then solve each partition by guessing a shift and comparing the result to the normal english letter frequency
<RomyEatsDrupal>
bnagy: i just started to teach myself ruby 2 months ago
<RomyEatsDrupal>
sometimes i would go for several days not studying
<bnagy>
well this isn't really ruby, it's just the algorithm
<RomyEatsDrupal>
about how long do you think it might take for someone to know enough ruby to solve something like that if they study like three hours of ruby a day?
<bnagy>
no idea? Someone that had a compsci degree? One day
<bnagy>
if you know HOW to dio it then you just need the rubymachanics
<bnagy>
(sry for terrible typing, can't see input)
<bnagy>
if you're effectively learning ruby and compsci at the same time then longer, obviously
looopy joined #ruby-lang
<RomyEatsDrupal>
hmmm i see
<RomyEatsDrupal>
i come from an English/Philosophy background
<bnagy>
me too :D but hacking pays much better :(
<lianj>
('a'..'z').to_a.repeated_combination(5).each{|i| p i.join }
<imperator>
wait, you couldn't get a job with an english/philosophy background? shocking
<looopy>
require 'digest' returns false using ruby 1.9.2 am i missing something?
<imperator>
i kid, i kid
<bnagy>
looopy: you probably want 'digest/md5' or something
<imperator>
looopy, think they changed it to digest/md5 and stuff
<imperator>
what bnagy said
<looopy>
hmm no dice there either
<bnagy>
then someone already required it?
<imperator>
looopy, debian?
<looopy>
actually i should tell the entire truth. not from irb...from the rails console
<looopy>
osx
<looopy>
using irb it returns true as it should
<imperator>
#rubyonrails
<bnagy>
looopy: try Digest::MD5.hexdigest 'foo'
<looopy>
imperator: yeah, just hopped over. it's clearly rails
<imperator>
oh, returns false? means it's already loaded
<looopy>
bnagy: ok
<looopy>
ahh no kidding
<imperator>
false does not mean failure; LoadError means failure
<imperator>
true means wasn't loaded already
<imperator>
false means already loaded
<looopy>
imperator: ahh, i see. good to know =P
<imperator>
confuses lots of newbies
<shevy>
man
<looopy>
and that i am
<shevy>
I wish I could jump back in time to see when imperator was a newbie to ruby himself :)
<shevy>
or drbrain!
tomzx joined #ruby-lang
Marco joined #ruby-lang
<RomyEatsDrupal>
shevy, lianj imperator thank you for all your help tonight
<imperator>
shevy, 2001 or so :)
<imperator>
RomyEatsDrupal, you're welcome
<RomyEatsDrupal>
maybe one of these days we can have a Skype ruby study session and solve these Puzzlenode puzzles, one at a time. i'll need good wifi though
<imperator>
it's like 2:30 there or something
<RomyEatsDrupal>
my apt wit is spotty
<RomyEatsDrupal>
yea
<RomyEatsDrupal>
i'm analyzing a simple ruby code right now :)
<imperator>
good luck!
<RomyEatsDrupal>
a rendition on the 99 bottles of beer, i changed it to 99 bottles of milk
<RomyEatsDrupal>
but the way the code is written (by Kevin Baird, the writer of Ruby by Example) is quite beautiful
<RomyEatsDrupal>
because at the end he runs pure Ruby syntax and it is … oh.. so… beautiful…. sigh
<RomyEatsDrupal>
and he uses the ternary operator in a way i do not yet quite immediately grasp… i'm studying it now…be back later
<shevy>
RomyEatsDrupal ruby should read like poetry
<RomyEatsDrupal>
shevy: Ruby is like poetry. the end of this script reads like this:
huug joined #ruby-lang
<RomyEatsDrupal>
wall.sing_one_verse? until wall.empty?
<bnagy>
personally I would do something like [producer]->[beanstalkd]->[Parallel.map Consumer x ncpus]->[redis]
<hzlocky>
producer is somewhere in internet
<hzlocky>
and I should store everything in mysql as a final point
<bnagy>
*shrug*
<bnagy>
I wouldn't touch mysql with someone else's 10 foot pole, but ymmv
<hzlocky>
thats requirements
<hzlocky>
not my wish
<shevy>
ruby is so cool
<shevy>
array1 - exclude_these
<shevy>
beautiful :)
sepp2k joined #ruby-lang
jimmy1980 joined #ruby-lang
marcostoledo joined #ruby-lang
Manhose joined #ruby-lang
tallship joined #ruby-lang
Spooner joined #ruby-lang
jimmy1980 joined #ruby-lang
chessguy joined #ruby-lang
jensn joined #ruby-lang
yorickpeterse joined #ruby-lang
thrcka joined #ruby-lang
jimmy1980 joined #ruby-lang
publicvoid joined #ruby-lang
AlHafoudh joined #ruby-lang
AlHafoudh joined #ruby-lang
cantonic joined #ruby-lang
Manhose_ joined #ruby-lang
mssola joined #ruby-lang
m0wfo joined #ruby-lang
sopheak joined #ruby-lang
shevy joined #ruby-lang
Marco joined #ruby-lang
jimmy1980 joined #ruby-lang
jensn joined #ruby-lang
rkk joined #ruby-lang
<shevy>
hmm
<shevy>
that's the first time my bugs made me laugh
geoffwright joined #ruby-lang
beiter joined #ruby-lang
SteveG joined #ruby-lang
SteveG joined #ruby-lang
Squarepy joined #ruby-lang
mnoble joined #ruby-lang
Squarepy joined #ruby-lang
publicvoid joined #ruby-lang
robotmay joined #ruby-lang
looopy joined #ruby-lang
<chris2>
shevy: you must have a sad life
<apeiros_>
chris2: or he has a very entertaining bug…
<chris2>
perhaps :)
<apeiros_>
with shevy, I'm actually inclined to believe that :D
saLOUt joined #ruby-lang
tty234 joined #ruby-lang
dr0id left #ruby-lang
<andrewvos>
What's happening now?
<andrewvos>
shevy: Explain!
thrcka joined #ruby-lang
melic joined #ruby-lang
lenilson_dias joined #ruby-lang
<shevy>
andrewvos well, I wanted to do something, and in the process of doing this, I discovered a bug. When trying to work around, two more bugs hit me. I felt as if they were beating me into submission.
deryl joined #ruby-lang
<shevy>
It's like you go in a labyrinth and all ways out are blocked
lenilson_dias joined #ruby-lang
jensn joined #ruby-lang
jondot joined #ruby-lang
io_syl joined #ruby-lang
io_syl joined #ruby-lang
<jondot>
hi all. i'm trying to model an infrastructure for something i've been reimplementing several times over. i'm basically queueing work from email and then letting workers work on those queued items. however it gets interesting when input is from SMS, Jabber etc. I can't ignore the generic nature of this - anyone knows of some project that abstracts over this?
michas joined #ruby-lang
<jondot>
i guess such a thing might ring a bell when it comes to enterprise service bus. even hook-io might be good (but not suitable since it doesn't have a persistent queue based backend). next up is nanite but i think it might be not simple enough.
<rue>
All you're doing is converting the incoming requests into your common format?
<jondot>
well yea. i guess an ideal goal, is to _configure_ input sources, and then code workers. let the infrastructure do the polling of email, listening of sockets, then pushing to a persistent queue, and run workers as daemons and distribute the work (and manage failures) to them.
solars joined #ruby-lang
<jondot>
i guess like a delayed_job but with pluggable inputs, pluggable worker types and *maybe* pluggable backend-although it doesnt matter as much.
* apeiros_
doesn't see the problem…
<jondot>
apeiros_: it isn't a problem really, a couple of hours would get me 80% of what I need i guess. however - i wouldn't like to reinvent the wheel, i don't see all of the requirements i might need right now, and i wouldn't have the time to write a good suite of tests for it.
<apeiros_>
ah, so you're looking for existing software to hook into…
<rue>
Nanite seems like it's solving the opposite problem
<rue>
Or, well, if you need it (YAGNI), you could use it as your “pluggable backend”
<jondot>
well any kind of idea for an existing library, yes. i have a couple of hours of free time to perhaps make generic a thing i've been implementing a lot.
IoGA joined #ruby-lang
<rue>
Especially if you only have input from sources, it'd seem reasonable to have a couple frontends converting into a format to feed to your backend
<rue>
The problem of handling that queue is pretty much solved (resque, nanite, &c.)
<jondot>
yes, each of the problems is solved. i'm looking for the glue - i'm starting to realize this would be any kind of 'bus'.
<rue>
I suppose I see the architecture differently.
<jondot>
just as general discussion, you could take a look at that ^^
andrewhl joined #ruby-lang
<andrewhl>
with nokogiri, if I want to grab, say, all the rows in a table /except/ the first one (which contains <th>s), how might I do that?
<rue>
Looks terrifying. Are you intending to support arbitrary transport with arbitrary messages to arbitrary backends?
<apeiros_>
andrewhl: grab all, throw away the first.
<jondot>
rue: no :). i'm looking up to the idea of pluggability
<apeiros_>
alternatively, tr:not(:first) might work
<apeiros_>
or was that :first-child?
<andrewhl>
how do you discard the first? doc.css('<tr>[1]') would grab the first, yeah? but how would I discard it?
<apeiros_>
<tr> is not really the selector you want…
<apeiros_>
you don't have the <> part of a tag in css selectors.
<andrewhl>
oh
<jondot>
i guess no such servicebus exists in ruby. my decision now either to implement a generic bus or to keep doing what i did up to now.
<andrewhl>
right I was using xpath
<rue>
andrewhl: Effectively, nodeset[1..-1]
<andrewhl>
nodeset is for parsing xml right?
<rue>
jondot: I'm still not sure that's the right problem to solve (or maybe I misunderstand the term “bus”). That is, if truly the only variant are the various input sources
<andrewhl>
ok brilliant, got it working. Thanks all
<jondot>
rue: well if you follow me, here is what i'd like to do. 1 - configure a source 'email', 'sms'. both those components come prepackaged with the library. i just plug in email's credentials. 2 - configure a queue backend to which inputs push contents. 3 - write worker_email.rb, worker_sms.rb 4 - start up the concoction with a single command.
macmartine joined #ruby-lang
<rue>
jondot: Why do you need worker_N.rb? I assume the messages are the same, just sent through different channels
<jondot>
both worker_email and worker_sms get only their own messages (based on input source). now, stage 1 of computation is done. but worker_email and worker_sms have results - so lets reply. how would you reply to an email? to SMS?. again lets configure input sources and workers with a 2nd queue. replyer_email.rb replyer_sms.rb -- soon enough we have a statemachine over queues and workers.
Pip joined #ruby-lang
<rue>
I'd probably try to just have N translation layers and 1 backend queue… If you want to do it this way, though, you don't need a single queue, do you?
michael_mbp joined #ruby-lang
<jondot>
sure, you can do it with a single queue and then put the state into the message
curtism joined #ruby-lang
Pip joined #ruby-lang
cyri_ joined #ruby-lang
<jondot>
well, i realize through discussing with you that there isn't such a thing so far, and it would be beneficial to implement over delated_job or qu, etc. it's actually something that i've been planning some time ago. here is an interesting example: http://camel.apache.org/simple-jira-bot.html
<jondot>
if you can ignore the XML and enterprisy lingo, it's kinda attractive.
Pip joined #ruby-lang
<andrewhl>
so I'm getting all the rows from a table using rows = doc.each do |stuff| puts stuff.content end, however it's doing stuff like Cell1Cell2 Cell3Cell4 Cell5Cell6. How can I space these individually?
<jondot>
actually its worth a question to jruby guys.
<andrewhl>
i really need to learn how to read this api documentation... sigh
niklasb joined #ruby-lang
jensn joined #ruby-lang
malev joined #ruby-lang
<andrewhl>
actually it's not doing what I described. Those are internal spaces. It's doing: <td></td><td></td><td></td>, and grabbing the content from each. I need to add spaces between the tds...
cantonic_ joined #ruby-lang
apeiros_ joined #ruby-lang
dejongge joined #ruby-lang
saLOUt joined #ruby-lang
danishman joined #ruby-lang
imperator joined #ruby-lang
<imperator>
bnagy, ping
solars joined #ruby-lang
matti joined #ruby-lang
matti joined #ruby-lang
Marco joined #ruby-lang
toretore joined #ruby-lang
looopy joined #ruby-lang
thrcka joined #ruby-lang
burgestrand joined #ruby-lang
scottschecter joined #ruby-lang
slyphon joined #ruby-lang
aasmith joined #ruby-lang
aasmith joined #ruby-lang
mkscrg joined #ruby-lang
srbaker joined #ruby-lang
adambeynon joined #ruby-lang
ecin joined #ruby-lang
looopy joined #ruby-lang
thone joined #ruby-lang
jasox joined #ruby-lang
heppy joined #ruby-lang
mztriz joined #ruby-lang
gokulnath joined #ruby-lang
Silowyi joined #ruby-lang
jimmy1980 joined #ruby-lang
scampbell joined #ruby-lang
felipegb joined #ruby-lang
gokulnath_ joined #ruby-lang
flip_digits joined #ruby-lang
m0wfo joined #ruby-lang
imperator2 joined #ruby-lang
m0wfo joined #ruby-lang
niklasb joined #ruby-lang
niklasb joined #ruby-lang
RomyEatsDrupal joined #ruby-lang
jimmy1980 joined #ruby-lang
niklasb joined #ruby-lang
geoffwright joined #ruby-lang
niklasb joined #ruby-lang
Jake232 joined #ruby-lang
yank joined #ruby-lang
yank left #ruby-lang
jimmy1980 joined #ruby-lang
Phrogz joined #ruby-lang
workmad3 joined #ruby-lang
darkf joined #ruby-lang
kyrylo joined #ruby-lang
DotMH joined #ruby-lang
livinded joined #ruby-lang
Codif_ joined #ruby-lang
<DotMH>
can anyone tell me what this is called in a module class << self , I am not sure what it does but not sure what to google for to find out ?
m0wfo joined #ruby-lang
<apeiros_>
DotMH: `class << obj` opens the eigenclass of obj
<apeiros_>
s/eigenclass/singleton_class/
<apeiros_>
which is where you put methods that should only be available on obj itself (such as class methods)
Pip joined #ruby-lang
<DotMH>
apeiros_: thanks thats brilliant
looopy joined #ruby-lang
lsegal joined #ruby-lang
<shevy>
hmm
<shevy>
I just googled for "using vim to remove leading blanks of a line"
<shevy>
then I changed my mind and used ruby instead :)
<apeiros_>
gsub(/^ +/, '')?
<shevy>
it was an "aha" experience
<shevy>
"Why use vim when I can use Ruby instead."
<rue>
Why use Ruby when you can use Sed and AWK
<shevy>
I don't use dinosaur tools
phaedrix joined #ruby-lang
<shevy>
I wouldn't be able to figure out awk syntax anyway
phaedrix joined #ruby-lang
<rue>
shevy: Well, true. Some -pe is usually pretty workable
phaedrix joined #ruby-lang
<rue>
-Eex[:in] :(
sepp2k1 joined #ruby-lang
<shevy>
I am actually writing this into a method, put it into a file, and then call that method via aliases. The alias is then something like ruby -r some_file_here -r some_file_there -e name_of_method so it boils down to something like "rin strip_blanks"
DMKE joined #ruby-lang
jimmy1980 joined #ruby-lang
srbaker joined #ruby-lang
towski joined #ruby-lang
jimmy1980 joined #ruby-lang
m0wfo joined #ruby-lang
tomzx joined #ruby-lang
rane_ joined #ruby-lang
DotMH joined #ruby-lang
macmartine joined #ruby-lang
solars joined #ruby-lang
livinded joined #ruby-lang
towski joined #ruby-lang
JosephRuby joined #ruby-lang
joseph_ joined #ruby-lang
JosephRuby joined #ruby-lang
RomyEatsDrupal joined #ruby-lang
RomyEatsDrupal joined #ruby-lang
jimmy1980 joined #ruby-lang
workmad3 joined #ruby-lang
RomyEatsDrupal joined #ruby-lang
thrcka joined #ruby-lang
empity joined #ruby-lang
RomyEatsDrupal joined #ruby-lang
marting joined #ruby-lang
phaedrix joined #ruby-lang
QaDeS joined #ruby-lang
Banistergalaxy joined #ruby-lang
Codif joined #ruby-lang
michas joined #ruby-lang
workmad3 joined #ruby-lang
<erikh>
why use ruby -pe when I can use perl -pe
<erikh>
the syntax is almost exactly the same and it's about 400% faster
bryno joined #ruby-lang
<andrewhl>
can someone point me to GOOD nokogiri documentation? Everything I have found so far is useless and unhelpful
<erikh>
rue: does ruby have perl's -i? I guess I could check, but I've never used ruby that way
<rue>
I've found it rather well-documented
<andrewhl>
arghhh. I'm trying to read it, rue, but I can't make heads or tails of it
<rue>
erikh: i.bak ?
<rue>
Yes
<erikh>
ah yes
<erikh>
it does!
<erikh>
in-place edit is one of my favorite perl on the command line features
cornholio joined #ruby-lang
<erikh>
awk is a dinosaur tool!
<cornholio>
no way
<erikh>
that's hilarious
<rue>
andrewhl: I'm not sure what the trouble is? You can parse HTML or XML into DOM XML. Then you can filter that doc with either CSS selectors or XPath, and/or use Node/NodeSet and relevant methods, mostly for iteration and transforms
<rue>
Maybe you should play with it in pry/irb if you have trouble visualizing the data
y3llow joined #ruby-lang
s0ber joined #ruby-lang
<andrewhl>
rue: i've figured out how to parse a table into rows and extract the tag content with .content, and separately how to extract a url from an <a> tag, but I have no idea how to do both at the same time.
<andrewhl>
such that it iterates through each <td> in the row, putting .content where appropriate, and attributes for the <a> tags
saLOUt joined #ruby-lang
<injekt>
andrewhl: do you have an example of the html you want to parse (a small snippet) and what you'd like to extract from it?