brandoncordell has quit [Remote host closed the connection]
emmanuelux has joined #ruby
awarner has joined #ruby
mengu has quit [Remote host closed the connection]
beneggett has quit [Ping timeout: 255 seconds]
awarner has quit [Remote host closed the connection]
artOfWar_ has quit [Remote host closed the connection]
beneggett has joined #ruby
verto|off is now known as verto
headius has quit [Quit: headius]
davidcelis has quit [Ping timeout: 244 seconds]
kvirani has quit [Remote host closed the connection]
beneggett has quit [Ping timeout: 248 seconds]
kevinbond has left #ruby [#ruby]
headius has joined #ruby
shadoi has joined #ruby
beneggett has joined #ruby
hunglin has joined #ruby
savage-_ has quit [Remote host closed the connection]
Norrin has quit [Quit: Zzz]
blownapart has joined #ruby
Speed has quit [Quit: When two people dream the same dream, it ceases to be an illusion.]
niklasb has quit [Ping timeout: 248 seconds]
awarner has joined #ruby
liluo has joined #ruby
beneggett has quit [Ping timeout: 256 seconds]
hasrb has quit [Remote host closed the connection]
dhruvasagar has joined #ruby
benjammin891 has quit [Ping timeout: 240 seconds]
Ontolog has quit [Quit: Ontolog]
wilmoore has quit [Remote host closed the connection]
wilmoore has joined #ruby
ckrailo has quit [Quit: Computer has gone to sleep.]
Spooner has quit [Ping timeout: 276 seconds]
yoklov has joined #ruby
awarner has quit [Remote host closed the connection]
mrdodo has quit [Remote host closed the connection]
beneggett has joined #ruby
wilmoore has quit [Ping timeout: 252 seconds]
awarner has joined #ruby
choffstein has joined #ruby
vitoravelino`afk is now known as vitoravelino
straind has quit [Read error: Connection reset by peer]
eywu has quit [Quit: Leaving.]
tomb_ has quit [Ping timeout: 248 seconds]
tomb_ has joined #ruby
beneggett has quit [Ping timeout: 264 seconds]
bburhans_ is now known as bburhans
iamjarvo has joined #ruby
ryanf has quit [Ping timeout: 245 seconds]
balki_ is now known as balki
UNIXgod has quit [Ping timeout: 248 seconds]
voodoofish430 has quit [Quit: Leaving.]
beneggett has joined #ruby
ryanf has joined #ruby
GoGoGarrett has quit [Remote host closed the connection]
davidcelis has joined #ruby
davidcelis has joined #ruby
davidcelis has quit [Changing host]
seanstickle has joined #ruby
dev_ryan70 has joined #ruby
awarner has quit [Remote host closed the connection]
xscc has joined #ruby
beneggett has quit [Ping timeout: 276 seconds]
freeayu has joined #ruby
xscc has quit [Client Quit]
bnagy_ is now known as bnagy
beneggett has joined #ruby
mrsolo has left #ruby ["Leaving"]
Orban has joined #ruby
<Orban>
i'm trying to write a ruby gem (puppet module specifically) but i can't get the rspec tests working... my gem will hopefully allow me to manage contents of files within zip files via puppet, but my rspec tests keep saying a test.zip file is not found...
<Orban>
i've got the source up on github.com/ruckc/rezip if anyone wants to take a peek
awarner has joined #ruby
<Orban>
i assume its an easy typo, but i can't find it right now
Ontolog has joined #ruby
nopolitica has joined #ruby
nopolitica has quit [Client Quit]
jeff_sebring has joined #ruby
uris has joined #ruby
lukeholder has joined #ruby
Hanmac1 has joined #ruby
Hanmac has quit [Ping timeout: 248 seconds]
<bnagy>
looks like a relative path issue
<Orban>
i tried using Dir.pwd to force an absolute path with the same result
<Orban>
and i'm getting File.exist? to return true...
<bnagy>
yeah cause that's in the spec code, where the relative path is valid
adeponte has joined #ruby
<Orban>
so using a lib changes the pwd?
<Orban>
also, i'm only about 3 working days into ruby...
brianpWins has joined #ruby
<bnagy>
try using File.expand_path or something
<bnagy>
always better to work with absolute paths where possible
williamcotton_ has joined #ruby
williamcotton has quit [Ping timeout: 252 seconds]
williamcotton_ is now known as williamcotton
CannedCorn has quit [Quit: Computer has gone to sleep.]
<Orban>
bnagy, no luck... time to add debugging into my lib
boredomist has left #ruby ["WeeChat 0.3.7"]
<bnagy>
you don't need 'real' debugging.
<Orban>
i was going to fake it... but i was looking to see if there was a built-in logging library that would let me leave it in incase i needed it again
<bnagy>
but in rezip.rb line 6 - sure that shouldn't be z.get_entry( filepath ).read ?
jlwestsr has quit [Read error: Operation timed out]
<Orban>
bnagy, i havn't gotten the read test working... i was wanting it to fail, just not with an "Errno::ENOENT"
<bnagy>
yeah but is the ENOENT from trying to read an internal file that doesn't exist?
<bnagy>
cause that's what I think your code will do right now
beneggett has quit [Ping timeout: 256 seconds]
<Orban>
the 'test.txt' is inside the spec/data/test.zip file...
<bnagy>
yeah, which is the filepath variable, which you never use
<Orban>
well that definetly changes the rspec results
<Orban>
thanks
<Orban>
now i feel like a tool
PIZDECCIO has joined #ruby
<PIZDECCIO>
Hey, guys! Look at my site (non-viruses I swear!) --> impirat.com Is it cute? I've made it! =^.^=
c0rn_ has quit [Quit: Computer has gone to sleep.]
<bnagy>
if you use ruby -wc on your code you can sometimes feel like a tool in private instead of in public, if that helps :)
headius has quit [Quit: headius]
emmanuelux has quit [Read error: Connection reset by peer]
ianbrandt has quit [Quit: ianbrandt]
awarner has quit [Remote host closed the connection]
<ukd1>
I'm probably being dumb...what's the opposite of intersect for an array?
<bnagy>
Orban: but looks like you definitely need to add some better error handling to that read method so it fails more gracefully
Ontolog has quit [Quit: Ontolog]
<bnagy>
ukd1: a1 - a2?
<ukd1>
bnagy, LOL
Icoin has quit [Quit: Icoin]
<ukd1>
bnagy, that' doesn't actually do what I want [1,2,3] - [2,3,4] = [1] ---- I'm looking to get [1,4]
<bnagy>
(a1 - a2) + (a2 - a1) ?
<bnagy>
gonna suck for more than two though :/
<ukd1>
yea
<ukd1>
:D
fbernier has joined #ruby
<bnagy>
I'd restate the problem, if possible
<minijupe>
can anyone recommend a book on application development security?
jeff_sebring has quit [Quit: Leaving]
<bnagy>
for which language?
nari has joined #ruby
<bnagy>
ukd1: like you might be able to deploy Sets or Hashes (which is what Set is built on) to approach whatever you have to do a different way
awarner has joined #ruby
<coyo>
i keep hearing this rumor that there isnt a standard way to handle sockets in ruby. why are people saying that?
<bnagy>
mostly we don't handle sockets at all
<coyo>
oh?
<coyo>
bnagy: um.. does that mean that you have nonstandard libraries handle sockets?
<bnagy>
I would imagine 99% of people should never see an actual call on Socket, it should be abstracted
* coyo
is sorry for the newbish question btw.
<bnagy>
there are a jillion libs that communicate over networks
<williamcotton>
hey guys, I've got this going on: Data sent to WebSocket must be valid UTF-8 but was ASCII-8BIT
<bnagy>
and who wants to come to a language looking for elegance and find themselves writing more or less glorified 1976 C code?
<williamcotton>
I fixed this like 2 months ago but I can't remember how to force a string to a certain encoding
<mdszy>
coyo: TCPSocket?
<coyo>
bnagy: so, basically, the reason people say that ruby handles sockets strangely is because you're not supposed to handle sockets directly AT ALL in ruby? only with a abstract api? which would you suggest?
<williamcotton>
anyone know?
awarner has quit [Remote host closed the connection]
<bnagy>
williamcotton: String#force_encoding
<williamcotton>
haha
<bnagy>
coyo: well I can't really respond to blind quotes that I don't neccessarily agree with
PIZDECCIO has quit [Ping timeout: 245 seconds]
<coyo>
mdszy: i dont know. i'm new hethat's fair.
<coyo>
..
<coyo>
*that's fair
<bnagy>
I'm saying that mostly people don't need 'to handle sockets', they need to perform some higher level task, like "send a file" or "read a webpage"
<coyo>
okay, that answers my question, then.
<bnagy>
for which there are usually suitable libs already done
Orban has quit [Ping timeout: 245 seconds]
subbyyy has quit [Read error: Connection reset by peer]
<coyo>
okay. what if i need to write one of those application-specific libraries, especially for learning, say, building an IRC bot?
<mdszy>
coyo: I've built IRC bots, use TCPSocket.
subbyyy has joined #ruby
<bnagy>
only time I have used Socket is to write layer 2 fuzzers where I have to drop stuff directly onto the wire
<coyo>
okay.
<shadoi>
I use sockets *heavily
<bnagy>
use EventMachine
jlwestsr has joined #ruby
dev_ryan70 has quit [Remote host closed the connection]
<bnagy>
yeah or that - building something on TCPSocket is a horrible way to learn
<coyo>
celluloid <3
<bnagy>
the point of using a HLL is to think in high level patterns
Ontolog has joined #ruby
<shadoi>
There's nothing wrong with the ruby Socket libraries, the API is fine.
<shadoi>
There are some oddities with the way it handles certain socket options, other than that, I see no glaring problems.
<bnagy>
TCPSocket is a micron thin wrapper for unixy sockets
<shadoi>
Which is pretty much exactly the way you want it.
khakimov has quit [Quit: Computer has gone to sleep.]
<bnagy>
I didn't say it was bad or broken, just that mostly there's no reason to use it unless you're producing Abstract Networking Library Number 622
<shadoi>
Like you said, if you want higher level stuff, it exists.
<shadoi>
*shrug*
<shadoi>
I wrote various UDP and TCP services with raw sockets
<shadoi>
understanding socket programming is an excellent learning exercise.
<minijupe>
bnagy: general principles
pk1001100011 has quit [Ping timeout: 244 seconds]
tcopp has quit [Ping timeout: 240 seconds]
<bnagy>
dammit, neighbours chicken in the garden again >:(
hadees has joined #ruby
<bnagy>
minijupe: hm. App security is very domain focused now
jkarayusuf has joined #ruby
<bnagy>
there's an oldish book called 7 deadly sins of software security
<bnagy>
but I wouldn't pay money for it, tbf
<minijupe>
bnagy: I guess rails security then, but I've already read the guides
<bnagy>
ahhh webapp stuff
<bnagy>
there is tons and tons of owasp lit
<bnagy>
some of that must be generic
noganex has quit [Ping timeout: 240 seconds]
<williamcotton>
bnagy: so, I'm doing a msg.force_encoding("UTF-8"), but still getting this error, any clue why?
<williamcotton>
the full error being: /usr/local/rvm/gems/ruby-1.9.3-p194/gems/em-websocket-0.3.6/lib/em-websocket/connection.rb:135:in `send': Data sent to WebSocket must be valid UTF-8 but was ASCII-8BIT (valid: true) (EventMachine::WebSocket::WebSocketError)
<williamcotton>
and I'm printing out the msg.encoding and it is already a UTF-8 string
<bnagy>
guess it must have some illegal chars in it
<williamcotton>
it works fine locally
<williamcotton>
well
<williamcotton>
ruby 1.9.3p194 on the server
<williamcotton>
l
<bnagy>
there's some valid_encoding? type calls, from memory
<williamcotton>
ok, i'll try that out
<bnagy>
otherwise looks like you need to look at the gem code
sdwrage has joined #ruby
<bnagy>
if you need to send binary goop then encode / decode it if you can (like if you control both ends)
noganex has joined #ruby
<williamcotton>
it's just a utf-8 "emoji" character
yoklov has quit [Quit: computer sleeping]
<bnagy>
hm, ok well I would see how they're validating and then go from there
<williamcotton>
ok
<Boohbah>
williamcotton: check the locale settings on your server
<Boohbah>
$LANG, $LC_ALL
beilabs has quit [Ping timeout: 252 seconds]
<williamcotton>
$LC_ALL is en_US.UTF-8
sdwrage has quit [Client Quit]
weasels has joined #ruby
weasels has quit [Remote host closed the connection]
<williamcotton>
well, it's not the ruby version, because I tested it locally on 1.9.3p194
<williamcotton>
no probe there
<williamcotton>
hmm
cmaujean_ has joined #ruby
<williamcotton>
lemme check out the gem versions
dev_ryan70 has joined #ruby
vivmbbs has joined #ruby
<williamcotton>
whelp, differing gems on the server compared to local
<williamcotton>
figured it out and fixed, thanks guys!
cmaujean has quit [Ping timeout: 276 seconds]
cmaujean_ is now known as cmaujean
dev_ryan70 has quit [Remote host closed the connection]
JustinCampbell has quit [Remote host closed the connection]
jkarayusuf has quit [Remote host closed the connection]
typicalRunt has joined #ruby
apok_ has joined #ruby
typicalRunt has quit [Client Quit]
apok_ has quit [Client Quit]
sdwrage has joined #ruby
vivmbbs has left #ruby ["Leaving"]
beilabs has joined #ruby
andrewhl has joined #ruby
apok has quit [Ping timeout: 252 seconds]
awarner has joined #ruby
awarner has quit [Remote host closed the connection]
igotnolegs has joined #ruby
Ontolog has quit [Quit: Ontolog]
awarner has joined #ruby
Ontolog has joined #ruby
ponzicoder has joined #ruby
Progster has quit [Ping timeout: 260 seconds]
<ponzicoder>
Does sudo gem install put the gems in a different place than simply gem install?
bradhe has quit [Remote host closed the connection]
kevinbond has joined #ruby
verto is now known as verto|off
awarner has quit [Remote host closed the connection]
<bnagy>
possibly
beneggett has joined #ruby
bburhans has quit [Quit: reconnecting...]
Ethan has quit [Ping timeout: 264 seconds]
<ponzicoder>
I guess rvm influences this as well?
<bnagy>
yep
<bnagy>
imho always use rbenv / rvm as a normal user, never try a "system install"
<ponzicoder>
bnagy: Am I close in that if I'm using a particular version of ruby via rvm than using gem install will place the gem in .rvm
<bnagy>
you'd need to ask about rvm specifics on #rvm or whatever
wilmoore has joined #ruby
<ponzicoder>
fair enough
ponzicoder has quit [Quit: ponzicoder]
<bnagy>
it performs significant magic
<bnagy>
not all of which is well advised imho, but to each their own
ponzicoder has joined #ruby
fbernier has quit [Read error: Connection reset by peer]
ponzicoder has left #ruby [#ruby]
ponzicoder has joined #ruby
ponzicoder has quit [Client Quit]
ponzicoder has joined #ruby
awarner has joined #ruby
fbernier has joined #ruby
cloud|windoze has quit [Quit: Leaving.]
awarner has quit [Remote host closed the connection]
blownapart has quit [Remote host closed the connection]
Axsuul has quit [Remote host closed the connection]
jkarayusuf has joined #ruby
stefanp has joined #ruby
stefanp has quit [Changing host]
stefanp has joined #ruby
Axsuul has joined #ruby
bricker88 has quit [Quit: Leaving.]
jonathanwallace has quit [Remote host closed the connection]
fbernier has quit [Ping timeout: 276 seconds]
ringotwo has quit [Remote host closed the connection]
ryanf has quit [Quit: leaving]
stefanp_ has quit [Ping timeout: 265 seconds]
lledet has joined #ruby
stefanp has quit [Ping timeout: 265 seconds]
wpaulson has joined #ruby
htroyack has quit [Excess Flood]
htroyack has joined #ruby
yoklov has joined #ruby
seanstickle has quit [Quit: Nihil sub sole novum]
htroyack has left #ruby [#ruby]
cpruitt has quit [Quit: cpruitt]
perryh_away is now known as perryh
htroyack has joined #ruby
X-Jester has joined #ruby
ryanf has joined #ruby
<X-Jester>
has anyone successfully used net-ssh or another gem to generate a public/private keypair for cert-based authentication?
<iamjarvo>
hrm I'm getting this this NameError: uninitialized class variable @@current_spec in MiniTest::Spec
Chryson has quit [Quit: Leaving]
<shadoi>
google is your friend on that sort of thing. :)
<shadoi>
short answer: you need to use the "it" keyword after you use "describe"
mikeycgto has quit [Remote host closed the connection]
skryking has quit [Read error: Connection reset by peer]
ponzicoder has quit [Quit: ponzicoder]
c0rn_ has joined #ruby
<iamjarvo>
thanks
jlwestsr has quit [Remote host closed the connection]
<iamjarvo>
i ended up doing this class == Array
<iamjarvo>
.class == Array
minijupe has quit [Quit: minijupe]
<iamjarvo>
i guess must_be_instance_of is more for spec type syntax
<iamjarvo>
shadoi ^
<shadoi>
yeah
<shadoi>
.is_a? Array <- much shorter and still readable.
<iamjarvo>
thanks
reuf has joined #ruby
lledet has quit [Quit: lledet]
htroyack has quit [Quit: See you tomorrow... Late night here in Rio, better sleep...]
<bnagy>
aaand that's why I hate a lot of TDD
<bnagy>
why on earth would you ever want to make 'it returns an Array' part of your spec?
<bnagy>
is_a? < kind_of? < respond_to?
chriskk has quit [Quit: chriskk]
<mdszy>
.is_a? Array irks me
<mdszy>
is there .is_an?
<mdszy>
XD
Draco___ has joined #ruby
dogenpunk has joined #ruby
ryanf has quit [Quit: broken pipes |||]
<bnagy>
alias :is_an? :is_a?; [].is_an? Array => true
<otters>
Array ===
<shadoi>
mdszy: annoys me too, and yes, it's been monkey patched all over the place
<shadoi>
ActiveSupport, utlility_belt, an so on.
<mdszy>
class Object
<mdszy>
alias_method :is_an, :is_a
<mdszy>
end
<shadoi>
don't forget those question marks! ;)
<mdszy>
true XD
maxmmurphy has joined #ruby
Draco_ has quit [Ping timeout: 276 seconds]
mockra has joined #ruby
jkarayusuf has quit [Remote host closed the connection]
mdszy has quit [Quit: nini]
ananthakumaran has joined #ruby
nu7hatch has left #ruby [#ruby]
vitor-br has quit [Ping timeout: 276 seconds]
Draco_ has joined #ruby
Bosma has quit [Quit: leaving]
coyo has quit [Quit: Changing server...]
ringotwo has joined #ruby
<iamjarvo>
bnagy I'm just practicing some ted stuff. basically i am getting some csv data and then i am reading it and checking if the method does its job. suggestions are welcome :)
<iamjarvo>
it does seem useless
minijupe has joined #ruby
<iamjarvo>
but then its good for writing only what you need
<iamjarvo>
i think thats where the useless test help me
mahmoudimus has quit [Quit: Computer has gone to sleep.]
<bnagy>
I just object to stuff that promotes tight coupling
<iamjarvo>
Hanmac if i wanted to stub something would i have to require 'mintiest/mock' ?
<iamjarvo>
i basically want to return a fake value for a method i have not written yet
<Hanmac>
i dont know ... i never used minitest yet
choffstein has quit [Remote host closed the connection]
btanaka has quit [Remote host closed the connection]
cantonic_ has joined #ruby
fantazo has joined #ruby
zodiac1111 has quit [Remote host closed the connection]
d3vic3 has joined #ruby
cantonic has quit [Ping timeout: 244 seconds]
cantonic_ is now known as cantonic
cloud_droid has joined #ruby
Juul has joined #ruby
yoklov has quit [Quit: computer sleeping]
blazes816 has quit [Quit: Leaving]
cloud|droid has quit [Ping timeout: 255 seconds]
jkarayusuf has quit [Remote host closed the connection]
htroyack has joined #ruby
mjb2k has quit [Quit: Leaving.]
rippa has joined #ruby
Xethron has quit [Ping timeout: 244 seconds]
wrapids has joined #ruby
wilmoore has quit [Remote host closed the connection]
ananthakumaran has quit [Quit: Leaving.]
zodiac1111 has joined #ruby
luckyruby has joined #ruby
mjb2k has joined #ruby
<wrapids>
Can replacement using string['replaceme'] = 'withme' work for strings?
<bnagy>
use sub or gsub
<Hanmac>
string[/replaceme/] = "withme", works too
Xethron has joined #ruby
<lukeholder>
iamjarvo thats what tests do? the method should not be written yet and should fail until you crate it
<lukeholder>
*create
mockra has quit [Remote host closed the connection]
<iamjarvo>
lukeholder understood but I'm trying to use a method in another method so say print name puts name.titleize
<iamjarvo>
i don't want to implement titleize i want to stub it out. maybe I'm thinking of it wrong
<lukeholder>
split your tests out then… don't have dependant tests
<lukeholder>
unless your doing integration testing
<iamjarvo>
lukeholder but I'm not testing the titleize method in the puts name.title method i just want to say titleize should return somethong
<lukeholder>
a string?
<iamjarvo>
so basically i have a method that returns an array and then a method that adds up the values in the array. I'm trying to stub the array method
<lukeholder>
a int? then just return it straight..
mikeric has joined #ruby
Juul has quit [Ping timeout: 260 seconds]
<lukeholder>
your not testing the size in that test
c0rn_ has quit [Quit: Computer has gone to sleep.]
nilg has joined #ruby
Xethron has quit [Read error: Operation timed out]
<wrapids>
If I were to want to permanently store data in ruby (!rails) what would be the best method of doing so? The only obvious option I see is writing to files.
banghouse has quit [Remote host closed the connection]
heftig has quit [Ping timeout: 240 seconds]
<wrapids>
I feel like that would be cumbersome, I'll be storing a fairly large number of objects, each with their own attributes.
<bnagy>
direct your semantic web 'browser' to return information on 'databases' ?
<fowl>
wrapids, most efficient way is to read it aloud thousands of times and commit it to memory, then you'll be able to recall it whenever you need it
<bnagy>
LOL
<wrapids>
fowl, SQLite maybe?
<bnagy>
sqlite is a pile
mikeric has quit [Quit: mikeric]
iamjarvo has joined #ruby
<bnagy>
mainly it depends how you want to use the data
<bnagy>
if you forsee a lot of relational queries use postgres / mysql (bleh) or something
tonini has joined #ruby
<wrapids>
bnagy I do not.
<bnagy>
if you want to do less work use a nosql like redis mongo tokyocabinet
<wrapids>
I have two series of objects. One will be a single string with an integer attribute, the other will be a string with another string for an attribute.
<wrapids>
If that's not clear, I can probably give a more useful explanation
<bnagy>
sounds like a KV store would fit fine
zeromodulus has joined #ruby
<bnagy>
basically they're like a persistent Hash
fantazo has quit [Remote host closed the connection]
uris has quit [Quit: leaving]
<bnagy>
personally I use tokyocabinet via oklahoma-mixer for hacky local stuff that never needs to be connected to a 'service' etc
<wrapids>
bnagy, Reading on them. Is there a particular one that you would recommend? I realize it's biased opinion, but one of them may have an issue of sorts that I souldn't be aware-
<wrapids>
lol ^ thx
<bnagy>
I've also used redis, which is much more fully featured
<wrapids>
Hrm.
<wrapids>
I've heard redis tossed around a bit, I'll probably take a look at that first
a_a_g has joined #ruby
<bnagy>
antirez is an old hacker, it's good code :)
<icy`>
hi, how can I get the first grouped regex match in one operation? e.g. str[/Pattern (.+?)/] (with some trick) to return $1 ?
<wrapids>
bnagy, Any chance there's a windows version :p
<wrapids>
bnagy, Answered my question, looks like no
<bnagy>
icy`: [/pattern/,1]
<wrapids>
Well, not officially
<icy`>
bnagy, yes, thanks! ;P
htroyack has quit []
htroyack has joined #ruby
<wrapids>
Er, it looks like most of them don't have windows versions available
mockra has quit [Remote host closed the connection]
<bnagy>
MSSQL! YAY!
<wrapids>
microsoftsql?
minijupe has quit [Quit: minijupe]
<bnagy>
maybe there's a Sequel adapter for it :D
<wrapids>
bnagy, I don't usually develop on windows, but at the moment I'm here for a while.
kevinbond has quit [Quit: kevinbond]
<wrapids>
mongodb?
<Hanmac>
my pc is windowsfree since i build them :P
<bnagy>
heard of it, was under the impression it's more of a python thing
<bnagy>
Hanmac: nobody cares
<wrapids>
lol
<wrapids>
Well at least for now MongoDB it is
tewecske has joined #ruby
<bnagy>
can't you host the DB on a proper OS?
<wrapids>
bnagy, Remotely? I suppose so.
<bnagy>
and just use a network client?
<bnagy>
slow, obviously
<wrapids>
bnagy, Not really an issue, won't be high traffic or transfering large amounts of data
<wrapids>
What do you mean by network client?
htroyack has quit []
<wrapids>
bnagy, Why I assumed if I'm developing locally I needed to keep my db local I have no idea
<bnagy>
well you just host the DB on another box and then use a client that talks via tcp etc
<bnagy>
need 2 boxes obviously
<wrapids>
bnagy, That's not an issue
<bnagy>
but you can run the DB on whatever runs the virtualisation system that you installed windows in
ananthakumaran has joined #ruby
<wrapids>
bnagy, I suppose what I'm a bit lost on, is in my experience (however limited) with databases it's usually just a matter of ip/port
<wrapids>
connect, query/push ect
npn47 has joined #ruby
Eldariof-ru has joined #ruby
<bnagy>
well most the the stuff the API should be exactly the same whether it's local or remote
<wrapids>
I'm coming over from LAMP, so I've gotten certain ideas hammered into my head :p
heftig has joined #ruby
<bnagy>
so much suck in one little acronym
<wrapids>
Eh, Linux/Apache work great for me
<wrapids>
Can't say I've had a problem with mysql either
<wrapids>
But what I work with also deals heavily with relationship models and complex queries
<wrapids>
Although I suppose my work IS a problem
zeromodulus has quit [Read error: Connection reset by peer]
zeromodulus has joined #ruby
niklasb has joined #ruby
Tomasso has quit [Ping timeout: 245 seconds]
<wrapids>
Oh, redis looks like it will work very nicely for this
Cache_Money has joined #ruby
wrapids has left #ruby ["I quit."]
<Cache_Money>
say I have a 7 digit number, what's the most efficient way to determine whether all numbers are distinct?
<wrapids>
After running gem install redis, I've tried requiring redis and am getting a not found error. Am I missing a step?
Eldariof-ru has quit []
ryanf has joined #ruby
<user123>
what if you pretend rvm doesn't exist, and it's just a ruby thing?
<user123>
like help solve this, ignoring rvm
hbs has joined #ruby
<user123>
wrapids: run gem -v and ruby -v and gem list and paste the results please
Draco___ has quit [Ping timeout: 248 seconds]
hbs has quit [Remote host closed the connection]
<Hanmac>
user123 i can not say that rvm is not the problem ... you could try to ask shevy
<wrapids>
user123, I have the issue of not being able to highlight in my console. Not sure why. gem -v 1.8.16 and redis 3.0.1 I hope that answers what you need
<user123>
does redis appear in your gem list/
<user123>
?*
<user123>
wrapids, tagging
<user123>
shevy: can i have some help with this please?
noyb has joined #ruby
<Hanmac>
user123 i think the problem is torrent-ruby itself ... from what i see i think the gem is broken
<user123>
Hanmac: would that stop its inclusion at runtime?
<wrapids>
user123, yes.
<banisterfiend>
Hanmac: hey 'mac
<Hanmac>
user123 require "torrent_file" works for me ... so require "torrent-ruby" is wrong
maesbn has joined #ruby
<banisterfiend>
Hanmac: are you using the new p. version?
zommi has joined #ruby
<coyo>
i am trying to load a custom module or class, and i cannot load it by filename, classname, or modulename. it gives me "Cannot load such file (LoadError)"
<user123>
Hanmac: torrent_file is the nane?
<wrapids>
user123, Using $require 'redis' in interactive ruby returns true.
<Hanmac>
user123 yeah torrent_file is that what is requireable
<user123>
wrapids: what happens when you require from inside a .rb?
<user123>
Hanmac: it works!
<Hanmac>
wrapids & coyo: no require_relative is better
Guest33712 has joined #ruby
<wrapids>
Hanmac, sorry :(
<coyo>
hmm. still doesnt work.
<wrapids>
user123, I get: in `require': cannot load such file -- redis (LoadError)
JohnBat26 has joined #ruby
<user123>
wrapids: did you try require_relative?
<coyo>
trying.
adamkittelson has quit [Remote host closed the connection]
freeayu has quit [Ping timeout: 240 seconds]
<wrapids>
user123, The file is not in the programs directory, it also returns cannot load such file path/redis
timonv has quit [Remote host closed the connection]
<wrapids>
Am I possibly missing a step between gem install and loading it?
<user123>
try 'require 'rubygems' before it?
<wrapids>
user123, No change.
<coyo>
hmm. okay, it kindof works now with require_relative. but i am now wondering how to get output to the screen from an object.
Draco_ has quit [Read error: Connection reset by peer]
Draco_ has joined #ruby
<Hanmac>
wrapids: what did "gem which redis" return?
<coyo>
i have an IRCSocket object that i instantiated, and then told to join a channel. the object puts a lot. how can i get the object to log to the terminal?
<wrapids>
Hanmac, I'm don't believe I understand what you're asking.
<wrapids>
Oh
<wrapids>
I see
<wrapids>
Sorry, my wordwrap is playing tricks on me
<Hanmac>
wrapids: this return means that redis should be requireable
Ontolog has quit [Quit: Ontolog]
<wrapids>
Hanmac, Hrm.
<codespectator>
Hanmac: do you not want to install redis-rb gem and then require 'redis' ?
<wrapids>
I may have made an incorrect assumption. One moment.
Morkel has joined #ruby
yonggu_ has quit [Remote host closed the connection]
savage- has quit [Remote host closed the connection]
<Hanmac>
codespectator i installed redis ... not redis-rb ... does that make a difference?
<wrapids>
It looks like I have. You require needed gems in the main program rather than any that you are requiring?
yonggu has joined #ruby
<coyo>
i have an IRCSocket object that puts internally a lot of logging information that i want to see. i instantiated one of these objects in a "main.rb" but i cannot see the logging. any way to get the logging and print it?
Cache_Money has quit [Ping timeout: 255 seconds]
<Hanmac>
wrapids you could use require inside of methods too ...
<wrapids>
Actually no, it seems I'm assuming too much again. I'm not getting an error for requiring redis in the program that calls the others. I am getting uninitialized constant Redis (from Redis.new) now that I have moved require 'redis'
<codespectator>
Hanmac: I don;t know, but my quick look suggests that redis-rb is the gem with the ruby client library. I would guess that redis gem would also have that
<wrapids>
Hanmac, Would you look at my code and give me pointers on practices that I'm not following? It's not a lot of code
<Hanmac>
yeah make me a pastie
<wrapids>
Hanmac, Github okay?
<Hanmac>
yeah its okay
iamjarvo has quit [Quit: Computer has gone to sleep.]
<wrapids>
You'll have to excuse the .gitignore in my repo, not sure why that's there. Can't find it anywhere in my directory.
<wrapids>
I'm a great deal concerned at the moment that I'm just hacking together bits and pieces while trying to learn this, I'd like to not pick up bad habits along the way.
Draco_ has quit [Read error: Connection reset by peer]
<wrapids>
My code is running on other boxes (I'm running windows 7). I'm getting cannot load such file redis, my ruby version is 1.9.3 and gem -v redis: 1.8.16.
npn47 has quit [Ping timeout: 245 seconds]
workmad3 has joined #ruby
<wrapids>
Also, require 'redis' in interactive ruby gives me => true
<hoelzro>
wrapids: so require 'redis' in a script by itself doesn't work?
<hoelzro>
what's the error message?
<hoelzro>
also, I feel like you need to require 'rubygems' first
<wrapids>
in `require': cannot load such file -- redis (LoadError)
Draco___ has quit [Read error: Connection reset by peer]
<hoelzro>
I'm not sure how that works with 1.9
sspiff has joined #ruby
Draco_ has joined #ruby
<wrapids>
hoelzro, I cannot run it in a script by itself, same error as above
<hoelzro>
wrapids: did you require 'rubygems' first?
mrdodo has joined #ruby
<Hanmac>
1.9 should work without require "rubygems" ...
<wrapids>
hoelzro, I hadn't, but have now. Same error
<mjb2k>
you only need to require rubygems in 1.8
<hoelzro>
mjb2k, Hanmac: thanks, I wasn't sure
<mjb2k>
must be something wrong with GEM_PATH
<hoelzro>
I thought it was just distributed with 1.9
<wrapids>
mjb2k, I can include other gems such as socket, and would the interactive ruby be able to requrie it?
<Hanmac>
socket is not a gem, its in stdlib
<wrapids>
Hanmac, My mistake.
<tonini>
hi: I'm looking for some advise how to handle the stdout, stderr etc within command line application and rspec. here are an example how bundler handles these => https://gist.github.com/cc418a8b18963c8bf253
<tonini>
any other tipps?
<wrapids>
Hanmac, I cannot include any gems it seems, I've tried sprocket to the same effect.
williamcotton_ has joined #ruby
perryh is now known as perryh_away
<wrapids>
sprockets*
<wrapids>
Is rubygems a gem?
<wrapids>
Or also part of the stdlib?
<shevy>
in 1.9 rubygems is part of ruby
<shevy>
in 1.8.x rubygems is an "addon"
williamcotton has quit [Ping timeout: 276 seconds]
<shevy>
latest should be version 1.8.24, default in latest ruby 1.9.3 is 1.8.23
<wrapids>
shevy, I used the installer found at rubyinstaller.org, should that be the latest version?
<Hanmac>
it should be latest enough
aganov has joined #ruby
<wrapids>
Hrm
spinagon has joined #ruby
<shevy>
wrapids: dunno. sounds like you are on windows or? try to start irb, then do RUBY_VERSION and ... Gem::Version or something like that. or system "gem --version"
<wrapids>
shevy, ruby -v 1.9.3 gem -v 1.8.24
<shevy>
\o/
ukd1 has quit [Ping timeout: 276 seconds]
<wrapids>
shevy, As I also mentioned, I apparently cannot load any gems. And yes, windows 7
rippa has quit [Ping timeout: 252 seconds]
zodiac1111_ has joined #ruby
<shevy>
odd
<shevy>
works fine for me on my laptop
<shevy>
what happens when you install a gem via system "gem install pry" from within irb ?
<shevy>
also into what directory did you install ruby to
<wrapids>
shevy, The default C:\ruby193
zodiac1111 has quit [Read error: Connection reset by peer]
<wrapids>
shevy, Within IRB I get NameError: undefined local variable or method 'pry' for main:Object
ukd1 has joined #ruby
ukd1 is now known as Guest94595
workmad3 has quit [Ping timeout: 245 seconds]
ypk has left #ruby [#ruby]
<shevy>
ok but you did not say what happens when you do system 'gem install pry'
<wrapids>
shevy, Oh, im sorry
<shevy>
could also try:
<shevy>
result = `gem install pry`
<shevy>
require 'pp'; pp result
<shevy>
and if it has installed: system 'pry'
<wrapids>
fetching stuff, 5 gems installed, installing ri doc
<shevy>
ok so I suppose it installed
<shevy>
what happens if you do system 'pry'
<wrapids>
shevy, Still going
<wrapids>
One moment
<shevy>
good. all .gem files are downloaded on your machine locally too
<shevy>
they reside in cache/ directory
<shevy>
in the ruby base directory
noyb has quit [Quit: Leaving.]
<shevy>
lib/ruby/gems/1.9.1/cache/
<shevy>
on your system probably... it is:
<shevy>
C:/ruby193/lib/ruby/gems/1.9.1/cache/
<wrapids>
I get [1] pry(main)>
<shevy>
ok so pry installed fine and it works
<shevy>
it is a gem too :D
beneggett has quit [Ping timeout: 276 seconds]
<wrapids>
Could it be that I am using rubyw as the interparator rather than 'ruby'?
<shevy>
well yeah
<shevy>
but I think that just prevents those popups
arkiver has joined #ruby
<shevy>
there is this thing on windows that ... hmm lemme google
<wrapids>
Well, I'm not too worried about popups or not popups lol. At least not at this point. I'll be moving this over to linux once I'm finished anyways
roadt has quit [Ping timeout: 276 seconds]
<wrapids>
I like to be able to shotgun test when I can though
<shevy>
ok no real idea, everything works fine for me on windows too
<wrapids>
And I was told it was good practice to develop locally
<wrapids>
fuck.
Eldariof57-ru has joined #ruby
mucker has joined #ruby
n8ji has joined #ruby
gilead has joined #ruby
mjb2k has quit [Quit: Leaving.]
cloud|droid has joined #ruby
und3f has joined #ruby
kevinfagan has quit [Ping timeout: 244 seconds]
jgrevich has quit [Quit: jgrevich]
yxhuvud has joined #ruby
justsee has joined #ruby
zealinux has joined #ruby
tatsuya_o has joined #ruby
artnez has joined #ruby
n8ji has quit [Remote host closed the connection]
n8ji has joined #ruby
darren_ has quit [Remote host closed the connection]
axl_ has quit [Read error: Connection reset by peer]
axl_ has joined #ruby
Rochefort has joined #ruby
ringotwo has joined #ruby
sdwrage has left #ruby [#ruby]
etehtsea has joined #ruby
<wrapids>
Afer reinstalling via rubyinstaller I've got a new error. Cannot load redis amongst (some gem files)
roadt has joined #ruby
<wrapids>
It shows up in gem list though
Guest94595 has quit [Ping timeout: 260 seconds]
<wrapids>
in `to_specs': Could not find redis (>= 0) amongst [bigdecimal-1.1.0, io-console-0.3, json-1.5.4, minitest-2.5.1, rake-0.9.2.2, rdoc-3.9.4] (Gem::LoadError)
<wrapids>
from C:/Ruby193/lib/ruby/site_ruby/1.9.1/rubygems/dependency.rb:256:in `to_spec'
BiHi has joined #ruby
spinagon has quit [Quit: {#`%${%&`+'${`%&NO CARRIER]
Z_Mass has quit [Ping timeout: 252 seconds]
mwilson_ has quit [Excess Flood]
mwilson_ has joined #ruby
rippa has joined #ruby
oznek has joined #ruby
khakimov has quit [Quit: Computer has gone to sleep.]
ryanf has quit [Quit: leaving]
maletor has quit [Quit: Computer has gone to sleep.]
<burgestrand>
Hanmac: don’t forget about const_missing, too
<Hanmac>
nope i dont need too, or what do you mean?
<burgestrand>
Hanmac: assuming you’ve defined const_missing on say… C, it won’t be called through that lookup when it reaches C.const_get("D")
<_axx>
burgestrand: isn't set by a user. i have an "activity"-logger thtat logs actions inside my app. i save them all in one database and have a column for every model name, like User, Article, Image etc. Later i want to Call Activity.get_content('Klass',id)
<_axx>
it takes the classname, (as a model) and calls the id from that table
<burgestrand>
_axx: ah :)
<_axx>
it's inside a CMS and used for admins to see what actions have been done to every model
<_axx>
nothing fancy ^^
<burgestrand>
_axx: are you using rails?
<_axx>
yes
<burgestrand>
_axx: because if so you can use klassname.constantize
<burgestrand>
… or classify or wahtever
<_axx>
i found that to. :}
wpaulson has quit [Ping timeout: 240 seconds]
<_axx>
too
wpaulson_ is now known as wpaulson
<burgestrand>
hehe
<burgestrand>
I’d use that over eval :)
<_axx>
wasn't really sure which way to go ^^
<Muz>
Unfortunately, some of us still use 1.8.7 because it's the latest version supported on our /Enterprise/ systems.
<_axx>
in my old php days, eval always was a bad idea
<workmad3>
would be nice to see that as actual searches done too
mpereira has joined #ruby
Shrink has joined #ruby
lledet has joined #ruby
Kabaka has quit [Read error: Connection reset by peer]
Kabaka has joined #ruby
`brendan has joined #ruby
mneorr has joined #ruby
umttumt has joined #ruby
yonggu_ has quit [Remote host closed the connection]
<shevy>
hmm I'd say a big decline would still show
yonggu has joined #ruby
<shevy>
I wonder what impact mruby will have
tomb_ has joined #ruby
roadt has quit [Ping timeout: 260 seconds]
<workmad3>
shevy: well, percentages hide whether the number of searches has stayed about the same or even increased if the total number of searches has increased (or increased faster)
zommi has quit [Ping timeout: 260 seconds]
lledet has quit [Quit: lledet]
baphled has quit [Ping timeout: 276 seconds]
beginner_42 has joined #ruby
<_bart>
calling a method description is not allowed in ruby? (reserved word?)
<hoelzro>
_bart: I don't think description is reserved?
<Squee-D>
i doubt that very much
lorandi has joined #ruby
<Squee-D>
would ruin a lot of perfectly good orm's :D
<_bart>
okay
<_bart>
another question, how do I test wether a Hash contains a specific value? For example: {'a' => 'cookie', 'b' => 'car', 'c' => 'foo'}, how do I test for 'cookie' (true!)?
<Squee-D>
.values.include?
<hoelzro>
I think there's also has_value?
<_bart>
thanks
<hoelzro>
but keep in mind that will probably do a linear search
<hoelzro>
and will not be as fast as has_key?
<Squee-D>
there is
whitequark has left #ruby [#ruby]
verto|off is now known as verto
<_bart>
oh my question was wrong, let me rephrase, ["apple", "pie"], now search for "pp" and return true (and "aa" would return false)
jonathanwallace has joined #ruby
banister`doom has quit [Read error: Connection reset by peer]
<_bart>
so, not an exact match
banister`doom has joined #ruby
<_bart>
["apple", "pie"].include? "pp" <= or is that it?
<bnagy>
grep /pp/
<bnagy>
it will return "apple", but that's truthy
<_bart>
ah cool
<bnagy>
["apple", "pie"].any? {|e| e.include? 'pp'} works as well, but grep is neater imho
<_bart>
yes I did know about .any? but never found it really fun to work with
<_bart>
cool, I'll stick with grep
<peterhellberg>
(['apple', 'pie'].grep /pp/).any? would return true/false
<bnagy>
any? is possibly faster in this case
<bnagy>
cause it can shortcut
<shevy>
workmad3: hmm yeah
Squee-D has quit [Quit: The computer fell asleep]
<bnagy>
like %w(apple pie <a million items> supple) grep has to go through to the end
<bnagy>
those each_with_object ... .any? &:match things freak me out a bit
<bnagy>
these all kinds of wacky arity and defaults flying around in there
gregorg has joined #ruby
gregorg has quit [Changing host]
gregorg has joined #ruby
tommyvyo has joined #ruby
<Hanmac>
you could use :=~ instat of :match it should be a bit faster:> ['apple','pie'].each_with_object(/pp/).any?(&:=~)
<peterhellberg>
It looks like String#include? is pretty fast considering it is implemented with a plain call to rb_str_index
undyingrage has quit [Ping timeout: 276 seconds]
<bnagy>
_bart: the other awesome about Hanmac's code is that it's lazy, so you can use it on other lazy stuff, like IO#each_line etc
undyingrage has joined #ruby
<bnagy>
Hanmac: you get a gold star for managing to use 7 punctuation chars in a row as vald syntax :(
<shevy>
lazy and ugly
<shevy>
bnagy does not like Hanmac's code :>
<bnagy>
yeah it's awful
<shevy>
he is doing too much C++
tommyvyo has quit [Client Quit]
<Mon_Ouie>
Seriously, those each_with_object tricks aren't prettier nor faster than writing it normally
<_bart>
haha
<_bart>
how do I select both all divs and all a's in a Nokogiri document?
<_bart>
.css("div") and .css("a")
<_bart>
easy way to merge the results?
<workmad3>
_bart: .css("div,a")
<bnagy>
Mon_Ouie: how do you write it normally and have it lazy and shortcutty?
<_bart>
ah wow
<_bart>
obviously
<workmad3>
_bart: a.k.a. a normall CSS selector
<workmad3>
*normal
<bnagy>
I guess any? =~ regexp
<_bart>
yes it's very obvious, just didn't think of it, thanks
<bnagy>
duh
<Mon_Ouie>
["appl", "pe"].any? { |e| e.include? "pp" } was nice
<Mon_Ouie>
Except I failed to type the element names
<bnagy>
yeah if you don't need regexgen
baphled has joined #ruby
mneorr has quit [Quit: Leaving.]
<bnagy>
but it's not lazy
<bnagy>
and each {|s| break true if s=~ /pp/ } id bad
<bnagy>
ohwait probably I'm just high and Enumerable has any?
<bnagy>
I am clearly having a special needs day
<peterhellberg>
I did a quick benchmark on my little 11" i7 Air… and each_with_object is more than twice as slow as any?
sailias has joined #ruby
<Mon_Ouie>
any? is lazy
Axsuul has quit [Ping timeout: 252 seconds]
<Mon_Ouie>
Or rather, it short-circuits
<peterhellberg>
(For this tiny little example… might not be true in the real world)
verto is now known as verto|off
<Mon_Ouie>
Got the same results here
chrismcg is now known as zz_chrismcg
<peterhellberg>
1 million times: each_with_object: 2 seconds, any?: 0.8s
<Hanmac>
peterhellberg: question: when you have an array with 1 million elements, and the regex does only match last one, what takes more ram? (and may be slower?)
<peterhellberg>
No regex in the any? example
<peterhellberg>
But yes, I see your point
wangr has joined #ruby
Criztian has joined #ruby
kaspernj has joined #ruby
<Hanmac>
in this sample: (["ax"] * 1_000_000 + ["bx"]).any? { |e| e.include? "b" } there are 1.000.000 times the string "b" generated ... that why i prefer each_with_object
<bnagy>
well you could just create the string outside the block
<bnagy>
so that's not really a compelling argument
<Mon_Ouie>
And I tried with regexp, it's actually slower to do it like that
<peterhellberg>
10k times with an array of 10k items, checking for the last value: each_with_object: 41s, any?: 20s
<peterhellberg>
The Benchmark module is quite neat :)
<Gadgetoid>
If you have an array with a million elephants, you're doing it zoo
tommyvyo has joined #ruby
<peterhellberg>
:)
tommyvyo has quit [Client Quit]
<DefV>
hmz
<Gadgetoid>
Wouldn't you use some sort of BSP or other partitioning mechanism to optimise such a task for scalability going forward and synergize your approach with industry vest practise?
<DefV>
it's actually the Ruby compiler that optimizes the shit out of that
yonggu_ has joined #ruby
<DefV>
so you should go with .any? {|e| e =~ /regexp/ }
<DefV>
because the regexp will only be allocated once
<Gadgetoid>
That array has 1000001 elements...
<Mon_Ouie>
Also, each_with_object.any has to allocate an Enumerator — probably why it's slower, especially when used many times
erichmenge has joined #ruby
arkiver has quit [Quit: Leaving]
yonggu has quit [Ping timeout: 245 seconds]
strife25 has quit [Quit: Computer has gone to sleep.]
freeayu has quit [Ping timeout: 248 seconds]
<bnagy>
how come it can do it with a regex and not a string?
sailias has quit [Quit: Leaving.]
<JonnieCache>
interesting that regexps are allocated like symbols
<Mon_Ouie>
Maybe it could, it just doesn't. IIRC it specifically optimizes for when you use =~ with a regexp literal.
wvms has quit [Remote host closed the connection]
<JonnieCache>
im not showing that behaviour in irb, the same regexp literal gives incrementing object_ids
<JonnieCache>
or is that not what you meant
yonggu_ has quit [Remote host closed the connection]
yonggu has joined #ruby
<Mon_Ouie>
JonnieCache: 10.times { p /regexp/.object_id }
<workmad3>
don't forget that any? will short-circuit too
freeayu has joined #ruby
vlad_starkov has quit [Remote host closed the connection]
<JonnieCache>
Mon_Ouie: so its an effect of the block being only defined once
<JonnieCache>
makes sense
vlad_starkov has joined #ruby
hynkle has joined #ruby
<JonnieCache>
so its not exactly the same as symbols then
<Mon_Ouie>
No, it's really different. It only happens as an optimization, when possible.
[Neurotic] has quit [Quit: Leaving]
tommyvyo has joined #ruby
<JonnieCache>
riiiight
fbernier has joined #ruby
ktilcu has quit [Quit: ktilcu]
<workmad3>
JonnieCache: he's right... //.object_id gives you a different one each time, but 1000.times{p //.object_id} gives you the same one :)
umttumt has quit [Remote host closed the connection]
berkes has joined #ruby
uris has quit [Quit: leaving]
<JonnieCache>
whereas :foo.object id will be the same forever
<JonnieCache>
same as 123.object_id
<workmad3>
even those are slightly different :)
roadt has joined #ruby
<workmad3>
:foo.object_id will be different with different runs of the ruby runtime, while 123.object_id will be the same
vlad_starkov has quit [Ping timeout: 264 seconds]
<workmad3>
and if you go for a bignum literal rather than a fixnum literal, the object_id changes each time
<Mon_Ouie>
Actually usually bignums would behave like the regexp in the times { … } example, since they're immutable anyway
clocKwize has joined #ruby
<workmad3>
Mon_Ouie: oh, cool :)
<Mon_Ouie>
And 123.object_id is an implementation detail. :foo.equal? :foo is required to be true.
nu7hatch has joined #ruby
rbanffy has joined #ruby
<JonnieCache>
oddly enough i didnt mean the same value for different instances of mri
mengu has joined #ruby
<JonnieCache>
tbh i dont even want to know about stuff like that. it reduces the chance of me writing code that depends on it :)
k_89 has quit [Ping timeout: 240 seconds]
<workmad3>
JonnieCache: what? you don't want to write code that uses the MRI implementation detail of 'something.object_id.even?' to determine if something is or is not a fixnum? :)
tomb_ has quit [Quit: Computer has gone to sleep.]
sepp2k1 has joined #ruby
<workmad3>
Mon_Ouie: hmm... that's a question... does anything other than negative fixnums have a negative object id in MRI?
sepp2k has quit [Ping timeout: 276 seconds]
berkes has quit [Quit: Ex-Chat]
<Gadgetoid>
Oh for an integer.tryParse()
strife25 has joined #ruby
<Mon_Ouie>
I think it's not impossible for regular objects to have negative ids, depends on what value malloc returns
linoj has joined #ruby
justsee has quit [Quit: Leaving...]
<bnagy>
Gadgetoid: you mean like Integer( 'a' ) vs 'a'.to_i ?
<bnagy>
I dunno what a tryParse is :/
iamjarvo has joined #ruby
clocKwize has quit [Quit: clocKwize]
freeayu has quit [Ping timeout: 276 seconds]
<Gadgetoid>
bnagy: in theory, although I recall some problems with Integer() in a specific use case… can't remember exactly what
<shevy>
zastaph: you input ruby code in it. but you can also call system things via system() like system 'mplayer foo.avi'
freeayu has joined #ruby
<zastaph>
ok, so not really a bash replacement :p
<shevy>
sadly no
<zastaph>
however I thought about using ruby for some things, like my prompt
<shevy>
the syntax is still ruby :(
<Gadgetoid>
zastaph: Not unless you're decidedly masochistic :D
<shevy>
zastaph: we could write a replacement for bash though :)
<Mon_Ouie>
A shell using ruby's syntax would be hell to use
<shevy>
yea
<Gadgetoid>
Bash, now with slow!
<zastaph>
like bash isn't hell to use :p
<Muz>
zsh?
<shevy>
zsh is like bash
<Muz>
Sorry, I heard "bash" and "slow"
<shevy>
indeed, ruby will be slower
<shevy>
perhaps you could do a mixture between ruby shell and a c shell
<Muz>
Make it run on jRuby for shits and giggles.
<Muz>
Without nailgun.
<shevy>
but that requires java :(
<JonnieCache>
i like the "separate small tools" part of the unix philosophy but the "lines are king, lets all write different parsers for everything!" idea sucks really badly
etehtsea has quit [Ping timeout: 240 seconds]
<JonnieCache>
microsoft have the best shell
<Muz>
Powershell?
<shevy>
it's a good idea
<Muz>
You can tell it's good, it's powerful.
<shevy>
it sucks that it is exclusively windows
<Muz>
It's got "power" in the name.
<shevy>
it used to be called monad shell in the past, I think
<JonnieCache>
powershell is amazing. you get actual objects!
Gavilan has left #ruby [#ruby]
<shevy>
then marketing department wanted more propaganda
<shevy>
yeah
<JonnieCache>
if only I knew more than a minimal amount of .net
<shevy>
hehehe
<JonnieCache>
and used windows ever
<rking>
Hrm. I'm surprised to hear anyone saying something good about it. I'll have to check it out.
<Mon_Ouie>
Can the objects be streamed though, or do you have to wait for the command to build the whole object?
<shevy>
we need a ruby .net but for nix systems too
mdszy has joined #ruby
tomb_ has joined #ruby
<JonnieCache>
Mon_Ouie: that i dont know
<JonnieCache>
if you can stream everything it would be ridiculously powerful
<bnagy>
shevy: isn't that ironruby / mono?
<rking>
Mon_Ouie: I'm 100% sure, without looking at it, that streaming is possible. Otherwise tail -f-like behavior wouldn't work.
<JonnieCache>
presumably there must be a lisp shell out there thats kind of equivalent?
dv310p3r has joined #ruby
<shevy>
bnagy: hmm I think ironruby died... and mono kinda semi-died too, IMO, when they founded that new company
<rking>
shevy: What new company? I haven't paid any attention to any .net-related stuff, but I'm kind of curious.
zommi has joined #ruby
benjammin891 has joined #ruby
<shevy>
xamarin or something
<shevy>
it kinda changed the whole project :(
Criztian has quit [Remote host closed the connection]
<shevy>
it's less fun to read the blog entries of Miguel now (for me)
nanderoo has joined #ruby
freeayu has quit [Ping timeout: 248 seconds]
<shevy>
anyway, I want super fast ruby objects here
<shevy>
pipe them into excel
<shevy>
(okok I dont really use excel...)
uris has joined #ruby
freeayu has joined #ruby
SphericalCow has joined #ruby
tvw has joined #ruby
ramblex has quit [Read error: Connection reset by peer]
ramblex has joined #ruby
verto is now known as verto|off
monkegjinni has quit [Remote host closed the connection]
pfrost has joined #ruby
kevinbond has joined #ruby
<pfrost>
i'm sure this must have an obvious answer...but why is some_hash.each_key.join(' ') failing with "undefined method `join' for #<Enumerable::Enumerator:0x7f98f6d0bbc8>" ?
<pfrost>
really...enumerators can't be joined?
<hoelzro>
nope
<hoelzro>
I think some_hash.each_key.to_a.join(' ') will work though
etehtsea has joined #ruby
<pfrost>
that's an order of magnitude less efficient, but in my particular case i have only 9 things so it doesn't really matter.
Dreamer3 has quit [Quit: Leaving...]
<pfrost>
i guess there's no way to know how long the string will be without iterating over the things twice
oznek has quit [Remote host closed the connection]
<hoelzro>
pfrost: well, use what I suggested until it's too slow =)
<hoelzro>
then optimizae
<hoelzro>
*optimize
kpshek has joined #ruby
tomb_ has quit [Quit: Computer has gone to sleep.]
<peterhellberg>
pfrost: You could just call some_hash.keys.join(' ')
<pfrost>
unfortunately, that's the stratgey used by puppet, and it uses more ram on our network than everything else combined :(
nacengineer has joined #ruby
<peterhellberg>
Ah
<peterhellberg>
I thought it was a small hash?
banisterfiend has quit [Ping timeout: 252 seconds]
<pfrost>
it is. I'm just saying being inefficient on 10000 things because no one of them is a problem makes them a problem.
<pfrost>
fight against software bloat! etc.
<peterhellberg>
Ok
<pfrost>
whatever. I agree it's not really an issue. i'm just frustrated that computers can't always do exactly what i want.
cuppsy has joined #ruby
<Mon_Ouie>
pfrost: I think the reason you can't join an Enumerator is you can't know if an element is the last one
<peterhellberg>
pfrost: I wonder if it would be more efficient to use the shovel operator, eg: some_hash.each_key { |k| s << " #{k}" }
<peterhellberg>
pfrost: Where s is an empty string
Criztian has joined #ruby
jimeh has quit [Ping timeout: 245 seconds]
awarner has joined #ruby
<peterhellberg>
Then again, joining 10k things will be slower than doing the same for 9 things…
banisterfiend has joined #ruby
jsime has joined #ruby
skryking has quit [Remote host closed the connection]
<pfrost>
well, the optimal way to do this is to iterate over each element, and sum their lengths. Then add to this sum the length of the seperator times the number of things to be joined, minus one. Then, allocate memory for a string that big. Then, build the string. And, assure the thing being joined isn't modified meanwhile. Unfortunately I don't think that's easily accomplished in ruby.
<Hanmac>
peterhellberg you only want the comined size of the strings?
<pfrost>
for all i know that's exactly what Array#join does, but the (imaginary) Enumerable#join couldn't do it, since it could enumerate over the things only once.
<bnagy>
wtf?
choffstein has joined #ruby
<bnagy>
dude just do h.each_key.with_object('') {|k,s| s << k << ' '}[0..-2] or whatever
arkiver has joined #ruby
<peterhellberg>
I’m getting confused here… is a normal Array#join + String#length really less efficient than what pfrost suggests?
<Mon_Ouie>
Yeah, so you have to remove the last separator — and make sure it works for an empty collection
<pfrost>
peterhellberg: i'm not saying it is. Problem is...I don't have an arary.
<bnagy>
iterating once so you can malloc once is not the most efficient
<peterhellberg>
pfrost: The array being the return value from some_hash.keys
jameshyde has quit [Read error: Connection reset by peer]
adeponte has quit [Read error: Connection reset by peer]
<Hanmac>
something like hash.each_value.inject{|key,sum| sum + key.length}. or hash.each_value.map(&:length).inject(:+)
adeponte has joined #ruby
<bnagy>
yeah but then you have to do it again to build the damn string anyway
strife25 has quit [Quit: Computer has gone to sleep.]
<JonnieCache>
Hanmac: saw that. always thought that guy should be blogging that kind of thing
<salout>
I try to create a DSL lib using a syntax like this: method_to_add CustomObject.new(args) {#block}
<salout>
How do I know if the block is evaluated for the constructor method or "method_to_add"?
oposomme has joined #ruby
Kwpolska has quit [Ping timeout: 248 seconds]
<_bart>
I stumbled across this question, and I have exactly the same issue: http://www.ruby-forum.com/topic/4331880 but there is no solution posted, maybe you guys know the answer?
sspiff has quit [Remote host closed the connection]
<_bart>
it's using resque for queueing requests of a scraper
<Mon_Ouie>
salout: Precedence. { … } "binds more tightly", so it's passed to CustomObject.new
<Mon_Ouie>
do … end would be passed to method_to_add
vandemar has quit [Read error: Operation timed out]
<salout>
Mon_Ouie: How does it work for 3 chained method calls? do…end for first and {} for latest?
<bnagy>
_bart: I use beanstalkd for that kind of stuff
pxjorge has quit [Quit: Leaving]
maesbn has quit [Read error: Connection reset by peer]
tayy_ has joined #ruby
jxf has joined #ruby
maesbn has joined #ruby
<bnagy>
I can't understand the guy's problem, though, it's not written coherently
<Mon_Ouie>
salout: Yes, but I'd recommend to use a more explicit syntax in that case
<Mon_Ouie>
Since it gets confusing
vandemar has joined #ruby
mockra has joined #ruby
beneggett has joined #ruby
<salout>
Mon_Ouie: I agree completly. I didn't know that both block types are different somehow. That's really confusing.
tayy has quit [Ping timeout: 248 seconds]
choffstein has joined #ruby
<lectrick>
WHich block types?
<lectrick>
Braces vs. do...end or lambda vs. proc?
<salout>
lectrick: do…end vs {}
<lectrick>
(can we at least agree that braces should only be used on single-line block passing and do...end on multiline?)
<Mon_Ouie>
No, we can't
<bnagy>
no
<lectrick>
salout: Well, it's just 2 different syntaxes.
<Mon_Ouie>
{ … }.foo > do … end.foo
<lectrick>
Really?? We can't? I find {} to be much more readable on a one-liner and do...end to make much more sense in a multiline process. In fact, even the process of switching between them makes you think about "doing things better" because you WANT to have it all sit on one line
<salout>
lectrick: I also used it that way – obviously I was wrong…
bier has quit [Ping timeout: 240 seconds]
<shevy>
lectrick: I usually use {}
<lectrick>
Mon_Ouie: Oh, I see. So if you have a do...end.method, you'd prefer it to be a { ...multiline... }.method
<bnagy>
I use Thread.new do ... but each {|item| cause it just reads better
mockra has quit [Remote host closed the connection]
<shevy>
for me it was mostly the visually difference. def foo; array.each {}; end <-- I did not like the def foo; array.each do/end; end alternative
<JonnieCache>
do for multiline, {} for single line
<lectrick>
I admit I've called end.method in a few places... and yeah I guess it was a little weird, but I got used to it
Draco_ has joined #ruby
<Mon_Ouie>
I also use the precedence difference in a few cases, because it sounds silly to store the object in a variable just to be able to use do … end
freeayu has quit [Ping timeout: 264 seconds]
billiam has joined #ruby
chrisbolton has joined #ruby
bwlang has joined #ruby
crankycoder has quit [Read error: Connection reset by peer]
crankycoder has joined #ruby
etehtsea has quit [Read error: Operation timed out]
peterhellberg has quit [Remote host closed the connection]
tagrudev has quit [Remote host closed the connection]
verto|off is now known as verto
liluo has quit [Remote host closed the connection]
Kwpolska has joined #ruby
maxmmurphy has joined #ruby
beilabs has quit [Ping timeout: 248 seconds]
lledet_ has joined #ruby
bowlowni has joined #ruby
TheShadowFog has quit [Read error: Connection reset by peer]
jxf has quit [Read error: Connection reset by peer]
shahor_ has quit [Read error: Connection reset by peer]
jxf has joined #ruby
JStoker has quit [Excess Flood]
<_bart>
bnagy: I have endless-amount of queues, containing jobs for one domain/website. I have a limited amount of workers (let's say 4), and they can process all the jobs, BUT they should not process a job when another job of the same queue (same domain) is already handled by another worker. This results in double amount of pressure on the specific website and will result in an IP block or something like that. How do you suggest I do that in resque? (is the problem a bit
<_bart>
clearer now?)
blazes816 has joined #ruby
JStoker has joined #ruby
Shahor has quit [Ping timeout: 252 seconds]
<bnagy>
why would you have more than one queue?
Draco_ has quit [Ping timeout: 252 seconds]
verto is now known as verto|off
<bnagy>
I guess you could have n feeds and each worker processes jobs where (Zlib.adler32 % n)==my_id
<bnagy>
but that's fairly awful
uris has quit [Ping timeout: 245 seconds]
enroxorz has joined #ruby
<bnagy>
sounds kind of like a separate lock system :/
deryl has joined #ruby
<bnagy>
_bart: you might want to look at Storm
jimeh has quit [Read error: Connection reset by peer]
<bnagy>
I think they might even have a Thing for this issue
iamjarvo has quit [Quit: Computer has gone to sleep.]
beilabs has joined #ruby
<_bart>
bnagy: okay cool, ti's a pretty awful problem
<_bart>
but you see, the system right now is kind of based around resqueue
shevy has quit [Ping timeout: 276 seconds]
<_bart>
by just giving every domain (queue) its own worker. (awful for memory!)
mikepack has joined #ruby
Ontolog has joined #ruby
<bnagy>
well if every domain has a queue then I guess you don't have the problem?
mickn has joined #ruby
<_bart>
bnagy: I do, because if you just let 4 workers do all the jobs you get duplicate domains running at the same time!
<bnagy>
so just have the workers self partition, like I said
<_bart>
self partition?
<bnagy>
yeah, like via hashing the domain etc
<bnagy>
but I think it's bizarre to have so many queues
<_bart>
bnagy: you're right, I mean, in the end there will be a n-amount of queues
<_bart>
bnagy: so you really think the switch to Storm is worth it?
<bnagy>
well not for me
<bnagy>
but twitter seems to like it
<bnagy>
I use beanstalkd plus other glue
djdb has quit [Remote host closed the connection]
ananthakumaran has joined #ruby
tk___ has quit [Quit: ばいばい]
<bnagy>
but storm is definitely distributed computing done more or less right
bwlang has quit [Ping timeout: 240 seconds]
banisterfiend has quit [Read error: Connection reset by peer]
<_bart>
bnagy: but what kind of structure do you suggest, I mean, there are a great amount of websites involved here. 300 jobs per queue/website
Eldariof-ru has quit [Read error: Operation timed out]
tzvi has joined #ruby
banisterfiend has joined #ruby
Guest66045 has quit [Quit: leaving]
Draco_ has joined #ruby
k_89 has joined #ruby
maxmmurphy has quit [Quit: maxmmurphy]
<lectrick>
regarding {}.method vs. do..end.method... It makes sense if you follow the whole "everything in ruby is an object" mentality
chrisja has joined #ruby
<lectrick>
sorry, got pulled away into a call :)
<bnagy>
_bart: and you want no more than one worker on any given site at a time?
knightblader has joined #ruby
<_bart>
bnagy: exactly
bwlang has joined #ruby
<_bart>
bnagy: because that results in too frequent calls to that site
<bnagy>
ok then I guess I would do what I said
Draco_ has quit [Read error: No route to host]
shevy has joined #ruby
<bnagy>
one queue per worker and feed those queues in a way that domain X always goes in queue Y
Draco_ has joined #ruby
<bnagy>
or a billion queues like you have, but workers choose randomly from one of the queues they're allowed to use, same result
ij has quit [Read error: Connection reset by peer]
minijupe has joined #ruby
jimeh has joined #ruby
<bnagy>
if that doesn't work for some reason (the speeds could turn out to be very uneven, for some reason?) then I guess a shared locking system
faridplus has joined #ruby
<workmad3>
multiple queues? bleh
TPFC-SYSTEM has quit [Quit: TPFC-SYSTEM]
<salout>
I try to use alias_method (as suggested in the best practice ruby book), but it doesn't work for me :( stripped down example: http://pastie.org/4284278
<bnagy>
I think the shared locks are going to be just as fiddly
mahmoudimus has quit [Quit: Computer has gone to sleep.]
<bnagy>
cause you get a job from the one feed, find it's locked... now what?
tatsuya_o has quit [Remote host closed the connection]
oposomme is now known as oposomme|away
ananthakumaran has quit [Quit: Leaving.]
mdszy has quit [Quit: bye for now]
faridplus has left #ruby [#ruby]
<_bart>
queues could also hang
<workmad3>
only one job per domain can be run at a time?
bwlang_ has joined #ruby
<_bart>
and with multiple workers, like 4, then the other 3 workers can keep going
<_bart>
workmad3: yes
<workmad3>
in all honesty... not sure that's a good fit with a queue at that point...
<_bart>
workmad3: what structure do you suggest I use?
<bnagy>
it's definitely not a tidy fit
<_bart>
I have about 300 jobs per website/domain.
mahmoudimus has joined #ruby
<workmad3>
_bart: not sure... but queues work best when the jobs are properly independent
<workmad3>
_bart: it's almost a base assumption about the items in most queues
bwlang has quit [Ping timeout: 245 seconds]
Draco_ has quit [Ping timeout: 276 seconds]
bwlang_ is now known as bwlang
<_bart>
workmad3: or maybe write a plugin for resque that makes the workers smarter and maintain the 1 queue per domain structure?
<_bart>
but no idea what that'd look like
<workmad3>
_bart: it's still not a good fit, because you need to lock queues
<bnagy>
that's why I prefer one queue per worker
<bnagy>
not that I like any of the solutions so far
jgrevich has joined #ruby
baphled has joined #ruby
<workmad3>
_bart: out of curiosity... does it matter if the jobs for each domain get processed in a FIFO order?
<_bart>
nope, any order will do
<_bart>
so basically the idea is: n-amount of workers doing a random job for a specific domain
<workmad3>
_bart: hmm... it's almost becoming more of a lockable space than a queue
<_bart>
in a way that the delay does not get bypassed by two workers working for the same domain.
<workmad3>
_bart: wait... I thought you said only one job at a time per domain
<_bart>
because every job has a delay to prevent blocks / heavy load on the sites
<_bart>
oh sorry, multiple jobs, but not of the same domain!
jlogsdon has joined #ruby
<bnagy>
wait all you have to do is respect a delay?
<blazes816>
never used Redis, but it seems it'd be simple to store lists of jobs by domain, then use a mutex to lock that domain when a worker is doing a job.
<bnagy>
most of these architectures assume workers can be different processes / physical boxes
<_bart>
workmad3: all I see is problems :l
ckrailo has joined #ruby
<blazes816>
a mutex in the redis store
<workmad3>
_bart: that's because you've picked a big, gnarly problem :)
<_bart>
I just want it to be over, heh
<blazes816>
google.com: false, can't do anything. google.com: true, it's open
Stalkr_ has quit [Quit: Leaving...]
<blazes816>
lol
<bnagy>
_bart: if all you need to do is respect a per domain delay then you can just feed the queue with release_after X
<workmad3>
blazes816: yes... it's aquiring the lock that is problematic in a distributed system
mickn has quit [Quit: ERC Version 5.3 (IRC client for Emacs)]
<bnagy>
you could do that with beanstalkd with a sigle queue
<workmad3>
blazes816: distributed locking and distributed transactions aren't fun ;)
rbanffy_ has joined #ruby
<bnagy>
you'd need a smart feeder then though :/
<bnagy>
you could do the locking with something like zookeeper
<bnagy>
but it's still gross
yoklov has quit [Quit: computer sleeping]
<_bart>
maybe I should phrase this into a proper question and post it on stackoverflow
<workmad3>
_bart: also... if sometimes a job did violate the one-job-per-domain restriction, how would it be problematic?
<workmad3>
_bart: is this a soft-ish restriction, or an absolute, world ending must never happen?
freeayu has quit [Ping timeout: 260 seconds]
<_bart>
workmad3: heavy load on the website, will result into an IP block
davidcelis has quit [Ping timeout: 255 seconds]
maesbn has quit [Remote host closed the connection]
<_bart>
which is a world ending problem
<bnagy>
_bart: what's wrong with the solution(s) I mentioned, first? :)
uris has joined #ruby
<_bart>
your solution was to look at other systems rather than figure this out with resque, and I hope that is not required
<bnagy>
what? no
shahor- has quit [Quit: Leaving...]
<bnagy>
assuming reque has 'normal' queue sematics both approaches are completely generic
sepp2k1 has quit [Read error: Connection reset by peer]
<bnagy>
basically you either partition the work or you have workers that select only out of a partition
hoelzro is now known as hoelzro|away
<bnagy>
I prefer partitioning the work
yugui is now known as yugui_zzz
<bnagy>
how big are the job items, btw?
<bnagy>
you could also have an intermediate worker that trickle feeds a final work queue
ttilley is now known as ttilley_off
<bnagy>
like if each item is just a string an a short instruction, that should work
<bnagy>
makes that worker a spof, which may not be great
savage- has joined #ruby
Shahor has joined #ruby
jbw has quit [Ping timeout: 245 seconds]
Shahor has quit [Read error: Connection reset by peer]
Ontolog has quit [Quit: Ontolog]
bwlang has quit [Read error: Operation timed out]
bwlang has joined #ruby
Cache_Money has joined #ruby
Shahor has joined #ruby
wrapids has joined #ruby
apok has quit [Quit: apok]
Shahor has quit [Client Quit]
<wrapids>
What does redis.get(keyword) do if keyword=>nil (or doesn't exist?)?
Shahor has joined #ruby
<Muz>
There's an easy way to find out...
Shahor has quit [Client Quit]
<workmad3>
_bart: hmm, bnagy's idea of an intermediate worker isn't a bad idea... I could see that working (but with 3 queues :) )... queue one has all the jobs in feeding into a filter. filter has internally the state as to which domains are currently processable. if it draws off an item that is for an unprocessable domain, it feeds the item back into end of the main queue, otherwise it passes it to the process queue
<wrapids>
True
headius has joined #ruby
Shahor has joined #ruby
Morkel has quit [Quit: Morkel]
umttumt has joined #ruby
X-Jester has quit [Read error: Operation timed out]
<bnagy>
workmad3: well that's only 2 queues, really, no?
apeiros_ has joined #ruby
<workmad3>
_bart: it then locks the domain before reading the next item. your other workers then feed off the processable queue and, once they've finished, add a message onto a finished queue. Your filter can then also feed off the finished queue to unlock domains
iamjarvo has joined #ruby
<_bart>
hmm
<workmad3>
bnagy: I was still getting to the finished queue part ;)
<bnagy>
I don't like keeping that amount of critical stuff in a single worker, but it seems to work
<bnagy>
you don't need to unlock them
<workmad3>
bnagy: ah, it's just a delay is it?
<workmad3>
ok, that works nicely too
<bnagy>
your worker just has a hash of domains with can_process_after
eywu has joined #ruby
Cache_Money has quit [Ping timeout: 248 seconds]
<bnagy>
then it's either put back or let through and update can_process_after
<workmad3>
+1
<bnagy>
at least you can then have stupid workers again, and you get even distribution
<workmad3>
hmm... thinking about it, you could put the can_process_after into a distributed memcached store
<bnagy>
no good, cause locks
<bnagy>
and races
<workmad3>
ah, bleh good point
<_bart>
okay, well the intermediate worker sounds good
Rizzle has joined #ruby
<bnagy>
the trickle worker only works cause it holds /updates all the info
<workmad3>
yeah, true
<shevy>
hmm a package manager is a lot of work
<bnagy>
_bart: this doesn't guarantee only one worker per domain
<bnagy>
only 'only one start per x seconds'
<workmad3>
I guess if you have a lot of domains, you can scale out the trickle worker too
etehtsea has joined #ruby
<workmad3>
worker1 works with domain1, domain2 and domain3, and treats others as unprocessable, worker2 works with domain4, domain5 and domain6, same principle..
<bnagy>
well that was my first idea, without the trickle worker
<wrapids>
http://pastie.org/4284412 seems to be giving me create.rb:11:in `test': undefined local variable or method `redis'. It' was working just fine until I added test().
arkiver has quit [Quit: Leaving]
ananthakumaran has joined #ruby
<salout>
I changed my (not working) example to be more equal to the best practive book. It's still not working :( http://pastie.org/4284418
<bnagy>
wrapids: change all redis to @redis
<bnagy>
quick, dirty fix :<
<workmad3>
and you'd only really need to consider it if you had so many workers that your trickle worker couldn't keep them all filled (and not because all domains were unprocessable)
<wrapids>
Also, please ignore keyword in test() it's just a string at this point
<bnagy>
yeah I think it would be really weird if the trickle worker couldn't keep up
<workmad3>
_bart: I probably wouldn't suggest this as a redis plugin, you can do it with just workers
<bnagy>
like with only 4 workers, virtually no way that could happen
<workmad3>
bnagy: oh sure, with only 4 workers I'd be highly surprised
<wrapids>
Hrm, undefined method get in test
<workmad3>
bnagy: I was thinking of scaling out with hundreds or thousands of domains and workers :)
<bnagy>
anything with a remote website it ~50ms minimum, say
<_bart>
jobs can take 10 seconds
jbw has joined #ruby
<bnagy>
well if you had hundreds of thousands of domains then you could probably just use randomness :(
<workmad3>
bnagy: if there were still only 4 workers, sure
X-Jester has joined #ruby
<workmad3>
bnagy: hundreds of domains and hundreds of workers though... :)
<workmad3>
bnagy: still, that's hypothetical
<wrapids>
bnagy: I'm thinking that @redis didn't fix my issue. Line 11 in `test': undefined method `get' for nil:NilClass (NoMethodError)
<bnagy>
wrapids: you didn't change them all :)
chrisja has quit [Quit: leaving]
<wrapids>
bnagy: Yep, I did. All of them in the methods anyways. Should I change the redis = Redis.new also?
<bnagy>
that being part of 'all', yeah
<wrapids>
:D Mka y, connection error now. I can deal with that though.
<workmad3>
wrapids: welcome to the world of what does and doesn't create a closure in ruby :)
<wrapids>
a 'closusre'?
brianpWins has quit [Quit: brianpWins]
<wrapids>
Also, bnagy, say I wanted to google what you just did with those variables, what would I be looking for?
<salout>
Looks like my setter method in a block called with instance_eval gets interpreted as a local variable? How do I know this for sure?
<workmad3>
wrapids: yeah... that's the proper name for it... basically, 'redis = "whatever" ' creates a local variable, which only exists in a small scope
cantbecool has joined #ruby
<wrapids>
workmad3: It existed in all of the methods until I added the test method also.
<wrapids>
workmad3: I think anyways. Perhaps it was never called
<wrapids>
workmad3: Nevermind, I don't htink it was until now.
<workmad3>
wrapids: yeah, that's the issue ;)
<wrapids>
Cool stuff, thanks guys.
<workmad3>
salout: self.whatever = "value"
<workmad3>
salout: if you want to call a setter method on 'self' you always need to be explicit
<workmad3>
salout: otherwise ruby interprets it as a local variable instead
yonggu_ has quit [Remote host closed the connection]
arturas_ has quit [Ping timeout: 276 seconds]
<salout>
workmad3: http://pastie.org/4284418 – if my setter function doesn't have an equal sign an the end it seems to be no problem
benjammin891 has quit [Ping timeout: 264 seconds]
yonggu has joined #ruby
<workmad3>
salout: indeed it wouldn't
Ontolog has joined #ruby
<workmad3>
salout: because at that point, ruby can tell the difference between a method call and a local variable
<salout>
workmad3: This syntax "self.font_size = 12" looks very weird for me considering for usage in an API
<workmad3>
salout: however, with 'font_size = 12', ruby can't determine the difference between whether it should create the local variable, or call a setter method
<salout>
workmad3: so what's more common? Forget about the sign or the self. syntax?
<bnagy>
passing a block to new is not a DSL, it's just a bad api
benjammin891 has joined #ruby
<bnagy>
just initialize with a hash or options
<bnagy>
*of options
<workmad3>
also ^
<salout>
bnagy: I would like to make both possible
<bnagy>
Document.new font_size: 12
dankest has joined #ruby
<bnagy>
like... it's even cleaner
<bnagy>
and trivial to write
<workmad3>
salout: in all honesty... until you know the edge-cases for ruby's syntax, creating a DSL like you want will be difficult
<bnagy>
otherwise a DSLy way would be class MyDoc < Document; font_size 12; end
coderhut has joined #ruby
<bnagy>
but that takes class methods to set stuff up
<salout>
bnagy: passing blocks to constructors is demonstrated in ruby best practice (majesticseacreature.com/rbp-book/pdfs/rbp_1-0.pdf) page 32
tatsuya_o has joined #ruby
<bnagy>
and tbf is a lot of stuffing around
<salout>
tbf = ?
<workmad3>
to be frank?
<workmad3>
salout: also, don't always trust best practices from a book that's 3 years old
khakimov has joined #ruby
<workmad3>
salout: best practices change over time, due to shifts in style and as the community learns more about the techniques in use
<salout>
workmad3: I'm not an expert ruby programmer – what else would you suggest? I'm looking for a DSL-API guide.
<workmad3>
salout: I'd start with fowler's book 'Domain Specific Languages' so you get a grounding in the design issues in DSLs
<bnagy>
never heard of that book, but how does page 32 relate to what we're talking about?
mengu has quit [Quit: Konversation terminated!]
benson has joined #ruby
<bnagy>
like, he starts doing it properly, and making a class with hash options, like I just said
<bnagy>
then he goes insane and defines a method called Table
tomb_ has joined #ruby
philips_ has quit [Excess Flood]
Ontolog has quit [Quit: Ontolog]
<workmad3>
bnagy: in fairness, he does the more accepted way for a DSL method... he creates a standard class, and then layers a declarative API over the top for those that prefer that style
benjammin891 has quit [Ping timeout: 240 seconds]
<workmad3>
bnagy: and that book was from before the 1.9 hash syntax ;)
<bnagy>
yeah but I'm not seeing any classes being initialized with a block
<bnagy>
and I HATE that upperclass method name
<shevy>
hehe
<workmad3>
bnagy: yeah, it's a bit of a controversial topic that one :)
<salout>
bnagy: the generate-method gets a block and gets passed all way down to the initializer
<salout>
upperclass method name? what does it mean?
<workmad3>
bnagy: in a way, it makes sense, because it is sort of class-instantiation-ish, but on the other hand, as you say, upper-case method names feel... wrong :)
philips_ has joined #ruby
<workmad3>
salout: def Table <-- uppercase method name
<wrapids>
So get(nonexistent-keyword) returns nil?
davidcelis has joined #ruby
binaryplease has joined #ruby
cbuxton has joined #ruby
<workmad3>
salout: basically, don't start doing things like that until you are prepared to have half the community hate you for doing bad class-but-not-class things :)
maxmmurphy has joined #ruby
<bnagy>
salout: yeah but that block is, like, just a block
<bnagy>
it's nothing to do with the arguments for anything
yonggu_ has joined #ruby
davidw has quit [Ping timeout: 248 seconds]
mdszy has joined #ruby
<bnagy>
wrapids: I'd assume so, but didn't you just check? :)
apok has joined #ruby
Z_Mass has joined #ruby
<wrapids>
bnagy: Well, I ran it and got nothing. I'm assuming that would make it nil.
<bnagy>
do p @redis.get('xyzzy')
<wrapids>
bnagy: That's what I did.
<salout>
bnagy: don't think so. the idea is to use the setter and getter methods (page 69) in these blocks. At least I assumed this
<bnagy>
that will print the inspect value, should be 'nil' not blank
<wrapids>
p != puts?
<bnagy>
wrapids: no
<wrapids>
Ah.
wataken44 has quit [Remote host closed the connection]
<bnagy>
wrapids: people often say what they actually mean :)
wataken44 has joined #ruby
<wrapids>
bnagy: I had thought that I had read that it was a shorthand, which if it were a shorthand for puts, you wuold have said p and meant it.
<bnagy>
salout: ok well you and captain def Table() are on your own with your 3 year old syntax
<wrapids>
And it does in fact = nil.
<bnagy>
\o/
<bnagy>
nils have been isolated!
<workmad3>
woo! cache miss detected!
beneggett has quit [Ping timeout: 264 seconds]
TheHypnotist- has quit [Ping timeout: 246 seconds]
umttumt has quit [Remote host closed the connection]
harcher has quit [Ping timeout: 252 seconds]
<salout>
bnagy: don't get me wrong. I'm glad for any advise on how to write modern code. I just wanted to mention why I came up with these ideas
savage- has quit [Remote host closed the connection]
<bnagy>
ok well my advice is, the example you have should go Document.new font_size: 12
<workmad3>
salout: don't trust that everything you read in books is correct ;)
aganov has quit [Quit: aganov]
iamjarvo has quit [Ping timeout: 255 seconds]
codespectator has quit [Ping timeout: 255 seconds]
uris has quit [Read error: Connection reset by peer]
Beoran_ has quit [Read error: Connection reset by peer]
beneggett has joined #ruby
ackz has joined #ruby
TheHypnotist- has joined #ruby
Spooner has quit [Ping timeout: 245 seconds]
<workmad3>
salout: also, take into account context... I find Document.new do...end quite ugly as a setup block, however 'document do; font_size 12;...end' might be a nice layer
<workmad3>
salout: however, I wouldn't necesarily make the processing of that a part of Document, I'd probably do something like 'def document(&blk); d = Document.new; d.instance_eval(&blk); d; end' as my 'DSL' :)
bluOxigen has quit [Ping timeout: 255 seconds]
baroquebobcat has joined #ruby
<salout>
:)
<workmad3>
salout: the important thing is that I shouldn't be confronted with that dsl layer unless I want it :)
iamjarvo has joined #ruby
gilead has quit [Quit: This computer has gone to sleep]
tatsuya_o has quit [Remote host closed the connection]
<workmad3>
salout: and in all honesty, it shouldn't be an initial focus... you can add DSL layers on really easily in ruby, and do it in ways that don't pollute your main classes
zrail_ has joined #ruby
<apeiros_>
salout/workmad: random recommendation with regards to DSLs: I like having dedicated DSL classes. it makes it very easy to properly document the available methods in the DSL
kenichi has joined #ruby
zrail has quit [Ping timeout: 252 seconds]
<workmad3>
salout: so you should get your library working, and then spend some time considering if a) a DSL is really necessary, b) how it should look and c) how can I layer it on non-intrusively
ukd1 has joined #ruby
tatsuya_o has joined #ruby
codespectator has joined #ruby
ukd1 is now known as Guest19916
harcher has joined #ruby
<workmad3>
apeiros_: yeah, I've seen and appreciate that approach now :) a DSL module is also a good approach
<workmad3>
apeiros_: like capybara gives you... get the DSL by doing an 'include Capybara::DSL' in the class you want to have DSL access in
Guest33712 is now known as Jackneill
zrail_ has left #ruby [#ruby]
Jackneill has quit [Changing host]
Jackneill has joined #ruby
eywu has quit [Quit: Leaving.]
uris has joined #ruby
rizzy_work has joined #ruby
<apeiros_>
workmad3: for universally accessible DSLs - totally
<apeiros_>
or even shared dsl's
<apeiros_>
e.g. in my EWS lib, I have a build_soap helper in a module
vlad_starkov has joined #ruby
<workmad3>
salout: I repeat my original recommendation though... for a good grounding in the considerations in DSLs, I'd recommend starting with fowlers DSLs book rather than trying to pick it up from a smaller book that treats it as an almost side note
kevinbond has joined #ruby
mahmoudimus has quit [Quit: Computer has gone to sleep.]
bwlang_ has joined #ruby
ttilley_off is now known as ttilley
<Guest19916>
exit
Guest19916 has quit [Quit: Lost terminal]
dhruvasagar has quit [Ping timeout: 260 seconds]
lorandi has quit [Quit: Leaving]
uris has quit [Ping timeout: 248 seconds]
bwlang has quit [Ping timeout: 248 seconds]
bwlang_ is now known as bwlang
vlad_starkov has quit [Ping timeout: 264 seconds]
banisterfiend has quit [Ping timeout: 260 seconds]
banisterfiend has joined #ruby
Draco_ has joined #ruby
ephemerian has quit [Quit: Leaving.]
brianpWins has joined #ruby
adeponte has quit [Remote host closed the connection]
Beoran_ has joined #ruby
binaryplease has quit [Quit: WeeChat 0.3.8]
carloslopes has joined #ruby
Ontolog has joined #ruby
axl__ has joined #ruby
verto|off is now known as verto
axl_ has quit [Ping timeout: 276 seconds]
axl__ is now known as axl_
Draco___ has joined #ruby
whitedawg has joined #ruby
ianbrandt has joined #ruby
Fretta has joined #ruby
Draco_ has quit [Ping timeout: 276 seconds]
robozahn_ has quit [Ping timeout: 265 seconds]
artOfWar has joined #ruby
mdpatrick has joined #ruby
Jay_Levitt has joined #ruby
verto is now known as verto|off
schaerli has joined #ruby
ttilley is now known as ttilley_off
shadoi has quit [Quit: Leaving.]
yankhates has joined #ruby
salout has quit [Ping timeout: 264 seconds]
headius has quit [Quit: headius]
artOfWar_ has joined #ruby
nopper` is now known as nopper
banghouse has joined #ruby
baphled has quit [Ping timeout: 245 seconds]
luckyruby has quit [Remote host closed the connection]
headius has joined #ruby
mahmoudimus has joined #ruby
eywu has joined #ruby
TPFC-SYSTEM has joined #ruby
blumbri has joined #ruby
tayy_ has quit [Remote host closed the connection]
tommyvyo has joined #ruby
savage- has joined #ruby
artOfWar has quit [Ping timeout: 240 seconds]
Tomasso has quit [Ping timeout: 248 seconds]
beneggett has quit [Ping timeout: 260 seconds]
<_bart>
anybody knows of good mind mapping / data structure visualisation software/website
cantbecool has quit [Quit: Computer has gone to sleep.]
<sernin>
Freemind
_root_ has quit []
bwlang_ has joined #ruby
Berglund has quit [Quit: Computer died.]
bricker88 has joined #ruby
_root_ has joined #ruby
sonkei has quit [Quit: WeeChat 0.3.8]
bwlang has quit [Ping timeout: 252 seconds]
bwlang_ is now known as bwlang
deryl has quit [Quit: deryl]
beneggett has joined #ruby
<shevy>
I want to combine ruby with sex
Criztian has quit [Read error: Connection reset by peer]
<lectrick>
isn't it already?
Criztian has joined #ruby
<lectrick>
I could probably try to arrange something with the gf
wrapids has left #ruby ["Konversation terminated!"]
tuxillo has joined #ruby
<tuxillo>
hi
<tuxillo>
what do I use for checking whether a string is in another string?
<shevy>
lectrick: dunno, often I find ruby much harder. especially, when there are things going on in many different methods... this kind of complexity confuses my brain still :(
maletor has joined #ruby
_bart has quit [Ping timeout: 276 seconds]
<tuxillo>
.include?
uris has joined #ruby
<lectrick>
JonnieCache: The reason why it's still bugging me is that I see this massive separation between the "creator class" and the "consumer class", which should NOT be there, and I'm realizing that the creatives insist on an environment with elements of that TAZ, while the "consumer class" is somehow stuck in a "learned helplessness" state where they deal with someone else having total control at all ti
<lectrick>
mes
<lectrick>
So basically, schools are all wrong
tehdekan has quit [Ping timeout: 245 seconds]
<blazes816>
lectrick: only if you believe their goal is to instill education
etehtsea has quit []
beneggett has quit [Ping timeout: 252 seconds]
Ethan has quit [Ping timeout: 252 seconds]
<blazes816>
tuxillo: yes, #include?
mahmoudimus has quit [Quit: Computer has gone to sleep.]
<tuxillo>
:D
<lectrick>
blazes816: Ideally, yes, but yeah, I know it's mostly just a "glorified prison for kids while their parents have to work"
<tuxillo>
yeah, i come from C, how do you know
<tuxillo>
:P
QaDeS has joined #ruby
<blazes816>
lol
wallerdev has joined #ruby
knightblader has quit [Quit: WeeChat 0.3.8]
bradhe has joined #ruby
Z_Mass has quit [Ping timeout: 276 seconds]
beneggett has joined #ruby
timonv has quit [Remote host closed the connection]
benjammin891 has joined #ruby
bwlang_ has joined #ruby
zommi has quit [Remote host closed the connection]
lucasicf has joined #ruby
carloslopes has quit [Remote host closed the connection]
uris has quit [Ping timeout: 252 seconds]
voodoofish430 has joined #ruby
baphled has joined #ruby
lucasicf has left #ruby [#ruby]
minijupe has quit [Quit: minijupe]
<shevy>
lol
kevinfagan has quit [Quit: Leaving...]
bluenemo has quit [Read error: Connection reset by peer]
<lectrick>
Startups should have an unlimited-vacation policy.
ringotwo has joined #ruby
bwlang has quit [Ping timeout: 264 seconds]
bwlang_ is now known as bwlang
<lectrick>
(I've heard of some that do.)
kevinbond has left #ruby [#ruby]
<shevy>
tuxillo: careful with ruby, too much ruby and C won't look as fun anymore. "string_object".include? 'st' # => true
k_89 has quit [Ping timeout: 276 seconds]
<shevy>
startsups should have a no-work policy :)
<blazes816>
lectrick: man, I'd settle for a paycheck and bart pass
<shevy>
hmm one s toom any
<lectrick>
shevy: Well, since they have an almost-no-pay policy, that wouldn't be half bad lol
<tuxillo>
shevy: why not? :D
<Hanmac>
C and C++ are only preys to make ruby faster
<blazes816>
Hanmac: it's why Ritchie invented it
<lectrick>
blazes816: Many would, and personally, I'm glad I have those now. But I wouldn't trade my startup experiences for anything, even the pay I missed out on in a lump sum delivered to me right now :)
maxmmurphy_ has joined #ruby
villainous has joined #ruby
<blazes816>
yeah, i'm stuck at Cisco and excited to find a more, eh, "agile" place
j| has joined #ruby
SCommette has joined #ruby
bier has quit [Remote host closed the connection]
hadees has joined #ruby
xaq has joined #ruby
bier has joined #ruby
maxmmurphy has quit [Ping timeout: 276 seconds]
maxmmurphy_ is now known as maxmmurphy
villainous has quit [Client Quit]
carloslopes has joined #ruby
lorandi has joined #ruby
ttilley_off is now known as ttilley
Draco_ has joined #ruby
Z_Mass has joined #ruby
workmad3 has quit [Ping timeout: 240 seconds]
chienpo has joined #ruby
Draco___ has quit [Ping timeout: 276 seconds]
adeponte has joined #ruby
bwlang_ has joined #ruby
adamkittelson has joined #ruby
pfrost has left #ruby [#ruby]
khakimov has quit [Quit: Computer has gone to sleep.]
bburton has quit [Disconnected by services]
crankycoder has quit [Remote host closed the connection]
crankycoder has joined #ruby
wagle has quit [Ping timeout: 265 seconds]
Berglund has joined #ruby
Kabaka has quit [Ping timeout: 276 seconds]
bwlang has quit [Ping timeout: 245 seconds]
bwlang_ is now known as bwlang
shadoi has joined #ruby
ramblex has quit [Ping timeout: 260 seconds]
JohnBat26 has quit [Ping timeout: 252 seconds]
khakimov has joined #ruby
Stalkr_ has joined #ruby
awayy is now known as yy
Zespre_ has joined #ruby
Zespre has quit [Ping timeout: 265 seconds]
vlad_starkov has joined #ruby
mwilson_ has quit [Excess Flood]
drbawb has joined #ruby
<drbawb>
ux
mwilson_ has joined #ruby
drbawb has left #ruby ["WeeChat 0.3.7"]
GarethAdams has quit [Quit: Leaving...]
bbttxu has quit [Read error: Connection reset by peer]
bbttxu_ has joined #ruby
bbttxu_ is now known as bbttxu
mikeric has quit [Quit: mikeric]
vlad_starkov has quit [Ping timeout: 260 seconds]
Erdon has joined #ruby
eywu has quit [Quit: Leaving.]
vlad_starkov has joined #ruby
bwlang_ has joined #ruby
blumbri has quit [Read error: Connection reset by peer]
<shevy>
tuxillo: because ruby is more efficient in terms of getting things done than C
ckrailo has quit [Remote host closed the connection]
blumbri has joined #ruby
banghouse has quit [Read error: Connection reset by peer]
banghouse has joined #ruby
kevinfagan has joined #ruby
bwlang has quit [Ping timeout: 248 seconds]
bwlang_ is now known as bwlang
<eam>
shevy: depends on what you're doing
mwilson_ has quit [Excess Flood]
blazes816 has quit [Quit: Leaving]
mwilson_ has joined #ruby
<shevy>
if it can be done in ruby, ruby beats C
ckrailo has joined #ruby
Kabaka has joined #ruby
brianpWins has quit [Quit: brianpWins]
crankycoder has quit [Remote host closed the connection]
tatsuya_o has quit [Remote host closed the connection]
kaspernj_ has quit [Quit: Leaving]
leoncamel has joined #ruby
apok has quit [Remote host closed the connection]
apok has joined #ruby
Rochefort has joined #ruby
eywu has joined #ruby
jgrevich_ has joined #ruby
mlue has joined #ruby
Rochefortes has quit [Ping timeout: 276 seconds]
k_89 has joined #ruby
itnomad has joined #ruby
TheShadowFog has joined #ruby
jgrevich has quit [Ping timeout: 248 seconds]
jgrevich_ is now known as jgrevich
mrdodo has joined #ruby
Kabaka has quit [Ping timeout: 276 seconds]
cmaujean_ has joined #ruby
hunglin has quit [Quit: Leaving.]
luckyruby has joined #ruby
Rochefort has quit [Remote host closed the connection]
cmaujean has quit [Ping timeout: 276 seconds]
cmaujean_ is now known as cmaujean
GoGoGarrett has quit [Remote host closed the connection]
<moos3>
anyone user openssl library that built into ruby
GoGoGarrett has joined #ruby
k_89 has quit [Ping timeout: 276 seconds]
GarethAdams has joined #ruby
BiHi has quit [Quit: Computer has gone to sleep]
chrisja has joined #ruby
JStoker has quit [Excess Flood]
wmoxam_ has joined #ruby
yoklov has joined #ruby
<Tasser>
shevy, you wouldn't want to access raw hardware with C
<shevy>
linoj: most rails guys are on #rubyonrails
<linoj>
haha, this is a ruby question
tehdekan has joined #ruby
<otters>
yeah, that looks fine to me
<otters>
and you haven't told us what the error is or anything
<otters>
so I got nothing
<tompsony>
otters why do not you answer me?
<linoj>
the block gets executed but the "it" is always nil
<otters>
well you'll have to follow the execution path then
k_89 has joined #ruby
<tompsony>
I'm being ignored
<tompsony>
;/
<shevy>
you were not nice to otter
<shevy>
you must cuddle them first
<shevy>
linoj: well you wrote "rails helper". usually, when it is a helper library for rails, it means it follows some insane pattern
<yxhuvud>
I suppose you can wrap the block in a block and yield inside the block. Dunno if there is any cleaner solutions. You'd have to look at with_output_buffer for that
KL-7 has joined #ruby
wrapids has joined #ruby
<linoj>
i have traced into it, and as i said, the variable "it" is nil,
<linoj>
so i figured that i was making incorrect assumptions about ruby blocks
<otters>
linoj: with_output_buffer is responsible for providing the block with a variable
<otters>
so ask with_output_buffer what it's doing
Markvilla has quit [Ping timeout: 260 seconds]
<linoj>
ok thx
cbetta_ has joined #ruby
<wrapids>
I'm using split to parse some strings, the strings are extremely variated and sometimes I end up with nil values. An example of the method used: http://pastie.org/4285575 . What should I do to fix this problem?
<yxhuvud>
linoj: what assumptions did you make? I can see no way whatsoever that should work.
itnomad has quit [Quit: Leaving]
<linoj>
tough room
tompsony has quit [Quit: CyberScript - not made by microsoft (www.cyberscript.org)]
<wrapids>
Or rather, I end up with values not being created, as of such split on these non existent values throws an exception.
cbetta_ is now known as cbetta
ryanf has joined #ruby
knyar has left #ruby [#ruby]
und3f has quit [Quit: Leaving.]
niklasb is now known as tom_b
monkegjinni has joined #ruby
lorandi has joined #ruby
<sernin>
wrapids: exception handling -- your parser will need to be inside a begin/rescue/end block for you to catch and process the nil values
c0rn_ has joined #ruby
<Mon_Ouie>
No, check for nil at the beginning of the method
crankycoder has joined #ruby
crankycoder has quit [Remote host closed the connection]
<sernin>
...or that.
<Mon_Ouie>
Exception is for exceptional cases — if nil is a valid input, it's not exceptional
sei has quit [Quit: It's too late. You've awakened the gazebo. It catches and eats you.]
nu7hatch has left #ruby [#ruby]
bbttxu has joined #ruby
<wrapids>
So I'm basically going to need to test each of the splits for validitywith if != nil?
coderhut has quit [Ping timeout: 245 seconds]
<Mon_Ouie>
I'd do all of it with a single regular expression
krusty_ar has quit [Read error: Connection reset by peer]
<coyo>
whoooo! my bot works! now, to add functionality to it!
<yxhuvud>
either what Mon said or to create partial results instead of repeating yourself all over the place.
pdtpatrick has joined #ruby
fris has joined #ruby
krusty_ar has joined #ruby
<wrapids>
Mon_Ouie: There are varying degrees of what I have to check for. I couldn't test it with one regex
<Mon_Ouie>
Well the method you currently have *can* be implemented with a regex
yonggu_ has quit [Ping timeout: 255 seconds]
<wrapids>
Mon_Ouie: Oh?
<wrapids>
Mon_Ouie: I'll look into it
crankycoder has joined #ruby
<Mon_Ouie>
Just use five capture groups in the right places
mjb2k has joined #ruby
<sernin>
wrapids: rubular.com may be of help to you.
yonggu has joined #ruby
enherit has joined #ruby
workmad3 has joined #ruby
friskd has quit [Quit: friskd]
jackhammer2022 has quit [Quit: Computer has gone to sleep.]
<yxhuvud>
just remember that just because something *can* be implemented in a single regexp doesn't mean it is the clearest way to do it.
kirun has joined #ruby
k_89 has quit [Ping timeout: 248 seconds]
DrShoggoth has joined #ruby
bwlang has quit [Read error: Connection reset by peer]
tom_b is now known as tomx
jrist-afk is now known as jrist
DukeDave has joined #ruby
<DukeDave>
Can someone suggest an elegant way of create a hash of (a subset of) an objects attrs?
<DukeDave>
I'd like to do something like obj.to_hash(only: [:foo, :bar])
<wmoxam_>
now I'm super confused. But happy that this problem is resolved
<werdnativ>
if I do "extend self" in a module, is that supposed to make it available as class methods wherever it's included?
zommi has quit [Remote host closed the connection]
<yxhuvud>
werdnativ: no, it makes them available on the module itself.
<werdnativ>
or do I need to def self.included ?
<Mon_Ouie>
werdnativ: Also so module_function
<Mon_Ouie>
also see*
Z_Mass has quit [Ping timeout: 240 seconds]
<werdnativ>
yxhuvud: not sure I follow, regular def methods are available on the module itself.
<Mon_Ouie>
wmoxam_: That's what I remembered from when I was using it too. Maybe they changed it in newer versions?
wrapids has left #ruby ["Konversation terminated!"]
<werdnativ>
MonOuie, thanks for that. looks like what I need, but I guess it needs to be set for each method.
mengu has joined #ruby
jonathanwallace has joined #ruby
davejacobs has joined #ruby
Z_Mass has joined #ruby
Berglund has quit [Quit: Computer died.]
wrapids has joined #ruby
<Mon_Ouie>
No, module_function is just a better way of doing the self.extended thing — include and extend still only add the instance methods of the module
wrapids has left #ruby ["Konversation terminated!"]
Berglund has joined #ruby
masterkaen has quit [Quit: Leaving]
<wmoxam_>
Mon_Ouie: maybe. I am using 1.3
kaen has joined #ruby
eph3meral has joined #ruby
<werdnativ>
wherever I include NilObject::Confidence I expect it to have those methods on SomeObject and SomeObject.new, not sure why "extend self" isn't working here: https://gist.github.com/3146317
<eph3meral>
so, i've been googling for a while, and experimenting with capybara, what are some common/good approaches for integration testing of backbone apps?
<eph3meral>
or, even just "unit" testing for that matter
<DukeDave>
kalleth: Nice, thanks!
nanderoo has quit [Quit: Leaving.]
<ohcibi>
i installed a gem with bundle install --local --path vendor from vendor/cache, than i removed vendor/ruby/1.9.1/path/to/gem and vendor/cache/gem.gem. i copied the *.gem-file manually to vendor/cache, when i now run bundle install with the gem in the Gemfile it copys back the *.gem-file magically... how is this happen and how can i get rid of this gem??
DukeDave has left #ruby [#ruby]
rekenerd has joined #ruby
headius has joined #ruby
monkegjinni has quit [Remote host closed the connection]
CannedCorn has joined #ruby
JohnBat26 has quit [Ping timeout: 248 seconds]
monkegjinni has joined #ruby
brianpWins has joined #ruby
strife25 has quit [Ping timeout: 276 seconds]
chrismdp has left #ruby [#ruby]
minijupe has joined #ruby
banseljaj is now known as imami|afk
iamjarvo has quit [Read error: Operation timed out]
kaspernj has joined #ruby
davejacobs has quit [Ping timeout: 245 seconds]
robozahn has joined #ruby
mjb2k has quit [Quit: Leaving.]
Dreamer3 has joined #ruby
jonatha__ has joined #ruby
Tomasso has joined #ruby
schaerli has quit [Ping timeout: 248 seconds]
<shevy>
that's a good question for the guys on #bundler
kaspernj has quit [Client Quit]
jonathanwallace has quit [Ping timeout: 255 seconds]
c0rn_ has quit [Quit: Computer has gone to sleep.]
mneorr has joined #ruby
tatsuya__ has joined #ruby
andrewhl has joined #ruby
maletor has quit [Ping timeout: 252 seconds]
c0rn_ has joined #ruby
cousine has joined #ruby
cousine has quit [Remote host closed the connection]
maletor has joined #ruby
mjb2k has joined #ruby
geekbri has quit [Remote host closed the connection]
tatsuya_o has joined #ruby
headius has quit [Quit: headius]
saschagehlich has quit [Quit: saschagehlich]
krang has joined #ruby
indian has joined #ruby
indian has quit [Changing host]
indian has joined #ruby
jonatha__ has quit [Remote host closed the connection]
tatsuya__ has quit [Ping timeout: 248 seconds]
fantazo has joined #ruby
rekenerd has quit [Quit: Leaving]
strife25 has joined #ruby
MasterIdler_ has joined #ruby
tatsuya__ has joined #ruby
tatsuya_o has quit [Read error: Connection reset by peer]
yxhuvud has quit [Ping timeout: 255 seconds]
mwilson_ has quit [Excess Flood]
deryl has joined #ruby
Neurotiquette has joined #ruby
mwilson_ has joined #ruby
mjbamford has joined #ruby
mdpatrick has quit [Ping timeout: 260 seconds]
Neurotiquette is now known as mdpatrick
mdpatrick has quit [Client Quit]
SCommette has joined #ruby
ReTFEF has joined #ruby
jonathanwallace has joined #ruby
SCommette_ has quit [Ping timeout: 276 seconds]
TheTFEF has quit [Ping timeout: 240 seconds]
procrastination is now known as tomx
jeedey has quit [Quit: No Ping reply in 180 seconds.]
williamcotton has quit [Ping timeout: 276 seconds]
williamcotton_ is now known as williamcotton
jonatha__ has joined #ruby
<Tasser>
yet another botnet? ^^
kirun has joined #ruby
Poapfel has joined #ruby
<coyo>
Tasser: havent built a bot net, yet.
<coyo>
just a basic bot.
jonathanwallace has quit [Ping timeout: 260 seconds]
<Mon_Ouie>
Writting an IRC bot is a common (and nice IMO) exercise to learn programming
<Mon_Ouie>
Or practice it
ryanf has quit [Quit: leaving]
enherit has quit [Quit: leaving]
<coyo>
Mon_Ouie: you are far from the only one to believe that, and suggest it to me. Most of my friends suggested that I start with an IRC bot because it's easy and fun.
davidw has joined #ruby
<shevy>
I started that too
davidw is now known as Guest53736
<shevy>
now my goal is to provide standalone IRC components as gems.
<shevy>
I have not progressed much with that ... :\
<shevy>
my first IRC bot in ruby used to work, then years later I somehow broke it and then was too lazy to fix it
gtuckerkellogg has joined #ruby
Guest53736 is now known as davidw
davidw has quit [Changing host]
davidw has joined #ruby
bluenemo has quit [Remote host closed the connection]
aaroncm has joined #ruby
<shevy>
what is also hard is to write a game in ruby
axl__ has joined #ruby
<coyo>
shevy: i'm tempted to roll a rubygem for IRC protocol with a documented API and everything, for practice.
jlogsdon_ has quit [Remote host closed the connection]
jonathanwallace has joined #ruby
jlogsdon has joined #ruby
axl_ has quit [Ping timeout: 245 seconds]
axl__ is now known as axl_
<shevy>
cool
jonatha__ has quit [Ping timeout: 252 seconds]
strife25 has quit [Quit: Computer has gone to sleep.]
<coyo>
yup
Dreamer3 has quit [Quit: Computer has gone to sleep.]
workmad3 has joined #ruby
mucker has quit [Quit: leaving]
beginner_42 has quit [Quit: leaving]
v0n has quit [Ping timeout: 245 seconds]
workmad3 has quit [Ping timeout: 240 seconds]
s0ber_ has joined #ruby
khakimov has quit [Quit: Computer has gone to sleep.]
linoj has quit [Ping timeout: 240 seconds]
Berglund has quit [Quit: Computer died.]
robozahn has quit [Ping timeout: 265 seconds]
s0ber has quit [Ping timeout: 246 seconds]
timonv has quit [Remote host closed the connection]
s0ber_ is now known as s0ber
philips_ has quit [Excess Flood]
Ethan has joined #ruby
v0n has joined #ruby
SphericalCow has quit [Quit: Leaving]
<otters>
is it possible to define an extended regex that should match a space character?
S3kx has joined #ruby
SCommette_ has joined #ruby
philips_ has joined #ruby
Criztian_ has joined #ruby
<blazes816>
otters: what do you mean "extended regex"? " ".match? /\s/
<otters>
no, like //x
<Mon_Ouie>
Yes, you can escape spaces
<otters>
and I can just use \x20
<Mon_Ouie>
\
<otters>
or \
<otters>
okay
SCommette has quit [Ping timeout: 260 seconds]
<Mon_Ouie>
\s is not the same, it matches *whitespaces*
mafs has quit [Ping timeout: 244 seconds]
tehdekan has quit [Quit: BitchX: it's not for the tabkey impaired!]
<otters>
yeah, I know
<otters>
that's why I asked
<blazes816>
I think he's telling me
<otters>
oh
<otters>
heh
Criztian has quit [Ping timeout: 260 seconds]
zastaph has quit [Ping timeout: 260 seconds]
S2kx has quit [Ping timeout: 260 seconds]
dhruvasagar has quit [Ping timeout: 255 seconds]
wrapids has joined #ruby
mpereira has quit [Ping timeout: 240 seconds]
Guest68799 has joined #ruby
xaq has quit [Read error: Connection reset by peer]
vlad_starkov has quit [Remote host closed the connection]
<Mon_Ouie>
luckyruby: You need to set the $LOAD_PATH right
cespare has joined #ruby
Ethan has quit [Quit: *poof*]
mrsolo has joined #ruby
Ethan has joined #ruby
<Mon_Ouie>
If that code is a gem, you should let rubygems handle it; if it's just your standalone app, you should set it up at the beginning of your executable file
<luckyruby>
i see
<luckyruby>
just added $LOAD_PATH.unshift(File.dirname(__FILE__)) and seems to work now
<Mon_Ouie>
Yep, that should be right
PaciFisT has quit [Quit: Leaving.]
`brendan has quit [Quit: - nbs-irc 2.39 - www.nbs-irc.net -]
Ontolog has joined #ruby
the_jeebster has quit [Quit: Leaving.]
wedgeV has joined #ruby
bosphorus has quit [Remote host closed the connection]
KL-7 has quit [Quit: Leaving]
benjammin891 has joined #ruby
jgrevich_ has joined #ruby
tomx has quit [Ping timeout: 245 seconds]
bbttxu has quit [Quit: bbttxu]
mneorr has joined #ruby
seatea has quit []
alanp_ has joined #ruby
balki_ has joined #ruby
alanp_ has quit [Read error: Connection reset by peer]
balki_ has quit [Read error: Connection reset by peer]
Criztian_ has quit [Remote host closed the connection]
alanp_ has joined #ruby
balki_ has joined #ruby
GoGoGarrett has quit [Remote host closed the connection]
jgrevich has quit [Ping timeout: 240 seconds]
jgrevich_ is now known as jgrevich
jackhammer2022 has quit [Quit: Computer has gone to sleep.]
jsime has quit [Quit: Leaving]
iamjarvo has joined #ruby
balki has quit [Ping timeout: 264 seconds]
alanp has quit [Ping timeout: 264 seconds]
jarred_ has joined #ruby
darren_ has joined #ruby
akem has quit [Ping timeout: 264 seconds]
chrisja has quit [Quit: leaving]
minijupe has quit [Quit: minijupe]
tatsuya_o has quit [Remote host closed the connection]
bigkevmcd has joined #ruby
wedgeV has quit [Quit: wedgeV]
aaroncm has quit [Quit: Computer has gone to sleep.]
wedgeV has joined #ruby
jxf has quit [Ping timeout: 248 seconds]
mjbamford has quit [Quit: Leaving...]
hunglin has joined #ruby
billiam has quit [Quit: Leaving]
hunglin has left #ruby [#ruby]
c0rn_ has quit [Quit: Computer has gone to sleep.]
Spooner has joined #ruby
MasterIdler_ has quit [Quit: MasterIdler_]
phinfonet has joined #ruby
mpereira has joined #ruby
c0rn_ has joined #ruby
jackhammer2022 has joined #ruby
oscardelben has joined #ruby
nacengineer has quit [Quit: Leaving.]
rbanffy_ has quit [Quit: Ex-Chat]
hydrozen has quit [Quit: Computer has gone to sleep.]
mpereira_ has joined #ruby
awarner has quit [Remote host closed the connection]
icy` has quit [Ping timeout: 246 seconds]
Dreamer3 has joined #ruby
bwlang_ has joined #ruby
chson_ has quit [Remote host closed the connection]
axl_ has quit [Quit: axl_]
c0rn_ has quit [Quit: Computer has gone to sleep.]
Draco_ has joined #ruby
ppawel has quit [Ping timeout: 248 seconds]
justsee has joined #ruby
mpereira has quit [Quit: leaving]
mpereira_ has quit [Quit: leaving]
robbyoconnor has quit [Read error: Connection reset by peer]
mpereira has joined #ruby
hadees has quit [Quit: hadees]
GarethAdams has quit [Quit: Leaving...]
davidw has quit [Ping timeout: 240 seconds]
mdszy has joined #ruby
bwlang_ has quit [Quit: bwlang_]
awarner has joined #ruby
dhodgkin has joined #ruby
jxf has joined #ruby
uinomu has joined #ruby
undeclaredx has quit [Ping timeout: 240 seconds]
robbyoconnor has joined #ruby
xaq_ has quit [Remote host closed the connection]
MatthewGA has quit [Quit: Leaving]
awarner has quit [Remote host closed the connection]
jarred_ has quit [Ping timeout: 255 seconds]
fantazo has quit [Read error: Connection reset by peer]
mpereira has quit [Remote host closed the connection]
stringoO has quit [Quit: stringoO]
QaDeS has quit [Quit: Ex-Chat]
jarred has joined #ruby
jgarvey has quit [Quit: Leaving]
strcrzy has quit [Read error: Connection reset by peer]
bluenemo has joined #ruby
bluenemo has quit [Changing host]
bluenemo has joined #ruby
strcrzy has joined #ruby
Adran has quit [Read error: Operation timed out]
Reindeernix has joined #ruby
icy` has joined #ruby
Synthead has quit [Read error: Operation timed out]
icy` has quit [Changing host]
icy` has joined #ruby
oddmunds has quit [Read error: Operation timed out]
denstark has quit [Read error: Operation timed out]
schwap has quit [Read error: Operation timed out]
ged has quit [Read error: Connection reset by peer]
mpereira has joined #ruby
Reindeernix has quit [Read error: Connection reset by peer]
ged has joined #ruby
oddmunds has joined #ruby
<uinomu>
hello, this question has been asked millions of times before, still i think #ruby's opinion might be reliable; what is the "best" free book/guide/... for someone with sufficient OO/functional knowledge and experience?
<shevy>
uinomu: learn to program by chris pine. but it wont be large for you. pickaxe will be second best
burgalon has joined #ruby
<shevy>
but ultimately, the only real way to learn ruby is to write scripts and "think" in it
wmoxam_ has quit [Quit: leaving]
Adran has joined #ruby
<uinomu>
shevy: i do not want to waste time on skipping sections on general OO concepts/data types etc.
c0rn_ has joined #ruby
c0rn_ has quit [Client Quit]
burgalon has left #ruby [#ruby]
<uinomu>
shevy: sure, but it is necessary to be told how to standard lib is structured, how important classes are, how importing/packaging/modules work, how the language is structured internally(are certain elements objects themselves etc.)
<uinomu>
also most of the books seem to mix rails and ruby
<shevy>
and the pickaxe gives sufficient background for ruby
ringotwo has quit [Read error: Connection reset by peer]
thebananaskin has left #ruby ["Leaving"]
<shevy>
it has the whole stdlib in the appendix, like 300 pages all for that, with examples and explanations
benjammin891 has quit [Ping timeout: 248 seconds]
<shevy>
and 700 or 800 pages in total or something like that
ringotwo has joined #ruby
<shevy>
(I no longer need it, I kinda keep my own documentation locally)
kirun has quit [Quit: Client exiting]
kvirani has quit [Remote host closed the connection]
mneorr has quit [Quit: Leaving.]
etehtsea has quit []
bluenemo has quit [Remote host closed the connection]
Draco___ has joined #ruby
<uinomu>
ok, that seems to correspond to my general impression; i'll just dive right into it; that should be the most efficient thing; in case i come across other rookie questions i feel free to ask here
<uinomu>
shevy: thanks
Draco_ has quit [Ping timeout: 246 seconds]
tommyvyo has joined #ruby
jonathanwallace has quit [Remote host closed the connection]
ZachBeta has quit [Quit: Computer has gone to sleep.]
Nies has quit [Remote host closed the connection]
SCommette_ has quit [Quit: SCommette_]
mdszy has quit [Quit: foods]
jlogsdon has quit [Remote host closed the connection]
bowlowni has quit [Remote host closed the connection]
stephenjudkins has joined #ruby
kpshek has quit []
ken_barber has quit [Remote host closed the connection]
bglusman has joined #ruby
iamjarvo has quit [Quit: Computer has gone to sleep.]
cpruitt has quit [Quit: cpruitt]
emmanuelux has joined #ruby
yugui_zzz is now known as yugui
Draco_ has joined #ruby
Draco_ has quit [Remote host closed the connection]
danheberden has quit [Read error: Operation timed out]
bwlang has joined #ruby
mdszy has joined #ruby
dogenpunk has quit [Quit: rcirc on GNU Emacs 24.0.94.1]
c0rn_ has joined #ruby
ramblex has quit [Quit: ramblex]
c0rn_ has quit [Client Quit]
danheberden has joined #ruby
pdtpatrick has quit [Quit: pdtpatrick]
akem has joined #ruby
akem has quit [Changing host]
akem has joined #ruby
tomb has joined #ruby
uris has quit [Quit: leaving]
bosphorus has joined #ruby
umttumt has joined #ruby
true_techie has joined #ruby
reuf has quit [Quit: Leaving]
<true_techie>
is this an array or a hash,also whats happening here? :html => { :method => :delete }
kevinbond has joined #ruby
jjang has joined #ruby
moos3 has quit [Ping timeout: 248 seconds]
bwlang has quit [Quit: bwlang]
GoGoGarrett has joined #ruby
Progster has quit [Ping timeout: 244 seconds]
byronb has joined #ruby
byronb has quit [Excess Flood]
byronb has joined #ruby
byronb has quit [Excess Flood]
[Neurotic] has joined #ruby
byronb has joined #ruby
byronb has quit [Excess Flood]
byronb has joined #ruby
byronb has quit [Excess Flood]
<bricker88>
is a constant technically a variable?
<mdszy>
bricker88: Yes.
krzkrzkrz has joined #ruby
chson has joined #ruby
ashp has quit [Quit: leaving]
Jake232 has quit [Quit: Computer has gone to sleep.]
<bricker88>
mdszy: So even though it's not actually variable (i.e. it can only be one value and not change), it's still called a "variable"
<bricker88>
mdszy: I should say, not SUPPOSED to be variable
hadees has joined #ruby
<bricker88>
Or is it named "variable" because it can store any value at runtime?
<mdszy>
bricker88: I'm pretty sure. Yeah.
<bricker88>
okay
mxbtt has joined #ruby
Progster has joined #ruby
true_techie has left #ruby [#ruby]
<mxbtt>
why do hashes have a shift method and no pop counterpart?
TorpedoSkyline has joined #ruby
c0rn_ has joined #ruby
SQLStud has quit [Read error: Connection reset by peer]
foolove has joined #ruby
lledet has quit [Quit: lledet]
kevinbond has quit [Quit: kevinbond]
<foolove>
how can I parse a value from a variable I come froma perl background and it would be as such in perl my ($newvar) = $var =~ /astringofsomethingthatiscoupledwithvalue(valueassignedto_newvar)/;
bwlang has joined #ruby
Chryson has joined #ruby
awarner has joined #ruby
rmc3 has quit [Quit: Lost terminal]
<ged>
foolove: newvar = var[/foo(bar)/, 1]
awarner has quit [Remote host closed the connection]
<foolove>
ged thanks cool
Markvilla has joined #ruby
stephenjudkins has quit [Quit: stephenjudkins]
phinfonet has quit [Quit: phinfonet]
Draco_ has joined #ruby
\13k has quit [Quit: Leaving]
EPIK has joined #ruby
brianpWins has quit [Quit: brianpWins]
kenichi has quit [Remote host closed the connection]
GoGoGarrett has quit [Remote host closed the connection]
jxf has quit [Ping timeout: 246 seconds]
monkegjinni has quit [Remote host closed the connection]
krzkrzkrz is now known as krz
monkegjinni has joined #ruby
seanstickle has joined #ruby
`brendan has joined #ruby
monkegjinni has quit [Ping timeout: 246 seconds]
platzhirsch has joined #ruby
tomx has joined #ruby
bglusman has quit [Ping timeout: 248 seconds]
<shevy>
mxbtt: hmm no real idea.
<shevy>
mxbtt: perhaps matz forgot it
phinfonet has joined #ruby
cespare has quit [Quit: WeeChat 0.3.5]
<mxbtt>
when looping over a hash and wanting to do something different on the last iteration, it seems like it would be more efficient to just pop off the last pair then do your loop
<mxbtt>
that's the only reason I was asking
cespare has joined #ruby
cespare has quit [Client Quit]
luckyruby has quit [Remote host closed the connection]
<shevy>
yeah I am not sure
<shevy>
with Arrays it works
<shevy>
with hashes, only one of the two method works hmm
baroquebobcat has quit [Quit: baroquebobcat]
cespare has joined #ruby
CannedCorn has quit [Quit: Computer has gone to sleep.]
<mxbtt>
so then I was like maybe I can reverse the hash since the order is now preserved and just shift that… but there's no reverse which makes more sense than not having a pop
tomb has quit [Quit: Computer has gone to sleep.]
Orban has joined #ruby
Draco_ has quit [Remote host closed the connection]
ckrailo has quit [Quit: Computer has gone to sleep.]