From nwalls at ismedia.org Fri Jul 1 09:06:28 2011 From: nwalls at ismedia.org (Nathan L. Walls) Date: Fri, 1 Jul 2011 09:06:28 -0400 Subject: [raleigh.rb] Job Opportunity: Continuous Integration/Build Dev. at WebAssign Message-ID: <7349F11E-8699-4CEC-848E-008A6493E137@ismedia.org> Hi guys, I'm looking for a Continuous Integration/Build Developer to join a small, focused team at WebAssign. See the blurb below. I'm also still looking for a senior-level developer. Cheers, Nathan --------- WebAssign is looking for a Continuous Integration/Build Developer to help improve the consistency, stability and reliability of our environments. We're looking for an experienced software developer ? tell us about your GitHub projects! ? who has a love for: - Setting up and tuning continuous integration servers like Hudson/Jenkins, Bamboo or Cruise Control - Automating environment set-up and application deployment with tools like Chef or Puppet - Using service APIs to set-up informational wallboards on release status, bug counts and so on for the engineering group - Delivering working, maintainable code through behavior-driven development - Automating test suites with tools like webrat, Selenium and Cucumber - Finding and eliminating manual, inconsistent processes in operations This is an intermediate-level, full-time position with competitive salary and benefits. We have a great office on NC State's Centennial Campus, a relaxed work environment and a great product that helps students learn and teachers teach. Please send resume, salary requirements and a cover letter selling us on why you love DevOps to jobs at webassign.net. No phone calls please. WebAssign is proud to be an EEO/AA employer M/F/D/V From kevin.olbrich at gmail.com Sat Jul 9 11:23:16 2011 From: kevin.olbrich at gmail.com (Kevin Olbrich) Date: Sat, 9 Jul 2011 11:23:16 -0400 Subject: [raleigh.rb] iContact Technology Open House (Thursday July 14) Message-ID: http://blog.icontact.com/blog/icontact-technology-open-house/ Rumor has it that there will be 'refreshments' served. I will be there to answer questions about how we use ruby. Kevin Olbrich iContact.com Operations Engineer kolbrich at icontact.com -------------- next part -------------- An HTML attachment was scrubbed... URL: From rick.denatale at gmail.com Tue Jul 19 11:47:59 2011 From: rick.denatale at gmail.com (Rick DeNatale) Date: Tue, 19 Jul 2011 11:47:59 -0400 Subject: [raleigh.rb] Pre-Meeting chow and agenda In-Reply-To: References: Message-ID: I've been eating Pizza for the past two nights, so I'd like to suggest an alternative for this evening http://maps.google.com/maps/place?cid=1975847804604896751 I know that a lot of us have been saving up those punches on our Randy's pizza cards, but I havent been to Schlotzky's in a while and this is one of the two remaining ones in the area, and it's actually closer to iContact by half. So if no one objects, I'll plan to be there at the usual 5:30. We can go back to Randy's next month, or not. But I still want to get my card punched. On Tue, Jun 21, 2011 at 10:31 AM, Rick DeNatale wrote: > Will be at the usual time 5:30, and place Randy's Pizza in RTP > http://bit.ly/lv63pe > > For the benefit of those who got lost and ended up at another Randy's last > month, this one is on S. Miami Blvd not far from the exit of that name on > I-40 (Exit 281). > > To change things up just a bit, I'd like to start the meeting with an > opportunity for members (particularly those new to Ruby) to ask general Ruby > questions, and then go on to the speaker. > > -- > Rick > > -- Rick DeNatale Blog: http://talklikeaduck.denhaven2.com/ Github: http://github.com/rubyredrick Twitter: @RickDeNatale WWR: http://www.workingwithrails.com/person/9021-rick-denatale LinkedIn: http://www.linkedin.com/in/rickdenatale -------------- next part -------------- An HTML attachment was scrubbed... URL: From mikehale at gmail.com Tue Jul 19 15:56:24 2011 From: mikehale at gmail.com (Michael Hale) Date: Tue, 19 Jul 2011 15:56:24 -0400 Subject: [raleigh.rb] Pre-Meeting chow and agenda In-Reply-To: References: Message-ID: Sounds good to me. On Tue, Jul 19, 2011 at 11:47 AM, Rick DeNatale wrote: > I've been eating Pizza for the past two nights, so I'd like to suggest an > alternative for this evening > http://maps.google.com/maps/place?cid=1975847804604896751 > I know that a lot of us have been saving up those punches on our Randy's > pizza cards, but I havent been to Schlotzky's in a while and this is one of > the two remaining ones in the area, and it's actually closer to iContact by > half. > So if no one objects, I'll plan to be there at the usual 5:30. ?We can go > back to Randy's next month, or not. But I still want to get my card punched. > > > On Tue, Jun 21, 2011 at 10:31 AM, Rick DeNatale > wrote: >> >> Will be at the usual time 5:30, and place Randy's Pizza in >> RTP?http://bit.ly/lv63pe >> For the benefit of those who got lost and ended up at another Randy's last >> month, this one is on S. Miami Blvd not far from the exit of that name on >> I-40 (Exit 281). >> >> To change things up just a bit, I'd like to start the meeting with an >> opportunity for members (particularly those new to Ruby) to ask general Ruby >> questions, and then go on to the speaker. >> -- >> Rick >> > > > > -- > Rick DeNatale > > Blog: http://talklikeaduck.denhaven2.com/ > Github: http://github.com/rubyredrick > Twitter: @RickDeNatale > WWR: http://www.workingwithrails.com/person/9021-rick-denatale > LinkedIn: http://www.linkedin.com/in/rickdenatale > > _______________________________________________ > raleigh-rb-members mailing list > raleigh-rb-members at rubyforge.org > http://rubyforge.org/mailman/listinfo/raleigh-rb-members > From mshiltonj at gmail.com Wed Jul 20 10:05:52 2011 From: mshiltonj at gmail.com (Steven Hilton) Date: Wed, 20 Jul 2011 10:05:52 -0400 Subject: [raleigh.rb] Rails 3.1 delay due to coffeescript? Message-ID: Rick mentioned last that one of the reasons for the delay in rails 3.1 final centers around coffeescript. Is there more information on this on the intertubes? - Steven From brentmc79 at gmail.com Wed Jul 20 10:18:01 2011 From: brentmc79 at gmail.com (Brent Collier) Date: Wed, 20 Jul 2011 10:18:01 -0400 Subject: [raleigh.rb] Rails 3.1 delay due to coffeescript? In-Reply-To: References: Message-ID: I'm interested as well. I've got a client app in development that's currently running on rc4 and I'm hoping that 3.1 final is released before my deployment deadline... On Wed, Jul 20, 2011 at 10:05 AM, Steven Hilton wrote: > Rick mentioned last that one of the reasons for the delay in rails 3.1 > final centers around coffeescript. Is there more information on this > on the intertubes? > > - Steven > _______________________________________________ > raleigh-rb-members mailing list > raleigh-rb-members at rubyforge.org > http://rubyforge.org/mailman/listinfo/raleigh-rb-members > -- Brent Collier | 919.564.6915 | www.BrentCollier.com | www.brentmc79.com -------------- next part -------------- An HTML attachment was scrubbed... URL: From midpeter444 at gmail.com Wed Jul 20 10:39:58 2011 From: midpeter444 at gmail.com (Michael Peterson) Date: Wed, 20 Jul 2011 10:39:58 -0400 Subject: [raleigh.rb] Online version of same presentation Rick gave last night Message-ID: I knew I had heard Rick's presentation before, so I checked confreaks.netand that's where I had seen it about 6 months ago. Hopefully, Rick doesn't mind me sending out the link to everyone, but could be useful to everyone, especially if those that weren't able to make it last night: http://confreaks.net/videos/461-rubyconf2010-objects-are-just-objects-aren-t-they -Michael -------------- next part -------------- An HTML attachment was scrubbed... URL: From tj at stank.us Wed Jul 20 12:47:09 2011 From: tj at stank.us (TJ Stankus) Date: Wed, 20 Jul 2011 12:47:09 -0400 Subject: [raleigh.rb] Rails 3.1 delay due to coffeescript? In-Reply-To: References: Message-ID: FWIW we've got one production app deployed on edge 3.1 and one soon to be put into production on 3.1.rc4. While I'd love to see 3.1 final sooner than later, the edge and RC apps have held up fine. -TJ On Wed, Jul 20, 2011 at 10:18 AM, Brent Collier wrote: > I'm interested as well. I've got a client app in development that's > currently running on rc4 and I'm hoping that 3.1 final is released before my > deployment deadline... > > On Wed, Jul 20, 2011 at 10:05 AM, Steven Hilton wrote: >> >> Rick mentioned last that one of the reasons for the delay in rails 3.1 >> final centers around coffeescript. Is there more information on this >> on the intertubes? >> >> - Steven >> _______________________________________________ >> raleigh-rb-members mailing list >> raleigh-rb-members at rubyforge.org >> http://rubyforge.org/mailman/listinfo/raleigh-rb-members > > > > -- > Brent Collier | 919.564.6915 | www.BrentCollier.com | www.brentmc79.com > > _______________________________________________ > raleigh-rb-members mailing list > raleigh-rb-members at rubyforge.org > http://rubyforge.org/mailman/listinfo/raleigh-rb-members > From rick.denatale at gmail.com Wed Jul 20 13:24:16 2011 From: rick.denatale at gmail.com (Rick DeNatale) Date: Wed, 20 Jul 2011 13:24:16 -0400 Subject: [raleigh.rb] Rails 3.1 delay due to coffeescript? In-Reply-To: References: Message-ID: On Wed, Jul 20, 2011 at 10:05 AM, Steven Hilton wrote: > Rick mentioned last that one of the reasons for the delay in rails 3.1 > final centers around coffeescript. Is there more information on this > on the intertubes > FWIW, this article by ykatz was the source of my comment http://yehudakatz.com/2011/06/14/what-the-hell-is-happening-to-rails/ see the section on Heroku and the Asset Pipeline -- Rick DeNatale Blog: http://talklikeaduck.denhaven2.com/ Github: http://github.com/rubyredrick Twitter: @RickDeNatale WWR: http://www.workingwithrails.com/person/9021-rick-denatale LinkedIn: http://www.linkedin.com/in/rickdenatale -------------- next part -------------- An HTML attachment was scrubbed... URL: From mikehale at gmail.com Wed Jul 20 14:12:48 2011 From: mikehale at gmail.com (Michael Hale) Date: Wed, 20 Jul 2011 14:12:48 -0400 Subject: [raleigh.rb] Pry: a ruby gem for exploring and debugging code Message-ID: Hello list, I just learned about pry a ruby gem for exploring and debugging code and thought I would share my excitement. In addition to letting you view method documentation and source (even c source), you can use it to debug and even update code. I found this 15 minute intro video by Joshua Cheek very helpful: http://vimeo.com/26391171 From brentmc79 at gmail.com Wed Jul 20 19:36:52 2011 From: brentmc79 at gmail.com (Brent Collier) Date: Wed, 20 Jul 2011 19:36:52 -0400 Subject: [raleigh.rb] Wifi venues open late Message-ID: <837D4AAF-73DB-4EA0-9D38-E57E93018F96@gmail.com> Does anyone know of any hacking-friendly places in the triangle that stay open late? Basically I'm just looking for a coffee shop or something with wifi that stays open closer to midnight during the week. It seems like most places around here close by 10pm on weekdays. Brent Collier (919) 564-6915 Sent from my iPhone From justis.peters at gmail.com Wed Jul 20 20:24:22 2011 From: justis.peters at gmail.com (Justis Peters) Date: Wed, 20 Jul 2011 20:24:22 -0400 Subject: [raleigh.rb] Wifi venues open late In-Reply-To: <837D4AAF-73DB-4EA0-9D38-E57E93018F96@gmail.com> References: <837D4AAF-73DB-4EA0-9D38-E57E93018F96@gmail.com> Message-ID: <4E2771B6.1010209@gmail.com> On 07/20/2011 07:36 PM, Brent Collier wrote: > Does anyone know of any hacking-friendly places in the triangle that stay open late? Basically I'm just looking for a coffee shop or something with wifi that stays open closer to midnight during the week. It seems like most places around here close by 10pm on weekdays. In Raleigh, try the Raleigh Times. They're open til midnight on Mondays and til 02:00 every other night: http://www.raleightimesbar.com/ In Durham, you want a membership to SplatSpace. For $50/month, you get a key and 24/7 access to the space. We have hand tools, soldering stations, lots of electronic parts, and free wifi. It's also very "hacking friendly": http://splatspace.org/about/ Kind regards, Justis From motley.crue.fan at gmail.com Wed Jul 20 22:29:11 2011 From: motley.crue.fan at gmail.com (Phillip Rhodes) Date: Wed, 20 Jul 2011 22:29:11 -0400 Subject: [raleigh.rb] Wifi venues open late In-Reply-To: <837D4AAF-73DB-4EA0-9D38-E57E93018F96@gmail.com> References: <837D4AAF-73DB-4EA0-9D38-E57E93018F96@gmail.com> Message-ID: On Wed, Jul 20, 2011 at 7:36 PM, Brent Collier wrote: > Does anyone know of any hacking-friendly places in the triangle that stay > open late? Basically I'm just looking for a coffee shop or something with > wifi that stays open closer to midnight during the week. It seems like most > places around here close by 10pm on weekdays. > The High Park Sports Pub on East Whitaker Mill Rd. isn't a bad place, as long as it's a night when there isn't a major sporting event on. Oh, and Wed., which is karaoke night. On those nights, you might want to stay away. But on a slow night, it's a decent place. Free wifi, and plenty of room. There aren't a lot of electrical outlets though, so an extension cord is handy. The food is decent (I like their buffalo wings a lot, fwiw) and they have coffee, although it's generic coffee, no espresso drinks or anything. But it's cheap and has caffeine. And if you like to "drink and hack" they do have beer. :-) Phil -------------- next part -------------- An HTML attachment was scrubbed... URL: From jon.list+rb at gmail.com Wed Jul 20 23:43:01 2011 From: jon.list+rb at gmail.com (Jonathon Brenner) Date: Wed, 20 Jul 2011 23:43:01 -0400 Subject: [raleigh.rb] Wifi venues open late In-Reply-To: <837D4AAF-73DB-4EA0-9D38-E57E93018F96@gmail.com> References: <837D4AAF-73DB-4EA0-9D38-E57E93018F96@gmail.com> Message-ID: If you're looking for a place in downtown Raleigh, check out Helios. They can get pretty busy on weekends and sometimes have live music on Fri/Sat nights, but it's a great place to work out of most other times. http://cafehelios.com/contact/ On Wed, Jul 20, 2011 at 7:36 PM, Brent Collier wrote: > Does anyone know of any hacking-friendly places in the triangle that stay > open late? Basically I'm just looking for a coffee shop or something with > wifi that stays open closer to midnight during the week. It seems like most > places around here close by 10pm on weekdays. > > Brent Collier > (919) 564-6915 > > Sent from my iPhone > _______________________________________________ > raleigh-rb-members mailing list > raleigh-rb-members at rubyforge.org > http://rubyforge.org/mailman/listinfo/raleigh-rb-members > -------------- next part -------------- An HTML attachment was scrubbed... URL: From harry.park at gmail.com Wed Jul 20 23:51:16 2011 From: harry.park at gmail.com (Harry Park) Date: Wed, 20 Jul 2011 23:51:16 -0400 Subject: [raleigh.rb] Wifi venues open late In-Reply-To: References: <837D4AAF-73DB-4EA0-9D38-E57E93018F96@gmail.com> Message-ID: Caffe Driade in Chapel Hill: Open Mon-Thu 7am-11pm; Fri-Sat 7am-12am; Sun 7:30am-11pm Not a bad place to hack. Caffeine and beer available. Wifi too. On Wed, Jul 20, 2011 at 10:29 PM, Phillip Rhodes wrote: > > > On Wed, Jul 20, 2011 at 7:36 PM, Brent Collier wrote: > >> Does anyone know of any hacking-friendly places in the triangle that stay >> open late? Basically I'm just looking for a coffee shop or something with >> wifi that stays open closer to midnight during the week. It seems like most >> places around here close by 10pm on weekdays. >> > > The High Park Sports Pub on East Whitaker Mill Rd. isn't a bad place, as > long as it's a night when there isn't a major > sporting event on. Oh, and Wed., which is karaoke night. On those > nights, you might want to stay away. But on a slow night, it's a decent > place. Free wifi, and plenty of room. There aren't a lot of electrical > outlets though, so an extension cord is handy. > The food is decent (I like their buffalo wings a lot, fwiw) and they have > coffee, although it's generic coffee, no espresso drinks > or anything. But it's cheap and has caffeine. And if you like to "drink > and hack" they do have beer. :-) > > > Phil > > _______________________________________________ > raleigh-rb-members mailing list > raleigh-rb-members at rubyforge.org > http://rubyforge.org/mailman/listinfo/raleigh-rb-members > -------------- next part -------------- An HTML attachment was scrubbed... URL: From brentmc79 at gmail.com Thu Jul 21 00:42:42 2011 From: brentmc79 at gmail.com (Brent Collier) Date: Thu, 21 Jul 2011 00:42:42 -0400 Subject: [raleigh.rb] Wifi venues open late In-Reply-To: References: <837D4AAF-73DB-4EA0-9D38-E57E93018F96@gmail.com> Message-ID: Yeah, it seems like there's quite a few places in downtown Raleigh. If only I didn't live in western Cary, where it takes me at least 30 minutes to get anywhere worth going... On Wed, Jul 20, 2011 at 11:43 PM, Jonathon Brenner wrote: > If you're looking for a place in downtown Raleigh, check out Helios. They > can get pretty busy on weekends and sometimes have live music on Fri/Sat > nights, but it's a great place to work out of most other times. > http://cafehelios.com/contact/ > > On Wed, Jul 20, 2011 at 7:36 PM, Brent Collier wrote: > >> Does anyone know of any hacking-friendly places in the triangle that stay >> open late? Basically I'm just looking for a coffee shop or something with >> wifi that stays open closer to midnight during the week. It seems like most >> places around here close by 10pm on weekdays. >> >> Brent Collier >> (919) 564-6915 >> >> Sent from my iPhone >> _______________________________________________ >> raleigh-rb-members mailing list >> raleigh-rb-members at rubyforge.org >> http://rubyforge.org/mailman/listinfo/raleigh-rb-members >> > > > _______________________________________________ > raleigh-rb-members mailing list > raleigh-rb-members at rubyforge.org > http://rubyforge.org/mailman/listinfo/raleigh-rb-members > -- Brent Collier | 919.564.6915 | www.BrentCollier.com | www.brentmc79.com -------------- next part -------------- An HTML attachment was scrubbed... URL: From fmedlin at gmail.com Thu Jul 21 07:57:42 2011 From: fmedlin at gmail.com (Fred Medlin) Date: Thu, 21 Jul 2011 07:57:42 -0400 Subject: [raleigh.rb] Wifi venues open late In-Reply-To: <837D4AAF-73DB-4EA0-9D38-E57E93018F96@gmail.com> References: <837D4AAF-73DB-4EA0-9D38-E57E93018F96@gmail.com> Message-ID: I've never done this, but a lot of McDonalds are open 24/7 and have wifi, coffee and the occasional McRib sandwich. :) On Jul 20, 2011 7:56 PM, "Brent Collier" wrote: > Does anyone know of any hacking-friendly places in the triangle that stay open late? Basically I'm just looking for a coffee shop or something with wifi that stays open closer to midnight during the week. It seems like most places around here close by 10pm on weekdays. > > Brent Collier > (919) 564-6915 > > Sent from my iPhone > _______________________________________________ > raleigh-rb-members mailing list > raleigh-rb-members at rubyforge.org > http://rubyforge.org/mailman/listinfo/raleigh-rb-members -------------- next part -------------- An HTML attachment was scrubbed... URL: From joe at bodkinconsulting.com Thu Jul 21 10:44:10 2011 From: joe at bodkinconsulting.com (joe Fair) Date: Thu, 21 Jul 2011 10:44:10 -0400 Subject: [raleigh.rb] Wifi venues open late In-Reply-To: References: <837D4AAF-73DB-4EA0-9D38-E57E93018F96@gmail.com> Message-ID: I've tried McDonald's, but I find it's noisy and not too comfy. Depending on the neighborhood, you might be able to piggy back off a library's wifi after they are closed. I tried a couple of Denny's, which tend to be less noisy but just as uncomfortable. Joe On Thu, Jul 21, 2011 at 7:57 AM, Fred Medlin wrote: > I've never done this,? but a lot of McDonalds are open 24/7 and have wifi, > coffee and the occasional McRib sandwich.?? :) > > On Jul 20, 2011 7:56 PM, "Brent Collier" wrote: >> Does anyone know of any hacking-friendly places in the triangle that stay >> open late? Basically I'm just looking for a coffee shop or something with >> wifi that stays open closer to midnight during the week. It seems like most >> places around here close by 10pm on weekdays. >> >> Brent Collier >> (919) 564-6915 >> >> Sent from my iPhone >> _______________________________________________ >> raleigh-rb-members mailing list >> raleigh-rb-members at rubyforge.org >> http://rubyforge.org/mailman/listinfo/raleigh-rb-members > > _______________________________________________ > raleigh-rb-members mailing list > raleigh-rb-members at rubyforge.org > http://rubyforge.org/mailman/listinfo/raleigh-rb-members > From tj at stank.us Fri Jul 22 13:20:40 2011 From: tj at stank.us (TJ Stankus) Date: Fri, 22 Jul 2011 13:20:40 -0400 Subject: [raleigh.rb] Ruby and PHP/Ruby remote jobs Message-ID: Hi all, The company I work for, Federated Media, is growing its team. We have 3 job openings for both Rubyists and aspiring Rubyists with PHP experience. The company is based out of San Francisco. Currently myself and one other Triangle-based Rubyist work for FM remotely. I've been very happy working both for the company and within the small team I'm on. Here's a quick summary of the job descriptions: 1 experienced Rails developer to join a team working on a launched and growing Rails application suite. We're using edge 3.1 Rails, the new mountable engines, in a multi-app service-oriented architecture. 2 developers who have some PHP and some Rails experience. Or, if you're proficient in PHP and looking to transition to Rails, that's fine too. This work would involve writing v2 of an existing product, transitioning it from PHP to Rails. Here's a more full, but somewhat generic description: http://www.federatedmedia.net/careers/?nl=1&jvi=oLfNVfws,Job&jvs=triangle_team The most important consideration for these jobs is that you are comfortable working and being productive without a lot of supervision. There is a decent chance that we'll have local office space available a couple days a week, but you'll probably be expected to work on your own more than half the time. Well, not totally on your own: we use Campfire and Skype to communicate throughout the day. Please contact me directly offlist if interested. Thanks, -TJ From nilbus at nilbus.com Fri Jul 22 15:27:38 2011 From: nilbus at nilbus.com (Edward Anderson) Date: Fri, 22 Jul 2011 15:27:38 -0400 Subject: [raleigh.rb] Use capistrano to deploy Rails apps to Windows servers Message-ID: For anyone deploying Rails apps to Windows servers: https://github.com/SciMed/capistrano-windows-server I just put this gem together in the last couple days. I'd love to hear if this is useful to anyone here and get your critique on it. Regards, Edward -------------- next part -------------- An HTML attachment was scrubbed... URL: From luke at ehresman.org Fri Jul 22 17:47:41 2011 From: luke at ehresman.org (Luke Ehresman) Date: Fri, 22 Jul 2011 17:47:41 -0400 Subject: [raleigh.rb] ruby http api options Message-ID: I have a fairly simple REST API that mostly just consumes copious amounts of data. Scaling out to more servers is an option, but an expensive one. I really just need to receive HTTP requests, process the data and slam it into the database as quickly as possible. Currently it is implemented in Rails, but load testing reveals that Rails is probably too big for my needs (I get an abysmal 240 requests/sec on a xlarge high-cpu ec2 instance). I've gotten impressive results with nginx+Passenger+Sinatra (upwards of 1000 requests/sec). I'm curious if anyone could point me to some other options I may not have considered. Thanks! Luke -- Luke Ehresman, luke at ehresman.org CopperEgg - http://copperegg.com Tebros Systems - http://tebros.com -------------- next part -------------- An HTML attachment was scrubbed... URL: From adam at thewilliams.ws Fri Jul 22 17:56:45 2011 From: adam at thewilliams.ws (Adam Williams) Date: Fri, 22 Jul 2011 17:56:45 -0400 Subject: [raleigh.rb] ruby http api options In-Reply-To: References: Message-ID: <40D9A488-9464-4A44-825B-727F9BE6AE73@thewilliams.ws> Have you thought about using Node.js? I know that doesn't fit the subject line :) On Jul 22, 2011, at 5:47 PM, Luke Ehresman wrote: > I have a fairly simple REST API that mostly just consumes copious amounts of data. Scaling out to more servers is an option, but an expensive one. I really just need to receive HTTP requests, process the data and slam it into the database as quickly as possible. > > Currently it is implemented in Rails, but load testing reveals that Rails is probably too big for my needs (I get an abysmal 240 requests/sec on a xlarge high-cpu ec2 instance). > > I've gotten impressive results with nginx+Passenger+Sinatra (upwards of 1000 requests/sec). I'm curious if anyone could point me to some other options I may not have considered. > > Thanks! > Luke > > -- > Luke Ehresman, luke at ehresman.org > CopperEgg - http://copperegg.com > Tebros Systems - http://tebros.com > > _______________________________________________ > raleigh-rb-members mailing list > raleigh-rb-members at rubyforge.org > http://rubyforge.org/mailman/listinfo/raleigh-rb-members -------------- next part -------------- An HTML attachment was scrubbed... URL: From sbklein at reverbnation.com Fri Jul 22 18:01:10 2011 From: sbklein at reverbnation.com (Scott Klein) Date: Fri, 22 Jul 2011 18:01:10 -0400 Subject: [raleigh.rb] ruby http api options In-Reply-To: <40D9A488-9464-4A44-825B-727F9BE6AE73@thewilliams.ws> References: <40D9A488-9464-4A44-825B-727F9BE6AE73@thewilliams.ws> Message-ID: Done anything to figure out the bottleneck? Believe mongo is being hailed as the "write-speed banshee" right now, and could allow you quickly take the request and get it into something persistent. If all else fails, head back to PHP =D On Fri, Jul 22, 2011 at 5:56 PM, Adam Williams wrote: > Have you thought about using Node.js? I know that doesn't fit the subject > line :) > > On Jul 22, 2011, at 5:47 PM, Luke Ehresman wrote: > > I have a fairly simple REST API that mostly just consumes copious amounts > of data. Scaling out to more servers is an option, but an expensive one. I > really just need to receive HTTP requests, process the data and slam it into > the database as quickly as possible. > > Currently it is implemented in Rails, but load testing reveals that Rails > is probably too big for my needs (I get an abysmal 240 requests/sec on a > xlarge high-cpu ec2 instance). > > I've gotten impressive results with nginx+Passenger+Sinatra (upwards of > 1000 requests/sec). I'm curious if anyone could point me to some other > options I may not have considered. > > Thanks! > Luke > > -- > Luke Ehresman, luke at ehresman.org > CopperEgg - http://copperegg.com > Tebros Systems - http://tebros.com > > _______________________________________________ > raleigh-rb-members mailing list > raleigh-rb-members at rubyforge.org > http://rubyforge.org/mailman/listinfo/raleigh-rb-members > > > > _______________________________________________ > raleigh-rb-members mailing list > raleigh-rb-members at rubyforge.org > http://rubyforge.org/mailman/listinfo/raleigh-rb-members > -------------- next part -------------- An HTML attachment was scrubbed... URL: From seancribbs at gmail.com Fri Jul 22 18:23:09 2011 From: seancribbs at gmail.com (Sean Cribbs) Date: Fri, 22 Jul 2011 18:23:09 -0400 Subject: [raleigh.rb] ruby http api options In-Reply-To: References: Message-ID: I've enjoyed using Goliath for small fast APIs, but you really need to embrace EventMachine to make best use of it. On Fri, Jul 22, 2011 at 5:47 PM, Luke Ehresman wrote: > I have a fairly simple REST API that mostly just consumes copious amounts of > data. ?Scaling out to more servers is an option, but an expensive one. ?I > really just need to receive HTTP requests, process the data and slam it into > the database as quickly as possible. > Currently it is implemented in Rails, but load testing reveals that Rails is > probably too big for my needs (I get an abysmal 240 requests/sec on a xlarge > high-cpu ec2 instance). > I've gotten impressive results with nginx+Passenger+Sinatra (upwards of 1000 > requests/sec). ?I'm curious if anyone could point me to some other options I > may not have considered. > Thanks! > Luke > > -- > Luke Ehresman,?luke at ehresman.org > CopperEgg - http://copperegg.com > Tebros Systems - http://tebros.com > > _______________________________________________ > raleigh-rb-members mailing list > raleigh-rb-members at rubyforge.org > http://rubyforge.org/mailman/listinfo/raleigh-rb-members > From tj at stank.us Fri Jul 22 18:40:50 2011 From: tj at stank.us (TJ Stankus) Date: Fri, 22 Jul 2011 18:40:50 -0400 Subject: [raleigh.rb] ruby http api options In-Reply-To: References: <40D9A488-9464-4A44-825B-727F9BE6AE73@thewilliams.ws> Message-ID: EventMachine might be worth considering. PeepCode just put out a couple screencasts on it: http://peepcode.com/products/eventmachine http://peepcode.com/products/eventmachine-ii -TJ On Fri, Jul 22, 2011 at 6:01 PM, Scott Klein wrote: > Done anything to figure out the bottleneck? Believe mongo is being hailed as > the "write-speed banshee" right now, and could allow you quickly take the > request and get it into something persistent. > If all else fails, head back to PHP =D > On Fri, Jul 22, 2011 at 5:56 PM, Adam Williams wrote: >> >> Have you thought about using Node.js? I know that doesn't fit the subject >> line :) >> On Jul 22, 2011, at 5:47 PM, Luke Ehresman wrote: >> >> I have a fairly simple REST API that mostly just consumes copious amounts >> of data. ?Scaling out to more servers is an option, but an expensive one. ?I >> really just need to receive HTTP requests, process the data and slam it into >> the database as quickly as possible. >> Currently it is implemented in Rails, but load testing reveals that Rails >> is probably too big for my needs (I get an abysmal 240 requests/sec on a >> xlarge high-cpu ec2 instance). >> I've gotten impressive results with nginx+Passenger+Sinatra (upwards of >> 1000 requests/sec). ?I'm curious if anyone could point me to some other >> options I may not have considered. >> Thanks! >> Luke >> >> -- >> Luke Ehresman,?luke at ehresman.org >> CopperEgg - http://copperegg.com >> Tebros Systems - http://tebros.com >> _______________________________________________ >> raleigh-rb-members mailing list >> raleigh-rb-members at rubyforge.org >> http://rubyforge.org/mailman/listinfo/raleigh-rb-members >> >> _______________________________________________ >> raleigh-rb-members mailing list >> raleigh-rb-members at rubyforge.org >> http://rubyforge.org/mailman/listinfo/raleigh-rb-members > > > _______________________________________________ > raleigh-rb-members mailing list > raleigh-rb-members at rubyforge.org > http://rubyforge.org/mailman/listinfo/raleigh-rb-members > From info at lojic.com Fri Jul 22 18:52:26 2011 From: info at lojic.com (Brian Adkins) Date: Fri, 22 Jul 2011 18:52:26 -0400 Subject: [raleigh.rb] ruby http api options In-Reply-To: References: <40D9A488-9464-4A44-825B-727F9BE6AE73@thewilliams.ws> Message-ID: I never worked with Merb, but I thought that with the Rails/Merb merge it was easier to trim Rails down to a leaner core. Has anyone done this effectively? Maybe implement it directly with a simple Rack application? http://rack.rubyforge.org/ Thin? http://code.macournoyer.com/thin/ Other options: Haskell Warp web server: http://www.yesodweb.com/blog/2011/02/warp-speed-ahead :) -- Brian Adkins Lojic Technologies, LLC http://lojic.com/ On Jul 22, 2011, at 6:01 PM, Scott Klein wrote: > Done anything to figure out the bottleneck? Believe mongo is being hailed as the "write-speed banshee" right now, and could allow you quickly take the request and get it into something persistent. > > If all else fails, head back to PHP =D > > On Fri, Jul 22, 2011 at 5:56 PM, Adam Williams wrote: > Have you thought about using Node.js? I know that doesn't fit the subject line :) > > On Jul 22, 2011, at 5:47 PM, Luke Ehresman wrote: > >> I have a fairly simple REST API that mostly just consumes copious amounts of data. Scaling out to more servers is an option, but an expensive one. I really just need to receive HTTP requests, process the data and slam it into the database as quickly as possible. >> >> Currently it is implemented in Rails, but load testing reveals that Rails is probably too big for my needs (I get an abysmal 240 requests/sec on a xlarge high-cpu ec2 instance). >> >> I've gotten impressive results with nginx+Passenger+Sinatra (upwards of 1000 requests/sec). I'm curious if anyone could point me to some other options I may not have considered. >> >> Thanks! >> Luke >> >> -- >> Luke Ehresman, luke at ehresman.org >> CopperEgg - http://copperegg.com >> Tebros Systems - http://tebros.com >> >> _______________________________________________ >> raleigh-rb-members mailing list >> raleigh-rb-members at rubyforge.org >> http://rubyforge.org/mailman/listinfo/raleigh-rb-members > > > _______________________________________________ > raleigh-rb-members mailing list > raleigh-rb-members at rubyforge.org > http://rubyforge.org/mailman/listinfo/raleigh-rb-members > > _______________________________________________ > raleigh-rb-members mailing list > raleigh-rb-members at rubyforge.org > http://rubyforge.org/mailman/listinfo/raleigh-rb-members From crnixon at gmail.com Fri Jul 22 21:35:30 2011 From: crnixon at gmail.com (Clinton R. Nixon) Date: Fri, 22 Jul 2011 21:35:30 -0400 Subject: [raleigh.rb] ruby http api options In-Reply-To: References: Message-ID: If you want something that was invented pretty much yesterday, there's RESTRack: http://restrack.me/. -- Clinton -------------- next part -------------- An HTML attachment was scrubbed... URL: From luke at ehresman.org Sat Jul 23 06:46:26 2011 From: luke at ehresman.org (Luke Ehresman) Date: Sat, 23 Jul 2011 06:46:26 -0400 Subject: [raleigh.rb] ruby http api options In-Reply-To: References: <40D9A488-9464-4A44-825B-727F9BE6AE73@thewilliams.ws> Message-ID: Brian, Good idea, I'll try slimming down Rails first. Has anyone done this with much success? Also to everyone else commenting on the thread, thanks! These are great suggestions. To the non-ruby suggestions: I'm hoping to stick with Ruby because I'd rather not rewrite everything. Thanks, Luke On Fri, Jul 22, 2011 at 6:52 PM, Brian Adkins wrote: > I never worked with Merb, but I thought that with the Rails/Merb merge it > was easier to trim Rails down to a leaner core. Has anyone done this > effectively? > > Maybe implement it directly with a simple Rack application? > http://rack.rubyforge.org/ > > Thin? http://code.macournoyer.com/thin/ > > Other options: > > Haskell Warp web server: > http://www.yesodweb.com/blog/2011/02/warp-speed-ahead :) > > -- > Brian Adkins > Lojic Technologies, LLC > http://lojic.com/ > > > > > On Jul 22, 2011, at 6:01 PM, Scott Klein wrote: > > > Done anything to figure out the bottleneck? Believe mongo is being hailed > as the "write-speed banshee" right now, and could allow you quickly take the > request and get it into something persistent. > > > > If all else fails, head back to PHP =D > > > > On Fri, Jul 22, 2011 at 5:56 PM, Adam Williams > wrote: > > Have you thought about using Node.js? I know that doesn't fit the subject > line :) > > > > On Jul 22, 2011, at 5:47 PM, Luke Ehresman wrote: > > > >> I have a fairly simple REST API that mostly just consumes copious > amounts of data. Scaling out to more servers is an option, but an expensive > one. I really just need to receive HTTP requests, process the data and slam > it into the database as quickly as possible. > >> > >> Currently it is implemented in Rails, but load testing reveals that > Rails is probably too big for my needs (I get an abysmal 240 requests/sec on > a xlarge high-cpu ec2 instance). > >> > >> I've gotten impressive results with nginx+Passenger+Sinatra (upwards of > 1000 requests/sec). I'm curious if anyone could point me to some other > options I may not have considered. > >> > >> Thanks! > >> Luke > >> > >> -- > >> Luke Ehresman, luke at ehresman.org > >> CopperEgg - http://copperegg.com > >> Tebros Systems - http://tebros.com > >> > >> _______________________________________________ > >> raleigh-rb-members mailing list > >> raleigh-rb-members at rubyforge.org > >> http://rubyforge.org/mailman/listinfo/raleigh-rb-members > > > > > > _______________________________________________ > > raleigh-rb-members mailing list > > raleigh-rb-members at rubyforge.org > > http://rubyforge.org/mailman/listinfo/raleigh-rb-members > > > > _______________________________________________ > > raleigh-rb-members mailing list > > raleigh-rb-members at rubyforge.org > > http://rubyforge.org/mailman/listinfo/raleigh-rb-members > > _______________________________________________ > raleigh-rb-members mailing list > raleigh-rb-members at rubyforge.org > http://rubyforge.org/mailman/listinfo/raleigh-rb-members > -- Luke Ehresman, luke at ehresman.org CopperEgg - http://copperegg.com Tebros Systems - http://tebros.com -------------- next part -------------- An HTML attachment was scrubbed... URL: From crnixon at gmail.com Sat Jul 23 08:46:42 2011 From: crnixon at gmail.com (Clinton R. Nixon) Date: Sat, 23 Jul 2011 08:46:42 -0400 Subject: [raleigh.rb] ruby http api options In-Reply-To: References: <40D9A488-9464-4A44-825B-727F9BE6AE73@thewilliams.ws> Message-ID: On Sat, Jul 23, 2011 at 6:46 AM, Luke Ehresman??wrote: > Good idea, I'll try slimming down Rails first. ?Has anyone done this with much success? Luke, Are you using Rails 2 or 3? You can slim it down just fine with Rails 2, but Rails 3 makes it even easier. On Rails 2, start by editing this line in config/environment.rb: config.frameworks -= [ :active_record, :active_resource, :action_mailer ] The line is commented out by default. Uncomment it and add whatever you aren't using to it. What I have above is probably what you want. On Rails 3, there's a "require 'rails/all'" line in config/application.rb. You can delete it and replace it with: require "action_controller/railtie" require "rails/test_unit/railtie" After you've done that, decide how you're going to get the data into the DB. I suggest using Sequel: http://sequel.rubyforge.org/. This is assuming you are using a relational DB. If you have your choice of relational DBs, read up and decide which is fastest for what you're doing: I am certain your DB will be your biggest bottleneck. I was about to suggest using Rails Metal in Rails 2, or mounting a simple Rack or Sinatra app in Rails 3, and then I realized that it made way more sense to just use Sinatra. Lastly, consider if Passenger's the right thing for your needs. I would experiment with trying Thin or Unicorn. -- Clinton From brandan at bclennox.com Mon Jul 25 12:09:55 2011 From: brandan at bclennox.com (Brandan Lennox) Date: Mon, 25 Jul 2011 12:09:55 -0400 Subject: [raleigh.rb] Anybody using BBEdit? Message-ID: <7BB1C70C-FCAF-4DA2-BA5E-50384FECB792@bclennox.com> I?ve finally given up on TextMate and jumped onboard the BBEdit bandwagon*. It?s definitely powerful, but its out-of-the-box Rails support is poor. I?m looking around for some equivalent of a TextMate bundle for Rails/Rspec/Erb support. There?s this marginally useful bundle, but I was hoping for something like language support for Rspec/Erb and a port to ?clippings? from TextMate?s snippets. Is anybody using BBEdit? Trent made fun of me already, so if RubyMine or something is way better, suggestions won?t hurt my feelings (more). Brandan L. -- brandan at bclennox.com http://bclennox.com +1 (919) 274.7565 * I?d rather do this voluntarily now than involuntarily when TextMate finally breaks in a future OS update. And even if MacroMates eventually releases TextMate 2, I wouldn't want to wait another five years for the next update. -------------- next part -------------- An HTML attachment was scrubbed... URL: From nathan at wallscorp.us Mon Jul 25 13:28:18 2011 From: nathan at wallscorp.us (Nathan L. Walls) Date: Mon, 25 Jul 2011 13:28:18 -0400 Subject: [raleigh.rb] Anybody using BBEdit? In-Reply-To: <7BB1C70C-FCAF-4DA2-BA5E-50384FECB792@bclennox.com> References: <7BB1C70C-FCAF-4DA2-BA5E-50384FECB792@bclennox.com> Message-ID: <2346803A-C02A-41CE-8571-A0167309C87A@wallscorp.us> Brandon, I use BBEdit with Ruby and Rails. if I remember correctly, I started with BBEdit's default Ruby clippings and augmented them with some ones I wrote myself for RSpec. There is a Cucumber clipping set out and about as well. BBEdit *does* have support for ERb. In the language preferences, it's treated as "Ruby in HTML." Cheers, Nathan -- Nathan L. Walls | http://wallscorp.us/ On Jul 25, 2011, at 12:09 PM, Brandan Lennox wrote: > I?ve finally given up on TextMate and jumped onboard the BBEdit bandwagon*. It?s definitely powerful, but its out-of-the-box Rails support is poor. I?m looking around for some equivalent of a TextMate bundle for Rails/Rspec/Erb support. There?s this marginally useful bundle, but I was hoping for something like language support for Rspec/Erb and a port to ?clippings? from TextMate?s snippets. > > Is anybody using BBEdit? Trent made fun of me already, so if RubyMine or something is way better, suggestions won?t hurt my feelings (more). > > Brandan L. > -- > brandan at bclennox.com > http://bclennox.com > +1 (919) 274.7565 > > > * I?d rather do this voluntarily now than involuntarily when TextMate finally breaks in a future OS update. And even if MacroMates eventually releases TextMate 2, I wouldn't want to wait another five years for the next update. > > > _______________________________________________ > raleigh-rb-members mailing list > raleigh-rb-members at rubyforge.org > http://rubyforge.org/mailman/listinfo/raleigh-rb-members -------------- next part -------------- An HTML attachment was scrubbed... URL: From brandan at bclennox.com Mon Jul 25 14:12:36 2011 From: brandan at bclennox.com (Brandan Lennox) Date: Mon, 25 Jul 2011 14:12:36 -0400 Subject: [raleigh.rb] Anybody using BBEdit? In-Reply-To: <2346803A-C02A-41CE-8571-A0167309C87A@wallscorp.us> References: <7BB1C70C-FCAF-4DA2-BA5E-50384FECB792@bclennox.com> <2346803A-C02A-41CE-8571-A0167309C87A@wallscorp.us> Message-ID: <70F2284E-4BA8-4CBB-9866-D98BE734A646@bclennox.com> Thanks Nathan. I realize now that it?s not BBEdit?s lack of Erb support. It?s the way we embed JavaScript into our Erb templates in content_for blocks. I had to hack TextMate to cooperate, so I?ll just have to find a way to hack BBEdit too. As for the clippings, I feel like I?m missing something. I don?t see any clippings whatsoever, for any language. That?s why I was so disappointed. I may have missed something or installed something wrong, so I?m going to try to hunt down that clipping set. I just need a starting point and I?ll be able to add all my must-haves as necessary. Thanks for the input, Brandan L. -- brandan at bclennox.com http://bclennox.com +1 (919) 274.7565 On Jul 25, 2011, at 1:28 PM, Nathan L. Walls wrote: > Brandon, > > I use BBEdit with Ruby and Rails. if I remember correctly, I started with BBEdit's default Ruby clippings and augmented them with some ones I wrote myself for RSpec. There is a Cucumber clipping set out and about as well. > > BBEdit *does* have support for ERb. In the language preferences, it's treated as "Ruby in HTML." > > Cheers, > > Nathan > -- > Nathan L. Walls | http://wallscorp.us/ > > > > On Jul 25, 2011, at 12:09 PM, Brandan Lennox wrote: > >> I?ve finally given up on TextMate and jumped onboard the BBEdit bandwagon*. It?s definitely powerful, but its out-of-the-box Rails support is poor. I?m looking around for some equivalent of a TextMate bundle for Rails/Rspec/Erb support. There?s this marginally useful bundle, but I was hoping for something like language support for Rspec/Erb and a port to ?clippings? from TextMate?s snippets. >> >> Is anybody using BBEdit? Trent made fun of me already, so if RubyMine or something is way better, suggestions won?t hurt my feelings (more). >> >> Brandan L. >> -- >> brandan at bclennox.com >> http://bclennox.com >> +1 (919) 274.7565 >> >> >> * I?d rather do this voluntarily now than involuntarily when TextMate finally breaks in a future OS update. And even if MacroMates eventually releases TextMate 2, I wouldn't want to wait another five years for the next update. >> >> >> _______________________________________________ >> raleigh-rb-members mailing list >> raleigh-rb-members at rubyforge.org >> http://rubyforge.org/mailman/listinfo/raleigh-rb-members > > _______________________________________________ > raleigh-rb-members mailing list > raleigh-rb-members at rubyforge.org > http://rubyforge.org/mailman/listinfo/raleigh-rb-members -------------- next part -------------- An HTML attachment was scrubbed... URL: From joe at bodkinconsulting.com Mon Jul 25 14:40:42 2011 From: joe at bodkinconsulting.com (joe Fair) Date: Mon, 25 Jul 2011 14:40:42 -0400 Subject: [raleigh.rb] Anybody using BBEdit? In-Reply-To: <2346803A-C02A-41CE-8571-A0167309C87A@wallscorp.us> References: <7BB1C70C-FCAF-4DA2-BA5E-50384FECB792@bclennox.com> <2346803A-C02A-41CE-8571-A0167309C87A@wallscorp.us> Message-ID: I know what you mean. I use gvim for windows and linux (and mac, when I had it). The graphical bits are a little better than just a console, and you can get ctrl-space completion without the memory/time hit. I won a license to RedMine at a user group raffle. It was a lot like intelliJ (which I liked) but I didn't spend enough time on it to get hooked. Hope you find a solution soon, Joe On Mon, Jul 25, 2011 at 1:28 PM, Nathan L. Walls wrote: > Brandon, > I use BBEdit with Ruby and Rails. if I remember correctly, I started with > BBEdit's default Ruby clippings and augmented them with some ones I wrote > myself for RSpec. There is a Cucumber clipping set out and about as well. > BBEdit *does* have support for ERb. In the language preferences, it's > treated as "Ruby in HTML." > Cheers, > Nathan > -- > Nathan L. Walls | http://wallscorp.us/ > > > > On Jul 25, 2011, at 12:09 PM, Brandan Lennox wrote: > > I?ve finally given up on TextMate and jumped onboard the BBEdit bandwagon*. > It?s definitely powerful, but its out-of-the-box Rails support is poor. I?m > looking around for some equivalent of a TextMate bundle for Rails/Rspec/Erb > support. There?s?this marginally useful bundle, but I was hoping for > something like language support for Rspec/Erb and a port to ?clippings? from > TextMate?s snippets. > Is anybody using BBEdit? Trent made fun of me already, so if RubyMine or > something is way better, suggestions won?t hurt my feelings (more). > Brandan L. > -- > brandan at bclennox.com > http://bclennox.com > +1 (919) 274.7565 > > * I?d rather do this voluntarily now than involuntarily when TextMate > finally breaks in a future OS update. And even if MacroMates eventually > releases TextMate 2, I wouldn't want to wait another five years for the next > update. > > > _______________________________________________ > raleigh-rb-members mailing list > raleigh-rb-members at rubyforge.org > http://rubyforge.org/mailman/listinfo/raleigh-rb-members > > _______________________________________________ > raleigh-rb-members mailing list > raleigh-rb-members at rubyforge.org > http://rubyforge.org/mailman/listinfo/raleigh-rb-members > From jimmy at jimmythrasher.com Wed Jul 27 12:19:34 2011 From: jimmy at jimmythrasher.com (Jimmy Thrasher) Date: Wed, 27 Jul 2011 12:19:34 -0400 Subject: [raleigh.rb] Hoedown 2011 carpooling Message-ID: Hi everyone, So far, I'm the only one that I know of in the RTP area planning to go to this year's Hoedown. Is anybody else planning to go? My aim is to drive, and I'd love to carpool. Jimmy -------------- next part -------------- An HTML attachment was scrubbed... URL: From donald.ball at gmail.com Wed Jul 27 13:23:53 2011 From: donald.ball at gmail.com (Donald Ball) Date: Wed, 27 Jul 2011 13:23:53 -0400 Subject: [raleigh.rb] memory leak analysis Message-ID: I'm working on tracking down a memory leak in a resque import job. Through some judicious use of ObjectSpace, I've identified and corrected the major culprits, but I've still got a few model instances which are being kept alive by references I haven't been able to find tracing through the code by hand. Is anyone aware of a library or ruby patch that lets you see all references to a given object? In general, what, if anything, do folks use for heap analysis? -- donald From kevin at hypotheticalabs.com Wed Jul 27 14:17:01 2011 From: kevin at hypotheticalabs.com (Kevin Smith) Date: Wed, 27 Jul 2011 14:17:01 -0400 Subject: [raleigh.rb] Opportunities @ Opscode Message-ID: <0FB317CE-A28F-4DFF-95FC-90ACA6517CAB@hypotheticalabs.com> Hi everyone - Apologies in advance for the recruiting email. If this isn't your cup of tea, feel free to delete and ignore and please accept my humble apologies. I've begun a new job as Director of Engineering at Opscode, the makers of Chef, and I'm building a development team based in RDU to work on our back-end systems. We're going to be rapidly scaling up over the next year and we're counting on Erlang and Ruby to help us get there. I'm looking for developers with Ruby and/or Erlang experience, a desire to learn, and an interest in improving the state of systems automation. If this sounds interesting or you'd like more information about opportunities w/Opscode in RDU please drop me a note via email (k at opscode.com) or look me up at tomorrow's Hack Night. You can also find out more information about Opscode and Chef at our websites http://www.opscode.com and http://www.opscode.com/chef. --Kevin From pelargir at gmail.com Wed Jul 27 14:34:11 2011 From: pelargir at gmail.com (Matthew Bass) Date: Wed, 27 Jul 2011 14:34:11 -0400 Subject: [raleigh.rb] Hoedown 2011 carpooling In-Reply-To: References: Message-ID: On Jul 27, 2011, at 12:19 PM, Jimmy Thrasher wrote: > So far, I'm the only one that I know of in the RTP area planning to go to this year's Hoedown. Is anybody else planning to go? My aim is to drive, and I'd love to carpool. Alas, my schedule won't permit it this year. Matthew -------------- next part -------------- A non-text attachment was scrubbed... Name: smime.p7s Type: application/pkcs7-signature Size: 4881 bytes Desc: not available URL: From tom.brooke at gmail.com Wed Jul 27 15:05:48 2011 From: tom.brooke at gmail.com (Tom Brooke) Date: Wed, 27 Jul 2011 15:05:48 -0400 Subject: [raleigh.rb] Fwd: Hoedown 2011 carpooling In-Reply-To: References: Message-ID: It's sold out - I'd consider going if anyone could get me in Tom Brooke ---------- Forwarded message ---------- From: Matthew Bass Date: Wed, Jul 27, 2011 at 2:34 PM Subject: Re: [raleigh.rb] Hoedown 2011 carpooling To: "The mailing list of raleigh.rb" On Jul 27, 2011, at 12:19 PM, Jimmy Thrasher wrote: > So far, I'm the only one that I know of in the RTP area planning to go to this year's Hoedown. Is anybody else planning to go? My aim is to drive, and I'd love to carpool. Alas, my schedule won't permit it this year. Matthew _______________________________________________ raleigh-rb-members mailing list raleigh-rb-members at rubyforge.org http://rubyforge.org/mailman/listinfo/raleigh-rb-members -------------- next part -------------- An HTML attachment was scrubbed... URL: -------------- next part -------------- A non-text attachment was scrubbed... Name: smime.p7s Type: application/pkcs7-signature Size: 4881 bytes Desc: not available URL: From jeremymcanally at gmail.com Wed Jul 27 15:34:09 2011 From: jeremymcanally at gmail.com (Jeremy McAnally) Date: Wed, 27 Jul 2011 15:34:09 -0400 Subject: [raleigh.rb] Fwd: Hoedown 2011 carpooling In-Reply-To: References: Message-ID: IT SHALL BE DONE. -- Jeremy, Lord of the Hoedown P.S. - Seriously, just show up. :) 30% of people who sign up don't show at all (always within 2% of that EVERY year both Hoedown and MagicRuby), so I have space for a few more. On Wed, Jul 27, 2011 at 3:05 PM, Tom Brooke wrote: > It's sold out - I'd consider going if anyone could get me in > > > Tom Brooke > > ---------- Forwarded message ---------- > From: Matthew Bass > Date: Wed, Jul 27, 2011 at 2:34 PM > Subject: Re: [raleigh.rb] Hoedown 2011 carpooling > To: "The mailing list of raleigh.rb" > > > > On Jul 27, 2011, at 12:19 PM, Jimmy Thrasher wrote: > >> So far, I'm the only one that I know of in the RTP area planning to go to >> this year's Hoedown. Is anybody else planning to go? My aim is to drive, and >> I'd love to carpool. > > Alas, my schedule won't permit it this year. > > Matthew > > > _______________________________________________ > raleigh-rb-members mailing list > raleigh-rb-members at rubyforge.org > http://rubyforge.org/mailman/listinfo/raleigh-rb-members > > > _______________________________________________ > raleigh-rb-members mailing list > raleigh-rb-members at rubyforge.org > http://rubyforge.org/mailman/listinfo/raleigh-rb-members > -- http://jeremymcanally.com/?-?http://arcturo.com/ Bowties, ties, and more:?http://wickhamhousebrand.com My books: http://r3uh.com ?http://rbip.info/ ?http://hlrb.org (FREE!) From trevormg19 at gmail.com Mon Jul 25 13:38:05 2011 From: trevormg19 at gmail.com (Trevor Little) Date: Mon, 25 Jul 2011 13:38:05 -0400 Subject: [raleigh.rb] Anybody using BBEdit? In-Reply-To: <2346803A-C02A-41CE-8571-A0167309C87A@wallscorp.us> References: <7BB1C70C-FCAF-4DA2-BA5E-50384FECB792@bclennox.com> <2346803A-C02A-41CE-8571-A0167309C87A@wallscorp.us> Message-ID: This may be a tad off-topic but as we're talking about editors... I've recently discovered a few awesome Vim plugins for ruby and rails that have been really helpful, including one that implements TextMate snippets so you can use existing snippets in Vim with little or no modifications. I've got my vimrc on github including a list of plugins I've got installed if anyones interested. I've found using vim with those plugins inside screen with spork and autotest to be a pretty great experience. Trevor On Mon, Jul 25, 2011 at 1:28 PM, Nathan L. Walls wrote: > Brandon, > I use BBEdit with Ruby and Rails. if I remember correctly, I started with > BBEdit's default Ruby clippings and augmented them with some ones I wrote > myself for RSpec. There is a Cucumber clipping set out and about as well. > BBEdit *does* have support for ERb. In the language preferences, it's > treated as "Ruby in HTML." > Cheers, > Nathan > -- > Nathan L. Walls | http://wallscorp.us/ > > > > On Jul 25, 2011, at 12:09 PM, Brandan Lennox wrote: > > I?ve finally given up on TextMate and jumped onboard the BBEdit bandwagon*. > It?s definitely powerful, but its out-of-the-box Rails support is poor. I?m > looking around for some equivalent of a TextMate bundle for Rails/Rspec/Erb > support. There?s this marginally useful bundle, but I was hoping for > something like language support for Rspec/Erb and a port to ?clippings? from > TextMate?s snippets. > Is anybody using BBEdit? Trent made fun of me already, so if RubyMine or > something is way better, suggestions won?t hurt my feelings (more). > Brandan L. > -- > brandan at bclennox.com > http://bclennox.com > +1 (919) 274.7565 > > * I?d rather do this voluntarily now than involuntarily when TextMate > finally breaks in a future OS update. And even if MacroMates eventually > releases TextMate 2, I wouldn't want to wait another five years for the next > update. > > > _______________________________________________ > raleigh-rb-members mailing list > raleigh-rb-members at rubyforge.org > http://rubyforge.org/mailman/listinfo/raleigh-rb-members > > _______________________________________________ > raleigh-rb-members mailing list > raleigh-rb-members at rubyforge.org > http://rubyforge.org/mailman/listinfo/raleigh-rb-members > -------------- next part -------------- An HTML attachment was scrubbed... URL: From kjp at brightleafsoftware.com Mon Jul 25 15:01:06 2011 From: kjp at brightleafsoftware.com (Kevin Poorman) Date: Mon, 25 Jul 2011 15:01:06 -0400 Subject: [raleigh.rb] Anybody using BBEdit? In-Reply-To: <7BB1C70C-FCAF-4DA2-BA5E-50384FECB792@bclennox.com> References: <7BB1C70C-FCAF-4DA2-BA5E-50384FECB792@bclennox.com> Message-ID: I'm only so-so on IDE's, generally preferring to use redcar, sublimetext or textmate. But I've found the refactoring support in rubymine too helpful to give up. I highly commend rubyMine to anyone, if only for the refactor menu. -pkj On Jul 25, 2011, at 12:09 PM, Brandan Lennox wrote: > I?ve finally given up on TextMate and jumped onboard the BBEdit bandwagon*. It?s definitely powerful, but its out-of-the-box Rails support is poor. I?m looking around for some equivalent of a TextMate bundle for Rails/Rspec/Erb support. There?s this marginally useful bundle, but I was hoping for something like language support for Rspec/Erb and a port to ?clippings? from TextMate?s snippets. > > Is anybody using BBEdit? Trent made fun of me already, so if RubyMine or something is way better, suggestions won?t hurt my feelings (more). > > Brandan L. > -- > brandan at bclennox.com > http://bclennox.com > +1 (919) 274.7565 > > > * I?d rather do this voluntarily now than involuntarily when TextMate finally breaks in a future OS update. And even if MacroMates eventually releases TextMate 2, I wouldn't want to wait another five years for the next update. > > > _______________________________________________ > raleigh-rb-members mailing list > raleigh-rb-members at rubyforge.org > http://rubyforge.org/mailman/listinfo/raleigh-rb-members -------------- next part -------------- An HTML attachment was scrubbed... URL: From kjp at brightleafsoftware.com Wed Jul 27 12:36:02 2011 From: kjp at brightleafsoftware.com (Kevin Poorman) Date: Wed, 27 Jul 2011 12:36:02 -0400 Subject: [raleigh.rb] Hoedown 2011 carpooling In-Reply-To: References: Message-ID: First I've heard of the hoedown! Looks fun!, I wouldn't mind carpooling. I'll kevin.wife.check_calendar -pkj On Jul 27, 2011, at 12:19 PM, Jimmy Thrasher wrote: > Hi everyone, > > So far, I'm the only one that I know of in the RTP area planning to go to this year's Hoedown. Is anybody else planning to go? My aim is to drive, and I'd love to carpool. > > Jimmy > _______________________________________________ > raleigh-rb-members mailing list > raleigh-rb-members at rubyforge.org > http://rubyforge.org/mailman/listinfo/raleigh-rb-members From trevormg19 at gmail.com Wed Jul 27 16:44:05 2011 From: trevormg19 at gmail.com (Trevor Little) Date: Wed, 27 Jul 2011 16:44:05 -0400 Subject: [raleigh.rb] Hoedown 2011 carpooling In-Reply-To: References: Message-ID: Looks interesting. I'd consider going too, if the "sold out" doesn't really mean "sold out". Trevor On Wed, Jul 27, 2011 at 12:36 PM, Kevin Poorman wrote: > First I've heard of the hoedown! > > Looks fun!, I wouldn't mind carpooling. I'll kevin.wife.check_calendar > > -pkj > > On Jul 27, 2011, at 12:19 PM, Jimmy Thrasher wrote: > > > Hi everyone, > > > > So far, I'm the only one that I know of in the RTP area planning to go to > this year's Hoedown. Is anybody else planning to go? My aim is to drive, and > I'd love to carpool. > > > > Jimmy > > _______________________________________________ > > raleigh-rb-members mailing list > > raleigh-rb-members at rubyforge.org > > http://rubyforge.org/mailman/listinfo/raleigh-rb-members > > _______________________________________________ > raleigh-rb-members mailing list > raleigh-rb-members at rubyforge.org > http://rubyforge.org/mailman/listinfo/raleigh-rb-members > -------------- next part -------------- An HTML attachment was scrubbed... URL: From jim at jimvanfleet.com Fri Jul 29 16:13:17 2011 From: jim at jimvanfleet.com (Jim Van Fleet) Date: Fri, 29 Jul 2011 16:13:17 -0400 Subject: [raleigh.rb] memory leak analysis In-Reply-To: References: Message-ID: Hi, Donald. The tools Rubinius has for introspecting its runtime are unmatched. Of course, it's a total reimplementation, so if the reason that you are leaking memory is VM specific, you won't find it. On the plus side, that means you can solve your problem by picking a new runtime VM! Ruby's got plenty. For MRI, the best tools are outlined by Aman Gupta here (slides) http://www.slideshare.net/tmm1/debugging-ruby and here (video) http://confreaks.net/videos/371-rubyconf2010-debugging-ruby Cheers! Jim On Wed, Jul 27, 2011 at 1:23 PM, Donald Ball wrote: > I'm working on tracking down a memory leak in a resque import job. > Through some judicious use of ObjectSpace, I've identified and > corrected the major culprits, but I've still got a few model instances > which are being kept alive by references I haven't been able to find > tracing through the code by hand. Is anyone aware of a library or ruby > patch that lets you see all references to a given object? > > In general, what, if anything, do folks use for heap analysis? > > -- donald > _______________________________________________ > raleigh-rb-members mailing list > raleigh-rb-members at rubyforge.org > http://rubyforge.org/mailman/listinfo/raleigh-rb-members > -------------- next part -------------- An HTML attachment was scrubbed... URL: From chris at randomutterings.com Fri Jul 29 18:06:13 2011 From: chris at randomutterings.com (Chris Barnes) Date: Fri, 29 Jul 2011 18:06:13 -0400 Subject: [raleigh.rb] Preventing duplicate records Message-ID: I'm trying to come up with a solution to a problem in one of my apps where users are "accidentally" submitting a form twice and causing duplicate records. I disabled the UI with javascript on form submission and that fixed the problem for the most part but users who hit enter several times quickly can get the form to submit twice before the javascript executes. I've tried scoped unique validations in the model but record 1 doesn't yet exist when record 2 validates and so they both save. The only other way I've come up with is adding a multi field unique index to the table. The problem is, a record with all identical fields in the table (except for the id of course) should be valid. What I'm saying is, if they try to key in a record with all the same info as an existing record it should be valid. I just don't want it to happen due to a form being submitted twice. As far as I can tell, the only way to prevent it is to disable the enter key. The problem is, some views have inline editing and use the enter key for submission. So I can either disable the enter key and add submit buttons to my inline edit forms (yuck) or I can disable the enter key only on forms that are not the inline editing type (inconsistant). Edit: While typing this email, I may have figured out a way to accomplish this. If I create a unique index on the table and include the created_at timestamp, it should work. Then users can create records that perfectly match existing ones (except for the timestamp) but if a form gets submitted twice it won't save the second record. Anyone see any problems with this solution or perhaps know a better one? From tj at stank.us Fri Jul 29 21:51:14 2011 From: tj at stank.us (TJ Stankus) Date: Fri, 29 Jul 2011 21:51:14 -0400 Subject: [raleigh.rb] Preventing duplicate records In-Reply-To: References: Message-ID: Chris, I've heard this referred to as the uniqueness caveat. Unfortunately, using validates :uniqueness does not guarantee uniqueness. As you're finding, a double submit may create two objects in memory, each of which passes validation, ensuring both get saved. I think you're onto the solution though, which is to enforce uniqueness at the database level as well, via a unique index. For example if you require a unique email attribute, in addition to the model uniqueness validation, you'd want something like this: class AddEmailUniquenessIndex < ActiveRecord::Migration def up add_index :users, :email, :unique => true end def down remove_index :users, :email end end Now, ActiveRecord::StatementInvalid will be thrown for duplicate emails. -TJ On Fri, Jul 29, 2011 at 6:06 PM, Chris Barnes wrote: > I'm trying to come up with a solution to a problem in one of my apps > where users are "accidentally" submitting a form twice and causing > duplicate records. ?I disabled the UI with javascript on form > submission and that fixed the problem for the most part but users who > hit enter several times quickly can get the form to submit twice > before the javascript executes. > > I've tried scoped unique validations in the model but record 1 doesn't > yet exist when record 2 validates and so they both save. > > The only other way I've come up with is adding a multi field unique > index to the table. ?The problem is, a record with all identical > fields in the table (except for the id of course) should be valid. > What I'm saying is, if they try to key in a record with all the same > info as an existing record it should be valid. ?I just don't want it > to happen due to a form being submitted twice. > > As far as I can tell, the only way to prevent it is to disable the > enter key. ?The problem is, some views have inline editing and use the > enter key for submission. ?So I can either disable the enter key and > add submit buttons to my inline edit forms (yuck) or I can disable the > enter key only on forms that are not the inline editing type > (inconsistant). > > Edit: > > While typing this email, I may have figured out a way to accomplish > this. ?If I create a unique index on the table and include the > created_at timestamp, it should work. ?Then users can create records > that perfectly match existing ones (except for the timestamp) but if a > form gets submitted twice it won't save the second record. > > Anyone see any problems with this solution or perhaps know a better one? > _______________________________________________ > raleigh-rb-members mailing list > raleigh-rb-members at rubyforge.org > http://rubyforge.org/mailman/listinfo/raleigh-rb-members > From harry.park at gmail.com Fri Jul 29 22:33:24 2011 From: harry.park at gmail.com (Harry Park) Date: Fri, 29 Jul 2011 22:33:24 -0400 Subject: [raleigh.rb] Preventing duplicate records In-Reply-To: References: Message-ID: You could also put an extra hidden field in the form. So when you see the hidden field's value a second time, you'll know it was a double submit of the form. Sorry, no sample ruby code included. On Fri, Jul 29, 2011 at 9:51 PM, TJ Stankus wrote: > Chris, > > I've heard this referred to as the uniqueness caveat. Unfortunately, > using validates :uniqueness does not guarantee uniqueness. > > As you're finding, a double submit may create two objects in memory, > each of which passes validation, ensuring both get saved. I think > you're onto the solution though, which is to enforce uniqueness at the > database level as well, via a unique index. > > For example if you require a unique email attribute, in addition to > the model uniqueness validation, you'd want something like this: > > class AddEmailUniquenessIndex < ActiveRecord::Migration > def up > add_index :users, :email, :unique => true > end > > def down > remove_index :users, :email > end > end > > Now, ActiveRecord::StatementInvalid will be thrown for duplicate emails. > > -TJ > > On Fri, Jul 29, 2011 at 6:06 PM, Chris Barnes > wrote: > > I'm trying to come up with a solution to a problem in one of my apps > > where users are "accidentally" submitting a form twice and causing > > duplicate records. I disabled the UI with javascript on form > > submission and that fixed the problem for the most part but users who > > hit enter several times quickly can get the form to submit twice > > before the javascript executes. > > > > I've tried scoped unique validations in the model but record 1 doesn't > > yet exist when record 2 validates and so they both save. > > > > The only other way I've come up with is adding a multi field unique > > index to the table. The problem is, a record with all identical > > fields in the table (except for the id of course) should be valid. > > What I'm saying is, if they try to key in a record with all the same > > info as an existing record it should be valid. I just don't want it > > to happen due to a form being submitted twice. > > > > As far as I can tell, the only way to prevent it is to disable the > > enter key. The problem is, some views have inline editing and use the > > enter key for submission. So I can either disable the enter key and > > add submit buttons to my inline edit forms (yuck) or I can disable the > > enter key only on forms that are not the inline editing type > > (inconsistant). > > > > Edit: > > > > While typing this email, I may have figured out a way to accomplish > > this. If I create a unique index on the table and include the > > created_at timestamp, it should work. Then users can create records > > that perfectly match existing ones (except for the timestamp) but if a > > form gets submitted twice it won't save the second record. > > > > Anyone see any problems with this solution or perhaps know a better one? > > _______________________________________________ > > raleigh-rb-members mailing list > > raleigh-rb-members at rubyforge.org > > http://rubyforge.org/mailman/listinfo/raleigh-rb-members > > > _______________________________________________ > raleigh-rb-members mailing list > raleigh-rb-members at rubyforge.org > http://rubyforge.org/mailman/listinfo/raleigh-rb-members > -------------- next part -------------- An HTML attachment was scrubbed... URL: From steve at iannopollo.com Fri Jul 29 23:44:42 2011 From: steve at iannopollo.com (Steve Iannopollo) Date: Fri, 29 Jul 2011 23:44:42 -0400 Subject: [raleigh.rb] Preventing duplicate records In-Reply-To: References: Message-ID: <2ECEAFEC-C415-4F55-9CD3-CEAAC15F1858@iannopollo.com> > You could also put an extra hidden field in the form. So when you see the hidden field's value a second time, you'll know it was a double submit of the form. I would second that approach. Also no code from me, but I would imagine something like the following would work: * Hook into form_for (or whatever other way you generate forms) to include a hidden field with a uuid. Something similar to the way form_for adds the authenticity_token field. * Have a table where you store the uuids, indexing the value since you'll be searching on it * Have a before filter that takes that uuid from form submissions and checks to see if they are in the db. If so, the submission is a duplicate and stops the request. If not, the submission is the first one and should be allowed to proceed as normal That's how I'd do it anyway. Hope this helps. -Steve On Jul 29, 2011, at 10:33 PM, Harry Park wrote: > > Sorry, no sample ruby code included. > > On Fri, Jul 29, 2011 at 9:51 PM, TJ Stankus wrote: > Chris, > > I've heard this referred to as the uniqueness caveat. Unfortunately, > using validates :uniqueness does not guarantee uniqueness. > > As you're finding, a double submit may create two objects in memory, > each of which passes validation, ensuring both get saved. I think > you're onto the solution though, which is to enforce uniqueness at the > database level as well, via a unique index. > > For example if you require a unique email attribute, in addition to > the model uniqueness validation, you'd want something like this: > > class AddEmailUniquenessIndex < ActiveRecord::Migration > def up > add_index :users, :email, :unique => true > end > > def down > remove_index :users, :email > end > end > > Now, ActiveRecord::StatementInvalid will be thrown for duplicate emails. > > -TJ > > On Fri, Jul 29, 2011 at 6:06 PM, Chris Barnes wrote: > > I'm trying to come up with a solution to a problem in one of my apps > > where users are "accidentally" submitting a form twice and causing > > duplicate records. I disabled the UI with javascript on form > > submission and that fixed the problem for the most part but users who > > hit enter several times quickly can get the form to submit twice > > before the javascript executes. > > > > I've tried scoped unique validations in the model but record 1 doesn't > > yet exist when record 2 validates and so they both save. > > > > The only other way I've come up with is adding a multi field unique > > index to the table. The problem is, a record with all identical > > fields in the table (except for the id of course) should be valid. > > What I'm saying is, if they try to key in a record with all the same > > info as an existing record it should be valid. I just don't want it > > to happen due to a form being submitted twice. > > > > As far as I can tell, the only way to prevent it is to disable the > > enter key. The problem is, some views have inline editing and use the > > enter key for submission. So I can either disable the enter key and > > add submit buttons to my inline edit forms (yuck) or I can disable the > > enter key only on forms that are not the inline editing type > > (inconsistant). > > > > Edit: > > > > While typing this email, I may have figured out a way to accomplish > > this. If I create a unique index on the table and include the > > created_at timestamp, it should work. Then users can create records > > that perfectly match existing ones (except for the timestamp) but if a > > form gets submitted twice it won't save the second record. > > > > Anyone see any problems with this solution or perhaps know a better one? > > _______________________________________________ > > raleigh-rb-members mailing list > > raleigh-rb-members at rubyforge.org > > http://rubyforge.org/mailman/listinfo/raleigh-rb-members > > > _______________________________________________ > raleigh-rb-members mailing list > raleigh-rb-members at rubyforge.org > http://rubyforge.org/mailman/listinfo/raleigh-rb-members > > _______________________________________________ > raleigh-rb-members mailing list > raleigh-rb-members at rubyforge.org > http://rubyforge.org/mailman/listinfo/raleigh-rb-members -------------- next part -------------- An HTML attachment was scrubbed... URL: From tj at stank.us Sat Jul 30 09:50:09 2011 From: tj at stank.us (TJ Stankus) Date: Sat, 30 Jul 2011 09:50:09 -0400 Subject: [raleigh.rb] Preventing duplicate records In-Reply-To: <2ECEAFEC-C415-4F55-9CD3-CEAAC15F1858@iannopollo.com> References: <2ECEAFEC-C415-4F55-9CD3-CEAAC15F1858@iannopollo.com> Message-ID: I have to respectfully disagree with the form-based approach. Two reasons: 1) It's a lot more code. 2) It takes a model-level concern and spreads it across all three layers of MVC. Usual disclaimers apply: - There is more than one way to skin the cat. - To each his own. - There may be other business rules in your app that affect your decisions. -TJ On Fri, Jul 29, 2011 at 11:44 PM, Steve Iannopollo wrote: > You could also put an extra hidden field in the form. So when you see the > hidden field's value a second time, you'll know it was a double submit of > the form. > > I would second that approach. Also no code from me, but I would imagine > something like the following would work: > * Hook into form_for (or whatever other way you generate forms) to include a > hidden field with a uuid. Something similar to the way form_for adds the > authenticity_token field. > * Have a table where you store the uuids, indexing the value since you'll be > searching on it > * Have a before filter that takes that uuid from form submissions and checks > to see if they are in the db. If so, the submission is a duplicate and stops > the request. If not, the submission is the first one and should be allowed > to proceed as normal > That's how I'd do it anyway. Hope this helps. > -Steve > On Jul 29, 2011, at 10:33 PM, Harry Park wrote: > > Sorry, no sample ruby code included. > > On Fri, Jul 29, 2011 at 9:51 PM, TJ Stankus wrote: >> >> Chris, >> >> I've heard this referred to as the uniqueness caveat. Unfortunately, >> using validates :uniqueness does not guarantee uniqueness. >> >> As you're finding, a double submit may create two objects in memory, >> each of which passes validation, ensuring both get saved. I think >> you're onto the solution though, which is to enforce uniqueness at the >> database level as well, via a unique index. >> >> For example if you require a unique email attribute, in addition to >> the model uniqueness validation, you'd want something like this: >> >> ? ?class AddEmailUniquenessIndex < ActiveRecord::Migration >> ? ? ?def up >> ? ? ? ?add_index :users, :email, :unique => true >> ? ? ?end >> >> ? ? ?def down >> ? ? ? ?remove_index :users, :email >> ? ? ?end >> ? ?end >> >> Now, ActiveRecord::StatementInvalid will be thrown for duplicate emails. >> >> -TJ >> >> On Fri, Jul 29, 2011 at 6:06 PM, Chris Barnes >> wrote: >> > I'm trying to come up with a solution to a problem in one of my apps >> > where users are "accidentally" submitting a form twice and causing >> > duplicate records. ?I disabled the UI with javascript on form >> > submission and that fixed the problem for the most part but users who >> > hit enter several times quickly can get the form to submit twice >> > before the javascript executes. >> > >> > I've tried scoped unique validations in the model but record 1 doesn't >> > yet exist when record 2 validates and so they both save. >> > >> > The only other way I've come up with is adding a multi field unique >> > index to the table. ?The problem is, a record with all identical >> > fields in the table (except for the id of course) should be valid. >> > What I'm saying is, if they try to key in a record with all the same >> > info as an existing record it should be valid. ?I just don't want it >> > to happen due to a form being submitted twice. >> > >> > As far as I can tell, the only way to prevent it is to disable the >> > enter key. ?The problem is, some views have inline editing and use the >> > enter key for submission. ?So I can either disable the enter key and >> > add submit buttons to my inline edit forms (yuck) or I can disable the >> > enter key only on forms that are not the inline editing type >> > (inconsistant). >> > >> > Edit: >> > >> > While typing this email, I may have figured out a way to accomplish >> > this. ?If I create a unique index on the table and include the >> > created_at timestamp, it should work. ?Then users can create records >> > that perfectly match existing ones (except for the timestamp) but if a >> > form gets submitted twice it won't save the second record. >> > >> > Anyone see any problems with this solution or perhaps know a better one? >> > _______________________________________________ >> > raleigh-rb-members mailing list >> > raleigh-rb-members at rubyforge.org >> > http://rubyforge.org/mailman/listinfo/raleigh-rb-members >> > >> _______________________________________________ >> raleigh-rb-members mailing list >> raleigh-rb-members at rubyforge.org >> http://rubyforge.org/mailman/listinfo/raleigh-rb-members > > _______________________________________________ > raleigh-rb-members mailing list > raleigh-rb-members at rubyforge.org > http://rubyforge.org/mailman/listinfo/raleigh-rb-members > > _______________________________________________ > raleigh-rb-members mailing list > raleigh-rb-members at rubyforge.org > http://rubyforge.org/mailman/listinfo/raleigh-rb-members > From martin.streicher at gmail.com Sat Jul 30 10:11:48 2011 From: martin.streicher at gmail.com (Martin Streicher) Date: Sat, 30 Jul 2011 10:11:48 -0400 Subject: [raleigh.rb] Preventing duplicate records In-Reply-To: References: Message-ID: Can you include a form serial number, a key of some sort that you expect to see in the response, and that's unique per rendered form? I suppose the session needs to track the last serial number issued and ignore any duplicate uses. Each new or edit action would reset the serial number. On Jul 29, 2011, at 6:06 PM, Chris Barnes wrote: > I'm trying to come up with a solution to a problem in one of my apps > where users are "accidentally" submitting a form twice and causing > duplicate records. I disabled the UI with javascript on form > submission and that fixed the problem for the most part but users who > hit enter several times quickly can get the form to submit twice > before the javascript executes. > > I've tried scoped unique validations in the model but record 1 doesn't > yet exist when record 2 validates and so they both save. > > The only other way I've come up with is adding a multi field unique > index to the table. The problem is, a record with all identical > fields in the table (except for the id of course) should be valid. > What I'm saying is, if they try to key in a record with all the same > info as an existing record it should be valid. I just don't want it > to happen due to a form being submitted twice. > > As far as I can tell, the only way to prevent it is to disable the > enter key. The problem is, some views have inline editing and use the > enter key for submission. So I can either disable the enter key and > add submit buttons to my inline edit forms (yuck) or I can disable the > enter key only on forms that are not the inline editing type > (inconsistant). > > Edit: > > While typing this email, I may have figured out a way to accomplish > this. If I create a unique index on the table and include the > created_at timestamp, it should work. Then users can create records > that perfectly match existing ones (except for the timestamp) but if a > form gets submitted twice it won't save the second record. > > Anyone see any problems with this solution or perhaps know a better one? > _______________________________________________ > raleigh-rb-members mailing list > raleigh-rb-members at rubyforge.org > http://rubyforge.org/mailman/listinfo/raleigh-rb-members From steve at iannopollo.com Sat Jul 30 10:50:00 2011 From: steve at iannopollo.com (Steve Iannopollo) Date: Sat, 30 Jul 2011 10:50:00 -0400 Subject: [raleigh.rb] Preventing duplicate records In-Reply-To: References: <2ECEAFEC-C415-4F55-9CD3-CEAAC15F1858@iannopollo.com> Message-ID: <07D3C003-7166-463B-88D6-40C1503E1B0B@iannopollo.com> This problem doesn't really seem like a model level concern. Yes, the end goal is to eliminate the creation of duplicate records, but the problem stems from the UI. So, if the problem involves both the UI and model, then it follows that the controller level should be used to glue the solution together. My 2?. -Steve On Jul 30, 2011, at 9:50 AM, TJ Stankus wrote: > I have to respectfully disagree with the form-based approach. Two reasons: > > 1) It's a lot more code. > 2) It takes a model-level concern and spreads it across all three layers of MVC. > > Usual disclaimers apply: > > - There is more than one way to skin the cat. > - To each his own. > - There may be other business rules in your app that affect your decisions. > > -TJ > > On Fri, Jul 29, 2011 at 11:44 PM, Steve Iannopollo wrote: >> You could also put an extra hidden field in the form. So when you see the >> hidden field's value a second time, you'll know it was a double submit of >> the form. >> >> I would second that approach. Also no code from me, but I would imagine >> something like the following would work: >> * Hook into form_for (or whatever other way you generate forms) to include a >> hidden field with a uuid. Something similar to the way form_for adds the >> authenticity_token field. >> * Have a table where you store the uuids, indexing the value since you'll be >> searching on it >> * Have a before filter that takes that uuid from form submissions and checks >> to see if they are in the db. If so, the submission is a duplicate and stops >> the request. If not, the submission is the first one and should be allowed >> to proceed as normal >> That's how I'd do it anyway. Hope this helps. >> -Steve >> On Jul 29, 2011, at 10:33 PM, Harry Park wrote: >> >> Sorry, no sample ruby code included. >> >> On Fri, Jul 29, 2011 at 9:51 PM, TJ Stankus wrote: >>> >>> Chris, >>> >>> I've heard this referred to as the uniqueness caveat. Unfortunately, >>> using validates :uniqueness does not guarantee uniqueness. >>> >>> As you're finding, a double submit may create two objects in memory, >>> each of which passes validation, ensuring both get saved. I think >>> you're onto the solution though, which is to enforce uniqueness at the >>> database level as well, via a unique index. >>> >>> For example if you require a unique email attribute, in addition to >>> the model uniqueness validation, you'd want something like this: >>> >>> class AddEmailUniquenessIndex < ActiveRecord::Migration >>> def up >>> add_index :users, :email, :unique => true >>> end >>> >>> def down >>> remove_index :users, :email >>> end >>> end >>> >>> Now, ActiveRecord::StatementInvalid will be thrown for duplicate emails. >>> >>> -TJ >>> >>> On Fri, Jul 29, 2011 at 6:06 PM, Chris Barnes >>> wrote: >>>> I'm trying to come up with a solution to a problem in one of my apps >>>> where users are "accidentally" submitting a form twice and causing >>>> duplicate records. I disabled the UI with javascript on form >>>> submission and that fixed the problem for the most part but users who >>>> hit enter several times quickly can get the form to submit twice >>>> before the javascript executes. >>>> >>>> I've tried scoped unique validations in the model but record 1 doesn't >>>> yet exist when record 2 validates and so they both save. >>>> >>>> The only other way I've come up with is adding a multi field unique >>>> index to the table. The problem is, a record with all identical >>>> fields in the table (except for the id of course) should be valid. >>>> What I'm saying is, if they try to key in a record with all the same >>>> info as an existing record it should be valid. I just don't want it >>>> to happen due to a form being submitted twice. >>>> >>>> As far as I can tell, the only way to prevent it is to disable the >>>> enter key. The problem is, some views have inline editing and use the >>>> enter key for submission. So I can either disable the enter key and >>>> add submit buttons to my inline edit forms (yuck) or I can disable the >>>> enter key only on forms that are not the inline editing type >>>> (inconsistant). >>>> >>>> Edit: >>>> >>>> While typing this email, I may have figured out a way to accomplish >>>> this. If I create a unique index on the table and include the >>>> created_at timestamp, it should work. Then users can create records >>>> that perfectly match existing ones (except for the timestamp) but if a >>>> form gets submitted twice it won't save the second record. >>>> >>>> Anyone see any problems with this solution or perhaps know a better one? >>>> _______________________________________________ >>>> raleigh-rb-members mailing list >>>> raleigh-rb-members at rubyforge.org >>>> http://rubyforge.org/mailman/listinfo/raleigh-rb-members >>>> >>> _______________________________________________ >>> raleigh-rb-members mailing list >>> raleigh-rb-members at rubyforge.org >>> http://rubyforge.org/mailman/listinfo/raleigh-rb-members >> >> _______________________________________________ >> raleigh-rb-members mailing list >> raleigh-rb-members at rubyforge.org >> http://rubyforge.org/mailman/listinfo/raleigh-rb-members >> >> _______________________________________________ >> raleigh-rb-members mailing list >> raleigh-rb-members at rubyforge.org >> http://rubyforge.org/mailman/listinfo/raleigh-rb-members >> > _______________________________________________ > raleigh-rb-members mailing list > raleigh-rb-members at rubyforge.org > http://rubyforge.org/mailman/listinfo/raleigh-rb-members From mriffe at gmail.com Sat Jul 30 11:33:47 2011 From: mriffe at gmail.com (Mel Riffe) Date: Sat, 30 Jul 2011 11:33:47 -0400 Subject: [raleigh.rb] Preventing duplicate records In-Reply-To: References: <2ECEAFEC-C415-4F55-9CD3-CEAAC15F1858@iannopollo.com> Message-ID: I 2d TJ's concerns. Forget the form-based approach. Catch ActiveRecord::StatementInvalid, log it (because you want to be able to go back and research how many duplicate submissions your getting), and ignore it. Be sure you have a test case for double submissions too! If you add the form-based solution, that's another area where bugs can get introduced, forcing you to spend time debugging crazy UUID solutions when you should be focusing on solving your client's solutions. My $0.02! Mel Riffe On Sat, Jul 30, 2011 at 9:50 AM, TJ Stankus wrote: > I have to respectfully disagree with the form-based approach. Two reasons: > > 1) It's a lot more code. > 2) It takes a model-level concern and spreads it across all three layers of MVC. > > Usual disclaimers apply: > > - There is more than one way to skin the cat. > - To each his own. > - There may be other business rules in your app that affect your decisions. > > -TJ > > On Fri, Jul 29, 2011 at 11:44 PM, Steve Iannopollo wrote: >> You could also put an extra hidden field in the form. So when you see the >> hidden field's value a second time, you'll know it was a double submit of >> the form. >> >> I would second that approach. Also no code from me, but I would imagine >> something like the following would work: >> * Hook into form_for (or whatever other way you generate forms) to include a >> hidden field with a uuid. Something similar to the way form_for adds the >> authenticity_token field. >> * Have a table where you store the uuids, indexing the value since you'll be >> searching on it >> * Have a before filter that takes that uuid from form submissions and checks >> to see if they are in the db. If so, the submission is a duplicate and stops >> the request. If not, the submission is the first one and should be allowed >> to proceed as normal >> That's how I'd do it anyway. Hope this helps. >> -Steve >> On Jul 29, 2011, at 10:33 PM, Harry Park wrote: >> >> Sorry, no sample ruby code included. >> >> On Fri, Jul 29, 2011 at 9:51 PM, TJ Stankus wrote: >>> >>> Chris, >>> >>> I've heard this referred to as the uniqueness caveat. Unfortunately, >>> using validates :uniqueness does not guarantee uniqueness. >>> >>> As you're finding, a double submit may create two objects in memory, >>> each of which passes validation, ensuring both get saved. I think >>> you're onto the solution though, which is to enforce uniqueness at the >>> database level as well, via a unique index. >>> >>> For example if you require a unique email attribute, in addition to >>> the model uniqueness validation, you'd want something like this: >>> >>> ? ?class AddEmailUniquenessIndex < ActiveRecord::Migration >>> ? ? ?def up >>> ? ? ? ?add_index :users, :email, :unique => true >>> ? ? ?end >>> >>> ? ? ?def down >>> ? ? ? ?remove_index :users, :email >>> ? ? ?end >>> ? ?end >>> >>> Now, ActiveRecord::StatementInvalid will be thrown for duplicate emails. >>> >>> -TJ >>> >>> On Fri, Jul 29, 2011 at 6:06 PM, Chris Barnes >>> wrote: >>> > I'm trying to come up with a solution to a problem in one of my apps >>> > where users are "accidentally" submitting a form twice and causing >>> > duplicate records. ?I disabled the UI with javascript on form >>> > submission and that fixed the problem for the most part but users who >>> > hit enter several times quickly can get the form to submit twice >>> > before the javascript executes. >>> > >>> > I've tried scoped unique validations in the model but record 1 doesn't >>> > yet exist when record 2 validates and so they both save. >>> > >>> > The only other way I've come up with is adding a multi field unique >>> > index to the table. ?The problem is, a record with all identical >>> > fields in the table (except for the id of course) should be valid. >>> > What I'm saying is, if they try to key in a record with all the same >>> > info as an existing record it should be valid. ?I just don't want it >>> > to happen due to a form being submitted twice. >>> > >>> > As far as I can tell, the only way to prevent it is to disable the >>> > enter key. ?The problem is, some views have inline editing and use the >>> > enter key for submission. ?So I can either disable the enter key and >>> > add submit buttons to my inline edit forms (yuck) or I can disable the >>> > enter key only on forms that are not the inline editing type >>> > (inconsistant). >>> > >>> > Edit: >>> > >>> > While typing this email, I may have figured out a way to accomplish >>> > this. ?If I create a unique index on the table and include the >>> > created_at timestamp, it should work. ?Then users can create records >>> > that perfectly match existing ones (except for the timestamp) but if a >>> > form gets submitted twice it won't save the second record. >>> > >>> > Anyone see any problems with this solution or perhaps know a better one? >>> > _______________________________________________ >>> > raleigh-rb-members mailing list >>> > raleigh-rb-members at rubyforge.org >>> > http://rubyforge.org/mailman/listinfo/raleigh-rb-members >>> > >>> _______________________________________________ >>> raleigh-rb-members mailing list >>> raleigh-rb-members at rubyforge.org >>> http://rubyforge.org/mailman/listinfo/raleigh-rb-members >> >> _______________________________________________ >> raleigh-rb-members mailing list >> raleigh-rb-members at rubyforge.org >> http://rubyforge.org/mailman/listinfo/raleigh-rb-members >> >> _______________________________________________ >> raleigh-rb-members mailing list >> raleigh-rb-members at rubyforge.org >> http://rubyforge.org/mailman/listinfo/raleigh-rb-members >> > _______________________________________________ > raleigh-rb-members mailing list > raleigh-rb-members at rubyforge.org > http://rubyforge.org/mailman/listinfo/raleigh-rb-members > From chris at randomutterings.com Sat Jul 30 18:03:40 2011 From: chris at randomutterings.com (Chris Barnes) Date: Sat, 30 Jul 2011 18:03:40 -0400 Subject: [raleigh.rb] Preventing duplicate records In-Reply-To: References: <2ECEAFEC-C415-4F55-9CD3-CEAAC15F1858@iannopollo.com> Message-ID: Thanks for all the suggestions. I'm trying the uniqueness index solution. It seems to be working in my dev environment but I had to temporarily disable UI blocking to successfully double post and I ended up with 1 successfully prevented duplicate and one duplicate with a timestamp 1 second off. I believe the combination of UI blocking and a uniqueness index will solve the problem with the least overhead so I'm pushing that out to production with a custom logger to track prevented duplicates. I'll keep an eye on the log for a few days and also check manually for duplicate records. Does anyone know how to simulate a double post in a test? A quick google search returned nothing useful. Also, would you do this in a controller spec? Thats the only place with code related to the RecordNotUnique exception but if I stub the model and mock the exception I'm only testing that the controller code works properly. While that may be a beneficial test to have, what I'm looking for is more of an integration test. A cucumber feature seems like a good place to test this but I don't know how to simulate a double post there. On Sat, Jul 30, 2011 at 11:33 AM, Mel Riffe wrote: > I 2d TJ's concerns. Forget the form-based approach. Catch > ActiveRecord::StatementInvalid, log it (because you want to be able to > go back and research how many duplicate submissions your getting), and > ignore it. Be sure you have a test case for double submissions too! > > If you add the form-based solution, that's another area where bugs can > get introduced, forcing you to spend time debugging crazy UUID > solutions when you should be focusing on solving your client's > solutions. > > My $0.02! > > Mel Riffe > > > On Sat, Jul 30, 2011 at 9:50 AM, TJ Stankus wrote: >> I have to respectfully disagree with the form-based approach. Two reasons: >> >> 1) It's a lot more code. >> 2) It takes a model-level concern and spreads it across all three layers of MVC. >> >> Usual disclaimers apply: >> >> - There is more than one way to skin the cat. >> - To each his own. >> - There may be other business rules in your app that affect your decisions. >> >> -TJ >> >> On Fri, Jul 29, 2011 at 11:44 PM, Steve Iannopollo wrote: >>> You could also put an extra hidden field in the form. So when you see the >>> hidden field's value a second time, you'll know it was a double submit of >>> the form. >>> >>> I would second that approach. Also no code from me, but I would imagine >>> something like the following would work: >>> * Hook into form_for (or whatever other way you generate forms) to include a >>> hidden field with a uuid. Something similar to the way form_for adds the >>> authenticity_token field. >>> * Have a table where you store the uuids, indexing the value since you'll be >>> searching on it >>> * Have a before filter that takes that uuid from form submissions and checks >>> to see if they are in the db. If so, the submission is a duplicate and stops >>> the request. If not, the submission is the first one and should be allowed >>> to proceed as normal >>> That's how I'd do it anyway. Hope this helps. >>> -Steve >>> On Jul 29, 2011, at 10:33 PM, Harry Park wrote: >>> >>> Sorry, no sample ruby code included. >>> >>> On Fri, Jul 29, 2011 at 9:51 PM, TJ Stankus wrote: >>>> >>>> Chris, >>>> >>>> I've heard this referred to as the uniqueness caveat. Unfortunately, >>>> using validates :uniqueness does not guarantee uniqueness. >>>> >>>> As you're finding, a double submit may create two objects in memory, >>>> each of which passes validation, ensuring both get saved. I think >>>> you're onto the solution though, which is to enforce uniqueness at the >>>> database level as well, via a unique index. >>>> >>>> For example if you require a unique email attribute, in addition to >>>> the model uniqueness validation, you'd want something like this: >>>> >>>> ? ?class AddEmailUniquenessIndex < ActiveRecord::Migration >>>> ? ? ?def up >>>> ? ? ? ?add_index :users, :email, :unique => true >>>> ? ? ?end >>>> >>>> ? ? ?def down >>>> ? ? ? ?remove_index :users, :email >>>> ? ? ?end >>>> ? ?end >>>> >>>> Now, ActiveRecord::StatementInvalid will be thrown for duplicate emails. >>>> >>>> -TJ >>>> >>>> On Fri, Jul 29, 2011 at 6:06 PM, Chris Barnes >>>> wrote: >>>> > I'm trying to come up with a solution to a problem in one of my apps >>>> > where users are "accidentally" submitting a form twice and causing >>>> > duplicate records. ?I disabled the UI with javascript on form >>>> > submission and that fixed the problem for the most part but users who >>>> > hit enter several times quickly can get the form to submit twice >>>> > before the javascript executes. >>>> > >>>> > I've tried scoped unique validations in the model but record 1 doesn't >>>> > yet exist when record 2 validates and so they both save. >>>> > >>>> > The only other way I've come up with is adding a multi field unique >>>> > index to the table. ?The problem is, a record with all identical >>>> > fields in the table (except for the id of course) should be valid. >>>> > What I'm saying is, if they try to key in a record with all the same >>>> > info as an existing record it should be valid. ?I just don't want it >>>> > to happen due to a form being submitted twice. >>>> > >>>> > As far as I can tell, the only way to prevent it is to disable the >>>> > enter key. ?The problem is, some views have inline editing and use the >>>> > enter key for submission. ?So I can either disable the enter key and >>>> > add submit buttons to my inline edit forms (yuck) or I can disable the >>>> > enter key only on forms that are not the inline editing type >>>> > (inconsistant). >>>> > >>>> > Edit: >>>> > >>>> > While typing this email, I may have figured out a way to accomplish >>>> > this. ?If I create a unique index on the table and include the >>>> > created_at timestamp, it should work. ?Then users can create records >>>> > that perfectly match existing ones (except for the timestamp) but if a >>>> > form gets submitted twice it won't save the second record. >>>> > >>>> > Anyone see any problems with this solution or perhaps know a better one? >>>> > _______________________________________________ >>>> > raleigh-rb-members mailing list >>>> > raleigh-rb-members at rubyforge.org >>>> > http://rubyforge.org/mailman/listinfo/raleigh-rb-members >>>> > >>>> _______________________________________________ >>>> raleigh-rb-members mailing list >>>> raleigh-rb-members at rubyforge.org >>>> http://rubyforge.org/mailman/listinfo/raleigh-rb-members >>> >>> _______________________________________________ >>> raleigh-rb-members mailing list >>> raleigh-rb-members at rubyforge.org >>> http://rubyforge.org/mailman/listinfo/raleigh-rb-members >>> >>> _______________________________________________ >>> raleigh-rb-members mailing list >>> raleigh-rb-members at rubyforge.org >>> http://rubyforge.org/mailman/listinfo/raleigh-rb-members >>> >> _______________________________________________ >> raleigh-rb-members mailing list >> raleigh-rb-members at rubyforge.org >> http://rubyforge.org/mailman/listinfo/raleigh-rb-members >> > _______________________________________________ > raleigh-rb-members mailing list > raleigh-rb-members at rubyforge.org > http://rubyforge.org/mailman/listinfo/raleigh-rb-members > From adam at thewilliams.ws Sun Jul 31 07:04:00 2011 From: adam at thewilliams.ws (Adam Williams) Date: Sun, 31 Jul 2011 07:04:00 -0400 Subject: [raleigh.rb] Preventing duplicate records In-Reply-To: References: <2ECEAFEC-C415-4F55-9CD3-CEAAC15F1858@iannopollo.com> Message-ID: <6042710265606445198@unknownmsgid> I'd 3rd it. This is in fact a model/data concern. No matter the code which inserts, you do not want duplicates? Database constraints are made for this purpose. Sent from my iPhone On Jul 30, 2011, at 12:51 PM, Mel Riffe wrote: > I 2d TJ's concerns. Forget the form-based approach. Catch > ActiveRecord::StatementInvalid, log it (because you want to be able to > go back and research how many duplicate submissions your getting), and > ignore it. Be sure you have a test case for double submissions too! > > If you add the form-based solution, that's another area where bugs can > get introduced, forcing you to spend time debugging crazy UUID > solutions when you should be focusing on solving your client's > solutions. > > My $0.02! > > Mel Riffe > > > On Sat, Jul 30, 2011 at 9:50 AM, TJ Stankus wrote: >> I have to respectfully disagree with the form-based approach. Two reasons: >> >> 1) It's a lot more code. >> 2) It takes a model-level concern and spreads it across all three layers of MVC. >> >> Usual disclaimers apply: >> >> - There is more than one way to skin the cat. >> - To each his own. >> - There may be other business rules in your app that affect your decisions. >> >> -TJ >> >> On Fri, Jul 29, 2011 at 11:44 PM, Steve Iannopollo wrote: >>> You could also put an extra hidden field in the form. So when you see the >>> hidden field's value a second time, you'll know it was a double submit of >>> the form. >>> >>> I would second that approach. Also no code from me, but I would imagine >>> something like the following would work: >>> * Hook into form_for (or whatever other way you generate forms) to include a >>> hidden field with a uuid. Something similar to the way form_for adds the >>> authenticity_token field. >>> * Have a table where you store the uuids, indexing the value since you'll be >>> searching on it >>> * Have a before filter that takes that uuid from form submissions and checks >>> to see if they are in the db. If so, the submission is a duplicate and stops >>> the request. If not, the submission is the first one and should be allowed >>> to proceed as normal >>> That's how I'd do it anyway. Hope this helps. >>> -Steve >>> On Jul 29, 2011, at 10:33 PM, Harry Park wrote: >>> >>> Sorry, no sample ruby code included. >>> >>> On Fri, Jul 29, 2011 at 9:51 PM, TJ Stankus wrote: >>>> >>>> Chris, >>>> >>>> I've heard this referred to as the uniqueness caveat. Unfortunately, >>>> using validates :uniqueness does not guarantee uniqueness. >>>> >>>> As you're finding, a double submit may create two objects in memory, >>>> each of which passes validation, ensuring both get saved. I think >>>> you're onto the solution though, which is to enforce uniqueness at the >>>> database level as well, via a unique index. >>>> >>>> For example if you require a unique email attribute, in addition to >>>> the model uniqueness validation, you'd want something like this: >>>> >>>> class AddEmailUniquenessIndex < ActiveRecord::Migration >>>> def up >>>> add_index :users, :email, :unique => true >>>> end >>>> >>>> def down >>>> remove_index :users, :email >>>> end >>>> end >>>> >>>> Now, ActiveRecord::StatementInvalid will be thrown for duplicate emails. >>>> >>>> -TJ >>>> >>>> On Fri, Jul 29, 2011 at 6:06 PM, Chris Barnes >>>> wrote: >>>>> I'm trying to come up with a solution to a problem in one of my apps >>>>> where users are "accidentally" submitting a form twice and causing >>>>> duplicate records. I disabled the UI with javascript on form >>>>> submission and that fixed the problem for the most part but users who >>>>> hit enter several times quickly can get the form to submit twice >>>>> before the javascript executes. >>>>> >>>>> I've tried scoped unique validations in the model but record 1 doesn't >>>>> yet exist when record 2 validates and so they both save. >>>>> >>>>> The only other way I've come up with is adding a multi field unique >>>>> index to the table. The problem is, a record with all identical >>>>> fields in the table (except for the id of course) should be valid. >>>>> What I'm saying is, if they try to key in a record with all the same >>>>> info as an existing record it should be valid. I just don't want it >>>>> to happen due to a form being submitted twice. >>>>> >>>>> As far as I can tell, the only way to prevent it is to disable the >>>>> enter key. The problem is, some views have inline editing and use the >>>>> enter key for submission. So I can either disable the enter key and >>>>> add submit buttons to my inline edit forms (yuck) or I can disable the >>>>> enter key only on forms that are not the inline editing type >>>>> (inconsistant). >>>>> >>>>> Edit: >>>>> >>>>> While typing this email, I may have figured out a way to accomplish >>>>> this. If I create a unique index on the table and include the >>>>> created_at timestamp, it should work. Then users can create records >>>>> that perfectly match existing ones (except for the timestamp) but if a >>>>> form gets submitted twice it won't save the second record. >>>>> >>>>> Anyone see any problems with this solution or perhaps know a better one? >>>>> _______________________________________________ >>>>> raleigh-rb-members mailing list >>>>> raleigh-rb-members at rubyforge.org >>>>> http://rubyforge.org/mailman/listinfo/raleigh-rb-members >>>>> >>>> _______________________________________________ >>>> raleigh-rb-members mailing list >>>> raleigh-rb-members at rubyforge.org >>>> http://rubyforge.org/mailman/listinfo/raleigh-rb-members >>> >>> _______________________________________________ >>> raleigh-rb-members mailing list >>> raleigh-rb-members at rubyforge.org >>> http://rubyforge.org/mailman/listinfo/raleigh-rb-members >>> >>> _______________________________________________ >>> raleigh-rb-members mailing list >>> raleigh-rb-members at rubyforge.org >>> http://rubyforge.org/mailman/listinfo/raleigh-rb-members >>> >> _______________________________________________ >> raleigh-rb-members mailing list >> raleigh-rb-members at rubyforge.org >> http://rubyforge.org/mailman/listinfo/raleigh-rb-members >> > _______________________________________________ > raleigh-rb-members mailing list > raleigh-rb-members at rubyforge.org > http://rubyforge.org/mailman/listinfo/raleigh-rb-members From heedspin at gmail.com Sat Jul 30 11:23:02 2011 From: heedspin at gmail.com (Tim Harrison) Date: Sat, 30 Jul 2011 11:23:02 -0400 Subject: [raleigh.rb] Preventing duplicate records In-Reply-To: References: Message-ID: I'm not a javascript guy, but it seems like this can be solved in the browser without any change to backend. For the love of sanity, don't change the backend!! :-) Javascript waving of hands begins now: If you disable default behavior of submit button, then can't you store some state (beenSubmitted boolean) in the page to enforce the submit only happens once? It sounds like you already tried this... But it doesn't seem possible that the browser would bypass callbacks just by triggering UI events quickly. Here's some javascript we have in one of our projects. (I didn't write it...) jQuery.fn.preventDoubleSubmit = function() { jQuery(this).submit(function() { if (this.beenSubmitted){ return false; } else { this.beenSubmitted = true; $(this).find(":submit").addClass("inprogress"); } }); }; $(document).ready(function() { $("form").preventDoubleSubmit(); } Is Javascript in browsers single threaded? If so, this simple synchronization technique should work, right? On Sat, Jul 30, 2011 at 10:11 AM, Martin Streicher < martin.streicher at gmail.com> wrote: > Can you include a form serial number, a key of some sort that you expect to > see in the response, and that's unique per rendered form? I suppose the > session needs to track the last serial number issued and ignore any > duplicate uses. Each new or edit action would reset the serial number. > > On Jul 29, 2011, at 6:06 PM, Chris Barnes wrote: > > > I'm trying to come up with a solution to a problem in one of my apps > > where users are "accidentally" submitting a form twice and causing > > duplicate records. I disabled the UI with javascript on form > > submission and that fixed the problem for the most part but users who > > hit enter several times quickly can get the form to submit twice > > before the javascript executes. > > > > I've tried scoped unique validations in the model but record 1 doesn't > > yet exist when record 2 validates and so they both save. > > > > The only other way I've come up with is adding a multi field unique > > index to the table. The problem is, a record with all identical > > fields in the table (except for the id of course) should be valid. > > What I'm saying is, if they try to key in a record with all the same > > info as an existing record it should be valid. I just don't want it > > to happen due to a form being submitted twice. > > > > As far as I can tell, the only way to prevent it is to disable the > > enter key. The problem is, some views have inline editing and use the > > enter key for submission. So I can either disable the enter key and > > add submit buttons to my inline edit forms (yuck) or I can disable the > > enter key only on forms that are not the inline editing type > > (inconsistant). > > > > Edit: > > > > While typing this email, I may have figured out a way to accomplish > > this. If I create a unique index on the table and include the > > created_at timestamp, it should work. Then users can create records > > that perfectly match existing ones (except for the timestamp) but if a > > form gets submitted twice it won't save the second record. > > > > Anyone see any problems with this solution or perhaps know a better one? > > _______________________________________________ > > raleigh-rb-members mailing list > > raleigh-rb-members at rubyforge.org > > http://rubyforge.org/mailman/listinfo/raleigh-rb-members > > _______________________________________________ > raleigh-rb-members mailing list > raleigh-rb-members at rubyforge.org > http://rubyforge.org/mailman/listinfo/raleigh-rb-members > -------------- next part -------------- An HTML attachment was scrubbed... URL: