We are fortunate to live in a world with a surplus of Android smartphones. These devices generally have Wifi and Bluetooth radios and work quite nicely even without a service contract with a telephone provider.
Has somebody written an app that lets me use my extra smartphone as a baby monitor (preferably audio and video)? The monitoring phone can sit there in speaker-phone mode with its volume all the way down, and then I can use my phone to listen in. Ideally this would all be encrypted, travel over local Wifi or a peer-to-peer Bluetooth connection inside my house, and be just fine running for 12 straight hours. In this use case it’s totally fine for both devices to be plugged into wall power the whole time.
A second idea is to use an extra phone as a dog presence / bark sensor. When the dog jumps up on the gate and barks at somebody, turn the hose on for about a second. Have the hose hooked to a typical lawn sprinkler. A little localized, on-demand rain should be enough to encourage the dog to stop that. Maybe this is too cruel? Maybe it’s brilliant?
Obviously all of these things can be readily built, but right now I don’t have the time.
Here’s the (less-common-but-still-all-too-common) scenario: I’m filling out a big web form with a lot of paragraph-sized fields. However, unlike (e.g., the editor for WordPress) modern websites, it’s just a plain HTML multi-line input field. This means there is no spell check, no ability to do any formatting, possibly horrible line wrap issues, no caching of partially complete work, and the much-greater-than-zero probability that a back button mistake will lose all of your work in progress.
Just edit in another program and paste your results, you might say? Ha! The web forms I’m talking about have many, if not tens of such fields, possibly split across multiple pages, and some of their own little length restrictions. The amount of clickery and potential for copy-paste mistakes is much too high. This solution is not satisfactory.
It does seem like this is solvable, though. A browser plug-in could, for each multi-line “paragraph” input field, pop open a smarter editing environment, e.g., in another tab. This plug-in would run everything client-side so as not to put, e.g., sensitive student data on a third party’s servers in violation of laws in many cases (e.g., editing confidential student records). Obviously this plug-in would have rich undo and local caching facilities, so that data loss is almost impossible.
Does this exist?
It’s easy to redirect stdin and stdout between programs in a single direction, but full-duplex or bi-directional communication is more challenging. Rather than deal with named pipes or fancy versions of fork, we can let socat do the hard work for us.
This program first prints something to stdout and then reads a response on stdin. One might think of it as the client. The final output to STDERR is not manipulated, and serves to inform the user of what actually happened. Note that buffering can really ruin our day, so this code disables buffering of stdout and stderr.
$ cat print_then_read.pl
$| = 1; # disable buffering
$| = 1;
$line = <STDIN> ;
print STDERR "print_then_read got ($line)\n";
This little program first reads something and then prints it back. Its behavior is like that of a single-threaded, one-shot server.
$ cat read_then_print.pl
$| = 1;
$| = 1;
$line = <STDIN> ;
print "read_then_print read ($line) and has printed it!\n";
And here is the output when properly wired together using socat:
$ socat exec:./print_then_read.pl exec:./read_then_print.pl
print_then_read got (read_then_print read (print_then_read) and has printed it!)
Nifty! I’m using this trick to enable writing a simplistic pair of client/server scripts that implement a challenge-response protocol. socat can later enable tunneling over SSL, SSH, gzip/unzip, or anything else one can imagine, it seems.