From rick.denatale at gmail.com Mon Apr 2 12:14:44 2007 From: rick.denatale at gmail.com (Rick DeNatale) Date: Mon, 2 Apr 2007 12:14:44 -0400 Subject: [raleigh.rb] Intermittent 502 errors and Rails/Typo load balancing. In-Reply-To: <0DDDB3C0-C721-45EF-AD8B-6B099574B6A8@nc.rr.com> References: <0DDDB3C0-C721-45EF-AD8B-6B099574B6A8@nc.rr.com> Message-ID: Thanks Jared, It's most likely the latter, I just checked both the mongrel_cluster.yml and /etc/pen/pen.conf and they match up. Now to prove that and if it's true figure out why. I checked my Apache logs and didn't see anything untoward around the time in question. Nothing in the rails log either. I can't figure out how to use the info in the mongrel log since it doesn't seem to be timestamped. I couldn't find any obvious way to turn on timestamping in the mongrel log via google or the usual sources. On 3/31/07, Jared Richardson wrote: > I think it's because Pen is trying to talk to a port that doesn't > have a Mongrel on it. I'd suspect that your configuration between Pen > and Mongrel Cluster are off by one or one of your Mongrels has crashed. > > Jared > http://JaredRichardson.net > > > On Mar 31, 2007, at 10:19 AM |Mar/31, Rick DeNatale wrote: > > > I recently added a small ruby script to my cron jobs which acts as a > > watchdog on my blog. Every so often I try to get the main page and if > > I get a response other than a 200 I email myself with the result. > > > > About twice a week or so I'm seeing something like the forwarded > > message below. It' seems to be intermittent. > > > > My setup is Apache 2.1 proxying to pen which load balances to a > > mongrel cluster of processes running typo. These are all running on > > the same machine. > > > > Is this just evidence that I should be running more mongrels because > > my blog is more popular that I expected, or should I be looking for > > something more serious. > > > > ---------- Forwarded message ---------- > > From: talklikeaduck at denhaven2.com > > Date: Mar 31, 2007 1:01 AM > > Subject: 502 Response from talklikeaduck.denhaven2.com/ > > To: undisclosed-recipients > > > > > > Response message = Proxy Error > > > > > > > > 502 Proxy Error > > > >

Proxy Error

> >

The proxy server received an invalid > > response from an upstream server.
> > The proxy server could not handle the request > href="/">GET /.

> > Reason: Error reading from remote server

