Topic for #ruby-lang is now Ruby 1.9.3p0: http://ruby-lang.org | Paste >3 Lines of Text on http://pastie.org
Karmaon has joined #ruby-lang
Defusal has joined #ruby-lang
* drbrain facepalms
<drbrain> thomasfl: no, write a real patch
<thomasfl> drbrain: Thanks a lot. I think I can get this working: open 'https://www-dav.example.com/foo.html' do |io| io.puts "<html>..."; end
jamw has joined #ruby-lang
mikeric has joined #ruby-lang
<thomasfl> drbrain: Thank's again. I'll hopefully have a open-uri-and-write gem soon.
wyhaines has joined #ruby-lang
fayimora has joined #ruby-lang
uniqanomaly has joined #ruby-lang
S1kx has joined #ruby-lang
S1kx has joined #ruby-lang
Indian has joined #ruby-lang
havenn has joined #ruby-lang
kain has joined #ruby-lang
Defusal has joined #ruby-lang
Defusal has joined #ruby-lang
havenn has joined #ruby-lang
<whatasunnyday> I'm sort of confused. If I put puts in a method and another class calls on that method, why doesn't it always print to standard output?
<whatasunnyday> well, when i say standard output, i mean my terminal screen
<drbrain> whatasunnyday: it prints to $stdout which may be reassigned
<whatasunnyday> how do i reassign stdout back to the original? STDOUT.commandline?
kyrylo has joined #ruby-lang
kyrylo has joined #ruby-lang
kyrylo has joined #ruby-lang
kyrylo has joined #ruby-lang
<drbrain> $stdout = STDOUT (so long as STDOUT was not reopened)
<drbrain> sometimes people use STDOUT.reopen, but I don't recommend it since it prevents ^^
<whatasunnyday> thanks drbrain
<drbrain> I think my years-old blog post made people forget about STDOUT.reopen
<whatasunnyday> i think STDOUT was reeopened
Austin__ has quit [#ruby-lang]
<whatasunnyday> i guess i should ask a better question, thanks to outoftimes help, i was able to discover my problem. however, i'm not sure what class link is in this library. i was trying to figure it out so i could get the entire url instead of its relative path.
srbartlett has joined #ruby-lang
<whatasunnyday> its a uri
<whatasunnyday> all is in the world
<whatasunnyday> i just logged link.class
_bryanp has joined #ruby-lang
<whatasunnyday> well in the world*
slyphon has joined #ruby-lang
darkf_ has joined #ruby-lang
<whitequark> drbrain: I'd say that you want to STDOUT.dup, and then STDOUT.reopen it
<drbrain> whatasunnyday: yeah, but nobody ever bothered to do that
<whitequark> this fixes all code which may have already captured the value of $stdout/STDOUT, _and_ fixes the code which assumes that STDOUT.fd == 1
kyrylo has joined #ruby-lang
kyrylo has joined #ruby-lang
jtoy has joined #ruby-lang
ylluminate has joined #ruby-lang
jxie has joined #ruby-lang
Luxx_ has joined #ruby-lang
jxie has joined #ruby-lang
zenspider has joined #ruby-lang
jtoy has joined #ruby-lang
chimkan___ has joined #ruby-lang
parzo has joined #ruby-lang
andrewhl has joined #ruby-lang
monkeysmuggler has joined #ruby-lang
plusk has joined #ruby-lang
<zenspider> rawr
Heimidal_ has joined #ruby-lang
<whatasunnyday> thanks again drbrain and outoftime
<whatasunnyday> see everyone later
neoesque has joined #ruby-lang
lele has joined #ruby-lang
lele|w has joined #ruby-lang
Heimidal has joined #ruby-lang
Banistergalaxy has joined #ruby-lang
ryez has joined #ruby-lang
jtoy has joined #ruby-lang
nofxx has joined #ruby-lang
heppy_ has joined #ruby-lang
<andrewhl> I remember hearing about a gem that extends IRB with a bunch of helpful tools. I can't remember what it's called, though. Does this ring a bell for anyone?
<zenspider> there's about 70 of them
<drbrain> andrewhl: pry is the popular one these days
<andrewhl> yeah that was it, thanks!
<zenspider> that doesn't really extend irb so much as replace it
gix has joined #ruby-lang
Randroid has joined #ruby-lang
gjaldon has joined #ruby-lang
PatrixCR has joined #ruby-lang
srbartlett has joined #ruby-lang
SuperTaz_work has joined #ruby-lang
srbartlett has joined #ruby-lang
PatrixCR has quit [#ruby-lang]
Banistergalaxy has joined #ruby-lang
havenn has joined #ruby-lang
plusk has quit ["Leaving"]
plusk has joined #ruby-lang
plusk has quit [#ruby-lang]
monkeysmuggler has joined #ruby-lang
looopy has joined #ruby-lang
Oloryn_lt1 has joined #ruby-lang
Telmo has joined #ruby-lang
dberg has joined #ruby-lang
dhruvasagar has joined #ruby-lang
Defusal has joined #ruby-lang
Defusal has joined #ruby-lang
slimfit has joined #ruby-lang
MistyM has joined #ruby-lang
grough has joined #ruby-lang
fayimora_ has joined #ruby-lang
Heimidal has joined #ruby-lang
macmartine has joined #ruby-lang
monkeysmuggler has joined #ruby-lang
igotnolegs has joined #ruby-lang
dv310p3r has joined #ruby-lang
willdrew has joined #ruby-lang
delinquentme has joined #ruby-lang
<delinquentme> hey all I'm looking at some exercises regarding using "self" http://pastie.org/3398838
<delinquentme> This makes me wonder if there is a way to reference the class WhatIsSelf using self
<delinquentme> or is that whats actually happening here
<whitequark> self.class called from within instance context will give you the class
<whitequark> if you really want some deep understanding of `self' and friends in Ruby, then read http://yugui.jp/articles/846
Nisstyre has joined #ruby-lang
<WillMarshall> I have an interesting little conundrum. I have a Class that is basically a presenter wrapped around two different instances of a second class
<WillMarshall> I want to access attributes of the two wrapped classes via the superclass, by delegating method calls through to one of the two wrapped classes, based on a list I can store in the presenter
<WillMarshall> Is there a nicer way of doing this than just defining a zillion short little delegation methods in my presenter?
<WillMarshall> Basically a DRY way of doing this: http://pastie.org/3398927
<whitequark> WillMarshall: method_missing is your friend
<WillMarshall> whitequark: Yeah, if I cache my attributes as two sets of symbols in the wrapper class I can do a little included? switch in method_missing
nofxx has joined #ruby-lang
<whitequark> method_missing is also slow. if this is an often-called piece of code and the method lists are predefined and do not change, then consider using define_method to automatically define a "zillion of short delegation methods"
<whitequark> the latter would allow for efficient optimizations in e.g. JRuby, unlike method_missing
<WillMarshall> Would it make any difference when using straight-up 1.8.7?
<WillMarshall> That said, define_method would be a little nicer
slyphon has joined #ruby-lang
<whitequark> not much
<WillMarshall> I guess I'll save an array lookup on each attribute query
<whitequark> and you'll have your method defined with a lambda. that's a small penalty iirc
<whitequark> anyway, just benchmark it
<WillMarshall> Whereas with method_missing I either need to check my arrays of attributes each time, or lazily using define_method
<whitequark> oh, please do not do lazy define_method
<WillMarshall> Why's that?
<whitequark> it is quite evil and can lead to sudden performance degradations at unexpected times
<whitequark> in, ahem, sane implementations (not MRI)
Austin__ has joined #ruby-lang
<WillMarshall> If I'm just going to define this set of methods from an array of symbols at runtime, which seems cleanest...
<whitequark> basically define_method flushes a lot optimizations. you'd better do them all at once and then keep VM caches alone
<whitequark> yeah, that's a good variant
Indian has joined #ruby-lang
<WillMarshall> Is there anywhere logical to stick that other than straight into the class?
<whitequark> I think the class is ok
<whitequark> you can also use eval.
<WillMarshall> Just thinking about initialize … but I doubt it matters
<whitequark> it's faster than define_method.
<WillMarshall> define_method is easier to read than eval, though
<whitequark> mhm, kind of
<whitequark> if performance matters, use eval. that's how Rails do it, for example
<whitequark> define_method is fine too in most cases
<WillMarshall> Cheers
<WillMarshall> Is there anything neater than subclass_one.send(symbol) I can do to delegate through?
<WillMarshall> send makes me a little twitchy
<whitequark> it should not
<whitequark> send is a perfectly good way to do delegation
<WillMarshall> Sweet
<whitequark> it isn't an internal thing or whatever. Ruby objects "send" messages to each others, but some call them method calls
<whitequark> if you'd been using 1.9, I would suggest using public_send
<whitequark> which is a bit nicer for this purpose (`send' ignores private/protected modifiers)
<whitequark> why are you using 1.8 for a new project anyway? it will be dead after the summer
<WillMarshall> Not my project
<WillMarshall> I'm just cleaning out a bunch of the weirdness and trying to DRY things up.
<whitequark> ok
<WillMarshall> define_method will let me create instance methods, yeah?
<whitequark> yes
<whitequark> define_method in a class context creates instance methods
<whitequark> like `def'
<whitequark> there's also define_singleton_method which behaves like `def self.'
Guest99123 has joined #ruby-lang
<WillMarshall> whitequark: Thanks dude :)
<WillMarshall> There's a handy little way for me to try a method call on something that might be nil, yes?
<WillMarshall> I've got a bunch of foo ? foo.method : nil stuff
<WillMarshall> Hoping for a terser way of doing the same thing
<cirwin> andand
<WillMarshall> cirwin: foo && foo.method ?
<whitequark> that's a gem
<cirwin> foo.andand.method
<cirwin> or foo.andand(&X.method.to_s)
<whitequark> cirwin: the latter is 1.9-only afaik
<WillMarshall> Wasn't there .try?
qz has joined #ruby-lang
qz has joined #ruby-lang
<cirwin> whitequark: .andand takes a block in 1.8.7 too
jorgeaber has joined #ruby-lang
<jorgeaber> hello
jorgeaber has quit [#ruby-lang]
<whitequark> WillMarshall: #try is from ActiveSupport
<WillMarshall> Hmm - I've got https://gist.github.com/c6986f66faf7add7e03d so far
<WillMarshall> whitequark: I am in a Rails app here, so I guess I have it
<whitequark> ah sure. then it's ok to use it
<WillMarshall> That snippet still doesn't look dry enough. Hmmm
savage- has joined #ruby-lang
y3llow has joined #ruby-lang
andrewhl has joined #ruby-lang
hibariya has joined #ruby-lang
tdmackey has joined #ruby-lang
<cirwin> WillMarshall: do you know about delegate?
<WillMarshall> cirwin: Nope
<cirwin> delegate :method1, :method2, :method3 , :to => 'health_product'
<WillMarshall> Oh. Well that'd help...
mortice has joined #ruby-lang
<whitequark> yeah, that's a good idea indeed
<cirwin> I think that's active-support too
<whitequark> yes
<WillMarshall> How will delegate handle the case of health_product being nil?
<whitequark> it will raise an exception
<WillMarshall> Which I can catch
<cirwin> :to => 'health_product.andand'
<whitequark> but you can provide a :allow_nil => true
<whitequark> which will just pass the nil through the delegator
<cirwin> oh?
<cirwin> nil
<cirwin> nice
<WillMarshall> Niiiice
<WillMarshall> This looks perfect
<WillMarshall> That's a lot nicer, thank you
<whitequark> WillMarshall: use :to => 'health_product || extra_health_product' in the last delegate
<whitequark> delegate uses eval. hence you can delegate to instance variables and similar weird stuff
<WillMarshall> whitequark: I actually need the first_product method for other things...
havenn has joined #ruby-lang
<whitequark> ok
<WillMarshall> whitequark: So I might as well use it, since it's always there
cola_zero has joined #ruby-lang
<drbrain> try ☹
<nofxx> 'try' is nice cuz it's short and fast
brownies has joined #ruby-lang
<nofxx> 'andand' slower but better syntax
rippa has joined #ruby-lang
<nofxx> I will make the try gem someday..... it's basically -> git clone andand && cd andand && find . | xargs sed 'andand/try' && gem push
<nofxx> need to change the author name too
<erikh> yyyyyeah.
eban has joined #ruby-lang
<drbrain> using try is code smell
<nofxx> drbrain, how do you handle it?
<drbrain> nofxx: I like Avdi's way, Null Object Pattern
sora_h has joined #ruby-lang
<nofxx> drbrain, heh, that's evil... as in method_missing in nil?
<drbrain> nofxx: are you sure you know what the Null Object Pattern is?
thegeekinside has joined #ruby-lang
<drbrain> if you're using method_missing, you're probably not implementing the pattern
guns has joined #ruby-lang
banister`sleep has joined #ruby-lang
<nofxx> drbrain, never used, just saw an example on the web now
looopy has joined #ruby-lang
gokul has joined #ruby-lang
Austin__ has joined #ruby-lang
krz has joined #ruby-lang
Austin__ has quit [#ruby-lang]
kp666 has joined #ruby-lang
wmoxam has joined #ruby-lang
rohit has joined #ruby-lang
kp666 has joined #ruby-lang
mephux has joined #ruby-lang
andkerosine has joined #ruby-lang
jtoy has joined #ruby-lang
Asher has joined #ruby-lang
indeterminate has joined #ruby-lang
chimkan_ has joined #ruby-lang
macmartine has joined #ruby-lang
Banistergalaxy has joined #ruby-lang
Asher1 has joined #ruby-lang
ovnimancer has joined #ruby-lang
ovnimancer has quit [#ruby-lang]
ovnimancer has joined #ruby-lang
gianlucadv has joined #ruby-lang
havenn_ has joined #ruby-lang
kitallis has joined #ruby-lang
brownies has joined #ruby-lang
skryking has joined #ruby-lang
Karmaon has joined #ruby-lang
x0F_ has joined #ruby-lang
Banistergalaxy has joined #ruby-lang
yxhuvud has joined #ruby-lang
thone has joined #ruby-lang
mytrile has joined #ruby-lang
symm- has joined #ruby-lang
heppy has joined #ruby-lang
brianpWins has joined #ruby-lang
replore has joined #ruby-lang
tjadc has joined #ruby-lang
mytrile has joined #ruby-lang
chendo has joined #ruby-lang
banister_ has joined #ruby-lang
dc5ala has joined #ruby-lang
gnufied has joined #ruby-lang
solars has joined #ruby-lang
_bryanp has joined #ruby-lang
uniqanomaly has joined #ruby-lang
|Vargas| has joined #ruby-lang
|Vargas| has joined #ruby-lang
JohnBat26 has joined #ruby-lang
robotmay has joined #ruby-lang
<Asher> anyone know of any ruby-based flat-file btree implementations?
Banistertab has joined #ruby-lang
<chendo> Asher, you just want to store info?
<Asher> ordered info
<Asher> just integers/doubles
<chendo> i was actually thinking about doing a b-tree implementation so i could learn it properly
<chendo> but yeah i don't know if any exist
<chendo> you want super lightweight?
<chendo> cause otherwise you could use sqlite… :p
<Asher> there seem to be a number of ruby btree implementations but none that keep it on the disk
<Asher> i want something that is ruby-only that i can bundle with my persistence layer for the flat-file object-db
<chendo> Marshall.dump will do the trick :P
<Asher> it's more proof of concept than anything
<chendo> ah
<chendo> true
<chendo> hmm
<chendo> yeah i've run into things like that
<chendo> super fancy things that do what i want
<chendo> but require non-ruby deps
<Asher> well i'm storing the object data in serialized data output to individual files
<Asher> but i need a way to keep track of the order of the objects
<Asher> which is file system ordered atm
jaimef has joined #ruby-lang
<Asher> not mission critical.. production stuff will use the kyoto cabinet back end (or others) anyway
<Asher> but it's neat so i want a solution :P
macmartine has joined #ruby-lang
<chendo> Asher, you could just… read it then sort it :P
<Asher> yea but the threshold for that is pretty low
Tref has joined #ruby-lang
<Asher> or for reading/writing it each time
<chendo> heh
<chendo> i've done it before
<Asher> yea i mean i know it's an option
<Asher> but not what i want to do
<chendo> hmm
<chendo> but yeah why does it need to be ordered?
<chendo> like in the file
<Asher> i want to be able to keep ordered indexes
<chendo> but… would that work in a b-tree?
<chendo> when it writes it to a file
<chendo> it's probably not going to be ordered
<chendo> unless it explicitly writes the order flattened
<chendo> like.. i don't understand why it needs to be ordered in the file?
<chendo> what's the dataset?
<chendo> how big etc
<chendo> brb
<Asher> the advantage of btree is that it writes it in an ordered manner
<Asher> arbitrary datasets - it's an object persistence layer
kitallis has joined #ruby-lang
Banistergalaxy has joined #ruby-lang
roadkith has joined #ruby-lang
<chendo> Asher, yeah
<chendo> why don't you just serialise it in an ordered manner?
<Asher> they're serialized in individual files
<chendo> like, if it's a prototype, then it doesn't need to be fast
csherin has joined #ruby-lang
<chendo> like i'm not sure if i see the benefit of the b-tree apart from it being fast
<Asher> well i would like it if this little proof of concept were actually functional for small purposes
<chendo> in this particular case
<Asher> the benefit of b-tree is that it is a method for sorting data in this way
<Asher> i just need an on-disk implementation of it
<Asher> which doesn't seem to exist presently in ruby
<chendo> still confused lol
<chendo> on disk implementation being what exactly?
<Asher> i should just read up on how to plan data structures on disk for expansion later
<chendo> it stores the information in one file about the b-tree in an ordered serialised form?
<Asher> yes the btree would exist in one file and store an ordered list of IDs
<chendo> yeah
<chendo> the ordered list part
<chendo> so let's say, simplified
<chendo> still don't see why you need a b-tree
replore_ has joined #ruby-lang
<chendo> like, what is wrong with sorting it in an array, then writing that out?
<chendo> if being ordered in the file is what you want
<Asher> an array is linearly ordered so searching time increasing quite quickly
<chendo> yeah… so why not just load it into a b-tree?
<Asher> plus that doesn't solve the question of writing it portion at a time
neoesque has joined #ruby-lang
<chendo> how many operations do you expect this to be called?
<Asher> i want a solution not a compromise
Defusal has joined #ruby-lang
Defusal has joined #ruby-lang
<chendo> you want a prototype
<chendo> right?
<chendo> you're over-engineering this
<Asher> no it's for a persistence layer i have been writing - it's an adapter that runs the back end entirely with files
<Asher> strictly speaking i don't need any solution here compromise or otherwise
<chendo> persistence layer?
<chendo> otherwise known as a database?
frangiz has joined #ruby-lang
replore has joined #ruby-lang
<chendo> but you want the data set serialised in individual files
<chendo> right?
<Asher> like an ORM without the RM
<chendo> so the filenames essentially become keys
<chendo> so you don't want to use a database because?
<Asher> it takes cares of all of the storage/loading of objects by way of various configurations
<Asher> well databases are options using other adapters
<Asher> but i have a flat file adapter
<Asher> that does everything the databases do currently
<Asher> with the exception of ordering indexes
<Asher> so i want to add that feature
<Asher> … because i am a nerd like that
<chendo> not sure why you want the ordered index all the time
<Asher> i didn't say all the time
<Asher> i want it to be an option
<chendo> what
<chendo> really don't see why you want the index to be ordered in serial all the time
<chendo> just write it out ordered at intervals
<chendo> use the b-tree in memeroy
<chendo> memory*
<Asher> that breaks ACID
<chendo> and when you serialise it, write it to the file in order
<chendo> you actually want ACID?
<chendo> what
<Asher> why would you be shocked about that?
<chendo> because you would just use sqlite
<Asher> why?
<Asher> that's all sorts of extra cruft
<chendo> why not?
<chendo> because it's already there.
<Asher> … my justification was i'm a nerd and you're telling my to solve my problem by using an existing compromise?
h4y4shi has joined #ruby-lang
<chendo> so essentially you want a b-tree that writes to disk
<h4y4shi> How do I run ruby programs using Mingw
<chendo> and does ACID
<Asher> no ACID is implicit in my persistence layer
<Asher> so long as i don't violate its principles in the adapter
<chendo> what
<chendo> what does that even mean?
<chendo> you want to support ACID in spirit?
<chendo> either you have ACID or you don't
<Asher> meaning if the adapter is keeping the disk up to date and not simply storing stuff in memory then ACID is implicit
<Asher> but if it is storing stuff in memory not sync'd to disk then it isn't
<chendo> how are you going to guarantee that?
retro|cz has joined #ruby-lang
<Asher> my persistence layer already guarantees that
<chendo> so you do IO every time you update?
<Asher> if it's configured for atomic updates yes
<chendo> well
<chendo> it sounds like you're going to write your own database
<chendo> cause.. that's what it is
<Asher> indeed
<Asher> except in like 200 lines of code
<chendo> for a prototype?
<Asher> so now i want a ruby implementation for the btree part
<chendo> that's the part i don't get
<Asher> well the persistence layer has more lines
<Asher> but that's not in question atm
<Asher> the persistence layer does all the heavy lifting
<chendo> i wish i had the time to write my own databases
<chendo> too bad i don't have the time to and other people have done way better
<Asher> it's too bad that your ability to assess my code from over there isn't enough to help me with my original point in question…
<chendo> yeah that was me trying to understand the 'why'
<Asher> yup so i told you
<Asher> like i said this is a proof of concept
<Asher> the production implementation uses a kyoto cabinet adapter
<chendo> so the reason is because you want to write your own pure ruby kyoto cabinet?
<h4y4shi> Does anyone here run .rb files using Cygwin?
<Asher> no… i wrote a persistence layer
<Asher> it uses a back end to store data
<Asher> kyoto cabinet is a very fast and thin back end for that purpose
<Asher> i also wrote a flat-file based adapter, because it's neat
<chendo> so
<Asher> and since it does everything but keep sorted indexes, i'd like to add that
<chendo> riiight
<chendo> so whole reason is "because it's neat"
<chendo> got it
<Asher> yup
<Asher> thus the nerd bit
<chendo> right
<Asher> it is an intellectual concern
<chendo> i guess i'm too used to solving work problems
<chendo> but yeah doubt there is anything like it out there
<chendo> you'll have to write your own
<Asher> well the persistence layer + kyoto cabinet solved the work problem
<chendo> i'll be interested to see how you keep the sorted indexes without heavy IO
<Asher> and produced a secondary poitn of interest
<chendo> you'll need to either do fixed width rows
<chendo> or it'll have to be magical
<Asher> i don't need rows just ints
<chendo> yeah, but how are you going to know how long the ints are?
<chendo> are you going to calculate exactly which part of the file needs to be rewritten?
<Asher> well that was why i was hoping a disk-based solution exists
<Asher> b/c there are clearly strategies for doing this
<Asher> but i'm not particularly familiar with them
<chendo> look at mysql
<chendo> lol
<chendo> look up how a database works
<Asher> heh
<chendo> they've solved the problems you have
<chendo> because unless you know the start and end of where you want to rewrite
<chendo> it's going to be pretty hard to not rewrite the entire file to keep it sorted
<chendo> so i guess that's the only tip i can leave for you
<Asher> i love how on irc everyone assumes whoever they're talking to knows nothing
<chendo> sigh
<chendo> whatever
<chendo> i'm out
<chendo> i tried
<Asher> haha have a good night
coderrr has quit ["Ex-Chat"]
neoesque has joined #ruby-lang
uTired2 has joined #ruby-lang
uTired2 has quit [#ruby-lang]
<yorickpeterse> Morning gents
ramu3 has joined #ruby-lang
artOfWar has joined #ruby-lang
replore has joined #ruby-lang
JohnBat26 has joined #ruby-lang
NARKOZ has joined #ruby-lang
Defusal has joined #ruby-lang
Gekz has joined #ruby-lang
Gekz has joined #ruby-lang
<zenspider> Asher: haha
<zenspider> you so stupid
<Asher> :)
kitallis has joined #ruby-lang
<andkerosine> But it's seriously the most misplaced ambition I think I've ever seen.
<andkerosine> Still, I recall a phase where I was pretty set on doing amazing things with flat files, so I've no qualms.
<Asher> i just think it's neat that the result of having written the persistence layer is that you can have an object-db-without-a-db
<Asher> why? i duno… maybe development or small deployments or something
<Asher> maybe no good reason
<Asher> but it seems interesting as a problem
fayimora has joined #ruby-lang
<Asher> … would have been neater if someone had jumped in and pointed me to a gem i coulda done it in 15 minutes with
<Asher> but that may not exist :)
<andkerosine> If something like that remains "unsolved" (i.e., there are no existing solutions), it is like the idea is a bad one.
robotmay has joined #ruby-lang
rohit has joined #ruby-lang
<masterkorp> i like boobs
<andkerosine> +ly
<Asher> *shrug* in any case, bedtime for me
<manveru> i used that ages ago
<Asher> thanks - looked at that a while back when i was designing the persistence layer
tla has joined #ruby-lang
<manveru> otherwise, check out maglev, they also persist stuff really nicely
<manveru> and if that's not enough, there are enough image-based languages out there
mytrile_ has joined #ruby-lang
cyri_ has joined #ruby-lang
<zenspider> I'd go with maglev too ... but I'm biased
<zenspider> transparent object persistence is where it is at
piknup has joined #ruby-lang
tallship has joined #ruby-lang
<piknup> Hi I just installed Ubuntu and am trying to install Ruby 1.9.3 but I cannot seem to get it. I was only able to install 1.8.7 though.
<piknup> Can someone help?
<zenspider> welcome to ubuntu! here's your broken ruby!
<zenspider> rvm is the best way to go
<zenspider> and the folk in #rvm are very helpful if it goes wonky
<piknup> ok so rvm it is :)
<zenspider> tho, if it goes wonky, `rvm prerequisites` (iirc) is the way to go
<rohit> +1 for RVM and +100 for #rvm support
<zenspider> something like that at least
<zenspider> ok. I'm tired...l atre
<zenspider> later even
<piknup> thanks!
<andkerosine> But seriously, rvm is amazing.
fragmachine has joined #ruby-lang
slaytanic has joined #ruby-lang
pbjorklund has joined #ruby-lang
<masterkorp> andkerosine: yeah, just dont use it in production :P
<andkerosine> I... can't imagine why one would.
futurechimp has joined #ruby-lang
<injekt> masterkorp: there's nothing wrong with using it in production
<injekt> im not sure why people think using rbenv or rvm in production is a bad thing
<masterkorp> ofc it is
<injekt> knowing how it works and configuring it properly is fine
<masterkorp> it breaks package management
<injekt> ...
<injekt> so?
<masterkorp> its just an unecessary layer
<injekt> fuck package management
<injekt> I compile ruby myself every. single. time.
<masterkorp> heh, mac user ?
<injekt> because of package management
<injekt> no
<injekt> linux user
<andkerosine> Gentoo, then? : P
<masterkorp> u dont like package management ?
<injekt> who runs 12+ production servers all using ruby
<masterkorp> andkerosine: exherbo ftw :p
<injekt> andkerosine: 3 of them are gentoo yes
<injekt> but that's besides the point
<injekt> 2 of them are Ubuntu, and I'm certainly not going to use aptitude to manage ruby
<masterkorp> but apt you can use :p
<injekt> same thing, I wouldn't touch it
<injekt> not for ruby
<injekt> it's stupid and causes way more hassle than it's worth
<masterkorp> multiple version, and can handle non ruby deps
<injekt> tell me something it can do I can't do my managing ruby versions myself?
<masterkorp> only in the behining, believe me, it pays off later
<injekt> it.. it doesnt
<masterkorp> it does
<injekt> eh okay
<masterkorp> i passed trough that battle
<injekt> roger that
<andkerosine> Is aliasing for user convenience bad practice?
<masterkorp> andkerosine: uh no, i have some
Dotan has joined #ruby-lang
<injekt> andkerosine: in an api?
<andkerosine> Mm-hmm.
<injekt> depends
<andkerosine> Writing a wrapper around reddit's.
<injekt> what kind of aliases?
<andkerosine> Little things like r for subreddit, u for user, message for compose.
<injekt> oh do it
<andkerosine> Right on
<injekt> masterkorp: he's talking about methods
<masterkorp> oh
<masterkorp> lol
<masterkorp> sorry
<injekt> andkerosine: hey, reddit does it right :)
<andkerosine> Heh.
<injekt> andkerosine: in the urls, I mean
<andkerosine> Yes, indeed.
<injekt> masterkorp: ah, you use bash too? that explains more ;)
<andkerosine> But I want the semantics that go with full words, while still allowing for short names once there's familiarity.
<injekt> andkerosine: as long as they're only aliases for longer more descriptive words, I say go for it
* masterkorp coughs
<injekt> masterkorp: touche
<injekt> I still can't live without zsh :)
<andkerosine> Most significant advantages?
<masterkorp> yeah, i tried it
evenix has joined #ruby-lang
<masterkorp> just the fancy tab complete wasn't of my likings
<injekt> andkerosine: globbing is massive for me, I use it a LOT
<injekt> that too
<evenix> hi all
<andkerosine> Globbing as in being able to use *?
<injekt> can't live without my complete
<injekt> andkerosine: in an advanced way, yeah
<masterkorp> this globbing ? :p
<injekt> andkerosine: have a browse of http://www.rayninfo.co.uk/tips/zshtips.html
<andkerosine> Ah.
<injekt> evenix: it looks like lexicon isn't being loaded
<andkerosine> Globbing as a function.
<andkerosine> Very nice.
<evenix> from the test or from ex48.rb
<injekt> evenix: where is your test file located?
<andkerosine> Single-method modules = bad?
<evenix> ex48>test>test_lexicon.rb
<injekt> evenix: and how're you running it?
<injekt> ruby test/test_lexicon.rb ?
<evenix> ruby test_lexicon.rb
virunga has joined #ruby-lang
<injekt> andkerosine: depends what it's for?
<andkerosine> Well, originally I had my wrapper set up as just Objects and Actions, and I mixed Actions into everything.
<injekt> evenix: oh, you never require ex48.rb
<injekt> evenix: you need to load it
<injekt> andkerosine: if it's a mixin, one method is fine
<andkerosine> I just hate module Reply; def reply..., but I guess it makes the most sense.
<evenix> injekt: from the test?
<evenix> ok
<evenix> just did I'm getting the same error
<evenix> hold on.. wrong file
robwilliamsukio has joined #ruby-lang
zmack has joined #ruby-lang
<evenix> i added require 'ex48' but I'm getting a "no such file" injekt
<shevy> today I shall learn how to use #unpack
<injekt> evenix: you need to require it relative to the file you're requring it from
<evenix> injekt: yes, i did require '../lib/ex48'
<injekt> evenix: that wont work
<evenix> require_relative?
<injekt> yeah
<injekt> or use require File.expand_path('../../lib/ex48', __FILE__)
<andkerosine> s/__FILE__/$0
<injekt> no, __FILE__
<andkerosine> How come?
tekin has joined #ruby-lang
<injekt> __FILE__ is the name of the current file, $0 is the name of the script being executed
<evenix> injekt: require_relative worked.. I'm going to make a new pastebin
<injekt> andkerosine: that's how you can do if __FILE__ == $0 and it'l return true if the current file is the one being executed
<andkerosine> Hm, fair enough.
<andkerosine> Equivalent in this case, though, no?
leriksenau has joined #ruby-lang
<injekt> yeah, I just dont want to preach bad practice :)
<leriksenau> Is it possible, from a script, or from a rib or debug session, to get the ruby interpreter to tell you its version ? E.g. <code>puts Interpreter->version</code>
<injekt> RUBY_VERSION
futurechimp has joined #ruby-lang
<leriksenau> is that an envvar or a constant ?
<injekt> constant
<leriksenau> constant I guess
<leriksenau> ta
<injekt> open irb and type RUBY_[tab]
<injekt> those are all the constants you can use
QaDeS has joined #ruby-lang
<injekt> and may find useful
<leriksenau> schweet
<Phlogistique> require 'irb/completion' before that
<leriksenau> ok - I thought it might be part of a class available for introspection, didn't think of looking at constants
fayimora has joined #ruby-lang
<leriksenau> is the constant defined in the Kernel class ?
<andkerosine> Naturally.
<evenix> ok
brownies has joined #ruby-lang
<manveru> it's a global constant
<manveru> just like DATA, ARGV, ARGF, STDIN, etc
<leriksenau> yep - getting the hang of this now - thanx
<injekt> evenix: please use a better paste website :(
<manveru> they are in their own world, not defined on kernel/object/module etc
<andkerosine> Oops.
<manveru> oh wait, they are on Object
<injekt> evenix: what's going wrong? you haven't added any errors?
<manveru> damnit
<manveru> void rb_define_global_const(const char *name, VALUE val) { rb_define_const(rb_cObject, name, val); }
<manveru> that's just boring :(
<injekt> manveru: makes sense
<leriksenau> I'll grep the ruby source for the def's
<manveru> ack rb_define_global_const
<evenix> injekt: thing is I should be able to see whats wrong from the test.. when I'm running the test it is obviously not working because I might have approach that test in a wrong way
<evenix> i can add the errors message from running the test
<injekt> oh, the test fails?
<injekt> now that's your job to fix it
<injekt> :)
<injekt> manveru: you played with erlang before?
leriksenau has quit [#ruby-lang]
<shevy> manveru tried them all
<shevy> he even wrote his own language
<manveru> injekt: yeah
<injekt> manveru: thoughts? Thinking of making it the next
<manveru> not much though... the syntax slaps me in the face every 5 seconds
<injekt> yeah, that's my only issue
<manveru> erlang itself is pretty cool
<shevy> hehe
<shevy> ruby spoiled you guys
<injekt> evenix: Lexicon is a module, you don't initialize a module
<manveru> but i'd use go these days instead
<injekt> shevy: scala spoiled me
<injekt> manveru: still? heh I feel bad for bailing out early with go :(
<manveru> :)
<manveru> well, it has all the cool concurrency like erlang
<injekt> yeah
<manveru> and it's actually quite fast these days
<manveru> go won't win any beauty contests either, but it's nicer than C at least
<injekt> yeah, I didn't like the design much
<andkerosine> "Prettiest" language = Brainfuck.
<evenix> injekt: ok instead i did this http://pastebin.com/fsQyKiG6 I set up the Lexicon as the class
<manveru> the issue i have with go is lack of generics
<manveru> rust has that, but rust also has semicolons :(
<shevy> hehehe
<injekt> heh
<evenix> this thing is confusing me.. i think I'm going to email the author for a solution and learn from it
rohit has quit [#ruby-lang]
<injekt> evenix: the idea isn't confusing you
<injekt> the ruby is
<injekt> it's basic things you're doing wrong, ruby things
<evenix> true
<injekt> grab a book or something
<evenix> lol thats what I've been doing for a while now
<injekt> maybe you're just rushing it
<injekt> (writing this)
<evenix> do my approach look right?
<shevy> evenix, look at this:
<shevy> def Pair(token, word)
<shevy> this isn't typical ruby
<shevy> def pair
<shevy> would it be
<manveru> using class variables?
<shevy> if you look at modules and classes, they all start with an upcased character
futurechimp has joined #ruby-lang
<shevy> upcased leading character is a constant evenix
<evenix> true yea i rushed writing this it was "initialize(token ,word)
<evenix> on the previous pastebin
<shevy> it's not even consistent with the rest of that code
<shevy> def scan(stuff)
<injekt> shevy: it's supposed to be a class
<injekt> that's why
<andkerosine> evenix: Lbh'er shpxrq, qhqr.
<shevy> he wanted to do a class?
<evenix> this is what I've been doing: i looked at that test and I was looking for ways to create a file that it is going to test
<injekt> shevy: yes, look at his tests
<injekt> evenix: simplify it
<injekt> one test, one method
<injekt> make sure it passes
<shevy> evenix to make a class you use the keyword "class" like ... class Pair
<injekt> add a new test, then add a new method
<manveru> andkerosine: :)
<andkerosine> ^_^
<injekt> nerds
* manveru beats urxvt with a massive mace
<evenix> shevy: i understand those basics what confuses me right now is the test.
<evenix> ill make a shorter paste bin.. I've been actually trying to solve the test in part
<shevy> ok but there are errors even before you come to the actual testing ... :P
<evenix> but i posted everything at once
<andkerosine> Protip: stop using pastebin.
<manveru> see the topic :)
<shevy> use pastie.org
<shevy> it has nicer colours. it looks better. and someone feeds a kitten every time one uses it. compared that with pastebin, where a kitten gets killed every time someone uses it
futurechimp has joined #ruby-lang
<shevy> so you see the arguments are all in favour of pastie.org
<shevy> right andkerosine???
<injekt> use gist.github.com
<andkerosine> evenix: You are the cause of global warming.
<injekt> :P
<shevy> lol
<manveru> or https://gist.github.com if you prefer octocats
<injekt> ^
* injekt prefers octocats
<shevy> yeah
<shevy> that penguins have no more ice in a few decades
fritzek has joined #ruby-lang
<manveru> someohow i have the feeling the creator of those tests hates ruby
<andkerosine> Or is bringing them over from another language.
<ddfreyne> gist is nicer than pastie
<andkerosine> I imagine Learn Code the Hard Way just recycles its tests?
<ddfreyne> + gists are git-versioned :)
<shevy> !!!
<shevy> UNBELIEVERS!!!
<shevy> learn code the hard way? isn't that the raging rockstar coder?
<injekt> zed shaw, yes
<injekt> he wrote learn python the hard way and is writing the c equivilant
headius has joined #ruby-lang
<evenix> ok how about that I'm going to try and understand this fist.
<evenix> Pair = Lexicon::Pair
<andkerosine> A fist is a hand formed into a tight ball.
<evenix> that mean there is a module Lexicon and a class Pair?
<andkerosine> Second and most important protip: you are not ready for ex48.
<andkerosine> I apologize if I come off rude, but it's clear you're jumping the gun.
<shevy> evenix!!!
<andkerosine> What good is trying to learn to run when you can barely stand?
<shevy> WHY DO YOU USE UPCASED AGAIN
<shevy> "<evenix> shevy: i understand those basics what confuses me right now is the test."
<shevy> NO YOU DONT!!!!
<manveru> ex48?
<injekt> manveru: homework
<evenix> ok so Lexicon is in Pair
<evenix> Lexicon < Pair
<andkerosine> Lesson 48 of Learn Ruby the Hard Way.
<injekt> evenix: wait what
<shevy> what
<manveru> lol
<andkerosine> Wat?
<evenix> ok can you just help and explain? Ive clearly didn't understand that part
<shevy> I am a firm believer that the only way to learn ruby is by writing your own ruby code
<shevy> which part
<evenix> shevy: agree
<shevy> module Foo; class Bar <- Bar resides in Foo
<evenix> ok so its
<shevy> you want to initialize an object from class Bar, you do ... foo = Foo::Bar.new
<injekt> how misleading
<injekt> :D
<shevy> but not Foo = Foo::Bar.new !!!
<evenix> so what is Foo?
<shevy> in this context it is a module
<injekt> a module, shevy just defined it
<injekt> shevy> module Foo; class Bar
<shevy> you can arrange your code into modules, that can make your life easier in the long run, when you combine several projects into your code
<andkerosine> evenix: Out of sheer curiosity, did you /start/ on Lesson 48?
<evenix> so what was wrong when i said Lexicon is the module and Pair is the class?
<shevy> lol andkerosine
<andkerosine> Alas, I am being completely serious.
<shevy> that you used:
<shevy> Lexicon < Pair
<evenix> .. ok
<shevy> what is this evenix !
<shevy> what means the "<" in this context
<injekt> shevy: my god you hacked that sentence
<injekt> with an axe
GiambalaGiambala has joined #ruby-lang
<andkerosine> How can a Lexicon be lower than a Pair?!
<injekt> andkerosine: lol you're going to confuse him :(
<manveru> ok, took me almost 3 minutes to implement this
<andkerosine> Such is my intention.
<shevy> injekt I am bringing things down to the simplest thing :)
<manveru> so i suggest you try something way simpler
<shevy> he must learn what the "<" means
<injekt> not if he's not using it, maybe that's lesson 49
<andkerosine> In quotes it looks like a nose.
<evenix> injekt: thanks
<shevy> hehehe gosh
<shevy> so many lessons without content!
<shevy> lesson 578916
<shevy> puts "Hello world."
<headius> zenspider: fwiw, I'm just trying to clear out as many jruby patches to RG as possible
<andkerosine> evenix: You do realize that skipping ahead will fuck you in the long run, right?
<shevy> lesson 578917
<shevy> puts "Hello world." * 2
<evenix> i didn't even noticed i typed < until you said it
<evenix> typo
<shevy> hmm
<evenix> andkerosine: and I've been doing all of them
<shevy> the magical keyboard
<evenix> 18hours a days
<andkerosine> Bullshit.
<evenix> per days*
<evenix> andkerosine: think whatever you want
<evenix> I'm taking this thing seriously
<shevy> well you must have seen the "<" before, because it is actually valid ruby code
<injekt> what lessons are these?
<evenix> yes
<shevy> but you use it to subclass a class
<evenix> i meant to type >
<andkerosine> Learn Ruby the Hard Way.
<shevy> Lexicon > Pair
<evenix> andkerosine: cool
virunga has joined #ruby-lang
<injekt> oh, that book sucks
<andkerosine> Quite.
<shevy> I wanna shoot the author
<manveru> no, zed isn't the author
<injekt> zed didn't write that btw
<injekt> it was just based on zeds work
<injekt> which doesn't work well for ruby, imo
<shevy> hmm
<injekt> Rob Sobers wrote the translation
<shevy> isn't it a bit early to start from test-driven design, into the ruby world?
<evenix> i like his approach with exercise i found it quite helpful as a beginner in ruby
<injekt> shevy: the koans does it?
<evenix> i started learning rails first then i realized i needed the basics in ruby
<evenix> so I've been learning ruby for 5 days
<shevy> I dont know the koans either... I started with "Learn to program" and loved it!
<shevy> evenix, did you read through learn to program?
<injekt> shevy: yeah, learn to program is by far the best for someone new
<manveru> shevy: now here's one for you: http://regex.learncodethehardway.org/
<evenix> shevy: what do you mean?
<shevy> that one
<evenix> oh
<evenix> about to check
<injekt> manveru: meh, mastering regex > *
<shevy> manveru, cool
<shevy> I still have to learn positive... negative... lookaheads
<shevy> or how's it called
<shevy> but today I shall only learn #pack and #unpack !
<manveru> ouch
<andkerosine> Tricky beasts.
<evenix> is it about ruby? or programing in general?
<andkerosine> Ruby.
<injekt> evenix: it uses ruby
<andkerosine> Not the Ruby you deserve, but the Ruby you need right now.
<shevy> evenix it's about ruby, work through it as quickly as possible, it is fairly easy. much easier than test-driven design from the start IMO
<evenix> i have problems with hashes
<shevy> don't smoke them man
<shevy> it's just a container with data, and you use keys to query a value
* andkerosine may or may not be presently smoking them.
<injekt> shevy: 'fetch'
toretore has joined #ruby-lang
<shevy> @hash['cat'] # => "black"
<shevy> see that's a black cat you got there!
<evenix> yes sure, but Its still confusing me so Im trying to do assignment that could help and i start getting it but I get lost sometimes
<manveru> ...
<evenix> I've been very confusing when i tried to go back and forth between Test and the application
<brownies> it's just a dictionary
<evenix> confused*
<andkerosine> You're just a dictionary.
<evenix> the hashes itself is not confusing
<shevy> yeah see
<shevy> tests confuse people
<brownies> the syntax can be more convoluted than necessary, what with the alligators
<evenix> but using it in object oriented
<evenix> with class and module become confusing
<shevy> what alligators?
<andkerosine> s/alligators/rockets
<evenix> fat least for now
<injekt> shevy: => (hash rockets)
<brownies> andkerosine: cannot unsee
<shevy> oh
<andkerosine> 'Tis the conventional term.
<shevy> that is an alligator?
<brownies> just > or < is an alligator
<manveru> i thought that's ~>
<shevy> oh
<andkerosine> That's the spermy.
<shevy> that's a swimming alligator?
mytrile has joined #ruby-lang
<brownies> ~< would make more sense as an alligator
<shevy> andkerosine you pervy
<brownies> (his mouth is open)
<evenix> well more information is always welcome, i'll read that book too thanks
<andkerosine> ?!
<andkerosine> It's the conventional term, I swear.
<injekt> evenix: information on what?
toertore has joined #ruby-lang
<injekt> evenix: you're being too broad
<evenix> on ruby
<injekt> ^
<shevy> stay simple!
<injekt> again, too broad
<ddfreyne> ~> is the sperm operator
<manveru> there's even a company with that name :)
<shevy> I shall not use this term
<injekt> I was disappoint, manveru
<evenix> more informations about hashes and tests
<andkerosine> Brilliant logo.
<injekt> I wanted a rocket filled with hash
<shevy> I'll give more information about hashes, but I refuse to deal with tests
<shevy> evenix what about arrays?
<injekt> evenix: what info do you want about hashes? { foo: 'bar' }
<injekt> there's a hash
<manveru> i refuse to give information to people who never follow instructions :P
<evenix> injekt: I want to clearly understand the relationship between the hashes the test itself, the lib and the application
<andkerosine> What... the fuck?
<shevy> oh tests
<evenix> yes
<injekt> evenix: you're thinking too hard
<shevy> I don't like tests
<evenix> I feel like it will help me to understand some basics that I might think Ive understood
headius has joined #ruby-lang
<shevy> hehe
<shevy> more code in tests than actual code!
<manveru> you guys must be bored to death that you're still helping that guy
<injekt> heh
<injekt> i'm supposed to be launching a startup
<injekt> but im the only eu person so everyone else is asleep anyway :-)
<manveru> everything he needs to know is in the books, it's just a matter of discipline
<manveru> injekt: likewise :(
<evenix> injekt: thanks
<shevy> manveru you run a startup?
<evenix> shevy: yes but when you need to look for bugs it saves time
<manveru> shevy: yeah
<shevy> evenix, I also don't like bugs
<shevy> manveru: cool!
<manveru> shevy: it's called The Rubyists, LLC. based in nevada, and doing fancy gluing with FreeSWITCH and Ruby :)
<shevy> nevada??
<evenix> manveru: i think I'm disciplined enough to wake up at 10 everyday and go to bed at 6 everyday just because I'm trying to learn ruby to better master rails
<shevy> isn't that like at the end of the world?
<manveru> cheapest tax
<shevy> ah
<andkerosine> Holy shit, only 98 steps?
<manveru> evenix: yet you can't start from step 1?
<shevy> hehe
<shevy> rails teaches people to count from top down...
<evenix> manveru: whats step 1?
<injekt> oO
<injekt> ok that's me out
<shevy> lol
<evenix> lol
<manveru> :)
<shevy> when you finished it, I'll ask you exam questions from it ok?
<evenix> well out of context i had no idea he was talking about that book
<evenix> manveru: I've done
<evenix> everything on the exercice
<evenix> until 48
<andkerosine> You have not.
<shevy> my first exam question will be - evenix, how to use "yield" in a method
<andkerosine> Or you would have a thorough understanding of modules and classes and how they interact.
<shevy> when you worked through http://pine.fm/LearnToProgram/ you'll know
<evenix> shevy: ill just go in the rdoc and figure it out
<shevy> ewwww rdoc!
<manveru> good luck :)
<shevy> :(
<manveru> rdoc is particularly helpful when it comes to ruby syntax and idioms
<manveru> just needs a lot of [show source] clicking
<manveru> </sarcasm>
<manveru> bbl
<evenix> just a random question: how long you guys been coding in ruby?
<manveru> around 8 years now
NARKOZ has joined #ruby-lang
<injekt> around 5 and a half
<injekt> (days)
<injekt> bwahaha
<evenix> well i started 5 days ago. I am clearly a beginner..so i am not making "obvious" mistake as a pro
<shevy> about 7 years I think
<injekt> you just need to make every lesson count
<evenix> thats what i am doing i am really taking this thing seriously.. been reading a lot in a few days
<evenix> and the frustration doesn't help lol…
<injekt> maybe that's where you're going wrong
<evenix> i make sure i understand before moving on
<evenix> but sometimes there is thing we think we understand until we face them differently
<injekt> sure
<shevy> "<evenix> i make sure i understand before moving on "
<shevy> but you did not!
<shevy> I think it's really that book
<injekt> if you get confused with classes, modules and whatnot, you can do some basic exercises. Build a system which requires something enumerable, a mixin, a base class, and inherited classes
<andkerosine> Make a class that discovers the Higgs boson.
<shevy> higgs had a bosom?
<andkerosine> Using only bitwise arithmetic.
<shevy> andkerosine you are such a pervy
<andkerosine> I see what you did there, and it is delicious.
<andkerosine> So... I have 400,000 reddit usernames.
<rippa> find them and kill them
mytrile has joined #ruby-lang
<andkerosine> My intention is to crawl every users comments list to determine all of the subreddits they post in and then make it searchable.
<andkerosine> To find the sorts of people who post in /r/programming and /r/mylittlepony.
<shevy> take a chainsaw and hunt these bastards down
<andkerosine> Or some such.
<shevy> start with the mylittlepony users first
<andkerosine> Naturally.
<shevy> they are suspicious
<shevy> rippa could be their group leader
<andkerosine> My logs confirm that it is so.
<andkerosine> "?limit=#{[100, limit].min}"
<andkerosine> Don't do things like this?
<shevy> dunno
<shevy> I think it's hard to read
* manveru does that all the time
* injekt does too
* shevy feels very alone
<manveru> the next-best thing is a ternary with repetition :(
<andkerosine> Well, I meant interpolating it.
<andkerosine> Concatenating /is/ a little easier on the eyes.
<injekt> then concat?
<andkerosine> But I use interpolation just about everywhere else and I'd like to remain consistent.
<injekt> then interpolate
<injekt> >.>
<andkerosine> Everything I know is a lie.
<andkerosine> Heh, concatenating forms a bad URI.
<injekt> interpolation it is!
<injekt> that was easy
<andkerosine> Quite.
jtoy has joined #ruby-lang
<andkerosine> Am I sick for sometimes changing the wording of a comment to have all the lines flush with column 80?
jbsan has joined #ruby-lang
brownies has joined #ruby-lang
<andkerosine> jtoy: Watashi no ninja wa doko desu ka.
<andkerosine> *ninjin
kaiwren has joined #ruby-lang
<tobiasvl> andkerosine: no, i thought everyone did that
csherin has joined #ruby-lang
Gekz has joined #ruby-lang
futurechimp has joined #ruby-lang
fayimora has joined #ruby-lang
csherin has joined #ruby-lang
<jtoy> andkerosine: sorry, I'm not japanese
<jtoy> yamate
jtoy has quit [#ruby-lang]
jtoy has joined #ruby-lang
jtoy has quit [#ruby-lang]
Stalkr_ has joined #ruby-lang
Tanaka has joined #ruby-lang
tomzx has joined #ruby-lang
Stalkr_ has joined #ruby-lang
m3nd3s has joined #ruby-lang
<evenix> nani wa hanashimasu ka?
fritzek has joined #ruby-lang
<ddfreyne> namaste
naz has joined #ruby-lang
divoxx has joined #ruby-lang
<andkerosine> Watashi no ninjin wa doko desu ka?!
RubyHead has joined #ruby-lang
<evenix> watashi was nihongo o byenkyu shimasu
<evenix> anata wa nihonjin desu ka?
<yorickpeterse> Can we stick to English?
<shevy> lol
<shevy> wieso nicht deutsch!
<yorickpeterse> Oh fuck that
<Phlogistique> there's #ruby-ja if you want to speak 日本語
<evenix> lool
tbuehlmann has joined #ruby-lang
QaDeS has joined #ruby-lang
<andkerosine> From "phlogiston"?
divoxx_ has joined #ruby-lang
<ddfreyne> Nein!!!
Sailias_ has joined #ruby-lang
burgestrand has joined #ruby-lang
mark_locklear has joined #ruby-lang
Stalkr_ has joined #ruby-lang
virunga has joined #ruby-lang
banister`sleep has joined #ruby-lang
gianlucadv has joined #ruby-lang
rohit has joined #ruby-lang
MistyM has joined #ruby-lang
<Cope> Is there some difference between 1.8.7 and 1.9.[23] where $stdin.flush reports an error on the former but not the latter?
<Cope> irb(main):002:0> $stdin.flush
<Cope> IOError: not opened for writing
<Cope> vs
<Cope> irb(main):001:0> $stdin.flush
<Cope> => #<IO:<STDIN>>
malev has joined #ruby-lang
codewrangler has joined #ruby-lang
Spooner has joined #ruby-lang
rohit has joined #ruby-lang
<manveru> Cope: looks like
<Cope> any idea what I need to do to make 1.8.7 not bitch?
<andkerosine> Proxy it?
malev has joined #ruby-lang
<manveru> $stdin.sync = true :)
dv310p3r has joined #ruby-lang
<Cope> as an alternative to flush?
<manveru> kidding, mostly
xaio has joined #ruby-lang
stephenp has joined #ruby-lang
<Cope> hmm
<andkerosine> Putting single-statement methods on one line with semicolons: frowned upon?
willdrew has joined #ruby-lang
GiambalaGiambala has joined #ruby-lang
kain_ has joined #ruby-lang
tommyvyo has joined #ruby-lang
fayimora_ has joined #ruby-lang
judofyr has joined #ruby-lang
robbrit has joined #ruby-lang
erpuds has joined #ruby-lang
v0yager has joined #ruby-lang
v0yager_ has joined #ruby-lang
csherin has joined #ruby-lang
leonL has joined #ruby-lang
headius has joined #ruby-lang
fayimora_ has joined #ruby-lang
rippa has joined #ruby-lang
<andrewvos> andkerosine: You're an animal
anjen has joined #ruby-lang
wmoxam has joined #ruby-lang
monkeysmuggler has joined #ruby-lang
<andkerosine> Duly noted.
Stalkr_ has joined #ruby-lang
<erikh> hi
molgrew has joined #ruby-lang
<rue> HI THERE
<erikh> WHY HELLO RUEY MAYS
erpuds has joined #ruby-lang
setmeaway has joined #ruby-lang
dv310p3r has joined #ruby-lang
bglusman has joined #ruby-lang
Gekz has joined #ruby-lang
fayimora has joined #ruby-lang
headius has joined #ruby-lang
jondot has joined #ruby-lang
isale-eko has joined #ruby-lang
slyphon has joined #ruby-lang
enebo has joined #ruby-lang
jtoy has joined #ruby-lang
Austin__ has joined #ruby-lang
macmartine has joined #ruby-lang
erpuds has joined #ruby-lang
rshackleford has joined #ruby-lang
robbyoconnor has joined #ruby-lang
robotmay has joined #ruby-lang
r0bby has joined #ruby-lang
dr_bob has joined #ruby-lang
lordofthedance has joined #ruby-lang
outoftime_ has joined #ruby-lang
Sailias has joined #ruby-lang
leonL has joined #ruby-lang
andrewhl has joined #ruby-lang
<rue> Good for you
anthony has joined #ruby-lang
<andkerosine> rue: Might I pick your brain for a bit?
<rue> Maybe, what's it?
<andkerosine> Familiar with reddit, presumably?
shevy2 has joined #ruby-lang
<andkerosine> K.
wmoxam has joined #ruby-lang
lake has joined #ruby-lang
erpuds_ has joined #ruby-lang
m3nd3s has joined #ruby-lang
heppy has joined #ruby-lang
<rue> andkerosine: I don't really read Reddit
<rue> Used to a bit, when it was still better than /.
<andkerosine> Mm-hmm.
<andkerosine> I just thought I'd throw it out as a preliminary question. My issue isn't "directly" related.
divoxx has joined #ruby-lang
<devn> banister`sleep: check ur twitterz
<andkerosine> Essentially, is it possible for a method to know that it is the beginning of a chain?
<rue> As in obj.foo.bar #foo to know it's got something after? (And possibly that there's nothing preceeding?)
delinquentme has joined #ruby-lang
<delinquentme> so you've got a newly defined class and you want to leave some instructions for the next guy working with it ... whats the format / placement of the code comments so that the next guy can bring it up with the class help
<delinquentme> also .. i forgot how to call help on a specific object
outoftime_ has joined #ruby-lang
<rue> delinquentme: #python?
chimkan has joined #ruby-lang
<rue> Or do you mean ri/rdoc documentation? Ruby doesn't have runtime docstrings
<delinquentme> rue, yeah i've been programming in python for a while and I was expecting something equivalent to that in ruby
<delinquentme> ahhhh ok ok
<erikh> we have to have documentation first
* erikh runs
<rue> delinquentme: With pry (or irb, if you set it up) you can pull up ri docs, of course, so that might help.
<delinquentme> rue, so there is not operation like method.help()
fayimora has joined #ruby-lang
abuiles has joined #ruby-lang
<andkerosine> rue: Yes, that precisely, though not the parenthetical bit.
hopkinsju has joined #ruby-lang
<andkerosine> delinquentme: From a terminal, `ri method`.
<andkerosine> Of course, you could execute that from within Ruby if you so chose.
willdrew_ has joined #ruby-lang
hacketeer has joined #ruby-lang
slimfit has joined #ruby-lang
<rue> andkerosine: No, there isn't (without parsing). You might want to return a proxy object of some kind
malev_ has joined #ruby-lang
<rue> andkerosine: Consider how Enumerable and Enumerator work (although they have the advantage of #block_given?)
rpall has joined #ruby-lang
r0bby has joined #ruby-lang
futurechimp has joined #ruby-lang
r0bby_ has joined #ruby-lang
tekin has joined #ruby-lang
Jake232 has joined #ruby-lang
<erikh> something that tracks the call stack
<Jake232> Why is it not possible to OR EQUALS a cookie?
<Jake232> cookies.permanent[:some_cookie] ||=
<erikh> Jake232: I think you want #ror
<Jake232> Damnit, wrong roo
<Jake232> room*
<Jake232> Thanks
<erikh> yerp
lordofthedance has joined #ruby-lang
Indian has joined #ruby-lang
willdrew has joined #ruby-lang
<rue> erikh: Mm, yeah. I suppose you could have an external stack ordered by objects involved somehow
RomyRomy has joined #ruby-lang
<erikh> you could also look forward by using respond_to?
<erikh> dunno. I haven't been reading too closely
<erikh> (work)
dustacio has joined #ruby-lang
<rue> You won't know which method will be called
<erikh> yeah, I guess you're right
<andkerosine> The reddit API asks that you only make one call every two seconds.
<andkerosine> So, for example, some_user.comments[0].reply('some comment')
<andkerosine> Because it's chained, there should be a 2-second sleep called within the comments method.
<judofyr> andkerosine: you can use fancy delegation stuff
<andkerosine> But it's silly to make the user wait two extra seconds to continue execution if they're only grabbing the comments with no immediate intention of working on them.
<judofyr> in Rails: user.posts # doesn't really load the posts
<andkerosine> Completely different story here.
<andkerosine> I absolute /have/ to make the API call to get any meaningful information.
<judofyr> oh
<judofyr> I see now
<andkerosine> Mm-hmm. Deferred loading = awesome, but not applicable in this case unfortunately.
bitrot has joined #ruby-lang
<judofyr> why not just store the "previous request timestamp" in the Connection-object?
<judofyr> or whatever the object is
<judofyr> Request*
<andkerosine> It is indeed a connection.
<andkerosine> And that /sounds/ like it might work, but I can't quite wrap my head around it.
<judofyr> class Response; def reply; connection.request("…") end; end
<andkerosine> Sleep on the chain's tail if a call has recently been made?
<judofyr> yeah
<andkerosine> Absolutely brilliant.
<andkerosine> Hm...
<judofyr> def request; sleep left if @last <= TRESHOLD; carry_on! end
<andkerosine> But to avoid the potential issues that come with timing, could I not just have a boolean?
<judofyr> that ended up very pseudo-ish
<judofyr> what should the boolean say?
<erikh> moar like typo-ish
<erikh> :P
<andkerosine> Check the value at the beginning of the method and then reset it at the end?
<andkerosine> Eh, that only works for length-2 chains, I think.
<judofyr> doesn't work well for "only 1 per 2 second" either
<andkerosine> Well, no, I don't mind a manual call to sleep inside /my/ code, I'd just prefer that users of the wrapper not have to do it.
<judofyr> def request(thing);since = Time.now - @previous; sleep(2 - since) if since < 2; carry_on! end
<judofyr> err, and update @previous
<judofyr> andkerosine: that would only need a sleep in the general request-method
wyhaines has joined #ruby-lang
<judofyr> which should be very low level (just take an URL and method perhaps)
Indian has joined #ruby-lang
slimfit has joined #ruby-lang
methods2 has joined #ruby-lang
<methods2> is there a web irb that lets multiple people use it ?
<methods2> like a shared session
dberg has joined #ruby-lang
<andkerosine> If not, I'm on it. : )
<methods2> you talking to me ?
<andkerosine> Nah.
<andkerosine> : P
<methods2> :\
<andkerosine> I am.
<andkerosine> I've never heard of it, which means there's probably a huge logistical problem.
<andkerosine> But that would be an amazing teaching tool.
<andkerosine> methods2: Sorry, Internet shat out. Missed it if you said anything.
<methods2> nope
<andkerosine> Well, all right.
darchitect has quit ["Saliendo"]
havenn has joined #ruby-lang
<andkerosine> I imagine it would need to use sockets to be optimally functional, and I'm alas not yet familiar.
erpuds has joined #ruby-lang
<andkerosine> Seriously great idea, though.
<methods2> also a great interview tool
<methods2> jump on a tech phone call with a shared ruby web console
<andkerosine> Absolutely.
<methods2> andkerosine: shall we build it ?
<andkerosine> I'm actually kind of stunned this isn't a thing.
<methods2> i have 10 days to an interview..
<andkerosine> Sinatra + Heroku is kind of my forte...
jaimef has joined #ruby-lang
<judofyr> methods2: at first I read "is there a web irc that lets…"
<judofyr> and wondered, wtf?
<methods2> i bet we can just take one of the tryruby sites if they are open sourced and quickly add the feature
<andkerosine> Not my style. : )
<methods2> well just as a quick proof of concept ?
<judofyr> you'll get pretty far with common SSH + screen -r
<methods2> yea sure but on a phone interview ?
<methods2> yo interview guy ssh to this machine now please
<andkerosine> Heh.
<judofyr> why not?
<methods2> i think just sending someone a url and bam! shared irb .. that's cool..
<rue> methods2: pry-remote
<judofyr> then I think it's more useful to have a broadcasted session
<judofyr> like, "broadcast irb"
<judofyr> it gives you an URL
<rue> There's some ‘multiplayer’ support but I've not kept up to what the current status is. Ask #pry
<judofyr> and anyone can watch there
<judofyr> methods2: allowing two people to edit makes it way more complex
divoxx has joined #ruby-lang
<rue> judofyr: See above
<methods2> yea a broadcast is good enough
<judofyr> rue: that's not a shard session in the sense that the other user can see what you do
<judofyr> right?
<methods2> rue: so pry just lets you basically jump into a point of execution of an app with an irb session ?
<methods2> irb style session
<judofyr> shared*
<rue> There's been some recent development in the paradigm but, like I said, I'm not sure what the status is now. It worked to some extent earlier, so best ask over there
Heimidal has joined #ruby-lang
mtkd has joined #ruby-lang
<methods2> actually isn't that a huge security issue though ? I'd rather the idea of the a web irb since it's sandboxed properly
<judofyr> methods2: and what if you need some gems?
<methods2> i guess maybe that's going to far ?
dejongge has joined #ruby-lang
Jay_Levitt has joined #ruby-lang
futurechimp has joined #ruby-lang
heppy has joined #ruby-lang
fayimora_ has joined #ruby-lang
jacktrick has joined #ruby-lang
Luxx_ has joined #ruby-lang
RomyRomy has joined #ruby-lang
wmoxam has joined #ruby-lang
andrewhl has joined #ruby-lang
gnufied has joined #ruby-lang
danishman has joined #ruby-lang
methods2 has joined #ruby-lang
methods2 has quit [#ruby-lang]
ylg has joined #ruby-lang
savage- has joined #ruby-lang
savage- has joined #ruby-lang
rshackleford has joined #ruby-lang
macmartine has joined #ruby-lang
robotmay has joined #ruby-lang
<delinquentme> @var is an instance var?
* delinquentme is reviewing from his haitus to python
<shevy> delinquentme yeah
<shevy> all one @ are
<delinquentme> and the double ?
<shevy> class variable, but if you can, do not try to use it
<shevy> class Foo; @@foo = 5; def hello_world; @@foo += 5;
ylg has joined #ruby-lang
darkf has joined #ruby-lang
darkf_ has joined #ruby-lang
publicvoid_ has joined #ruby-lang
mytrile has joined #ruby-lang
<rippa> durr
divoxx has joined #ruby-lang
mrsolo has joined #ruby-lang
symm- has joined #ruby-lang
H2H has joined #ruby-lang
ged has joined #ruby-lang
dhruvasagar has joined #ruby-lang
looopy has joined #ruby-lang
krz has joined #ruby-lang
jaisoares has joined #ruby-lang
jaisoares has quit [#ruby-lang]
H2H_ has joined #ruby-lang
lsegal has joined #ruby-lang
outoftime_ has joined #ruby-lang
<rue> Heh, a magically sandboxed web irb
ylg has joined #ruby-lang
outoftime_ has joined #ruby-lang
malev has joined #ruby-lang
dous_ has joined #ruby-lang
abuiles has joined #ruby-lang
<delinquentme> classes aren't really objects??
* delinquentme feels like hes been lied to
gregmoreno has joined #ruby-lang
<Mon_Ouie> They are objects
lateau_ has joined #ruby-lang
<erikh> their inheritance tree is a big magical if I recall correctly
y3llow has joined #ruby-lang
<erikh> but otherwise yes
<erikh> s/big/bit
<Mon_Ouie> @@foo and @foo can both be used in the context of a class, but they have different meanings
<delinquentme> I hate to break it to you, but a class isn't really an object. From Ruby's source code:
<delinquentme> (from a why example nonetheless )
<delinquentme> A class has an m_tbl (a symbol table for storing methods) and a superclass (pointer to a superclass).
<erikh> 1.9.2p290 :002 > Class.new.kind_of?(Object)
<erikh> => true
<erikh> you can talk about technicalities all you want -- banister`sleep has done a lot more detail in that regard anyway
<erikh> but a class can be treated like any other object
<Mon_Ouie> That RClass struct you're showing just shows it's an object with additional fields
<Mon_Ouie> Strings and Arrays too have other fields after the RBasic structure
<delinquentme> so they're objects
<erikh> yeah, john's done a ton of work disassembling it all
<delinquentme> albeit slightly modified ones
<erikh> it's interesting how Object is a Class but Class is also an Object, etc.
<delinquentme> yeah im not trying to dismantle ... just make sure that what I've learned isn't falling apart
<delinquentme> yeah that part I can work with
<erikh> he has a blog somewhere where he posted all of it
<erikh> you should catch him when he's on
fayimora has joined #ruby-lang
Sailias has joined #ruby-lang
butchanton has joined #ruby-lang
lateau_ has joined #ruby-lang
<erikh> Mon_Ouie: thank you
mahlon has joined #ruby-lang
butchanton has joined #ruby-lang
<rue> It all fits together, you just have to wave hands a little with the circular structure between Object, Module, and Class
<erikh> mmhmm
<erikh> I mean I understand the problem, the solution is just interesting to read about is all
_bryanp has joined #ruby-lang
_bryanp has joined #ruby-lang
benanne has joined #ruby-lang
erpuds has joined #ruby-lang
r0bby_ has joined #ruby-lang
<andkerosine> How to eval into a string?
* andkerosine ducks pitchforks.
havenn has joined #ruby-lang
rushed has joined #ruby-lang
<andkerosine> Just prototyping the shared irb thing.
<shevy> eval string ?
<andkerosine> ?
<andkerosine> I need to store the result into an array to return as JSON.
<andkerosine> ary << eval('puts 10')
artOfWar has joined #ruby-lang
<andkerosine> Doesn't do it...
<andkerosine> It prints the 10 and appends nil.
<shevy> well ary << eval('5+10') appends 15 to the array
<andkerosine> Mm-hmm.
<andkerosine> But people will want to puts into the shared irb, I imagine.
<erikh> there's an EM-attached IRB out there
<erikh> I used it to build a remote console once
<erikh> you could probably easily extend it to share between n connections
cirwin has joined #ruby-lang
fayimora has joined #ruby-lang
<Spooner> pry-remote-em for example
<rippa> andkerosine: ary << eval('p 10')
sora_h has joined #ruby-lang
jredville has joined #ruby-lang
Heimidal has joined #ruby-lang
bradland has joined #ruby-lang
lordofthedance has joined #ruby-lang
RomyRomy has joined #ruby-lang
voker57 has joined #ruby-lang
voker57 has joined #ruby-lang
Heimidal_ has joined #ruby-lang
hopkinsju has joined #ruby-lang
whatasunnyday has joined #ruby-lang
cirwin has joined #ruby-lang
mytrile has joined #ruby-lang
robbyoconnor has joined #ruby-lang
bradland has joined #ruby-lang
lateau_1 has joined #ruby-lang
cyri_ has joined #ruby-lang
symm- has joined #ruby-lang
lateau_ has joined #ruby-lang
<rue> Again, work done on that, but of course it's a nice nontrivial exercise
sora_h has joined #ruby-lang
_bryanp has joined #ruby-lang
leonL has joined #ruby-lang
bryancp has joined #ruby-lang
danielvdotcom has joined #ruby-lang
Stalkr_ has joined #ruby-lang
malev_ has joined #ruby-lang
linkk has joined #ruby-lang
lateau_ has joined #ruby-lang
butchanton has joined #ruby-lang
xsdg has joined #ruby-lang
<banister`sleep> andkerosine: pry-remote-em does all that
<banister`sleep> andkerosine: http://github.com/simulacre/pry-remote-em
<andkerosine> Yes, I've gathered.
<andkerosine> Thank you, nonetheless.
Axsuul has joined #ruby-lang
Axsuul has joined #ruby-lang
Axsuul has joined #ruby-lang
Axsuul has joined #ruby-lang
Axsuul has joined #ruby-lang
Axsuul has joined #ruby-lang
hopkinsju has joined #ruby-lang
Axsuul has joined #ruby-lang
linkk has quit [#ruby-lang]
<whitequark> how can I get the ext/ directory of my gem?
Heimidal has joined #ruby-lang
csherin has joined #ruby-lang
looopy has joined #ruby-lang
<hopkinsju> I'm having trouble getting this code to run on a remote server, but it runs just fine on my local machine. I'm using the same ruby version on both boxes. Can anyone point me in the right direction? http://pastie.org/3402143
<hopkinsju> There's a few notes about ruby version and output at the bottom of that paste
<hopkinsju> Also - I'm a Ruby nub
<banister`sleep> whitequark: you probably have to use the rubygems api
<whitequark> banister`sleep: obviously
<whitequark> I'm currently looking at the API and the closest match is:
<whitequark> Gem.loaded_specs['sunscraper'].full_gem_path + 'ext/libsunscraper.so'
gregf has joined #ruby-lang
<whitequark> err, obviously I should File.join and so on
<whitequark> you got the idea
<banister`sleep> whitequark: yeah we use something similar to that
<rue> hopkinsju: First, get off 1.9.1
<rue> hopkinsju: But the error is what it tells you it is: size = output.to_s.scan(site_pat).flatten!.collect!{|s| s.to_i}.inject(:+), #collect! is sent to nil, which means that your #flatten! is returning nil.
<banister`sleep> whitequark: we use: `cli_options_file = File.join(spec.full_gem_path, "lib/#{spec.name}/cli.rb")` which is pretty much the same thing
<hopkinsju> rue: I'm using 1.9.1, but I've tried several different versions (older and newer) and the result is always the same. Doesn't work on the remote server, works fine on my laptop.
<rue> Regardless, don't use .1
<rue> It's buggy
<rue> At least .2 if you can't for some reason go to .3
<whitequark> banister`sleep: kinda same, yes. thanks
<erikh> .2 is a nice stable release at this point, if that's a concern
<whitequark> rue: IIRC .1 and .3 use the same rules for constant lookup
Gekz has joined #ruby-lang
Gekz has joined #ruby-lang
<whitequark> whereas for .2 it has been changed
<erikh> .3 isn't really much worse unless you're using extensions
<hopkinsju> rue: Ok. It's just what I happened to be on at the time, but I had started with .2 and have also tried .3 - I can tell that the problem is that .flatten is coming back nil, but I don't understand why the behavior is different on the two machines.
<whitequark> about 1.9.3
<whitequark> I've found a segfault bug in it
<whitequark> without any extensions
<whitequark> (-p0)
<banister`sleep> whitequark: me too
<banister`sleep> whitequark: how do you repro it?
<erikh> nice
<whitequark> I have a set of data, on which I perform some rather GC-heavy graph transformations
<whitequark> and it just fails each time
<erikh> I've only seen differences in GC that tend to break on certain ... wow
<erikh> maybe it wasn't the extension
<banister`sleep> whitequark: yeah 1.9.3 also segfaults sometimes with set_trace_func() but it's hard to reproduce
<whitequark> but the bug is very heisen-like
<banister`sleep> whitequark: but it was related to GC too
<erikh> although the ffi-rzmq stuff I've been doing has been solid
<whitequark> I move one line and it vanishes
<whitequark> I'll try to reproduce it now. maybe I'd be able to catch a backtrace
<whitequark> either it dies each time or just works correctly
<rue> hopkinsju: You might want to see what the output you receive is at that point, might be it's not in the correct format for your matcher
<banister`sleep> whitequark: when i migrated binding_of_caller to 1.9.3 i got occasional segfaults too, all related to GC
<banister`sleep> 1.9.2 had no issues there whatsoever
<erikh> right
seanstickle has joined #ruby-lang
<erikh> generate a couple of hundred objects and 1.9.3 (or the C extension) soils itself
<banister`sleep> but i turned off GC for the tiny binding->filename string and all is well (though still a tiny memleak)
<hopkinsju> rue: Ok, so maybe the problem lies in the ssh connection? Maybe the OS X implementation of of ssh results in different characters being returned than the Ubuntu version...
<erikh> err, hundred thousand
<epitron> banister is sleepchatting again
<rue> Might be
<whitequark> even worse, sometimes it did not segfault
<whitequark> but just randomly corrupted some values
<whitequark> very weird
krz has joined #ruby-lang
pieterm has joined #ruby-lang
<shevy> when I have a string "abc1", and I iterate through the tokens via .split(//).each, how to check whether the character is a number or not? I could use a regex but I wonder if there is something faster
<erikh> if you & when you meant to *, you're gonna have a bad time
<whitequark> s.to_i.to_s == s
<erikh> fuck it -- I'm going to tweet that
<shevy> whoa cool whitequark
<whitequark> as per the 1.9.3-p0 bug. I'm unable to trigger it now.
havenn has joined #ruby-lang
<whitequark> shevy: actually, .to_i is just marginally slower
<shevy> oh?
<shevy> than a regex?
havenn has joined #ruby-lang
<whitequark> yep
<shevy> what!
<shevy> :()
<whitequark> ruby has fast regexen
BadQuanta has joined #ruby-lang
<seanstickle> shevy: s.is_a? String is faster than s.to_i.to_s == s
<whitequark> seanstickle: but it does not work as expected
<seanstickle> Oh?
<shevy> well my input is string like "abc123def"
<whitequark> shevy: hm wait. do you need single characters or strings?
Indian has joined #ruby-lang
<whitequark> can you elaborate on your overall task?
<seanstickle> He said single chars, via split(//)
<whitequark> seanstickle: still does not work
<shevy> yeah, actually I am calculating the atom weight of molecules. Like "NH3" or "H2O"
Mchl has joined #ruby-lang
<seanstickle> whitequark: ah, good point
<whitequark> shevy: then you're alredy using regexen. try str.scan(/[A-Z][0-9]?/)
<shevy> aaaaah lol good point
<whitequark> ruby has fast regexes. afaik oniguruma dynamically compiles FSM's from the source regexp on the fly and then executes them
<whitequark> take advantage of that
<seanstickle> s.to_i.to_s == s is faster than single character regexes
<whitequark> seanstickle: but shevy already uses regexes to split the string. using a more specialized regexp to split it will be faster than both of our ways
<seanstickle> Ah, I thought he needed to know if the number/letter status of each item in the string
<shevy> yeah, I completely forgot that I use a regex in scan
<whitequark> actually, few know that Oniguruma regexen can actually parse a LALR(n) grammar
<whitequark> that is, the balanced parentheses problem can be solved with it
<shevy> I never saw s.to_i.to_s == s before btw so I am still kind of enthusiastic
<whitequark> and yes, you can parse HTML with Oniguruma regexps
<whitequark> as in "really parse"
<shevy> but this brought me down again :( whitequark> shevy: actually, .to_i is just marginally slower
<whitequark> shevy: scanning with a right kind of regex is the way to go
<banister`sleep> how do i link to a tweet from the new twitter UI?
<whitequark> right-click on Open
<seanstickle> banister`sleep: step 1, download a twitter client
<banister`sleep> whitequark: reply to this girl's most recent tweet then ;) https://twitter.com/#!/madebydna
<shevy> are you tweet stalking again!!!
<shevy> and now everyone clicks on that!
<banister`sleep> shevy: i just remember it being relevant to whitequark's recent comment
<whitequark> tweet stalking?
<shevy> hmm
<shevy> I dont think I know whitequark
<shevy> it's a weird nick
<shevy> whitequark blackcheese
mytrile has joined #ruby-lang
m3nd3s has joined #ruby-lang
<Asher> so how long till you all think we can do this in ruby?? http://io9.com/5885903/how-to-build-a-dna-nanorobot
<Asher> :P
Banistergalaxy has joined #ruby-lang
robbyoconnor has joined #ruby-lang
robbyoconnor has joined #ruby-lang
<whitequark> Asher: I bet they computed the structure in Python
<whitequark> I've been working for a bioinformatics lab for a while and these people really love python.
<whitequark> so: you can do it right now.
<Asher> heh
<Asher> is there something unique about pythont hey love?
<seanstickle> APL will be the Next Big bioinformatics languages, I think
robbrit has quit [#ruby-lang]
<shevy> APL?
<whitequark> Asher: it just happened that python was actively promoted in universities as a "language for beginners"
<whitequark> which it obviously isn't
<shevy> hehehe
<whitequark> the students grow up and become professors
Dotan has joined #ruby-lang
<whitequark> of course they have no time to learn a real language
<seanstickle> shevy: a brilliant language that has been eclipsed for awhile due to lack of good open source interpreters/compilers
<whitequark> shevy: it also used more special symbols than Perl
<whitequark> like three times
<shevy> hmm
<whitequark> most of which you couldn't find on any keyboard except APL keyboards.
<shevy> lol
<whitequark> I'm not saying it's bad through
<seanstickle> That's what digraphs are for
<whitequark> but kinda niché
<seanstickle> :)
<seanstickle> niché?
<whitequark> seanstickle: do you have -trigraphs in your $CFLAGS maybe?
<whitequark> you know. globally enabled for the entire system
<whitequark> seanstickle: not for everyone
yawniek has joined #ruby-lang
<seanstickle> whitequark: no, I mean, is that even a word?
<seanstickle> whitequark: or are you just throwing in acute accents to be cool?
<seanstickle> :P
<whitequark> I've seen that used as a word multiple times
<seanstickle> ök
<whitequark> and I have Compose key configured, so typing accents in isn't that painful for me
<seanstickle> Gòtchâ
<whitequark> ∀x>0∃y=x+1
<shevy> Asher I am not quite getting that article. what did they manage to achieve?
malev has joined #ruby-lang
<yawniek> calling send for setters in a loop is there something more elegant than: ["a","b"].each{|key| self.send((key "=").to_sym, myhash[key] }
<Asher> shevy - programming containerized attack robots out of DNA that can be sent into a group of cells and will attack only the leukemia cells
<manveru> %w[a b].each{|k| send("#{k}=", myhash[k]) }
<shevy> ah
<whitequark> yawniek: (key "=") does not do what you think it does
<shevy> that is a lot easier to understand suddenly hehehe
<whitequark> it calls self.key and does not refer to a local block variable key
<shevy> all the DNA origami confused me, I thought they are going to build the eiffel tower with DNA
<whitequark> Asher: they're not really robots
slimfit has joined #ruby-lang
<seanstickle> shevy: ↑1 ⍵∨.^3 4=+/,¯1 0 1∘.⊖¯1 0 1∘.⌽⊂⍵
<necromancer> is there a way i can make the Mail gem mark a message as read? i see Mail::Message.mark_for_delete=, but what if i just want to make it look like it was read, but not deleted?
<Asher> whitequark - why not?
<seanstickle> shevy: is Conway's game of Life in APL. You can see the beauty.
<whitequark> Asher: a robot is supposed to have some control core, some actuators and some program. this thingy is more like a molecular contraption which happens to bind to some structures
<whitequark> it has some resemblance with "not-very-live" things like viruses
<whitequark> but definitely not robots
<Asher> meh
<Asher> it is all of those things
<Asher> just doesn't look like you're used to
<whitequark> a robot is supposed to act on its own
<whitequark> the DNA thingy just interacts with its environment in a very special way
leonL has joined #ruby-lang
<whitequark> it is pretty much passive
<yawniek> whitequark: hmm suggestions?
<Asher> that's a silly understanding of artificial intelligence
<Asher> passivity is the basis for responsivity
<Asher> that's the foundation of cybernetics
<Asher> passivity is how the robot is brought "to life" so to speak
<Asher> a condition activates its responsivity
malev_ has joined #ruby-lang
* whitequark looks at the channel name
<Asher> it's a channel about the status of a programming language as a language
<Asher> understandings of AI in relation to language concepts seem pretty relevant to me
<erikh> artificial philosophy
<Asher> cybernetics?:P
<necromancer> erikh: religion?
<erikh> hrm. topics I don't discuss? check.
<necromancer> ;-)
<necromancer> jk
<necromancer> too much work to get done right now to be having theological discussions on IRC
<seanstickle> Particularly without being able to use the notation of modal logic.
<shevy> whitequark well if it works... it has like 90% enthusiasm and probably only 10% real thing inside
<necromancer> i was told that most of the use for C++ these days is in robotics
achiu has joined #ruby-lang
<erikh> yeah. that windows thing? nobody uses it
<necromancer> haha
<whitequark> shevy: what are you talking about?
<whitequark> the DNA thingy? it actually works, and it works well
<necromancer> erikh: do they still use C++ on windows? i was under the impression apps are made with C# and .NET these days (unless it's a game or something)
<shevy> whitequark: <whitequark> the DNA thingy just interacts with its environment in a very special way
<whitequark> especially if you'll take into account that it's a prototype
<erikh> necromancer: there's still a lot of native stuff out there
<necromancer> oh cool
<whitequark> yes, it is very real and the article does not exaggregate its usefulness/abilites
<erikh> but yes, a lot of shops are transitioning -- still, there's managed C++ and so forth.
<Asher> C# is just C++ clobbered with a sledge hammer and fit into a MS break-all-the-time-box
<necromancer> erikh: i've never programmed for windows, nor have i even used a windows machine since 2005
<erikh> nonononononoon
<erikh> C# is *nice*
<necromancer> Asher: it's not THAT bad haha
<Asher> compared to windows programming
<Asher> it is "nice"
<erikh> C# is fucking beautiful
<necromancer> compared to C++...
<whitequark> erikh, necromancer: ^ that
<necromancer> C# makes a LITTLE more sense
<erikh> I'd use it instead of ruby if it ran nicely on unix boxes.
<Asher> erikh- why?
<necromancer> ...really?
<rue> Mono runs just fine
<erikh> yes.
<necromancer> erikh: that's a hard comparison to make, they serve very different purposes. now comparing Obj-C to C# and Java makes more sense to me
<erikh> C# has a ton of absolutely awesome features
<erikh> horsepucky
<whitequark> horsepucky?
<erikh> bullshit.
<necromancer> you really can't say shit? lol
<necromancer> ;-)
<whitequark> rofl
<necromancer> this channel is not FCC regulated btw
<erikh> I'm getting chided at work for being a potty mouth
<erikh> so I'm working on it
<necromancer> ahah
<necromancer> tell your co-workers to suck my dick
* Asher doesn't know what the fuck swear words are
<Asher> … if it's in the dictionary it's a legit word
<erikh> nah, I just compared pingdom to the reliability of a drug fiend's bank account balance earlier
<Asher> … and if people use it and it's not in the dictionary it's a legit word
<deryl> HORSE PUCKIES!
<erikh> so I'm dealing with my issues
<necromancer> erikh: honestly that's a pretty good comparison lol
<erikh> yes
<Asher> erikh - seriously tho i'm curious what you have in mind as the distinguishing features
<Asher> not to argue w/them just curious what they are
<erikh> where to start
Heimidal_ has joined #ruby-lang
andkerosine has quit [#ruby-lang]
<erikh> it has pretty much everything ruby does, plus optional static typing, decorators, in-situ parser support (manipulate the ast not unlike lisp macros)
<erikh> that's just a taste
<whitequark> the bad thing about .NET anything is that it's plagued with patents
<erikh> the libraries are brilliant too
<whitequark> so, while it may be a good language
<whitequark> it is not a good FOSS language
<erikh> correct
<whitequark> tomorrow MS will change their mind and mono will have to die
<erikh> that and it's about 4 bazillion times faster
<whitequark> theoretically
<whitequark> mono isn't really fast
<erikh> mono isn't
<erikh> maybe
<whitequark> monodevelop is fucking slow
<erikh> but on windows box?
<whitequark> I don't care about windows for ~5 years
<whitequark> and I'm not going to start
<erikh> meh
<Asher> yea the windows problem is a terminal disease
<whitequark> nah, windows isn't that bad
Heimidal_ has joined #ruby-lang
<whitequark> NT kernel is better than Linux
<Asher> in that it's dying out, sure
<seanstickle> Windows on Mach will be awesome
<Asher> it's really awesome to see MS in its death throes
<whitequark> for example, Linux has no real usable asynchronous I/O
<erikh> libev?
<whitequark> (no, O_NONBLOCK isn't. no, POSIX AIO isn't implemented correctly enough)
<whitequark> erikh: libev = O_NONBLOCK
<erikh> which of course sits on epoll/kqueue/etc
<whitequark> erikh: think about this: you read() a file from a hard disk and read() will block
<whitequark> even if it's on O_NONBLOCK
<seanstickle> MS is in death throes like IBM is.
<whitequark> block for the time of seek and read, of course
<seanstickle> ie, they're not, they're just much less interesting
<whitequark> but still it's blocking
<erikh> sure
<whitequark> NT has real async I/O. also completion ports are quite awesome
<whitequark> that, unfortunately, does not make Windows a good OS
<whitequark> because userspace sucks and community sucks
<erikh> I'm not an expert in async. I just know a bit.
<whitequark> I wonder how Debian/kWinNT would look like
<whitequark> you know that NT has a compliant POSIX subsystem in it, right?
robwilliamsukio has joined #ruby-lang
<whitequark> you can download a package from MS website and you'll get init, cron, getty and whatever not
<whitequark> running side by side with your csrss session
<erikh> whitequark: yeah I was aware of the POSIX stuff
<whitequark> you could kill the GUI completely afterwards (yes, incl. win32k.sys) and just work in a POSIX OS
<whitequark> which is quite funny IMO
<erikh> orly
<erikh> I did not know that
<whitequark> well, you'd need some real kernel hacking for that, but it's perfectly possible
<whitequark> the POSIX subsys does not need Win32K one
ttilley has joined #ruby-lang
<whitequark> a friend of mine did that
achiu has joined #ruby-lang
<whitequark> a Windows installation CD which does not have GUI, but has POSIX
<whitequark> he's a fan of weird perversions
<erikh> heh
<whitequark> most people making fun of Win* do not know what they talk about
<erikh> ^
<whitequark> just as they don't know their OS of choose
<Asher> seanstickle - MS has the chance to go the way of IBM… the question is whether they can pull it off like IBM did
<seanstickle> Asher: makes tons of money in the enterprise space and be mostly irrelevant in the consumer space and not lead the future?
<Asher> right
<seanstickle> Asher: I think they're learning to do that pretty well
<whitequark> ^ that
<Asher> they're doing it well riding off their rape and pillage of the 90s/00s
<whitequark> they can live for 100 years more just by supporting old systems
<Asher> but what happens when that runs out
<whitequark> but they'll all die eventually
<Asher> we'll see
<erikh> yeah
<erikh> erikhcorp is coming soon
<Banistergalaxy> What is etymology of "serialization" ?
<Asher> it is hugely significant that apple's smallest dept now makes more than all of MS
<Asher> but it's true that does not necessarily bear directly on MS dying out
<whitequark> fuck that. even SCO is still alive
<whitequark> or they aren't
<seanstickle> Banistergalaxy: originally?
<seanstickle> Banistergalaxy: eirein, from Greek, meaning to fasten together in rows
<whitequark> at least they lived for five years not having any profit/operations at all
<erikh> SCO had a good system
<Banistergalaxy> seanstickle: haha I mean in compsci
<erikh> which ironically was also originally written by microsoft
<Banistergalaxy> It seems like a weird term for saving data
<whitequark> erikh: not until they were bought by some patent trolls
<whitequark> *after
zmack has joined #ruby-lang
<erikh> yeah, "had" being the effective term
<erikh> SCO was a nice option before linux was a real option for a lot of places
<erikh> it was also one of the few options on intel hardware
<seanstickle> Banistergalaxy: nihil sub sole novum
<whitequark> I think I was at age of three at that time, or something like that...
<erikh> oh. er, how old are you?
<whitequark> ~19
<erikh> ah
<whitequark> so, I obviously don't remember SCO being alive/useful :D
<erikh> :)
<seanstickle> I remember buying a copy of SCO Unix
<erikh> fwiw, it was on its way out when I was your age
<erikh> and next was already more or less gone
<erikh> I had a professor with a cube and I was entranced
<skryking> wow 19, that was a long time ago...
<shevy> you old farts!
<seanstickle> Although I think it was Tarantula Unix at the time.
<whitequark> time goes fast
<shevy> wow that's a name
<erikh> tarantella
<shevy> Tarantula Aggro Unix!
<seanstickle> Yeah
<shevy> tagliatella?
<seanstickle> Tarantella
<erikh> it was still unixware/openserver when I last messed with it
<seanstickle> I just remember it as a big spider that provided Unix to me.
<erikh> we had it hooked up to a digiboard pushing a cobol app to around 25 wyse terms
<shevy> I never saw Unix, my first exposure to Linux was with a debian installation (it failed to start X11R6 or something, but that way I learned the commandline)
<whitequark> >cobol
<whitequark> ffuuuuu
<erikh> I learned more at that job than I've learned at most
<erikh> it was pretty awesome
headius has joined #ruby-lang
<seanstickle> I like COBOL in some respects.
<seanstickle> Although I like ALGOL-68 more.
<erikh> I've never written either
<skryking> I break out in a rash when I look at the old COBOL code I use to write
<seanstickle> Did anyone ever write ALGOL-68?
<seanstickle> I just wrote it on paper. Never had a compiler.
* whitequark had to look it up in Wikipedia
<whatasunnyday> I'm using the nokogiri gem. I can easily extract all the links on a page but I'm having problems getting the link text. For example, <ahref=#foo>Bar</a>
ylg has joined #ruby-lang
<whatasunnyday> I can get the #foo but how do I associate with a hash, array, or any other data structure the relation ship between #foo and bar?
<whitequark> oh, case..esac
<whitequark> so that's where sh got these weird construtcs
ylg has joined #ruby-lang
macmartine has joined #ruby-lang
tyfighter has joined #ruby-lang
hagabaka has joined #ruby-lang
delinquentme has joined #ruby-lang
<darix> whitequark: you grab the text child of the <a> tag
outoftime_ has joined #ruby-lang
xaio has joined #ruby-lang
Heimidal has joined #ruby-lang
banister`sleep has joined #ruby-lang
<banister`sleep> hey dudes
rushed has joined #ruby-lang
kain has joined #ruby-lang
<erikh> hey banister
<rue> Dudeman
<erikh> duuuuuuuude
duckinatorr has joined #ruby-lang
<banistergalaxy> erikh: hey homes
<banistergalaxy> erikh: i implemented 'up regex' which i think is slick, have you seen it anywhere else?
<erikh> "up regex"?
<bougyman> up regex?
<banistergalaxy> sorry not being clear, instead of 'up 2' when walking stackframes, you can type `up hel` for example, and i'll jump to the next parent frame whose method name matches that regex, so it'll jump to a method called 'hello' up the stack, or 'help', same with 'down regex'
<banistergalaxy> it's great for jumping around a huge backtrace
<banistergalaxy> IMO
<erikh> oh neat
<erikh> yeah I thought you were talking about a regex construct
<rue> Sounds useful
<rue> That should work for a string, too
<erikh> like a NFA that can search both ways or something.
<banistergalaxy> yeah it just takes a string but i wrap it in Regexp.new()
<rue> Although you're approaching the stage where you start seeing the brilliance of the vim movement commands
<erikh> cf,
<erikh> I probably type that 30 times a day
<banistergalaxy> interesting
<banistergalaxy> could probably hook those in .inputrc
<rue> Or especially the combination of the command and movements
<banistergalaxy> or is it .editrc
<erikh> .inputrc for readline
<erikh> .editrc might be libedit
<banistergalaxy> libedit is a ghetto, why did apple default to that?
<rue> GPL thing maybe?
<erikh> readline 6 has a really really really painful license
<banistergalaxy> rb-readline is actually pretty nice
<erikh> lusis just pointed out something with nagios today too
<erikh> one of its clauses is that you CANNOT fork it.
<unsymbol> urgh...
<erikh> yeah.
<rue> Well, it *is* The Enterprise Industry Standard
Heimidal has joined #ruby-lang
<erikh> just seems like an odd clause
<erikh> I guess it's the author's choice though
Sailias has joined #ruby-lang
m3nd3s has joined #ruby-lang
<banistergalaxy> erikh: have you seen coolline?
<erikh> I have not
Heimidal has joined #ruby-lang
<erikh> I actually need to find a replacement for either highline or its readline integration
<banistergalaxy> erikh: http://github.com/mon-ouie/coolline
<erikh> we have a tool at work that it's flipping out over
<erikh> ah
<banistergalaxy> erikh: we use it for this: https://github.com/pry/pry-coolline
<banistergalaxy> it's pretty nice
<rue> Coolline is neat
<rue> But I still haven't solved my pry input problem
<erikh> yeah, no 1.9 here
<rue> Not that I've tried much
<erikh> or where this code lives at least
<banistergalaxy> erikh: wildfireapp is still 1.8?
<rue> Anytime I try to go up in history, it only goes up one, moves the cursor to the start of the line, and doesn't allow going further back or forward in history
<erikh> lots of rails apps still are
<banistergalaxy> rue: did you try ^P ?
<banistergalaxy> rue: it works fine with emacs keybindings
<banistergalaxy> but i have some trouble with normal up/down keys
<rue> Mh
lordofthedance has joined #ruby-lang
<rue> Should probably look at this at some point, I'd venture arrow keys are the default for others. I figured it was just me :P
<banistergalaxy> i use emacs keybindings anyway so it doesnt bother me
<banistergalaxy> but i generally dont use coolline cos we dont support auto-indenting for it yet (dont ask me why, it looks easy enough)
csherin has joined #ruby-lang
<rue> Yep, it is just on coolline that I've noticed it.
postmodern has joined #ruby-lang
eydaimon has joined #ruby-lang
<eydaimon> 1.9.3 lets me know iconv is going to be removed in the future. I've not found a good way to deal with invalid bytecode in UTF-8. Does anyone know how to use String.encode in it's place? Here's an example ready: https://gist.github.com/e9d4b390bf11b1689c73
<banistergalaxy> eydaimon: did u see the keynes vs hayek rap battle
<banistergalaxy> eydaimon: pretty awesome http://www.youtube.com/watch?v=d0nERTFo-Sk
<rue> eydaimon: Did you read the #encode doc page?
Heimidal_ has joined #ruby-lang
<eydaimon> rue: i read the core documentation on it
<eydaimon> banistergalaxy: I've seen both :)
heppy has joined #ruby-lang
<eydaimon> any ideas?
petercooper has joined #ruby-lang
<rue> eydaimon: OK, wait, what's the problem?
<rue> It looks like in that case the replacement will be of 2 bytes, so 2 characters inserted
<eydaimon> rue: I can't replicate the behavior of iconv by using String.encode. I'm trying to address this issue: "iconv will be deprecated in the future, use String#encode instead."
<rue> eydaimon: Hm, I see
<rue> eydaimon: It looks like you can just force_encoding there
Defusal_ has joined #ruby-lang
Defusal_ has joined #ruby-lang
<rue> But maybe that doesn't work for the general case?
<eydaimon> i'll try :)
<eydaimon> nope, doesn't work for my use-case :/
<eydaimon> see if I can replicate mine in a different way now
<petercooper> "I think the Law of Demeter is shit and never follow it." hehe
willdrew_ has joined #ruby-lang
elux has joined #ruby-lang
<elux> drbrain: you there?
looopy has joined #ruby-lang
anjen has joined #ruby-lang
sora_h has joined #ruby-lang
<eydaimon> wtf
<rue> eydaimon: What about this replacing with ""?
<eydaimon> ah, I got it to repro
<eydaimon> for some reason it didn't work to have the data segment as part of the file
Asher1 has joined #ruby-lang
chimkan_ has joined #ruby-lang
Furankuru has joined #ruby-lang
<eydaimon> rue: http://ge.tt/9wydlmD?c
<eydaimon> that one fails even with force_encoding
H2H has joined #ruby-lang
seanstickle has joined #ruby-lang
<rue> eydaimon: What if you replace with ""
<eydaimon> if I replace with "" ?
<eydaimon> I don't follow
andkerosine has joined #ruby-lang
<rue> You're trying to ignore invalid bytes, no?
kyrylo has joined #ruby-lang
<eydaimon> I'm trying to do a regular expression match on an xml file containing invalid bytes, so yes, trying to ignore
Dreamer3 has joined #ruby-lang
Heimidal has joined #ruby-lang
href has joined #ruby-lang
burgestrand has joined #ruby-lang
jimmyy111 has joined #ruby-lang
tomzx has joined #ruby-lang
sj26 has joined #ruby-lang
savage- has joined #ruby-lang
WillMarshall has joined #ruby-lang
kyrylo has joined #ruby-lang
kyrylo has joined #ruby-lang
senj has joined #ruby-lang
MistyM has joined #ruby-lang
shevy has joined #ruby-lang
darkf_ has joined #ruby-lang
jimmyy111 has joined #ruby-lang
virunga has joined #ruby-lang
Tref has joined #ruby-lang