Again, I find that I''m stumped trying to concisely attach a subject to my query... Sorry about that :-S Also, I apologize if the query is a bit off-topic, but I hope that it is relevant! Anyway, the recent thread about the "Ruby CronJob" got me thinking. We have an application that requires to read data from a device connected to the serial port of a Windows machine. The data collected from the device needs to be validated and dumped into a database with most of the remaining visualization being done over the web for which I plan to use RoR. The program that reads from the serial port also needs to access the database to find information from other tables to build the relationships between the data it captures and the "owner" of the data. Other than connecting to the serial port of the Windows machine, the whole project seems like a good idea for Rails. The best way that I can summarise this in 2 questions is as follows: 1. Any suggestions on what may be a good way to do the local Windows program using Ruby/ Rails so that I can benefit from the Rails framework for accessing and managing the database? 2. On the Windows application side, is it easy (I know it''s possible) to use Ruby with C/C++ programs that can access and fetch the data from the serial port? Has anyone done something like this and would care to share some of the experience/ thought process? Thanks! Cheers Mohit.
On 6/27/06, Mohit Sindhwani <mo_mail@onghu.com> wrote:> Again, I find that I''m stumped trying to concisely attach a subject to > my query... Sorry about that :-S > Also, I apologize if the query is a bit off-topic, but I hope that it is > relevant! > > Anyway, the recent thread about the "Ruby CronJob" got me thinking. We > have an application that requires to read data from a device connected > to the serial port of a Windows machine. The data collected from the > device needs to be validated and dumped into a database with most of the > remaining visualization being done over the web for which I plan to use RoR. > > The program that reads from the serial port also needs to access the > database to find information from other tables to build the > relationships between the data it captures and the "owner" of the data. > Other than connecting to the serial port of the Windows machine, the > whole project seems like a good idea for Rails. > > The best way that I can summarise this in 2 questions is as follows: > 1. Any suggestions on what may be a good way to do the local Windows > program using Ruby/ Rails so that I can benefit from the Rails framework > for accessing and managing the database? > 2. On the Windows application side, is it easy (I know it''s possible) to > use Ruby with C/C++ programs that can access and fetch the data from the > serial port? > > Has anyone done something like this and would care to share some of the > experience/ thought process? Thanks! > Cheers > Mohit. >You can search the ruby-talk mailing list for some examples of talking to serial ports directly from Ruby. You really don''t want your HTTP requests waiting for some serial request to finish. You''ll quickly bring your server to an unhappy place. I would write a standalone process that used the ActiveRecord gem to talk to the db. That way you preserve the performance of your Rails server, and have more flexible deployment options. You could run the Rails app itself on a Linux server, and do the serial work wherever you need to, etc. If there is more logic involved than you''re comfortable putting in a standalone app, you could also skip ActiveRecord entirely, and just have the script POST the data to your Rails app. Just some ideas. Should be fairly straightforward.
Wilson Bilkovich wrote:> On 6/27/06, Mohit Sindhwani <mo_mail@onghu.com> wrote: >> *snip* > > You can search the ruby-talk mailing list for some examples of talking > to serial ports directly from Ruby. > You really don''t want your HTTP requests waiting for some serial > request to finish. You''ll quickly bring your server to an unhappy > place. > > I would write a standalone process that used the ActiveRecord gem to > talk to the db. That way you preserve the performance of your Rails > server, and have more flexible deployment options. You could run the > Rails app itself on a Linux server, and do the serial work wherever > you need to, etc. > > If there is more logic involved than you''re comfortable putting in a > standalone app, you could also skip ActiveRecord entirely, and just > have the script POST the data to your Rails app. > > Just some ideas. Should be fairly straightforward.Hi Wilson, Thanks for the heads up! I now have the confidence to start looking around at things like accessing the serial from Ruby. I think it does give me a starting point.. Cheers Mohit.