Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 3227194
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 17, 20262026-05-17T16:32:45+00:00 2026-05-17T16:32:45+00:00

My question is pretty simple: how is event-driven programming actually achieved? To elaborate: I

  • 0

My question is pretty simple: how is event-driven programming actually achieved?

To elaborate: I have a Rails application, every time a user makes a change on the website, the model writes that “change” to a text file (as JSON.)

What I’d like to do is hook an IRC bot to that “event.” (the creation/modification of the text file.)

How is this done in general? It seems like it’d basically be an infinite loop. In pseudocode:

while (I'm Listening)
do
  if (output.txt Is changed)
    process("output.txt")

If this is how event-driven programming is achieved – how does it avoid locking up the CPU? As infinite loops have a tendency to do?

Edit-
The IRC server/bot are hosted on a locally maintained box. The Rails application is hosted on a shared server. As of now, the only way I know for my IRC bot to communicate with the Rails app is via an HTTP request to the server (or something similar.) As I stated though, this question is really more general, as I’d like to garner a knowledge of event-driven programming in general.

I apologize if this question is impossibly simple, but my understanding of event driven programming consists of attaching pre-made event handlers to objects with jQuery; which really doesn’t help when attaching an IRC bot [written in Ruby] to file I/O.

Thanks,
Robbie

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-17T16:32:46+00:00Added an answer on May 17, 2026 at 4:32 pm

    Maybe you should create a DRb server or use a solution which uses this, like delayed_job. You can run the workers on different machines. The connection is made by connecting to a special port on your server. All you need to do is open this port on your firewall for the dedicated machine running the IRC bot. You can put ruby objects on the queue, so every change to the file can be mirrored by putting a ruby object on the queue which also contains this change. The worker will grab this a few seconds later, it will not be instant. But it’s still pretty fast, uses low CPU and it is able to handle network outages.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Pretty simple question this time around. I have an application that communicates with another
Pretty simple question: When i have a persistable object, it usually has a property
This seems like a pretty softball question, but I always have a hard time
Pretty simple question, I'm writing an XML document and i'm not sure how to
Question is pretty self explanitory. I want to do a simple find and replace,
I'm pretty sure this is a simple question in regards to formatting but here's
Okay, pretty simple question. I think I need to drop in some escape characters,
I have a pretty simple ASP.NET Web Form that looks a bit like the
My question is pretty straightforward: You are an executable file that outputs Access granted
This question is pretty much the same as this .Net question exept for java.

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.