Is there a way to ‘listen’ for a database event and update a page in real time?

This isn’t too difficult. The simple way would be to add via .append: $( ‘#table > tbody:last’).append(‘<tr id=”id”><td>stuff</td></tr>’); Adding elements real-time isn’t entirely possible. You’d have to run an Ajax query that updates in a loop to “catch” the change. So, not totally real-time, but very, very close to it. Your user really wouldn’t notice … Read more

How do you write a real-time webbased collaboration tool such as google docs?

Google Docs works via operational transformation. The basic idea of operational transformation is to transform (or adjust) the parameters of an editing operation according to the effects of previously executed concurrent operations so that the transformed operation can achieve the correct effect and maintain document consistency. Google produced a video about operational transformation for Google … Read more

how to shield a cpu from the linux scheduler (prevent it scheduling threads onto that cpu)?

The answer is to use cpusets. The python cpuset utility makes it easy to configure them. Basic concepts 3 cpusets root: present in all configurations and contains all cpus (unshielded) system: contains cpus used for system tasks – the ones which need to run but aren’t “important” (unshielded) user: contains cpus used for “important” tasks … Read more

How do the protocols of real time strategy games such as Starcraft and Age of Empires look? [closed]

I can go into a lot of detail about this but first, go read “1500 archers” http://www.gamasutra.com/view/feature/3094/1500_archers_on_a_288_network_.php and this will answer many of your questions. Here’s a summary: First, most games use UDP due to the real-time nature of the game. THe game loop looks something like this: read network data do client-side predictions and … Read more

Are Exceptions still undesirable in Realtime environment?

Exceptions are now well-handled, and the strategies used to implement them make them in fact faster than testing return code, because their cost (in terms of speed) is virtually null, as long as you do not throw any. However they do cost: in code-size. Exceptions usually work hand in hand with RTTI, and unfortunately RTTI … Read more

How do I plot in real-time in a while loop?

Here’s the working version of the code in question (requires at least version Matplotlib 1.1.0 from 2011-11-14): import numpy as np import matplotlib.pyplot as plt plt.axis([0, 10, 0, 1]) for i in range(10): y = np.random.random() plt.scatter(i, y) plt.pause(0.05) plt.show() Note the call to plt.pause(0.05), which both draws the new data and runs the GUI’s … Read more

What technology does Google Drive use to get real-time updates?

Is there a name for Google’s solution for real-time updates in Drive (such as “long polling” or “sockets”)? It didn’t have a name until now. I’ll call it “no-polling,” to contrast with polling and long-polling. With polling, the client periodically sends queries for new data. With long-polling, the client queries for data, and the server … Read more

Does using heap memory (malloc/new) create a non-deterministic program?

In the context of realtime systems, there is more to determinism than a repeatable “execution path”. Another required property is that timing of key events is bounded. In hard realtime systems, an event that occurs outside its allowed time interval (either before the start of that interval, or after the end) represents a system failure. … Read more