<joevandyk>
basically, i have three items. i need to come up with all the different types of ways of shipping those items (so i can find the cheapest method). so they could be all in one box, could be shipped separately, items 1 and 2 in one box, items 1 and 3 in one box, etc
<joevandyk>
but i don't know the name for this sort of algorithm
nathanstitt has quit [Quit: I growing sleepy]
teleological has quit [Ping timeout: 252 seconds]
snarfmason has quit [Ping timeout: 252 seconds]
hogeo has joined #ruby-lang
snarfmason has joined #ruby-lang
saarinen has joined #ruby-lang
saarinen has quit [Client Quit]
snarfmason has quit [Quit: Computer has gone to sleep.]
djwonk has quit [Quit: djwonk]
ffio_ has quit [Quit: WeeChat 0.4.0]
roadt has joined #ruby-lang
teleological has joined #ruby-lang
glebm has quit [Quit: Computer has gone to sleep.]
<joevandyk>
bnagy: well, sorted was just to get rid of the dups
<joevandyk>
i.e. [[1,3], 2] and [3,1], 2]
dingus_khan has joined #ruby-lang
<bnagy>
(1...a.size).map {|i| a.combination(i).to_a.sort}.to_a.flatten(1).map {|c| [c,a-c].sort}.uniq that looks right-ish
<joevandyk>
bnagy: i'm still trying to work through that -- it's missing the case with all of them in separate and all of them in one
<joevandyk>
but i could probably just add those
<joevandyk>
ah, that one just splits it into a maximum of two packages
<bnagy>
oh, yeah you're right
<bnagy>
recursion
<bnagy>
but even that will be unfeasible on > 10 elems, so I'd give it up
<bnagy>
like, that's the NP complete version
<bnagy>
get all possible packing solutions and test each one
lsegal has joined #ruby-lang
roadt has quit [Ping timeout: 256 seconds]
<joevandyk>
so how do people figure out the cheapest way to ship stuff? right now, i've got a few hand coded rules like "if order weight < 1 pound, ship UPSMI. 1..3 pounds, ship UPS Surepost. >3 pounds, UPS Ground." it doesn't know that if you split up an order into 5 shipments, shipping to a US territory via UPSMI is way cheaper than shipping it in one package via ground.
<joevandyk>
i wonder if I could precompute this
roadt has joined #ruby-lang
vbatts|work has quit [Ping timeout: 252 seconds]
rmascarenhas has joined #ruby-lang
teleological has quit [Remote host closed the connection]
nathanstitt has joined #ruby-lang
roadt has quit [Ping timeout: 256 seconds]
roadt has joined #ruby-lang
pr0ton has joined #ruby-lang
catphive has quit [Quit: Leaving.]
vbatts|work has joined #ruby-lang
teleological has joined #ruby-lang
ykk` has joined #ruby-lang
amerine has quit [Ping timeout: 252 seconds]
hashkey has quit [Ping timeout: 260 seconds]
hashkey has joined #ruby-lang
hashkey is now known as Guest99948
fedesilva has joined #ruby-lang
amerine has joined #ruby-lang
justinmb_ has quit [Remote host closed the connection]
blaix has joined #ruby-lang
justinmb_ has joined #ruby-lang
<zzak>
yorickpeterse: nice!
blaix has quit [Ping timeout: 256 seconds]
<zzak>
injekt: pong
<zzak>
probably too early for them
<zzak>
bbl
fedesilva has quit [Remote host closed the connection]
pr0ton has quit [Quit: pr0ton]
fedesilva has joined #ruby-lang
Guest99948 is now known as hashkey
teleological has quit [Remote host closed the connection]
amerine has quit [Ping timeout: 248 seconds]
fosky has quit [Ping timeout: 252 seconds]
spuk has joined #ruby-lang
scottschecter has quit [Ping timeout: 256 seconds]
teleological has joined #ruby-lang
justinmb_ has quit [Remote host closed the connection]
Nisstyre has quit [Read error: Connection reset by peer]
Nisstyre has joined #ruby-lang
justinmb_ has joined #ruby-lang
machuga is now known as machuga|away
amerine has joined #ruby-lang
fosky has joined #ruby-lang
io_syl has quit [Ping timeout: 260 seconds]
Senjai has quit [Remote host closed the connection]
woollyams has quit [Quit: Computer has gone to sleep.]
pipework has quit [Remote host closed the connection]
henrikhodne has quit [Quit: Computer has gone to sleep.]
marr has joined #ruby-lang
ikrima has quit [Quit: Computer has gone to sleep.]
vlad_starkov has joined #ruby-lang
sirfilip has joined #ruby-lang
<sirfilip>
morning
noop has joined #ruby-lang
kn0tsel has joined #ruby-lang
vlad_starkov has quit [Ping timeout: 256 seconds]
dfdf has quit [Ping timeout: 245 seconds]
crudson has quit [Read error: Connection reset by peer]
jbsan has quit [Quit: jbsan]
toretore has joined #ruby-lang
ruurd has joined #ruby-lang
mbj has joined #ruby-lang
elia has joined #ruby-lang
elia has quit [Ping timeout: 252 seconds]
dingus_khan has joined #ruby-lang
crudson has joined #ruby-lang
mikewintermute has joined #ruby-lang
dingus_khan has quit [Ping timeout: 248 seconds]
snafoo has joined #ruby-lang
elia has joined #ruby-lang
ikrima has joined #ruby-lang
tomzx_mac has joined #ruby-lang
riffraff has quit [Quit: Leaving]
elia has quit [Ping timeout: 252 seconds]
beho has joined #ruby-lang
beho has quit [Remote host closed the connection]
krombr has joined #ruby-lang
GarethAdams has joined #ruby-lang
<injekt>
moin
benxao has quit [Remote host closed the connection]
kn0tsel has quit [Remote host closed the connection]
krombr has quit [Remote host closed the connection]
elia has joined #ruby-lang
<whitequark>
PaulePanter: hm
<whitequark>
lemme see
ffio has quit [Quit: WeeChat 0.4.0]
<PaulePanter>
whitequark: Hi. Thanks again for parser.
<PaulePanter>
whitequark: When running dos2unix over them, it seems to work now.
<yorickpeterse>
whitequark: quick dirty fix: find replace all \r\n with \n before parsing
<PaulePanter>
whitequark: I am thinking about using parser to convert/transform a ruby file with lots of PDF commands from Prawn to a new format, or just extract the coordinates.
<whitequark>
yorickpeterse: I do that
<whitequark>
yorickpeterse: aaaand it screws up source maps
<PaulePanter>
yorickpeterse, whitequark: I read, that File.Open("…").read should take care of the conversion.
<whitequark>
PaulePanter: you can also use parser 2.0.0.beta3
<yorickpeterse>
whitequark: hm
<whitequark>
but then replace all `node.src' with `node.loc' in the rewriter script
<PaulePanter>
The above is an excerpt from a much bigger file.
<whitequark>
judofyr: this is sad
<judofyr>
whitequark: what part?
<judofyr>
whitequark: I think it's mostly sad that I never got anything done on it :(
<PaulePanter>
The plan is to find out the attribute and the coordinates automatically.
noop has quit [Ping timeout: 252 seconds]
<PaulePanter>
I wanted `ruby-rewrite.rb` as a template and start from there.
vlad_starkov has quit [Ping timeout: 260 seconds]
ij has left #ruby-lang ["WeeChat 0.3.9.2"]
<judofyr>
whitequark: re: Sequel: I find Sequel to be practically better. SQL isn't relational algebra, and I find it awkward to work with the ARel abstraction.
<whitequark>
judofyr: it's sad that there is no agreement over *whether ASTs should be included in the language*
<whitequark>
even
<whitequark>
there's grammar, therefore they should be.
<yorickpeterse>
"Nothing wrong with your code as far as I can see.
<yorickpeterse>
Reboot your PC and try again. Maybe something is messing with your development environment and preventing your server from using your latest code. "
<yorickpeterse>
hahaha
<whitequark>
PaulePanter: where exactly did you get that file from, and what do you want to do with it?
<whitequark>
judofyr: (sequel) maybe. I was only talking about DSLs.
<judofyr>
ah
<whitequark>
I personally don't find ARel awkward, however, I do find that blending AR and ARel is.
<PaulePanter>
whitequark: The file is from a former project and has all the values hardcoded in it.
<whitequark>
PaulePanter: ah, so it is handwritten
<PaulePanter>
whitequark: The creation should be done automatically now.
<PaulePanter>
whitequark: Yes, unfortunately written by hand.
<whitequark>
then you are indeed better off extracting the values with parser
<whitequark>
if you're going to do it once (I hope)
<whitequark>
judofyr: it's also true that the best solution is Proc#source
<whitequark>
because optimizing implementations already don't store ASTs (that is silly)
<whitequark>
V8, for example, *only* stores machine code
<PaulePanter>
Reading the doc and you example, I could not find, how I would check for a command(?) expression, like `pdf.text`. I only found `on_if`, `on_case` and so on.
<judofyr>
true
<judofyr>
PaulePanter: on_send
<whitequark>
PaulePanter: that would be (send (send nil :pdf) :text ..)
<PaulePanter>
Ah. Thanks.
<judofyr>
whitequark: still, then Proc#to_ast should just use #source internally
<judofyr>
using the Ruby's parser
<whitequark>
judofyr: Proc#to_ast should be provided by a pure-Ruby, vendored gem
<whitequark>
headius is right: hooking stuff to the ruby's parser is a) complex b) requires constant maintenance
<whitequark>
even in the case of a self-hosted implementation
<whitequark>
besides, it doesn't provide you with significant advantages
kirin` has quit [Ping timeout: 248 seconds]
<whitequark>
ruby's parsers are optimized first and foremost for speed
<judofyr>
whitequark: yeah, I think `parser` has made my initial request obsolete
<judofyr>
whitequark: does MRI even store the column somewhere?
vlad_starkov has joined #ruby-lang
<whitequark>
judofyr: no
<whitequark>
parse.y doesn't record it afaik
<judofyr>
whitequark: I'm not touching parse.y, so I guess this is the best we can do (method_source + parser)
kirin` has joined #ruby-lang
vlad_sta_ has joined #ruby-lang
<whitequark>
judofyr: neither do rbx's parser and jruby's parser
vlad_st__ has joined #ruby-lang
<whitequark>
because they are basically parse.y.
<judofyr>
whitequark: I think the current situation (parser + method_source) is just fie
<judofyr>
fine
vlad_starkov has quit [Ping timeout: 248 seconds]
mdedetrich has joined #ruby-lang
noop has joined #ruby-lang
vlad_sta_ has quit [Ping timeout: 252 seconds]
<whitequark>
judofyr: it can't be used for any practical work
<whitequark>
but it's rather hard to improve.
<judofyr>
whitequark: define practical?
<whitequark>
judofyr: anything except toys.
<whitequark>
it breaks on: generated code. code written in a REPL. code which includes chains like .map{}.reduce{}.
freedrull has joined #ruby-lang
henrikhodne has joined #ruby-lang
blaix has quit [Quit: Leaving.]
<charliesome>
whitequark, judofyr: you could rip an AST out of the bytecode
<whitequark>
charliesome: no
<charliesome>
whitequark: i've done a proof of concept type thing before, it works surprisingly well
<whitequark>
it's an irreversible process
<whitequark>
"surprisingly well" is not enough
<charliesome>
compiling an AST to bytecode is slightly lossy
<whitequark>
you either have the AST back, or you don't.
<charliesome>
but you can get decent results going the other way
<charliesome>
you have an expression tree somewhat resembling the original AST
<charliesome>
which is often all you need
<whitequark>
charliesome: I'm well aware of which can be done. I wrote a deobfuscating decompiler
ldnunes has joined #ruby-lang
<whitequark>
however, it doesn't get you an AST. it gives you, well, some tree
<whitequark>
in some cases
jxie has quit [Quit: leaving]
<charliesome>
yeah but in most cases all you need is 'some tree'
<whitequark>
(you'd have a hard time guaranteeing that every possible bytecode combination can be decompiled)
<whitequark>
charliesome: I hardly agree
<whitequark>
the simplest thing of all, displaying the source, requires proper AST
<whitequark>
not even taking into account that the bytecode is undocumented MRI implementation detail and is subject to change without notice
<charliesome>
you could implement some amazing DSLs with the "some tree" you get
<charliesome>
especially when you consider Proc#binding
<judofyr>
whitequark: generated code is a biggie
<whitequark>
charliesome: ... which won't work on rbx/jruby
<whitequark>
I have no need in such "amazing" DSLs.
<charliesome>
whitequark: sure but that doesn't concern me as much
<whitequark>
oh and Proc#binding is going to be removed as well
<whitequark>
even from MRI ;)
<charliesome>
:(
<charliesome>
going to be, or proposed?
mdedetrich has quit [Ping timeout: 248 seconds]
<whitequark>
(doesn't concern you as much) then please don't promote this non-solution to the Ruby community, or at least explicitly mark it as MRI-specific, and MRI-version-specific.
<whitequark>
charliesome: (binding) I think there's a consensus that it should be removed.
<whitequark>
mri folks agreed
<charliesome>
ah bummer
<charliesome>
that sucks
<whitequark>
it doesn't
<whitequark>
Proc#binding kills performance
<whitequark>
(apart from breaking encapsulation)
<charliesome>
i'm well aware that Proc#binding kills a lot of potential optimizations
<judofyr>
charliesome: oh btw: I was thinking about writing a Minitest runner in the browser. and using something like better_errors to present a REPL at every error. would I be able to use better_errors' code?
<charliesome>
judofyr: it's MIT licensed, i can't stop you ;)
<judofyr>
charliesome: well, I meant more like if I could use it as a library
<yorickpeterse>
nice architecture (well most of it)
mbj_ is now known as mbj
<injekt>
i like handsome women
<yorickpeterse>
pick your style: if you like plastic surgery or faces with strong angles, go south korea
<yorickpeterse>
if you like round young looking faces, go Japan
<yorickpeterse>
(ofc I'm generalizing here)
<ykk`>
why can't a round face be plastic surgery
<ykk`>
hrmmm?
dfdf has quit [Remote host closed the connection]
fys has joined #ruby-lang
<yorickpeterse>
it can
<yorickpeterse>
but plastic surgery is almost a trend in SK sadly
<yorickpeterse>
from my little experience in Japan it's less the case over there, but I could be wrong
rwilcox has joined #ruby-lang
allan_farrell has joined #ruby-lang
Jungy has quit [Ping timeout: 256 seconds]
vlad_st__ has quit [Remote host closed the connection]
vlad_starkov has joined #ruby-lang
pipework has joined #ruby-lang
rsl has quit [Quit: Computer has gone to sleep.]
rsl has joined #ruby-lang
vlad_starkov has quit [Ping timeout: 248 seconds]
apeiros has quit [Remote host closed the connection]
henrikhodne has joined #ruby-lang
roadkith has joined #ruby-lang
<ykk`>
hey if i were to look for a company that hires noob developers and pay for their CS degree how would I go about that? any ideas?
snarfmason has joined #ruby-lang
<injekt>
ykk`: for writing ruby?
<ykk`>
yes
<injekt>
rails?
<ykk`>
yeah either
<ykk`>
it's all beautiful to me
<injekt>
have you done any rails?
<whitequark>
ykk`: why do you need a CS degree then.
<injekt>
^
<ykk`>
no not yet, bridging myself from intermediate to pro with Ruby right now
<ykk`>
then i'll tackle ror
<fys>
Anyone know how to check XML version w/ REXML?
<injekt>
if I hired you for a rails job I would not want to pay for your cs degree because I dont think I would get enough out of it
<yorickpeterse>
ykk`: no company is going to pay for your entire degree
<whitequark>
also: country?
<ykk`>
USA
GeissT has quit [Quit: MillBroChat AdIRC User]
<fys>
Paying for a degree is very very very expensive and a huge investment in someone, these days you're lucky for a company to relocate you on the cheap.
<ykk`>
from a business perspective i can understand that injekt and i would still be happy to do it
<bougyman>
ykk`: i think your initial premise is flawed.
<yorickpeterse>
don't count on it happening unless you're the next Dennis richie
<bougyman>
That is, it presumes that getting a CS degree would be advantageous to your career.
<injekt>
^
<bougyman>
That is often not the result.
<injekt>
this
wallerdev has quit [Quit: wallerdev]
<bougyman>
In fact I've never hired anyone with a CS degree, in 20 years of IS/IT management.
<ykk`>
correct but i'm in NYC and reading craigslist now I need like 2-5 years programming experience for a good job… I don't know but thinking of a CS degree would help with that experience maybe? but I hear its not necessary
<ykk`>
wow
<ykk`>
really?
<bougyman>
No, it wouldn't help one bit.
<bougyman>
really. I've hired a few CompE's
<yorickpeterse>
it helps in very specific areas
<ykk`>
well that saves me money
<yorickpeterse>
e.g. if you're doing programming for banks it probably helps if you've done a related education
<ykk`>
tbh
<wmoxam>
take a CS degree if you are interested in CS
<ykk`>
i want to work on a team of people that i can learn from and be happy coding
<bougyman>
If you want to get a programming job, start programming.
<bougyman>
Nothing is better on your resume than a body of work.
<ykk`>
yeah bougyman you're right
<yorickpeterse>
ykk`: do some open sores, go to meetups, start there
<ykk`>
i'm 33 and was born in front of a computer :P not new to computers at all but am new to coding. Started a few months ago but i'm learning real quick
<injekt>
fys: why?
<wmoxam>
but it doesn't make a degree pointless
<fys>
injekt: I wish computers were a hobby still.
<ykk`>
after chris pines book i was writing web scrapers and now stepping up my game and really learning ruby on a pro level. i read each chapter like 5 times over
<injekt>
fys: they're not a hobby for me I own a tech company, I just meant I trained as a carpenter :P
<wmoxam>
fys: why?
<yorickpeterse>
injekt: yeah, you also have an empty office with a black leather couch in it
scottschecter has quit [Ping timeout: 252 seconds]
<injekt>
yorickpeterse: ;-)
<fys>
injekt: Ah, gotcha.
<ykk`>
inject i've seen your company
<fys>
wmoxam: Ever since I've been an engineer for hire, I come home and work on engines.
<yorickpeterse>
you can tell fys knows what I'm talking about
<yorickpeterse>
giggity
<fys>
:D
<ykk`>
ok so that still doesn't answer how i could find an employer willing to take on a newbie. even after i got some programs on my github… how would i put myself out there?
<erikh>
helo again
<ykk`>
hail
<wmoxam>
ykk`: start applying to jobs?
<wmoxam>
:p
<yorickpeterse>
ykk`: by just asking
rippa has joined #ruby-lang
<ykk`>
pffft, i want them to find me hahaha
<erikh>
not gonna happen
<injekt>
ykk`: do you have a github profile yet?
<yorickpeterse>
go to meetups, get to know them, just flat out ask them
<crankharder>
companies want to hire jr engineers and pay them next to nothing. go for that.
<workmad3>
ykk`: not gonna happen for a while :P
<wmoxam>
ykk`: walk before you run
<wmoxam>
:p
<ykk`>
yeah i do
<injekt>
Want them to find you? haha no chance
<injekt>
ykk`: what is it?
<ykk`>
typical woman, come to me i don't go to you haha
<erikh>
yeaaaaah
<erikh>
so, things like that.
<erikh>
not going to fly at a job.
<yorickpeterse>
ykk`: to bring it into context: we have a 35-40 year old woman who's an ex heavy metal bassist
<yorickpeterse>
until about 6 months ago she never wrote any code
<workmad3>
ykk`: I think you have the relationship the wrong way around in your head :P
<yorickpeterse>
she basically tackled me during a meetup
<ykk`>
yeah i did a web scraper and a little combat program
<ykk`>
you get to fight an orc with a rusty spoon
<injekt>
you need some work on your indentation
<injekt>
it's a little hard to read some of your code, and that'll easily put people off
<yorickpeterse>
jesus the pedantics
<injekt>
oh come on
<injekt>
this shit matters, you know it
<injekt>
I know it
<workmad3>
it especially matters if it's what you expect people to judge you on
<yorickpeterse>
is that why your company has only two employers?
<yorickpeterse>
(re injekt )
* yorickpeterse
runs
<ykk`>
you mean use two space indents?
<injekt>
har
<erikh>
two employers at a company is usually one more than usual
<erikh>
also praise me for my repeated re-use of the repetitive usual
<ykk`>
after peter's book i'm going to write a timer for the pomodoro technique
<injekt>
ykk`: two space indents and making sure indents are not mismatched
<ykk`>
then a few more programs, maybe a simple packet sniffer
<injekt>
a packet sniffer isn't going to help find you work :)
<yorickpeterse>
that's the spriti
<ykk`>
haha
<yorickpeterse>
* spirit
<yorickpeterse>
actually injekt, you're wrong
<yorickpeterse>
it's a billion times better than Yet Another Stupid Blag
<injekt>
I'm not saying dont build one
<injekt>
I'm saying dont use it to advertise yourself
<erikh>
horsecrap
<ykk`>
that makes sense
<erikh>
i'd hire someone that could build a serious business packet sniffer
<injekt>
this isn't the same league as someone new to programming looking for a job
<erikh>
agreed
<erikh>
which is why I can say what I will hire or not
<erikh>
without getting pm spammed into oblivion
<yorickpeterse>
I'd be pretty fucking impressed if somebody were to walk up to me and say "I'm new to coding, here's a pretty decent packet sniffer I wrote"
<injekt>
:D
<ykk`>
lol
<erikh>
yorickpeterse: yep
<workmad3>
yorickpeterse: you're making the assumption it would be a decent packet sniffer ;)
<injekt>
yorickpeterse: yeah, thanks for applying for our rails job, nice packet sniffer, so how is your rails-fu?
<workmad3>
no offence ykk` :)
<erikh>
injekt: I hate you
<ykk`>
if i wrote it then it would be
<injekt>
erikh: :D
<erikh>
this is like, my whole fucking career with ruby in a nutshell
<ykk`>
i' am a noob at programming but not with compuers
<ykk`>
and computers too
<injekt>
erikh: we all know the same thing, it's horrible but it's true
nathanstitt has joined #ruby-lang
<erikh>
"hi, we see that you actually understand unix and networking and sql -- how well do you know all the bullshit in activesupport?"
<injekt>
^
<injekt>
precisely
<gnufied>
lol.
<yorickpeterse>
injekt: before I got this job I hadn't written Rails for 2 years
<gnufied>
well, I lost my head once tracking load_dependencies, does it count?
<yorickpeterse>
they didn't give a fuck
<injekt>
yorickpeterse: before I got my job I hadn't written rails
<erikh>
did you see my better supporter than activesupport/
<yorickpeterse>
Rails is a tool, it's much more important that you can learn concepts
<injekt>
yorickpeterse: that's different, we have ruby experience, ykk` is learning
<erikh>
I have to link it in here occasionally just for shock value
<yorickpeterse>
injekt: yes, and I think a packet sniffer is a great way to learn
<yorickpeterse>
and to show that you can actually do it
mdedetrich has quit [Quit: Computer has gone to sleep.]
justinmb_ has joined #ruby-lang
kleech has joined #ruby-lang
<kleech>
Anyone know if `Thread.current['__whatever'] = some_var` is threadsafe or does it need protecting with a mutex?
gnufied has quit [Quit: Leaving.]
<judofyr>
kleech: that's thread-safe
<kleech>
judofyr: thanks :)
dhruvasagar has joined #ruby-lang
rmascarenhas has quit [Ping timeout: 256 seconds]
justinmb_ has quit [Ping timeout: 252 seconds]
jsullivandigs has joined #ruby-lang
<apeiros>
judofyr: sure?
arooni-mobile has quit [Ping timeout: 252 seconds]
arooni-mobile__ has quit [Ping timeout: 252 seconds]
<judofyr>
apieros: what part shouldn't be thread-safe? or what does in "thread-safe" mean?
<judofyr>
(in this context)
sirfilip has quit [Quit: Leaving]
<apeiros>
granted, the question as such makes actually no sense
<judofyr>
Thread.current will always return the current thread
<injekt>
heh it's always thread local
<judofyr>
(or fiber local or whatever)
<injekt>
but thread safe in all contexts probably not
<injekt>
but yeah, bad question
<apeiros>
all assignments are "thread-safe". it's when the data is accessed by other threads when problems occur.
<apeiros>
and Thread#[] is not limited to Thread.current
<judofyr>
that is true
<apeiros>
kleech: are all threads only ever accessing data via Thread.current? if so then you don't need a mutex. if not, then you should be more specific.
dhruvasagar has quit [Ping timeout: 256 seconds]
cofin has quit [Quit: cofin]
<kleech>
apeiros: Many threads will be setting Thread.current['_foo'], my understanding was each thread gets its own var?
<apeiros>
kleech: every thread is a different object, so your threads are not sharing data.
io_syl has quit [Quit: Computer has gone to sleep.]
<injekt>
kleech: Thread.current is fine, but if you fetched a thread a did thread['__whatever'] then you're asking for problems and should probably use a mutex
<apeiros>
hence the question whether it is thread-safe is irrelevant.
<injekt>
I can't type today so im gonna stop
<apeiros>
y u kant typ?
<yorickpeterse>
fixed typ
<apeiros>
dinamycali tiped?
<injekt>
also god damn fiber-local vs thread-local
<injekt>
gtfo
<apeiros>
indeed
<apeiros>
1.9 vs. 2.0
<kleech>
I guess I should write a spec to confirm if its a problem!
<apeiros>
Thread#[] is fiber-local in 2.0, not thread-local.
<injekt>
1.8 vs 1.9+ no
dr_bob has quit [Ping timeout: 256 seconds]
<injekt>
1.9 Thread#[] is fiber local too
<apeiros>
good luck with that kleech - ruby sadly does not provide access to the scheduler, so speccing thread issues is virtually impossible.
mytrile has quit [Remote host closed the connection]
<kleech>
Now its getting complicated! :)
<apeiros>
injekt: oh, right
<apeiros>
1.9 just doesn't have the thread-local equivalent
glebm has quit [Quit: Computer has gone to sleep.]
djwonk has joined #ruby-lang
justinmb_ has joined #ruby-lang
solars has quit [Read error: Operation timed out]
<yorickpeterse>
lol threads in MRI
<workmad3>
lol threads
gnufied has joined #ruby-lang
<erikh>
they're fine if you're just doing a lot of i/o
vlad_starkov has joined #ruby-lang
<erikh>
not especially speedy, but that can be said about MRI as a whole
<yorickpeterse>
I prefer an actual threading system that actually allows me to run more than one thread at a time
<yorickpeterse>
but yeah, IO is one area where they can be useful in MRI
<apeiros>
aaach, go fork yourself ;-)
<injekt>
wait mri is slow?
<apeiros>
no, those are baseless rumors.
justinmb_ has quit [Ping timeout: 248 seconds]
<apeiros>
it still calculates 49! thousands of times faster than you!
<injekt>
hey if i practiced hard!
<apeiros>
even then!
<injekt>
damn, that's fast!
<injekt>
apeiros: I think we just sold Ruby
<apeiros>
how much do I earn?
vlad_starkov has quit [Ping timeout: 248 seconds]
<injekt>
I'll forward your 50% karma
<apeiros>
weee!
* apeiros
buys a karmaporsche
<injekt>
you must have been saving those things are expensive
<yorickpeterse>
dat comma
tbuehlmann has quit [Remote host closed the connection]
<injekt>
thanks now it's even bugging me
<injekt>
I clicked and edited it, can you see the change?
vbatts|work has joined #ruby-lang
blaix has joined #ruby-lang
krombr has joined #ruby-lang
<apeiros>
injekt: 8 or 9 years of helping on irc baby!
<apeiros>
though, being an op had some detrimental effect…
fedesilva has joined #ruby-lang
scottschecter has joined #ruby-lang
dhruvasagar has joined #ruby-lang
<kleech>
just found out Set#merge mutates itself, I would have expected this to be a bang method...
judofyr has quit [Remote host closed the connection]
<workmad3>
kleech: there's no non-destructive version
<kleech>
workmad3: so you only get the bang if there are both versions?
<apeiros>
kleech: so you also want shift!, pop!, push! etc.?
<apeiros>
it's not how it works
<workmad3>
kleech: the rule of thumb through most of the stdlib and core ruby is that a ! method exists when there are two versions and one version is something you should be more aware of
<apeiros>
and generally (as per quote of matz) ! just means "be careful"
<kleech>
workmad3: understood, I didn't realise that...
<workmad3>
kleech: yeah, a lot of people see the !s and think of the lisp usage 'this is destructive!'
<workmad3>
but the ruby use is 'be careful, here be dragons!'
<apeiros>
DRAGONS?!?
* apeiros
runs
<workmad3>
apeiros: would you prefer 'it's dangerous to go on alone. here, take this !'
<apeiros>
indeed
justinmb_ has joined #ruby-lang
<kleech>
got it, I can do `set_1 + set_2`, pretty ob
justinmb_ has quit [Remote host closed the connection]
fedesilva has quit [Read error: Connection reset by peer]
fedesilva has joined #ruby-lang
LinkedoT has joined #ruby-lang
rmascarenhas has joined #ruby-lang
blaix has quit [Quit: Leaving.]
io_syl has joined #ruby-lang
awkisopen has joined #ruby-lang
towski has joined #ruby-lang
<Olipro>
what's the scope of $?
<Olipro>
is it per-thread?
<Olipro>
i.e. if I have two separate threads calling Process.spawn and then Process.wait on the returned PID, am I running the risk of a race condition if I need to check $?
machuga is now known as machuga|away
<whitequark>
I think it's frame-local
<whitequark>
but it is definitely not global, be assured
vlad_starkov has joined #ruby-lang
fedesilva has quit [Remote host closed the connection]
justinmb_ has quit [Remote host closed the connection]
vlad_starkov has joined #ruby-lang
vlad_starkov has quit [Read error: Connection reset by peer]
vlad_starkov has joined #ruby-lang
solars has joined #ruby-lang
vlad_sta_ has joined #ruby-lang
jperry has quit [Quit: jperry]
jperry_ is now known as jperry
jperry_ has joined #ruby-lang
glebm has quit [Quit: Computer has gone to sleep.]
fedesilva has quit [Read error: Connection reset by peer]
skade has joined #ruby-lang
fedesilva has joined #ruby-lang
vlad_starkov has quit [Ping timeout: 252 seconds]
jperry_ has quit [Quit: jperry_]
snarfmason has quit [Quit: Computer has gone to sleep.]
symm- has joined #ruby-lang
djwonk has quit [Quit: djwonk]
mrfelix has joined #ruby-lang
vlad_sta_ has quit [Remote host closed the connection]
benlovell has joined #ruby-lang
towski has quit [Remote host closed the connection]
mrfelix has quit [Quit: Computer has gone to sleep.]
havenwood has quit [Remote host closed the connection]
carloslopes has quit [Remote host closed the connection]
jxie_ has joined #ruby-lang
havenwood has joined #ruby-lang
djwonk has joined #ruby-lang
jxie has quit [Ping timeout: 264 seconds]
havenwood has quit [Ping timeout: 276 seconds]
swav has joined #ruby-lang
jperry_ has joined #ruby-lang
krohrbaugh has quit [Quit: Leaving.]
krohrbaugh has joined #ruby-lang
sush24 has quit [Quit: This computer has gone to sleep]
vlad_starkov has joined #ruby-lang
henrikhodne has joined #ruby-lang
forrest has joined #ruby-lang
carloslopes has joined #ruby-lang
glebm has joined #ruby-lang
pr0ton has quit [Ping timeout: 264 seconds]
krohrbaugh has quit [Quit: Leaving.]
ffio has joined #ruby-lang
symm- has quit [Ping timeout: 252 seconds]
ffio has quit [Client Quit]
ffio has joined #ruby-lang
ffio has quit [Client Quit]
ffio has joined #ruby-lang
benlovell has quit [Ping timeout: 265 seconds]
setmeaway has quit [Ping timeout: 256 seconds]
symm- has joined #ruby-lang
justinmb_ has joined #ruby-lang
achiu has joined #ruby-lang
rippa has quit [Ping timeout: 240 seconds]
cofin_ has joined #ruby-lang
saarinen has quit [Quit: saarinen]
brianpWins_ has joined #ruby-lang
amateurhuman_ has joined #ruby-lang
<Aloysius1>
Style/design question: I have a class that creates an object from two parameters (A, B) but I'd like to the class to ensure that all objects that the same value of A and B are the same. IOW, if I the user specifies Animal("dog", "collie"), that should always return the same object. Is it better stylistically to override #new or create a class method that either passes back new or returns existing?
<erikh>
same object or can it be a different object that's equal in some fashion?
tdy has quit [Read error: Connection reset by peer]
<Aloysius1>
Same object. Assume these objects will end up being heavyweight, and since they are functionally identical if their A&B parms match, I don't want to have multiple copies.
pr0ton has joined #ruby-lang
crankhar1er has joined #ruby-lang
tdy has joined #ruby-lang
steez_ has joined #ruby-lang
<erikh>
I'm going to give you the secret sobcheckian pattern
<erikh>
"you're entering a world of pain"
__butch__ has joined #ruby-lang
<Aloysius1>
OVER THE LINE!!!
znz_v0 has joined #ruby-lang
<erikh>
exactly
Dan_ has joined #ruby-lang
stamina1 has joined #ruby-lang
<Aloysius1>
OK, so I'll mark it a zero.
<erikh>
I'm going to suggest you think about hwo you can do it with multiple objects.
cofin has quit [Ping timeout: 276 seconds]
amateurhuman has quit [Ping timeout: 276 seconds]
brianpWins has quit [Ping timeout: 276 seconds]
chendo_ is now known as chendo
brianpWins_ is now known as brianpWins
stamina has quit [Ping timeout: 276 seconds]
znz_v has quit [Ping timeout: 276 seconds]
egyp7 has quit [Ping timeout: 276 seconds]
dankest has quit [Ping timeout: 276 seconds]
workmad3 has joined #ruby-lang
crankharder has quit [Ping timeout: 276 seconds]
steez has quit [Ping timeout: 276 seconds]
Dan_ is now known as Guest51987
egypt has joined #ruby-lang
krohrbaugh has joined #ruby-lang
<Aloysius1>
Oh, it's not hard to do it with multiple objects. Just from a design standpoint, I like the idea of creating these objects once and reusing them. Which I can also do by having the client code check to see if the object they need exists. It just seemed like some class intelligence would be more elegant.
krohrbaugh1 has quit [Read error: Connection reset by peer]
krohrbaugh has quit [Ping timeout: 264 seconds]
krohrbaugh2 has joined #ruby-lang
amerine has joined #ruby-lang
elia has quit [Ping timeout: 256 seconds]
swav has joined #ruby-lang
ldnunes has quit [Quit: Saindo]
jonahR has joined #ruby-lang
elia has joined #ruby-lang
cored has quit [Ping timeout: 264 seconds]
ajack has quit [Ping timeout: 252 seconds]
ffio has quit [Ping timeout: 256 seconds]
ffio_ has joined #ruby-lang
saarinen has quit [Ping timeout: 264 seconds]
<injekt>
aw
saarinen has joined #ruby-lang
mucker has quit [Quit: leaving]
<erikh>
d'awwwwwwwwwwwww
krohrbaugh2 has quit [Quit: Leaving.]
dingus_khan has joined #ruby-lang
swav has quit [Remote host closed the connection]
zommi has quit [Read error: Connection reset by peer]
scampbell has quit [Quit: Leaving]
machuga is now known as machuga|away
justinmb_ has joined #ruby-lang
jonahR has quit [Ping timeout: 256 seconds]
<Aloysius1>
OK, question on project structure. I have a class X in myprojects/x/ and a script Y in myprojects/y/. Best way to get class X into script Y? (X is uploaded to a local gitlab. Others will use X. Y may or may not create a descendant of class X.)
<whitequark>
argh, python
<yorickpeterse>
self.__lol__
<apeiros_>
join(self)
fys has quit [Ping timeout: 240 seconds]
pipework has quit [Remote host closed the connection]
<yorickpeterse>
hahaha yeah that one pisses me off
<yorickpeterse>
','.join([10, 20, 30]) # who invented this shit
<injekt>
that always annoyed me
<yorickpeterse>
it's like yoda code
<yorickpeterse>
numbers join you must
<Olipro>
what's a convenient yet secure equivalent to `` for the purposes of running a hardcoded command, but with user-defined arguments
<yorickpeterse>
in Guido's defense, we Dutch people are kinda wack
<injekt>
Olipro: lol secure
<yorickpeterse>
Olipro: Shellwords.shellescape or w/e it was called
<Olipro>
injekt: in a relative sense
vlad_starkov has joined #ruby-lang
<apeiros_>
Olipro: don't use `` but a sane variant
<apeiros_>
like spawn
<Senjai>
Im pulling my hair out trying to understand metaprogramming
<apeiros_>
where you can pass the command and arguments as an array, bypassing shell interpretation
<Olipro>
apeiros_: yeah, I was considering that, because I already use it in certain places - how would I pass the arguments as a separate parameter, the documentation doesn't look terribly clear
<zenspider>
and doesn't have anything more focused
<zenspider>
fixed. thanks.
<zenspider>
damn. Finished in 0.132135s, 2035.7967 runs/s, 5191.6600 assertions/s.
dingus_khan has quit [Remote host closed the connection]
dingus_khan has joined #ruby-lang
symm- has joined #ruby-lang
<Senjai>
anyone have any input on the stackoverflow question I posted?
AgentWillyWonka has joined #ruby-lang
fedesilva has joined #ruby-lang
nathanstitt has joined #ruby-lang
teleological has joined #ruby-lang
fedesilva has quit [Remote host closed the connection]
rmascarenhas has joined #ruby-lang
<zenspider>
Senjai: what's the question
<zenspider>
?
<zenspider>
lots of words... not much clarity
<zenspider>
your title mentions "class methods" and never says it in the body
<Senjai>
I just want to know if what I'm saying is correct
<zenspider>
and all your examples are instance methods
<Senjai>
I'm sorry, then I would agree that the title is misleading
<Senjai>
I'll change it
mikewintermute has quit [Quit: mikewintermute]
<zenspider>
Senjai: is this a learning exercise?
<zenspider>
or are you actually using this?
<zenspider>
why not use the tracer than ships with ruby?
<Senjai>
It's a snippet from Programming Ruby 1.9
<Senjai>
I think its trying to explain how some of those classes work
__butch__ has quit [Quit: Leaving.]
<Senjai>
with metaprogramming, just like how it showed how OpenStruct is defined.
ikrima has quit [Quit: Computer has gone to sleep.]
<Senjai>
I just want to make sure my thinking is solid and correct
<Senjai>
It's kind of difficult for me to understand whats going on
<zenspider>
I would, at first glance, assume that it is sufficient to do the define method on the object's singleton class and just use super when you want to call up to the original functionality