15 Sep '12, 4pm

How to loop through a DB table and then search for duplicate records to delete with Ruby Rails: I have a table s...

I have a table storing some sound bites. I tried to create a loop which would read the table and then reread the table and delete and records which are close to being duplicates. My code is something like this: Numbersound.where{id != nil}.order(:id).each do |sound| Numbersound.where{(id != sound.id) & (sound.wavelength = wavelength)}.each do |duplicate| if (duplicate.wavecount != nil) #compare wave files and check if the same if MatchSound.compare(sound.frames, sound.wavecount, duplicate.frames, duplicate.wavecount, 0.03) Numbersound.delete(duplicate.id) end end end The problem is that I need to remove the deleted record from the sound array as otherwise ther e will always be at least one match (its self). I can't use SQL to do the comparison as I have some fairly long calculations to perform.

Full article: http://stackoverflow.com/questions/12439201/how-to-loop-t...

Tweets

SFI Food Warehouse Sale@234 Pandan Loop, 22 to 23 Sep 2012

SFI Food Warehouse Sale@234 Pandan Loop, 22 to ...

tualobang.blogspot.com 16 Sep '12, 4am

Hi, thanks for visiting. Here's a simple FAQ for the site: 1. We provide multiple content push options: a) Subscribe to em...

#Table #Tennis - Singapore table tennis chief Lee Bee Wah secures re-election - Straits Times

#Table #Tennis - Singapore table tennis chief L...

straitstimes.com 15 Sep '12, 10am

Nee Soon GRC MP Lee Bee Wah will lead the Singapore Table Tennis Association (STTA) until at least 2014. Ms Lee, who has b...

an #ecofashion update: Eco-friendly table décor from DIGS

an #ecofashion update: Eco-friendly table décor...

magnifeco.com 17 Sep '12, 7pm

Imagine how lovely your next dinner party would be with this combined carving & serving set designed by Jonas Bjerre-Pouls...

Loop & Meet App

Loop & Meet App

lesterchan.net 18 Sep '12, 12am

SingTel Loop & Meet organises your social life Discover things to do. Send and track invitations. Meet up and have fun! Si...

Domain Market Opens The Doors This Morning With...

fragerfactor.blogspot.com 15 Sep '12, 5am

Apple Blogger Makes $500K A Year No it's not me. But the man's story is quite remarkable. And makes me wonder why I don't ...