<yorickpeterse>
I'll see if I can whip one together tonight because it would be interesting to benchmark
nathanstitt has joined #ruby-lang
chouhoul_ has joined #ruby-lang
<headius>
yeah it would
qiffp has quit [Remote host closed the connection]
ascarter has joined #ruby-lang
chouhoulis has quit [Ping timeout: 244 seconds]
mcclurmc has quit [Remote host closed the connection]
rkowalick has joined #ruby-lang
arooni-mobile has quit [Ping timeout: 245 seconds]
hal_9000_ has joined #ruby-lang
ascarter has quit [Quit: My MacBook Pro has gone to sleep. ZZZzzz…]
Asher has joined #ruby-lang
mcclurmc has joined #ruby-lang
skade has quit [Quit: Computer has gone to sleep.]
ascarter has joined #ruby-lang
Dala has joined #ruby-lang
ledestin has joined #ruby-lang
<Dala>
Hi folks: Say I have arrays, each array has a list of hashes (like a key value): [ {:media_id => 1, :location => 'Utah'}, {:media_id => 5, :location => 'Texas'}, {:media_id => 3, :location => 'Miami'} ]
<Dala>
I want my end result to be a single array, that contains a list of each media and all its related data. Currently I am iterating through each, and using find. But that means loop through each array.
<Dala>
Is there anything that can be done, so that I can put all media data together, without having to separately iterate through each array?
sc00t has joined #ruby-lang
ghostpl_ has quit [Remote host closed the connection]
Miphix has quit [Ping timeout: 246 seconds]
<centrx>
dala, So you want to merge all hashes with the same media_id, for all arrays?
<Dala>
I wonder, if its basically doing what I am doing, but in an existing method.
<Dala>
i gotta look at the source for it
<Dala>
Hmm, it is based on the position of the elements, now i see why order was asked about.
rkowalick has quit [Ping timeout: 264 seconds]
<havenwood>
indeed, wouldn't work if they were unordered
<jhass>
mine would :P
<havenwood>
^
<Dala>
Ok, to clarify, i just looked at the returned structure. It is an array of arrays
<havenwood>
dala: An Array of Hashes
|jemc| has joined #ruby-lang
<Dala>
I think i have to redo what I have done, the original response I get is an array of arrays. so, each array in the main array has an ordered list of items. each representing a property of media.
<Dala>
I am then grouping by album_id. and I think thats where I am complicating things
<Dala>
Since the original response already has all the data together, I shouldn't be needing to put them together later on
<Dala>
i shouldn't be even separating them. the thing is I group by a element of the arrays (album_id).
<Dala>
I may be doing that too soon, the end result needs to be an array of album's and inside each album the list of media.
<Dala>
So, this original data, gives me media_id, I then get a list of media_id, to query mysql to give me all Media IN [that media id list], then I need to put that back into the original data.
<Dala>
I am going back to the drawing boards, I think I can improve this whole structure. Thank you guys for the suggestions, it opened up the door to new ideas.
thebastl has joined #ruby-lang
stan has quit [Quit: Leaving]
Dala has quit [Ping timeout: 246 seconds]
strixd has quit [Quit: 500]
strixd has joined #ruby-lang
mikecmpbll has quit [Ping timeout: 256 seconds]
stan has joined #ruby-lang
Phoenixmiss has joined #ruby-lang
ascarter has joined #ruby-lang
deol has joined #ruby-lang
piotrj has quit [Remote host closed the connection]
piotrj has joined #ruby-lang
Iskarlar has quit [Quit: My MacBook Pro has gone to sleep. ZZZzzz…]
Missphoenix has quit [Ping timeout: 245 seconds]
apeiros_ has joined #ruby-lang
darix has quit [Quit: may the packets be with you...]
ghostpl_ has quit [Remote host closed the connection]
rkowalick has joined #ruby-lang
strixd has quit [Quit: 500]
b_hoffman has quit [Quit: b_hoffman]
symm- has quit [Ping timeout: 244 seconds]
lytol has joined #ruby-lang
darix has joined #ruby-lang
bb010g has quit [Quit: Connection closed for inactivity]
<headius>
yorickpeterse: maybe easier to talk about that change here...obviously I was trying to help you get rid of the mutex, but I guess you don't want that?
wallerdev has joined #ruby-lang
chills42 has joined #ruby-lang
<headius>
I just happened to see this code reviewing updates since I last pulled
<headius>
"lazy" is always interesting :-)
stan has quit [Ping timeout: 256 seconds]
arBmind1 has joined #ruby-lang
ta has quit [Quit: Leaving...]
arBmind has quit [Ping timeout: 256 seconds]
hhatch_ has joined #ruby-lang
riotjone_ has joined #ruby-lang
DarkBushido has joined #ruby-lang
hhatch has quit [Ping timeout: 250 seconds]
sc00t has quit [Ping timeout: 255 seconds]
__butch__ has joined #ruby-lang
riotjone_ has quit [Ping timeout: 245 seconds]
wallerdev has quit [Quit: wallerdev]
skade has joined #ruby-lang
chills42 has quit [Remote host closed the connection]
chills42 has joined #ruby-lang
centrx has quit [Remote host closed the connection]
ruby-lang258 has joined #ruby-lang
_djbkd has joined #ruby-lang
Squarepy has joined #ruby-lang
JamesDH has joined #ruby-lang
centrx has joined #ruby-lang
thebastl has quit [Quit: Leaving...]
malconis has quit [Quit: My MacBook Pro has gone to sleep. ZZZzzz…]
b_hoffman has joined #ruby-lang
malconis has joined #ruby-lang
Phoenixmiss has quit [Quit: Leaving]
wallerdev has joined #ruby-lang
fusillicode has joined #ruby-lang
fusillicode1 has quit [Ping timeout: 244 seconds]
mberk has joined #ruby-lang
JamesDH has quit [Read error: Connection reset by peer]
centrx has quit [Remote host closed the connection]
Miphix has joined #ruby-lang
b_hoffman has quit [Quit: b_hoffman]
parenjitsu has joined #ruby-lang
meschi has quit [Quit: Leaving]
meschi has joined #ruby-lang
tunaCanBruh has quit [Ping timeout: 252 seconds]
lytol has quit [Remote host closed the connection]
caseydriscoll has quit [Remote host closed the connection]
spectra has quit [Client Quit]
ArchRogem has joined #ruby-lang
spectra has joined #ruby-lang
agarie has quit []
fusillicode1 has joined #ruby-lang
fusillicode has quit [Ping timeout: 252 seconds]
chills42 has quit [Remote host closed the connection]
chills42 has joined #ruby-lang
centrx has joined #ruby-lang
_djbkd has quit [Remote host closed the connection]
caseydriscoll has joined #ruby-lang
smoitra has quit [Remote host closed the connection]
hahuang61 has joined #ruby-lang
nathanstitt has quit [Quit: I growing sleepy]
ascarter has quit [Quit: My MacBook Pro has gone to sleep. ZZZzzz…]
marr has quit [Ping timeout: 250 seconds]
ledestin has quit [Quit: ledestin]
[H]unt3r has joined #ruby-lang
tpope has quit [Remote host closed the connection]
_whitelogger has joined #ruby-lang
<yorickpeterse>
The solution you proposed doesn't prevent multiple threads from triggering the decoding process multiple times at once
fusillicode has joined #ruby-lang
_whitelogger has joined #ruby-lang
<yorickpeterse>
In this case it won't lead to data corruption or anything, but it could lead to degraded performance as the conversion process gets triggered many times
fusillicode1 has quit [Ping timeout: 246 seconds]
momomomomo has quit [Quit: momomomomo]
red_horned_rihno has joined #ruby-lang
hhatch_ has quit [Ping timeout: 250 seconds]
fusillicode has quit [Read error: Connection reset by peer]
jgpawletko has joined #ruby-lang
fusillicode has joined #ruby-lang
pipework has joined #ruby-lang
tpope has joined #ruby-lang
ghostpl_ has joined #ruby-lang
fusillicode1 has joined #ruby-lang
Bwild has joined #ruby-lang
fusillicode has quit [Ping timeout: 264 seconds]
mustmodify has joined #ruby-lang
Iskarlar has joined #ruby-lang
fusillicode has joined #ruby-lang
Iskarlar has quit [Read error: Connection reset by peer]
fusillicode1 has quit [Ping timeout: 256 seconds]
Iskarlar has joined #ruby-lang
Iskarlar_ has joined #ruby-lang
mustmodify has left #ruby-lang [#ruby-lang]
Iskarlar has quit [Ping timeout: 272 seconds]
tunaCanBruh has quit [Ping timeout: 245 seconds]
Iskarlar has joined #ruby-lang
yfeldblum has joined #ruby-lang
b_hoffman has joined #ruby-lang
workmad3 has quit [Ping timeout: 256 seconds]
Iskarlar_ has quit [Ping timeout: 272 seconds]
Iskarla__ has joined #ruby-lang
hal_9000_ has quit [Read error: Connection reset by peer]
henrikhodne has quit [Quit: WeeChat 0.3.8]
jmrepetti has quit [Remote host closed the connection]
ruby-lang007 has joined #ruby-lang
tunaCanBruh has joined #ruby-lang
Iskarlar has quit [Ping timeout: 256 seconds]
<ruby-lang007>
s
ruby-lang007 has quit [Client Quit]
kawaiir has joined #ruby-lang
kawaiir has quit [Client Quit]
kawaiirb has joined #ruby-lang
<kawaiirb>
Hi!
ruby-lang258 has quit [Ping timeout: 246 seconds]
<kawaiirb>
How are you all doin'?
<centrx>
Amazing
tunaCanBruh has quit [Client Quit]
<kawaiirb>
Any rules I should be aware of?
<centrx>
Don't talk about PHP
replay has joined #ruby-lang
<kawaiirb>
Well, duh. That's common sense.
<kawaiirb>
:D
<centrx>
Rails in #rubyonrails
<centrx>
There is also #ruby but those guys suck
<kawaiirb>
Haha
<centrx>
#ruby-lang and #ruby are locked in mortal battle
<kawaiirb>
I see.
<kawaiirb>
This one is the official channel, isn't it? ;)
<centrx>
pshaw, you'd hardly know it by the way they talk of themselves in there
<kawaiirb>
lol
marr has joined #ruby-lang
<headius>
yorickpeterse: the conversion process would only get triggered more than once if many threads hit it at the same time before the first decoding
<headius>
and there's no behavioral harm from letting a couple of them double-convert
<headius>
it's completely thread-safe
<jhass>
centrx: aren't you a double agent like me too? :P
b_hoffman has quit [Quit: b_hoffman]
<kawaiirb>
Wow. A real holy war!
arBmind has joined #ruby-lang
<jhass>
kawaiirb: the funny part is the most active op is the most active op of both channels :P
<kawaiirb>
:D
<headius>
yorickpeterse: it's certainly your prerogative if you want to lock every time, but it's really not necessary
taylorrf has quit [Remote host closed the connection]
<kawaiirb>
Are you aware of any interesting articles about good Ruby practises, guys? I'm new to Ruby and I just finished my first script. It sucks ass, so I'd like to improve it.
ledestin has joined #ruby-lang
taylorrf has joined #ruby-lang
kyb3r_ has joined #ruby-lang
<havenwood>
kawaiirb: Paste a gist of your code for some feedback.
<kawaiirb>
Does it have to be a gist? I don't think this monster deservers to be there.
chouhoulis has joined #ruby-lang
chouhoul_ has quit [Read error: Connection reset by peer]
<havenwood>
kawaiirb: You can do a sekret gist. ;)
<apeiros_>
kawaiirb: we will gently wait for you to commit sudoku
<kawaiirb>
:DD
<apeiros_>
doesn't look that bad for a first script
<havenwood>
I'd rather sudoku than subuku.
<kawaiirb>
Any feedback?
<apeiros_>
havenwood: now you make me look up subuku. I thought sudoku was a joke term for seppuku
<havenwood>
kawaiirb: you can drop the line 19 `else`, unless it's just a placeholder
<havenwood>
apeiros_: i thought it was just the number game my mom plays!
chouhoulis has quit [Remote host closed the connection]
<apeiros_>
ah, hah
<kawaiirb>
Ah, yeah. Thanks for pointing it out!
<havenwood>
lol at rvm seppuku
chouhoulis has joined #ruby-lang
<havenwood>
the command, i mean
<headius>
yorickpeterse: it occurred to me now you might not even need the defensive copy, since you know where the raw text strings are coming from and that they're not being modified
<kawaiirb>
When would I want to use placeholders? TODOs?
<apeiros_>
havenwood: alias for implode?
<havenwood>
kawaiirb: I would add the else when I needed it, not before.
<havenwood>
apeiros_: aye
<headius>
anyway, bbl
<chills42>
kawaiirb: looks like you could also just do .where {|l| l.domain == 'i.imgur.com'}.each to filter down the list
* apeiros_
back at painting clocks made of clocks in JS+Canvas as a prototype for a physical clock made out of clocks :D
<kawaiirb>
Oh? I'll look into that! Thanks!
<havenwood>
kawaiirb: yeah, seems like #select is what you want there?
<kawaiirb>
#select?
<chills42>
sorry, yeah... select is the one... I mix those up sometimes
jmrepetti has quit [Remote host closed the connection]
nathanstitt has quit [Quit: I growing sleepy]
ur5us has joined #ruby-lang
ItSANgo has joined #ruby-lang
ItSANgo has quit [Client Quit]
mberk has quit [Remote host closed the connection]
b_hoffman has quit [Quit: b_hoffman]
mberk has joined #ruby-lang
GBrawl has joined #ruby-lang
GBrawl has quit [Client Quit]
ascarter has joined #ruby-lang
rippa has quit [Quit: {#`%${%&`+'${`%&NO CARRIER]
ItSANgo has joined #ruby-lang
Forgetful_Lion has joined #ruby-lang
centrx has quit [Remote host closed the connection]
canton7 has joined #ruby-lang
canton7 has joined #ruby-lang
Asher has quit [Quit: Leaving.]
workmad3 has quit [Remote host closed the connection]
mberk has quit [Remote host closed the connection]
zerocool_ has joined #ruby-lang
rikkipitt has joined #ruby-lang
<zerocool_>
Hi everyone: is anyone aware of how I can set constrains on mysql via migration. For example if I try to create record with User.create(:name => 'james', :email => 'test@Test.com'), but the db already has a record with those two columns. I want it to ignore the INSERT by letting the DB handle the conflict, instead of having to check if it exists via AR
<jhass>
try #RubyOnRails
<zerocool_>
Was not aware there was a different channel for rails. Thank You
sarkyniin has quit [Ping timeout: 272 seconds]
sgambino has quit [Remote host closed the connection]
mberk has joined #ruby-lang
fujimura has quit [Remote host closed the connection]
lytol has quit [Remote host closed the connection]
aadam21_ has joined #ruby-lang
centrx has joined #ruby-lang
rikkipitt has quit [Remote host closed the connection]
riotjone_ has joined #ruby-lang
ur5us has quit [Remote host closed the connection]
nirvana has quit [Quit: Page closed]
aadam21 has quit [Ping timeout: 272 seconds]
aadam21_ has quit [Ping timeout: 244 seconds]
ur5us has joined #ruby-lang
riotjone_ has quit [Ping timeout: 250 seconds]
mcclurmc_ has joined #ruby-lang
mcclurmc has quit [Ping timeout: 246 seconds]
lytol has joined #ruby-lang
jmrepetti has joined #ruby-lang
whippythellama has quit [Quit: whippythellama]
jmrepetti has quit [Ping timeout: 250 seconds]
zerocool_ has quit [Ping timeout: 246 seconds]
Rephiax has joined #ruby-lang
__butch__ has quit [Quit: Leaving.]
malconis has quit [Quit: My MacBook Pro has gone to sleep. ZZZzzz…]
sarahdashdashp has quit [Quit: Page closed]
red_menace has joined #ruby-lang
cryo28 has quit [Quit: leaving]
iliketurtles has joined #ruby-lang
ur5us has quit [Remote host closed the connection]
ur5us has joined #ruby-lang
mcclurmc_ has quit [Ping timeout: 272 seconds]
mcclurmc has joined #ruby-lang
chadwtaylor has joined #ruby-lang
Bwild has quit [Ping timeout: 256 seconds]
setanta_ has quit [Quit: Leaving]
ghostpl_ has quit [Remote host closed the connection]