> >
> >
Apache Server at talklikeaduck.denhaven2.com Port 80 > address> > > > > > > > > -- > > Rick DeNatale > > > > My blog on Ruby > > http://talklikeaduck.denhaven2.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 > -- Rick DeNatale My blog on Ruby http://talklikeaduck.denhaven2.com/ IPMS/USA Region 12 Coordinator http://ipmsr12.denhaven2.com/ Visit the Project Mercury Wiki Site http://www.mercuryspacecraft.com/ From lists-jared at nc.rr.com Mon Apr 2 13:17:29 2007 From: lists-jared at nc.rr.com (Jared Richardson) Date: Mon, 2 Apr 2007 13:17:29 -0400 Subject: [raleigh.rb] Intermittent 502 errors and Rails/Typo load balancing. In-Reply-To: References: <0DDDB3C0-C721-45EF-AD8B-6B099574B6A8@nc.rr.com> Message-ID: To see which instance isn't running, just hit each one of your Mongrels ports, one at a time. Go direct instead of hitting the Apache front end. I hope you don't have 1,000 instances to check! ;) You can use wget if the Mongrels are behind a firewall. It seems that this would be trivial for a Rails app to do... set up a basic controller that hits N Mongrels and verifies that they're running. You can hit that page if you're wondering if the main app is running properly. Of course, there are other services that already do this. Jared http://JaredRichardson.net On Apr 2, 2007, at 12:14 PM |Apr/2, Rick DeNatale wrote: > Thanks Jared, > > It's most likely the latter, I just checked both the > mongrel_cluster.yml and /etc/pen/pen.conf and they match up. > > Now to prove that and if it's true figure out why. > > I checked my Apache logs and didn't see anything untoward around the > time in question. Nothing in the rails log either. > > I can't figure out how to use the info in the mongrel log since it > doesn't seem to be timestamped. I couldn't find any obvious way to > turn on timestamping in the mongrel log via google or the usual > sources. > -------------- next part -------------- An HTML attachment was scrubbed... URL: http://rubyforge.org/pipermail/raleigh-rb-members/attachments/20070402/ada69fe6/attachment.html From rick.denatale at gmail.com Mon Apr 2 17:01:11 2007 From: rick.denatale at gmail.com (Rick DeNatale) Date: Mon, 2 Apr 2007 17:01:11 -0400 Subject: [raleigh.rb] Intermittent 502 errors and Rails/Typo load balancing. In-Reply-To: References: <0DDDB3C0-C721-45EF-AD8B-6B099574B6A8@nc.rr.com> Message-ID: Good idea, but the problem seems to be intermittent. For example the last time this happened was around 1:00 am and everything was fine the next morning. I guess that mongrel_cluster restarts failed processes. I'd really love to be able to figure out how to get mongrel to timestamp it's log entries (well, I guess it is open source...). On 4/2/07, Jared Richardson wrote: > To see which instance isn't running, just hit each one of your Mongrels > ports, one at a time. Go direct instead of hitting the Apache front end. I > hope you don't have 1,000 instances to check! ;) > > You can use wget if the Mongrels are behind a firewall. > > It seems that this would be trivial for a Rails app to do... set up a basic > controller that hits N Mongrels and verifies that they're running. You can > hit that page if you're wondering if the main app is running properly. Of > course, there are other services that already do this. > > Jared > http://JaredRichardson.net > > > > On Apr 2, 2007, at 12:14 PM |Apr/2, Rick DeNatale wrote: > > > Thanks Jared, > > > > > It's most likely the latter, I just checked both the > > mongrel_cluster.yml and /etc/pen/pen.conf and they match up. > > > > > Now to prove that and if it's true figure out why. > > > > > I checked my Apache logs and didn't see anything untoward around the > > time in question. Nothing in the rails log either. > > > > > I can't figure out how to use the info in the mongrel log since it > > doesn't seem to be timestamped. I couldn't find any obvious way to > > turn on timestamping in the mongrel log via google or the usual > > sources. > > > > > _______________________________________________ > raleigh-rb-members mailing list > raleigh-rb-members at rubyforge.org > http://rubyforge.org/mailman/listinfo/raleigh-rb-members > -- Rick DeNatale My blog on Ruby http://talklikeaduck.denhaven2.com/ IPMS/USA Region 12 Coordinator http://ipmsr12.denhaven2.com/ Visit the Project Mercury Wiki Site http://www.mercuryspacecraft.com/ From lists-jared at nc.rr.com Mon Apr 2 17:19:35 2007 From: lists-jared at nc.rr.com (Jared Richardson) Date: Mon, 2 Apr 2007 17:19:35 -0400 Subject: [raleigh.rb] Intermittent 502 errors and Rails/Typo load balancing. In-Reply-To: References: <0DDDB3C0-C721-45EF-AD8B-6B099574B6A8@nc.rr.com> Message-ID: On Apr 2, 2007, at 5:01 PM |Apr/2, Rick DeNatale wrote: > Good idea, > > but the problem seems to be intermittent. For example the last time > this happened was around 1:00 am and everything was fine the next > morning. I guess that mongrel_cluster restarts failed processes. > I'm not positive, but I'm fairly certain that it doesn't do a restart. Is it possible that your Rails app is taking too long to respond and the web hit is just timing out? > I'd really love to be able to figure out how to get mongrel to > timestamp it's log entries (well, I guess it is open source...). > > On 4/2/07, Jared Richardson wrote: >> To see which instance isn't running, just hit each one of your >> Mongrels >> ports, one at a time. Go direct instead of hitting the Apache >> front end. I >> hope you don't have 1,000 instances to check! ;) >> >> You can use wget if the Mongrels are behind a firewall. >> >> It seems that this would be trivial for a Rails app to do... set >> up a basic >> controller that hits N Mongrels and verifies that they're running. >> You can >> hit that page if you're wondering if the main app is running >> properly. Of >> course, there are other services that already do this. >> >> Jared >> http://JaredRichardson.net -------------- next part -------------- An HTML attachment was scrubbed... URL: http://rubyforge.org/pipermail/raleigh-rb-members/attachments/20070402/f05949d8/attachment.html From rick.denatale at gmail.com Mon Apr 2 18:03:43 2007 From: rick.denatale at gmail.com (Rick DeNatale) Date: Mon, 2 Apr 2007 18:03:43 -0400 Subject: [raleigh.rb] Intermittent 502 errors and Rails/Typo load balancing. In-Reply-To: References: <0DDDB3C0-C721-45EF-AD8B-6B099574B6A8@nc.rr.com> Message-ID: On 4/2/07, Jared Richardson wrote: > > > On Apr 2, 2007, at 5:01 PM |Apr/2, Rick DeNatale wrote: > > > Good idea, > > > > > but the problem seems to be intermittent. For example the last time > > this happened was around 1:00 am and everything was fine the next > > morning. I guess that mongrel_cluster restarts failed processes. > > > > I'm not positive, but I'm fairly certain that it doesn't do a restart. > > Is it possible that your Rails app is taking too long to respond and the web > hit is just timing out? Possible. It's not MY rails app, actually it's typo. I'm running out of ideas for how to find out if this is what's happening though. Is this the timeout in pen that you're suggesting? -- Rick From lists-jared at nc.rr.com Mon Apr 2 20:19:42 2007 From: lists-jared at nc.rr.com (Jared Richardson) Date: Mon, 2 Apr 2007 20:19:42 -0400 Subject: [raleigh.rb] Intermittent 502 errors and Rails/Typo load balancing. In-Reply-To: References: <0DDDB3C0-C721-45EF-AD8B-6B099574B6A8@nc.rr.com> Message-ID: On Apr 2, 2007, at 6:03 PM |Apr/2, Rick DeNatale wrote: > On 4/2/07, Jared Richardson wrote: >> >> >> On Apr 2, 2007, at 5:01 PM |Apr/2, Rick DeNatale wrote: >> >> >> Good idea, >> >> >> >> >> but the problem seems to be intermittent. For example the last time >> >> this happened was around 1:00 am and everything was fine the next >> >> morning. I guess that mongrel_cluster restarts failed processes. >> >> >> >> I'm not positive, but I'm fairly certain that it doesn't do a >> restart. >> >> Is it possible that your Rails app is taking too long to respond >> and the web >> hit is just timing out? > > Possible. It's not MY rails app, actually it's typo. > > I'm running out of ideas for how to find out if this is what's > happening though. > > Is this the timeout in pen that you're suggesting? Either in Apache or Pen, yes. If the machine is overloaded (making Mongrel too slow) or the Mongrels are busy (one request per instance), the I think you could see this. Just out of curiosity, how many Mongrels are you running? Do you know how many people are using that box? I'm wondering if someone else is swamping it. Jared http://JaredRichardson.net -------------- next part -------------- An HTML attachment was scrubbed... URL: http://rubyforge.org/pipermail/raleigh-rb-members/attachments/20070402/1eb4a61c/attachment-0001.html From hascott at email.unc.edu Wed Apr 11 15:54:09 2007 From: hascott at email.unc.edu (Hunter Scott) Date: Wed, 11 Apr 2007 15:54:09 -0400 Subject: [raleigh.rb] Ruby programmer Message-ID: <461D3CE1.1070105@email.unc.edu> Hi RB's! I am a senior at UNC and have developed a software program that we (my business partner and I -- APPSURFER LLC) are licensing with the University and others across the country. We are also looking for a RUBY programmer to help us out on the project and have plenty of capital to pay an experienced programmer. If any of you are interested in this free-lance programming opportunity, please contact us at Hunter S. & Brendan K. hascott at email.unc.edu Thanks for your help! Hunter From z at zworkbench.com Thu Apr 12 04:52:13 2007 From: z at zworkbench.com (Chris Garrett) Date: Thu, 12 Apr 2007 09:52:13 +0100 Subject: [raleigh.rb] Ruby programmer In-Reply-To: <461D3CE1.1070105@email.unc.edu> References: <461D3CE1.1070105@email.unc.edu> Message-ID: <82883b650704120152g4e21ee8em4c082ca9986d5e5e@mail.gmail.com> Hello, I am an experienced software engineer with about ten years of development in Smalltalk, Java, and most recently Ruby. I am currently doing a Rails project for the Duke University Department of Biochemistry, which will be finishing in a few weeks. In addition, I have developed two Rails sites for a software business that I am starting up. I am interested in discussing your project in more detail. My resume is attached. Regards, Chris Garrett ========== President ZWorkbench 919-599-0473 On 4/11/07, Hunter Scott < hascott at email.unc.edu> wrote: > > > Hi RB's! > > I am a senior at UNC and have developed a software program that we (my > business partner and I -- APPSURFER LLC) are licensing with the > University and others across the country. We are also looking for a > RUBY programmer to help us out on the project and have plenty of capital > to pay an experienced programmer. If any of you are interested in this > free-lance programming opportunity, please contact us at > > Hunter S. & Brendan K. > hascott at email.unc.edu > > Thanks for your help! > > Hunter > > _______________________________________________ > 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: http://rubyforge.org/pipermail/raleigh-rb-members/attachments/20070412/e596ab43/attachment-0001.html -------------- next part -------------- A non-text attachment was scrubbed... Name: Resume - technical.doc Type: application/msword Size: 62464 bytes Desc: not available Url : http://rubyforge.org/pipermail/raleigh-rb-members/attachments/20070412/e596ab43/attachment-0001.doc From tj at stank.us Thu Apr 12 18:29:45 2007 From: tj at stank.us (TJ Stankus) Date: Thu, 12 Apr 2007 18:29:45 -0400 Subject: [raleigh.rb] RailsConf expanded, space open Message-ID: For those who didnt' get in on the first go-round, but still wan to go to RailsConf. I just got this notice from O'Reilly... RailsConf 2007 May 17-20, 2007 Oregon Convention Center Portland, Oregon http://conferences.oreilly.com/rails A fourth technical track has just been added to the RailsConf schedule. That means a limited amount of space has opened up for those folks who didn't get a chance to register before RailsConf first sold out in February. If you haven't yet registered and would like to attend RailsConf 2007, please register now at: http://conferences.oreillynet.com/cs/railswaitlist/create/reg/ (If you do not already have an O'Reilly user account you will be required to create on in order to register for RailsConf. When prompted for your password, click on "No, I am new to O'Reilly." When you have finished creating an account for yourself you will be taken back to the RailsConf registration page.) Note: We are no longer accepting checks for this event. All registration fees will need to be paid in full by credit card at the time the registration form is completed. RailsConf Keynotes Just Announced Chad Fowler and Ruby Central have put together a stellar program, which now includes four simultaneous tracks. They've also just announced some of the keynote speakers presenting on the main stage this year: Ze Frank, Comedic Digital Savant David Heinemeier Hansson, Creator of Ruby on Rails Dave Thomas, The Pragmatic Programmers Avi Bryant, Creator of Seaside Tim Bray, Co-creator of XML and Atom More speakers are being confirmed every day. Check out the entire list of speakers and sessions on the RailsConf web site: http://conferences.oreillynet.com/pub/w/51/speakers.html Remember, seating is limited and likely to sell out very quickly. If you haven't already done so, register right away as this email does not guarantee your seat. We look forward to seeing you in May! The RailsConf 2007 Team From wesleyzhang2005 at gmail.com Tue Apr 17 10:50:10 2007 From: wesleyzhang2005 at gmail.com (Wesley Zhang) Date: Tue, 17 Apr 2007 10:50:10 -0400 Subject: [raleigh.rb] extract data from html source file Message-ID: Hi all, I used http module download a html page and wanted to extract some interested section out. After I successfully downloaded html source content stored as string, the string.scan(/
(.*)<\/div>/) doesn't return anything even though there are multiple div sections in the html file. What went wrong? Thanks! Wesley -------------- next part -------------- An HTML attachment was scrubbed... URL: http://rubyforge.org/pipermail/raleigh-rb-members/attachments/20070417/1d38ce47/attachment.html From kevin.olbrich at gmail.com Tue Apr 17 11:02:37 2007 From: kevin.olbrich at gmail.com (Kevin Olbrich) Date: Tue, 17 Apr 2007 11:02:37 -0400 Subject: [raleigh.rb] extract data from html source file In-Reply-To: References: Message-ID: I'd suggest using Hpricot to parse the file. _Kevin On 4/17/07, Wesley Zhang wrote: > > Hi all, > > I used http module download a html page and wanted to extract some > interested section out. After I successfully downloaded html source content > stored as string, the string.scan(/
(.*)<\/div>/) doesn't return > anything even though there are multiple div sections in the html file. > > What went wrong? > > Thanks! > > Wesley > > > > > > _______________________________________________ > 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: http://rubyforge.org/pipermail/raleigh-rb-members/attachments/20070417/4fd7c0f7/attachment.html From tj at stank.us Tue Apr 17 11:18:38 2007 From: tj at stank.us (TJ Stankus) Date: Tue, 17 Apr 2007 11:18:38 -0400 Subject: [raleigh.rb] extract data from html source file In-Reply-To: References: Message-ID: Scrubyt is another ruby html parsing tool. This post may help you explore your options: http://scrubyt.org/ruby-web-scraping-tool-guide/ -TJ On 4/17/07, Kevin Olbrich wrote: > I'd suggest using Hpricot to parse the file. > > _Kevin > > > On 4/17/07, Wesley Zhang wrote: > > > > Hi all, > > > > I used http module download a html page and wanted to extract some > interested section out. After I successfully downloaded html source content > stored as string, the string.scan(/
(.*)<\/div>/) doesn't return > anything even though there are multiple div sections in the html file. > > > > What went wrong? > > > > Thanks! > > > > Wesley > > > > > > > > > > > > _______________________________________________ > > 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 wesleyzhang2005 at gmail.com Tue Apr 17 11:44:06 2007 From: wesleyzhang2005 at gmail.com (Wesley Zhang) Date: Tue, 17 Apr 2007 11:44:06 -0400 Subject: [raleigh.rb] extract data from html source file In-Reply-To: References: Message-ID: Thanks, TJ and Kevin. Just wonder why scan method doesn't work, is it due to the way Ruby treat string object (wide guess)? On 4/17/07, TJ Stankus wrote: > > Scrubyt is another ruby html parsing tool. This post may help you > explore your options: > > http://scrubyt.org/ruby-web-scraping-tool-guide/ > > -TJ > > On 4/17/07, Kevin Olbrich wrote: > > I'd suggest using Hpricot to parse the file. > > > > _Kevin > > > > > > On 4/17/07, Wesley Zhang wrote: > > > > > > Hi all, > > > > > > I used http module download a html page and wanted to extract some > > interested section out. After I successfully downloaded html source > content > > stored as string, the string.scan(/
(.*)<\/div>/) doesn't return > > anything even though there are multiple div sections in the html file. > > > > > > What went wrong? > > > > > > Thanks! > > > > > > Wesley > > > > > > > > > > > > > > > > > > _______________________________________________ > > > 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 > -- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ~~~~ Wesley Zhang, CISSP PMP ~~~~~~ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -------------- next part -------------- An HTML attachment was scrubbed... URL: http://rubyforge.org/pipermail/raleigh-rb-members/attachments/20070417/33e629d6/attachment.html From ben at near-time.com Tue Apr 17 11:29:19 2007 From: ben at near-time.com (Ben Burdick) Date: Tue, 17 Apr 2007 11:29:19 -0400 Subject: [raleigh.rb] extract data from html source file In-Reply-To: References: Message-ID: <11FC4944-CCC6-4806-A4E4-37C5A121D5C4@near-time.com> There is a great tutorial on using Hpricot to scrape using IMDB as an example here: http://www.weheartcode.com/2007/04/03/scraping-imdb- with-ruby-and-hpricot/ On Apr 17, 2007, at 11:02 AM, Kevin Olbrich wrote: > I'd suggest using Hpricot to parse the file. > > _Kevin > > On 4/17/07, Wesley Zhang wrote: > Hi all, > > I used http module download a html page and wanted to extract some > interested section out. After I successfully downloaded html source > content stored as string, the string.scan(/
(.*)<\/div>/) > doesn't return anything even though there are multiple div sections > in the html file. > > What went wrong? > > Thanks! > > Wesley > > > > > > _______________________________________________ > 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 > > !DSPAM:9,4624e33c246311220514176! !DSPAM:57,4624e6f0249575304220063! -------------- next part -------------- An HTML attachment was scrubbed... URL: http://rubyforge.org/pipermail/raleigh-rb-members/attachments/20070417/60fa6568/attachment.html From kevin.olbrich at gmail.com Tue Apr 17 11:56:16 2007 From: kevin.olbrich at gmail.com (Kevin Olbrich) Date: Tue, 17 Apr 2007 11:56:16 -0400 Subject: [raleigh.rb] extract data from html source file In-Reply-To: References: Message-ID: In theory your regexp should work fine, but it depends on what the source looks like. If you have a lot of foreign character or some weird encoding, it might not behave right. _Kevin On 4/17/07, Wesley Zhang wrote: > > Thanks, TJ and Kevin. Just wonder why scan method doesn't work, is it due > to the way Ruby treat string object (wide guess)? > > > > On 4/17/07, TJ Stankus wrote: > > > > Scrubyt is another ruby html parsing tool. This post may help you > > explore your options: > > > > http://scrubyt.org/ruby-web-scraping-tool-guide/ > > > > -TJ > > > > On 4/17/07, Kevin Olbrich < kevin.olbrich at gmail.com> wrote: > > > I'd suggest using Hpricot to parse the file. > > > > > > _Kevin > > > > > > > > > On 4/17/07, Wesley Zhang wrote: > > > > > > > > Hi all, > > > > > > > > I used http module download a html page and wanted to extract some > > > interested section out. After I successfully downloaded html source > > content > > > stored as string, the string.scan(/
(.*)<\/div>/) doesn't return > > > anything even though there are multiple div sections in the html file. > > > > > > > > What went wrong? > > > > > > > > Thanks! > > > > > > > > Wesley > > > > > > > > > > > > > > > > > > > > > > > > _______________________________________________ > > > > 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 > > > > > > -- > ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ > ~~~~ Wesley Zhang, CISSP PMP ~~~~~~ > ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ > > _______________________________________________ > 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: http://rubyforge.org/pipermail/raleigh-rb-members/attachments/20070417/27e72632/attachment-0001.html From philomousos at gmail.com Tue Apr 17 11:56:45 2007 From: philomousos at gmail.com (Hugh Cayless) Date: Tue, 17 Apr 2007 11:56:45 -0400 Subject: [raleigh.rb] extract data from html source file In-Reply-To: References: Message-ID: <78540B6B-7500-4992-BAAE-21A3F25AE3E9@gmail.com> I'd bet your divs contain newlines. /./ will only match a newline character if you run the regex in multiline mode. Try string.scan(/
(.*)<\/div>/m) and see if it works. That's not to say an HTML parser like hpricot isn't a better solution... H On Apr 17, 2007, at 11:44 AM, Wesley Zhang wrote: > Thanks, TJ and Kevin. Just wonder why scan method doesn't work, is > it due to the way Ruby treat string object (wide guess)? > > > > On 4/17/07, TJ Stankus wrote: > Scrubyt is another ruby html parsing tool. This post may help you > explore your options: > > http://scrubyt.org/ruby-web-scraping-tool-guide/ > > -TJ > > On 4/17/07, Kevin Olbrich < kevin.olbrich at gmail.com> wrote: > > I'd suggest using Hpricot to parse the file. > > > > _Kevin > > > > > > On 4/17/07, Wesley Zhang wrote: > > > > > > Hi all, > > > > > > I used http module download a html page and wanted to extract some > > interested section out. After I successfully downloaded html > source content > > stored as string, the string.scan(/
(.*)<\/div>/) doesn't return > > anything even though there are multiple div sections in the html > file. > > > > > > What went wrong? > > > > > > Thanks! > > > > > > Wesley > > > > > > > > > > > > > > > > > > _______________________________________________ > > > 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 > > > > -- > ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ > ~~~~ Wesley Zhang, CISSP PMP ~~~~~~ > ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ > _______________________________________________ > 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: http://rubyforge.org/pipermail/raleigh-rb-members/attachments/20070417/28039665/attachment.html From lists-jared at nc.rr.com Tue Apr 17 13:59:29 2007 From: lists-jared at nc.rr.com (Jared Richardson) Date: Tue, 17 Apr 2007 13:59:29 -0400 Subject: [raleigh.rb] extract data from html source file In-Reply-To: References: Message-ID: <38342CB1-DD7A-498C-B28F-88F0C03BA393@nc.rr.com> Can you post the HTML snippet or URL you're trying to parse? Jared http://JaredRichardson.net On Apr 17, 2007, at 10:50 AM |Apr/17, Wesley Zhang wrote: > Hi all, > > I used http module download a html page and wanted to extract some > interested section out. After I successfully downloaded html source > content stored as string, the string.scan(/
(.*)<\/div>/) > doesn't return anything even though there are multiple div sections > in the html file. > > What went wrong? > > Thanks! > > Wesley > > > > > _______________________________________________ > 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 Tue Apr 17 15:20:47 2007 From: rick.denatale at gmail.com (Rick DeNatale) Date: Tue, 17 Apr 2007 15:20:47 -0400 Subject: [raleigh.rb] Pre-meeting chow? Message-ID: Are we having the usual Baja Burrito get together before the meeting tonight? Haven't heard anything from Nathaniel. -- Rick DeNatale My blog on Ruby http://talklikeaduck.denhaven2.com/ From ruby at bandkbroom.com Tue Apr 17 15:43:24 2007 From: ruby at bandkbroom.com (Brian Broom) Date: Tue, 17 Apr 2007 15:43:24 -0400 Subject: [raleigh.rb] Pre-meeting chow? In-Reply-To: References: Message-ID: I hope so. I'm planning on eating there. Brian On 4/17/07, Rick DeNatale wrote: > > Are we having the usual Baja Burrito get together before the meeting > tonight? > > Haven't heard anything from Nathaniel. > > -- > Rick DeNatale > > My blog on Ruby > http://talklikeaduck.denhaven2.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: http://rubyforge.org/pipermail/raleigh-rb-members/attachments/20070417/305d6f1b/attachment.html From nathaniel at talbott.ws Tue Apr 17 16:02:23 2007 From: nathaniel at talbott.ws (Nathaniel Talbott) Date: Tue, 17 Apr 2007 16:02:23 -0400 Subject: [raleigh.rb] Pre-meeting chow? In-Reply-To: References: Message-ID: On Apr 17, 2007, at 15:20 , Rick DeNatale wrote: > Are we having the usual Baja Burrito get together before the > meeting tonight? > > Haven't heard anything from Nathaniel. Sorry, been a busy day. Pre-meeting chow is definitely on for 5:30 as usual at Baja Burrito. See you there! -- Nathaniel Talbott <:((>< From wesleyzhang2005 at gmail.com Fri Apr 20 17:21:11 2007 From: wesleyzhang2005 at gmail.com (Wesley Zhang) Date: Fri, 20 Apr 2007 17:21:11 -0400 Subject: [raleigh.rb] anytime in near future for a deep talk in rails application iteself? Message-ID: Hi, I am newbie in Rails and especially interested in a talk to about rails features and why it is designed that way, what's the benefit and what's the caveat etc. Wonder if any such topic is scheduled in the near future. Thanks, Wesley -------------- next part -------------- An HTML attachment was scrubbed... URL: http://rubyforge.org/pipermail/raleigh-rb-members/attachments/20070420/437bc432/attachment.html From tj at stank.us Fri Apr 20 17:30:02 2007 From: tj at stank.us (TJ Stankus) Date: Fri, 20 Apr 2007 17:30:02 -0400 Subject: [raleigh.rb] anytime in near future for a deep talk in rails application iteself? In-Reply-To: References: Message-ID: Wesley, I don't know if there's a talk scheduled on that topic, but I'd suggest reading this at least: http://www.awprofessional.com/bookstore/product.asp?isbn=0321474074&rl=1 It's an excellent document that looks at how Ruby the language drove the design of Rails. Once you've got a grasp on that, if you'd like something a little more in-depth, this is another excellent resource: Ruby for Rails - http://manning.com/black/ HTH, -TJ On 4/20/07, Wesley Zhang wrote: > Hi, > > I am newbie in Rails and especially interested in a talk to about rails > features and why it is designed that way, what's the benefit and what's the > caveat etc. Wonder if any such topic is scheduled in the near future. > > Thanks, > Wesley > > > > _______________________________________________ > raleigh-rb-members mailing list > raleigh-rb-members at rubyforge.org > http://rubyforge.org/mailman/listinfo/raleigh-rb-members > From wesleyzhang2005 at gmail.com Fri Apr 20 23:54:03 2007 From: wesleyzhang2005 at gmail.com (Wesley Zhang) Date: Fri, 20 Apr 2007 23:54:03 -0400 Subject: [raleigh.rb] anytime in near future for a deep talk in rails application iteself? In-Reply-To: References: Message-ID: Am reading rubyism.. Excellent references. Thanks, TJ! On 4/20/07, TJ Stankus wrote: > > Wesley, > > I don't know if there's a talk scheduled on that topic, but I'd > suggest reading this at least: > > http://www.awprofessional.com/bookstore/product.asp?isbn=0321474074&rl=1 > > It's an excellent document that looks at how Ruby the language drove > the design of Rails. > > Once you've got a grasp on that, if you'd like something a little more > in-depth, this is another excellent resource: > > Ruby for Rails - http://manning.com/black/ > > HTH, > > -TJ > > On 4/20/07, Wesley Zhang wrote: > > Hi, > > > > I am newbie in Rails and especially interested in a talk to about rails > > features and why it is designed that way, what's the benefit and what's > the > > caveat etc. Wonder if any such topic is scheduled in the near future. > > > > Thanks, > > Wesley > > > > > > > > _______________________________________________ > > 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 > -- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ~~~~ Wesley Zhang, CISSP PMP ~~~~~~ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -------------- next part -------------- An HTML attachment was scrubbed... URL: http://rubyforge.org/pipermail/raleigh-rb-members/attachments/20070420/2d4eec58/attachment-0001.html From geoff at geoffdavis.net Wed Apr 25 15:57:41 2007 From: geoff at geoffdavis.net (Geoff Davis) Date: Wed, 25 Apr 2007 15:57:41 -0400 Subject: [raleigh.rb] Single table inheritance weirdness Message-ID: <5259C50B-3830-45D5-90A8-23DF11889C03@geoffdavis.net> Hi all-- I have a couple of classes that are derived from a common base using single table inheritance. Is there any sane way to change an object's class? E.g. suppose Boss and Lackey both derive from some common Employee class and share a table. I want to promote a Lackey to a Boss. Employee.update(lackey_id, :type => "Boss") doesn't seem to do anything. I can create a new Boss object and then manually copy the Lackey object's attributes over, but then the object's ID changes, and I have to go in and adjust a bunch of associations. I suppose I could go in and execute an update at the connection level, but that seems evil. Any suggestions? Geoff From adam at thewilliams.ws Wed Apr 25 16:15:30 2007 From: adam at thewilliams.ws (Adam Williams) Date: Wed, 25 Apr 2007 16:15:30 -0400 Subject: [raleigh.rb] Single table inheritance weirdness In-Reply-To: <5259C50B-3830-45D5-90A8-23DF11889C03@geoffdavis.net> References: <5259C50B-3830-45D5-90A8-23DF11889C03@geoffdavis.net> Message-ID: <76A88DE9-688D-4762-84AC-F9F03B0B3878@thewilliams.ws> On Apr 25, 2007, at 3:57 PM, Geoff Davis wrote: > Hi all-- Hey Geoff! > I have a couple of classes that are derived from a common base using > single table inheritance. Is there any sane way to change an > object's class? > > E.g. suppose Boss and Lackey both derive from some common Employee > class and share a table. I want to promote a Lackey to a Boss. > Employee.update(lackey_id, :type => "Boss") doesn't seem to do > anything. I can create a new Boss object and then manually copy the > Lackey object's attributes over, but then the object's ID changes, > and I have to go in and adjust a bunch of associations. I suppose I > could go in and execute an update at the connection level, but that > seems evil. > > Any suggestions? I've had to do something like this before, and I don't see why what you have wouldn't work, though I do wonder, perhaps you would be better off with composition instead of inheritance? An Employee has_one Position kind of thing? Then, you just change their position. adam williams From kevin.olbrich at gmail.com Wed Apr 25 16:30:40 2007 From: kevin.olbrich at gmail.com (Kevin Olbrich) Date: Wed, 25 Apr 2007 16:30:40 -0400 Subject: [raleigh.rb] Single table inheritance weirdness In-Reply-To: <76A88DE9-688D-4762-84AC-F9F03B0B3878@thewilliams.ws> References: <5259C50B-3830-45D5-90A8-23DF11889C03@geoffdavis.net> <76A88DE9-688D-4762-84AC-F9F03B0B3878@thewilliams.ws> Message-ID: It's possible that the update method was tripping up on the validations of the new class and thus failing. _Kevin On 4/25/07, Adam Williams wrote: > > On Apr 25, 2007, at 3:57 PM, Geoff Davis wrote: > > > Hi all-- > > Hey Geoff! > > > I have a couple of classes that are derived from a common base using > > single table inheritance. Is there any sane way to change an > > object's class? > > > > E.g. suppose Boss and Lackey both derive from some common Employee > > class and share a table. I want to promote a Lackey to a Boss. > > Employee.update(lackey_id, :type => "Boss") doesn't seem to do > > anything. I can create a new Boss object and then manually copy the > > Lackey object's attributes over, but then the object's ID changes, > > and I have to go in and adjust a bunch of associations. I suppose I > > could go in and execute an update at the connection level, but that > > seems evil. > > > > Any suggestions? > > I've had to do something like this before, and I don't see why what > you have wouldn't work, though I do wonder, perhaps you would be > better off with composition instead of inheritance? An Employee > has_one Position kind of thing? Then, you just change their position. > > adam williams > > _______________________________________________ > 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: http://rubyforge.org/pipermail/raleigh-rb-members/attachments/20070425/3a005402/attachment.html From blake at near-time.com Wed Apr 25 16:39:33 2007 From: blake at near-time.com (Blake Watters) Date: Wed, 25 Apr 2007 16:39:33 -0400 Subject: [raleigh.rb] Single table inheritance weirdness In-Reply-To: References: <5259C50B-3830-45D5-90A8-23DF11889C03@geoffdavis.net> <76A88DE9-688D-4762-84AC-F9F03B0B3878@thewilliams.ws> Message-ID: <994BAA05-1F1B-440A-B529-DA1D66122BB8@near-time.com> type is a protected attribute. You can update it with update_attribute: foo.class => Foo foo.update_attribute(:type, Bar) foo.reload foo.class => Bar On Apr 25, 2007, at 4:30 PM, Kevin Olbrich wrote: > It's possible that the update method was tripping up on the > validations of the new class and thus failing. > > _Kevin > > On 4/25/07, Adam Williams < adam at thewilliams.ws> wrote: > On Apr 25, 2007, at 3:57 PM, Geoff Davis wrote: > > > Hi all-- > > Hey Geoff! > > > I have a couple of classes that are derived from a common base using > > single table inheritance. Is there any sane way to change an > > object's class? > > > > E.g. suppose Boss and Lackey both derive from some common Employee > > class and share a table. I want to promote a Lackey to a Boss. > > Employee.update(lackey_id, :type => "Boss") doesn't seem to do > > anything. I can create a new Boss object and then manually copy the > > Lackey object's attributes over, but then the object's ID changes, > > and I have to go in and adjust a bunch of associations. I suppose I > > could go in and execute an update at the connection level, but that > > seems evil. > > > > Any suggestions? > > I've had to do something like this before, and I don't see why what > you have wouldn't work, though I do wonder, perhaps you would be > better off with composition instead of inheritance? An Employee > has_one Position kind of thing? Then, you just change their position. > > adam williams > > _______________________________________________ > 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 > > !DSPAM:2,462fb96620301345712632! !DSPAM:57,462fbb7321851533212049! -------------- next part -------------- An HTML attachment was scrubbed... URL: http://rubyforge.org/pipermail/raleigh-rb-members/attachments/20070425/aee671c6/attachment.html From geoff at geoffdavis.net Wed Apr 25 17:12:27 2007 From: geoff at geoffdavis.net (Geoff Davis) Date: Wed, 25 Apr 2007 17:12:27 -0400 Subject: [raleigh.rb] Single table inheritance weirdness In-Reply-To: <994BAA05-1F1B-440A-B529-DA1D66122BB8@near-time.com> References: <5259C50B-3830-45D5-90A8-23DF11889C03@geoffdavis.net> <76A88DE9-688D-4762-84AC-F9F03B0B3878@thewilliams.ws> <994BAA05-1F1B-440A-B529-DA1D66122BB8@near-time.com> Message-ID: <3D55C235-8EC6-4621-950C-6B354194125F@geoffdavis.net> Thanks! Geoff On Apr 25, 2007, at 4:39 PM, Blake Watters wrote: > type is a protected attribute. You can update it with > update_attribute: > foo.class => Foo > foo.update_attribute(:type, Bar) > foo.reload > foo.class => Bar > > On Apr 25, 2007, at 4:30 PM, Kevin Olbrich wrote: > >> It's possible that the update method was tripping up on the >> validations of the new class and thus failing. >> >> _Kevin >> >> On 4/25/07, Adam Williams < adam at thewilliams.ws> wrote: >> On Apr 25, 2007, at 3:57 PM, Geoff Davis wrote: >> >> > Hi all-- >> >> Hey Geoff! >> >> > I have a couple of clas ses that are derived from a common base >> using >> > single table inheritance. Is there any sane way to change an >> > object's class? >> > >> > E.g. suppose Boss and Lackey both derive from some common Employee >> > class and share a table. I want to promote a Lackey to a Boss. >> > Employee.update(lackey_id, :type => "Boss") doesn't seem to do >> > anything. I can create a new Boss object and then manually copy >> the >> > Lackey object's attributes over, but then the object's ID changes, >> > and I have to go in and adjust a bunch of associations. I >> suppose I >> > could go in and execute an update at the connection level, but that >> > seems evil. >> > >> > Any suggestions? >> >> I've had to do something like this before, and I don't see why what >> you have wouldn't work, though I do wonder, perhaps you would be >> better off with composition instead of inheritance? An Employee >> has_one Position kind of thing? Then, you jus t change their >> position. >> >> adam williams >> >> _______________________________________________ >> 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 >> >> !DSPAM:2,462fb96620301345712632! > > !DSPAM:57,462fbb7321851533212049! > _______________________________________________ > 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: http://rubyforge.org/pipermail/raleigh-rb-members/attachments/20070425/808d2146/attachment.html From jjeffers at nc.rr.com Fri Apr 27 07:25:47 2007 From: jjeffers at nc.rr.com (James Jeffers) Date: Fri, 27 Apr 2007 07:25:47 -0400 Subject: [raleigh.rb] Question about has_and_belongs_to_many and delete In-Reply-To: References: Message-ID: <1177673147.5366.6.camel@localhost> I'm not sure I'm using the "delete" method of a join association properly. I'm using Rails 1.1.6, by the way. I have a class (named "ballot") which has this... has_and_belongs_to_many :candidates At some point I want to dissolve the relationship between a particular ballot and a particular candidates. In a method in the ballot class I call candidates.delete(candidate_in_question) In my tests, I specifically ask for the number of unique candidates for a given ballot and then try to remove the association using "delete", but the number of candidates associated with the ballot remains the same. I thought this was supposed to destroy the entry in the join table. Did I misunderstand the method? From ryan.daigle at gmail.com Fri Apr 27 09:01:25 2007 From: ryan.daigle at gmail.com (Ryan Daigle) Date: Fri, 27 Apr 2007 09:01:25 -0400 Subject: [raleigh.rb] Question about has_and_belongs_to_many and delete In-Reply-To: <1177673147.5366.6.camel@localhost> References: <1177673147.5366.6.camel@localhost> Message-ID: <748ff3ff0704270601v18ed20a6r28096a0b524395b9@mail.gmail.com> I believe you want 'destroy', not 'delete'. Delete only executes a SQL call to remove the one row from the candidates table and does not follow any relationships or lifecycle callbacks. Destroy does. -Ryan On 4/27/07, James Jeffers wrote: > > I'm not sure I'm using the "delete" method of a join association > properly. I'm using Rails 1.1.6, by the way. > > I have a class (named "ballot") which has this... > > has_and_belongs_to_many :candidates > > At some point I want to dissolve the relationship between a particular > ballot and a particular candidates. In a method in the ballot class I > call > > candidates.delete(candidate_in_question) > > In my tests, I specifically ask for the number of unique candidates for > a given ballot and then try to remove the association using "delete", > but the number of candidates associated with the ballot remains the > same. > > I thought this was supposed to destroy the entry in the join table. Did > I misunderstand the method? > > _______________________________________________ > 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: http://rubyforge.org/pipermail/raleigh-rb-members/attachments/20070427/089d13bc/attachment.html