I’m using an old Mac Mini running regular OS X 10.4 “Tiger” to share an attached laser printer with the local network. For some reason, the two Windows laptops here (Windows Vista & Windows 7) can’t print PDFs with Adobe Reader. Printing from any other application works however.
I’m sick of debugging problems like this and instead shared a folder on the Mac Mini that is “watched” by a shell script that immediately prints every PDF that gets thrown in there, and deletes it afterwards.
We share this folder with Dropbox, so this could also be used to print from about anywhere to your home printer.
The actual printing is done with an AppleScript that uses GUI scripting to send the keystrokes ⌘P, ↵, and ⌘W to Preview.app after the PDF has been opened. While this isn’t very flexible (it always uses the default print options), it’s simple and probably covers 95% of the printing needs here.
Note that this doesn’t work well if someone is actually using the Mac where this is running on. You also need to “Enable access for assistive devices” in the Universal Access System Preference pane for the AppleScript to work (more details here).
Bash script watch_and_print.command
I used the extension .command for the shell script to allow it to be opened directly with the Finder, then dragged it to the Dock and enabled “Open at Login” from the contextual menu. Okay, cron would probably work too.
while [ 1 ]
find . -type f|grep -i .pdf$ |while read file; do
echo Printing "$file"
/usr/bin/open -a Preview.app "$file"
Put it in the same folder as watch_and_print.command.
The delays in the script are pretty arbitrary, your milage may vary.
tell application "Preview"
tell application "System Events"
tell process "Preview"
keystroke "p" using command down
keystroke "w" using command down
The primary purpose of this post is to document the changes I made to core WordPress code in order to get comments working they way I want. Since all of this is a hack, I have to re-do those changes when I upgrade WordPress to a newer version. It would probably be best to write a plugin instead, so I wouldn’t have to change the code each time I upgrade.
Maybe someone is reading this and knows a better way to do all of this. I’m a WordPress novice and just figured those things out by browsing the code, I never read the documentation.
Btw, all of the following applies to WordPress 2.9.1, so things might be different in other versions…
Read the full article »
I decided to switch from my aged Drupal CMS to WordPress because my website doesn’t really need all the flexiblity that Drupal offers. I also hope to make maintenance a bit easier — time will tell how that works out. Anyway, this wasn’t a very rational decision that I researched a lot. Maybe I just wanted to try WordPress and see how it works.
This post mainly is a reference for me to help me remember what I did, but it may be useful for others too…
Read the full article »
While a visiting student in Canada, I blogged occasionally (in German) to let my family and friends know what I was doing abroad. I used Wordpress for that purpose, which was set up as a farewell gift by a friend (who also happens to be my webhost).
When I launched my personal website, I decided to use Drupal but still have the old blog up in a “read-only” state.
As time went by, the Wordpress installation aged and security concerns arose due to the inevitable discovery of bugs in popular software. Spammers also occasionally suceeded in bypassing the blog’s Akismet spam protection. Turning comments off was easy, but I didn’t want to go through the pain of upgrading WordPress, especially because I wasn’t even using it anymore. So I decided to “freeze” the WordPress blog, turning it into a static collection of HTML pages.
Read the full article »
On January 27, my friend Lucas sent me a link to Johnny Lee’s head-tracking video on YouTube. I thought it was really cool what could be done with the Wiimote. I had no idea that it contains such a powerful camera and even does image processing. I checked out Johnny’s other projects and found the Whiteboard to be the most immediately useful. While the head-tracking is probably more impressive (I actually haven’t seen it in person), it wasn’t really that “accessible” to me. I could’ve ported the head-tracking demo to the Mac and had fun with it for a while. But eventually it would have become boring and making an actual game that uses head-tracking isn’t possible for me. Some game companies luckily picked up head-tracking very fast (EA’s Boom Blox to include Wiimote Headtracking).
I tried running Johnny’s demos on my parents’ Windows machines, since I’m running OS X on my MacBook, but couldn’t get them to work. So I decided to give it a shot on my Mac. I found WiiRemoteJ, which made it very easy for me to get started as a Java programmer. Soon, I had a “clone” of Johnny’s Wiimote Whiteboard software in about 400 lines of code. I decided to release it so that other Mac users could play with it as well. I actually have no real use for the application. I’m neither a teacher nor an artist, I just like to play with technology. And it makes me happy when my software is used by others, especially for purposes like the education of children.
Since the first release, I’ve been blown away by the reactions to my software. I never expected that much feedback and usage. It kept me motivated to successively enhance the software by adding features while trying to keep it easy to use.
I finally took the time to compile a list of posts and videos that reference my software: check it out.
Statistics for the last three months
|Pageviews (of Wiimote Whiteboard)
|Application starts #
|Download: Cross-platform version
|Download: Mac version
# The application accesses a tiny file on this webserver to check for updates at startup. This only happens if update-notification is enabled and a connection to the Internet exists. The number of applications starts in the table is hence a lower bound on the number of actual starts.
At times like this, I’m happy that I keep all sorts of electronics even if I don’t know whether I’ll ever use them again. My brother brought his PlayStation 2 (1) with him and wanted to connect it to a TV in order to play Pro Evolution Soccer. Unfortunately, there is no ordinary TV left in his old room because he took it with him when he moved out a while ago. So we assembled some spare electronics to get it to work…
For TV replacement, we used a TV box (3), that can output to an older CRT computer display (4). We were surprised that the Amplifier (below the display) was broken although it hadn’t been used at all and was working fine previously. So we took some mobile speakers from Logitech (5) and connected them directly to the TV box (whose built-in speakers are pretty bad).
The TV box has a component video input at the front but the PS2 has a yellow composite video RCA jack so we only got a grayscale image when we connected it to the Y component (luma) plug.
I remembered that we have an unused semi-broken VCR (2) without remote control (the cassette is ejected when trying to fast forward and other weird stuff is happening too). But it serves the purpose to be the mediator between the PS2 and the TV box. We plugged the PS2 composite video and audio jacks into a SCART adapter and connected it to the VCR input. The VCR can be connected to a TV either by using its SCART output or by tuning the TV to a “special channel” that the VCR inserts into the TV signal. Since the TV box has no SCART input, we did the latter. We did a re-scan on the TV box to find the new “special channel”.
After all this needs to be done in order to play:
- Turn on the CRT display, speaker, TV box, PS2 and VCR.
- Set the VCR’s input to Au2 to get the PS2’s video and audio which then is inserted into the TV signal as a new channel.
- Tune the TV box to channel 44 (that’s where the VCR channel has been found).
Is there a better solution (without buying new stuff)?