Command Line Polling
In an ideal world, we wouldn't have to poll for anything; we would always have events to trigger other functions. This isn't an ideal world, however, so it's important to know how to poll in multiple programming languages. I've covered JavaScript polling (with and without Promises), but what about command line polling? For example, ensuring MYSQL is up before attempting to perform more operations.
Here's the basic syntax:
# while ! (command here); do
while ! mysql -uroot; do
sleep 1
done
The example above performs the mysql -uroot
operation (which will fail until mysqld
is up) every second. Keep in mind the poll operation you run should be as simple as possible, just enough to know that what you want to use is available!
![6 Things You Didn’t Know About Firefox OS]()
Firefox OS is all over the tech news and for good reason: Mozilla's finally given web developers the platform that they need to create apps the way they've been creating them for years -- with CSS, HTML, and JavaScript. Firefox OS has been rapidly improving...
![Camera and Video Control with HTML5]()
Client-side APIs on mobile and desktop devices are quickly providing the same APIs. Of course our mobile devices got access to some of these APIs first, but those APIs are slowly making their way to the desktop. One of those APIs is the getUserMedia API...
![MooTools TextOverlap Plugin]()
Developers everywhere seem to be looking for different ways to make use of JavaScript libraries. Some creations are extremely practical, others aren't. This one may be more on the "aren't" side but used correctly, my TextOverlap plugin could add another interesting design element...
![Use Custom Missing Image Graphics Using jQuery]()