Beutelevision

by Thomas Beutel

Category: Programming

Making Aquamacs kill and yank work with the clipboard

My favorite editor on the Mac is Aquamacs (me and Emacs go waaay back) and something that has long been a productivity killer for me was the different actions of C-y and CMD-V.
This is due to there being two clipboards, the one belonging to the Mac and the one in Emacs (the kill ring).
Often I [...]

Find a Javascript parent node that matches a certain string

Here’s a small bit of javascript that I use in my Sencha Touch projects to find a parent with an id that matches a string.

function findParentNodeRegex(regex, childObj) {
var testObj = childObj;
var count = 1;
while(!testObj.id.match(regex)) {
//console.log(’My name is ‘ + testObj.id + ‘. Let\’s try moving [...]

Detecting a click in a checkbox with jQuery

A simple script to detect when a checkbox is clicked. What you do with once you’ve detected the click is up to you.
<html>
<head>
<script src=”http://www.google.com/jsapi”></script>
<script>
google.load(”jquery”, “1.3.2″);
google.setOnLoadCallback(function() {
$(’#agree’).click( function() {
if($(this).attr(’checked’)){
alert(’checked’);
}
else{
[...]

Redirect from within a Wordpress admin page

I was trying to perform a redirect to generate a CSV file from within a Wordpress admin page using the wp_redirect( ) function, but the problem was that I would always get the dreaded “Cannot modify header information – headers already sent” message. This is because admin plugins are simply hooks that are performed within [...]

Result of expression ‘document.forms[0].submit’ [[object HTMLInputElement]] is not a function.

I was trying to add a small delay into my form submission like so:
<form … onsubmit=”setTimeout(’document.forms[0].submit()’,2000);return false;”>
but everytime I tried it, I got the following error:
Result of expression ‘document.forms[0].submit’ [[object HTMLInputElement]] is not a function.
This one had me stumped, until I realized what it was telling me… that my submit button was named “submit”.
<input type=”submit” [...]

RSSCloud: No need to adjust your firewall

I’ve been following the recent development of RSSCloud with interest… I think it has the potential to replace Twitter in the long term, although I suspect that Twitter might also evolve in the direction of RSSCloud.
One misconception about RSSCloud is the supposed need for the cloud to notify the desktop or mobile reader of an [...]

Using jQuery and Prototype together while avoiding the dreaded element.dispatchEvent error

Here is what I do to avoid the dreaded “element.dispatchEvent is not a function” error. I load jQuery first, Prototype second, and then I use jQuery( ) instead of $( ) for all my jQuery calls.
<!– Set up jQuery and prototype together –>
<script src=”http://www.google.com/jsapi”></script>
<script>
google.load(”jquery”, “1.3.2″);
google.load(”prototype”, “1.6.0.3″);
google.setOnLoadCallback(function() {
[...]

Using Skype to control a model train

Small wireless spy cameras are widely available, and there are even a few available specifically for HO-scale trains.
This got me to thinking about letting my cousin in Germany run a train on my train layout, using Skype. Why not? Connecting the camera receiver to my laptop is easy and Skype allows you to select [...]

Useless use of private variable in void context (Perl)

Can you see what is wrong with this Perl code snippet?
foreach my $cat (@$categories) {
if ($cat->{col} == $column and $cat=>{pos} == $position) {
return $cat;
[...]

Lava lamps for programming

I just love this idea: integrating lava lamps to Cruise Control so that you can see when a software build has gone bad. The idea is to turn on a red lava lamp when the build failed, otherwise turn on a green one. Cool!