Skip to content

Audacity, Jack, and Kubuntu

I spent some time trying to get Audacity to work under Kubuntu — I kept getting a “check audio output device” error during playback. Finally, I stumbled across this in the ubuntu forum and am reposting it here in order to post it in as many places as possible. It works like a charm:

  1. Install JACK Control (might have to use Add/Remove; I did not)
  2. Start Jack Control; click Setup.
  3. On the Misc tab, select Start JACK audio server on application startup, then click OK
  4. Open Audacity
  5. In Audacity, select JACK Audio Connection Kit: system as the output device

Now to see about Rezound, Muse, and Hydrogen.

wscript.sleep in an HTA applet

Microsoft sort of has a built-in GUI for VBScript in the form of HTA “applications.” HTA is, in a nutshell, web pages — HTML and CSS — that don’t launch in Explorer and run VBScripts. The only problem is, for some reason Microsoft decided, in all its wisdom, that HTAs could run all wscript code, except wscript.sleep — perhaps one of the most useful commands, used to slow code down or wait for other processes to finish.

Now, I poked around for a fix to this, figuring someone had come up with a good loophole. To be sure, there are many ways cobbled together to use wscript.sleep in an HTA, but none of them were very tidy. Calls to nonexistant IPs, a web of nested functions, or useless bits of code were hard to implement, and not one of them could be done within a single sub or function. In short, there was no workaround that said, like wscript.sleep, “Hold on for a few seconds… Okay, now you can go.”

Then it hit me: Why not call an external VBScript that does nothing but accept an argument for the number of seconds to wait, then wscript.sleep for that long? This script could then be called from the HTA with a simple shell command, with parameters set to hide the called script and — most important — not continue executing the current script until that shell command has completed.

So here’s my fix. Here’s the easiest way to call wscript.sleep in an HTA without actually using wscript.sleep. Put this in the HTA at the point you need a pause:

objShell.Run(”wscript.exe sleep.vbs 10000″,0,True)

Of course, you have to first create the shell object to run the command, but the parameters of the actual call are thus:

  • wscript.exe — the application to run (in our case, Windows script/VBScript)
  • sleep.vbs — the file to open with the aforementioned application (more on this in a second)
  • 10000 — the amount of time to sleep (in this case, 10 seconds — the time is given in milliseconds)

All of those go in quotes, with the spaces between each element — it’s just like typing the command via the command line.

  • The 0 value says, “Don’t show this application running” — i.e., don’t open a new window.
  • The True value tells the VBScript in the HTA not to continue until the shell command has completed.

That’s it for the code in the HTA. Now for the sleep.vbs file we’re calling. This is the code, in full:

Option explicit
Dim ArgObj, vSeconds
‘create the object to get the seconds variable
Set ArgObj = WScript.Arguments
vSeconds = ArgObj(0)
set ArgObj = Nothing
‘ call wscript.sleep
wscript.sleep(vSeconds) ‘<– wait the length of time input
‘ that’s all folks!

If you copy-n-paste that into a text editor and name the file “sleep.vbs,” then call it as shown above, your HTA will pause for 10 seconds without spawning new windows or twiddling around with fake IPs and complex functions. Yes, it’s a lot of code just to use wscript.sleep, but it beats anything else I’ve found. Your mileage may vary — please let me know.

PCMCIA and USB start up in Linux

So I was specifically trying to get my network connection up under DeLiLinux (my flavor of the month), and stumbled across this on the wiki. I’m reposting it here for two reasons: 1) it worked like a charm; 2) I don’t want to have to hunt for it again in the wiki.

I edited a few files from the command line to get the internet card going:

Added pcmcia in the last line of /etc/rc.conf now it has SERVICES=”pcmcia”

Note: You may also need the net and coldplug services running from boot … My line reads: SERVICES=”coldplug pcmcia net”

Added sleep 10 to the forth line of /etc/rc.d/net

Added i82365 to the PCIC= found on line 38 of /etc/rc.d/pcmcia so now it has PCIC=i82365

Starting it now involves login as root, /etc/rc.d/net start, and logout.

Note: I don’t think you need to do this, if you add net to the services you start at boot.

There was also one spot where I had to change the DHCP from “n” to “y” … If you have a PCMCIA network adapter, edit /etc/pcmcia/network.opts and set dhcp=”y” (it’s “n” by default). If you don’t do this and you start net at boot, you’ll get a net [ERROR] message.

As for USBs, try this:

In the /etc/rc.modules file, I added the following to the end of the file:

/sbin/modprobe usbcore
/sbin/modprobe usb-uhci # this could also be usb-ohci
/sbin/modprobe usb-storage
/sbin/modprobe scsi_mod
/sbin/modprobe sd_mod

With this, during boot USB port recognized and added to /dev file system.

Just make sure to update your /etc/fstab — the mount point for USB can be insanely long (mine is /dev/scsi/host0/bus0/target0/lun0/part1). You might be able to get away with /dev/scsi, too. Also, make sure you define the filesystem — usbfs might not work (I had to change mine to vfat before it would correctly mount).

LILO restore

Did LILO kill your Master Boot Record? Don’t worry, it happens to all of us. So here, in a nutshell, is what you can do. Get yourself a Live CD, such as Puppy Linux or Damn Small Linux, and reboot the computer using the Live CD. Open a shell and do this (sub “/dev/hda2″ for wherever your bootable OS is, such as hda3, hda5, etc.):

$ su -
# fdisk -l
# mount -t ext3 -o rw /dev/hda2 /mnt
# chroot /mnt
# /sbin/lilo

If that doesn’t work, it’ll tell you why. If the partition table is off from what is actually on your HDD, then type this:

# /sbin/lilo -P fix

That will fix the table (in theory). Then you type the

# /sbin/lilo

command again, and you should be golden.

totally XAMPPed

I have long been putting off setting up Apache, mySQL, and PHP (or Perl) on my home computer out of sheer laziness. But seeing as PHP and HTML are such easy ways to create quick-n-dirty apps — and I had a quick-n-dirty need that involved keeping track of how much money I don’t have — I searched again for something quick-n-easy to help me. I figured there had to be a Linux distro out there that came with the what I needed. Instead, I found xampp, for Windoze, Linux, Solaris, and Mac. As they says:

Many people know from their own experience that it’s not easy to install an Apache web server and it gets harder if you want to add MySQL, PHP and Perl.

XAMPP is an easy to install Apache distribution containing MySQL, PHP and Perl. XAMPP is really very easy to install and to use - just download, extract and start.

So I guess my needs aren’t so unique after all, and people more able than I are able to fill them. Thanks, xamppers — my check’s in the mail (as soon as I figure out how much money I don’t have).

WordPress preview script

A friend wanted to show his most recent posts on a different page, outside the Word Press blog directory, so I cobbled together a dirty little script. It shows the whole last post, plus previews of the four posts before that. Thought you might enjoy it, too. Just copy-n-paste it into your html (don’t forget to change the extension of your page from “html” to “php”).

Note: WordPress uses semi randomly generated table names, so you’ll need to go into your SQL tables and find your random value. If there isn’t one, leave the $tblvar variable blank (remove the underbar, too).

/*
you really should hide these SQL variables in a page that’s not accessible by the public,
then call it like this: include(”../variables.php”);
Put it somewhere that’s not in your root domain, but rather at a higher level on your server.
*/
$mysql_username=”YOUR_USERNAME”;
$mysql_password=”YOUR_PASSWORD”;
$localhost=”YOUR_DATABASE_ADDRESS”;
$dbname=”YOUR_DATABASE_NAME”;
$link = mysql_connect($localhost,$mysql_username,$mysql_password) or die (”Unable to connect to SQL server.”);
mysql_select_db($dbname,$link) or die (”Unable to select database.”);
// okay, you can stop hiding stuff now.

// main variables
$tblvar=”abc123_”; // This is the random part of your SQL tables’ names — make sure you leave the final underbar!
$lim = 5; //the number of posts you want to show
$chars = 100; // the number of characters of the post body to show
$show=1; // the number of full posts to show
$path=”http://path/to/your/blog”; // do NOT include the last / !

$wp_posts = “wp_” . $tblvar . “posts”;
$new_news = mysql_query(”SELECT ID, post_author, post_date, post_title, post_content FROM $wp_posts ORDER BY ID DESC LIMIT 0,$lim”);

$i=1;

if ($new_news) {
while ($row = mysql_fetch_row($new_news)) {
$id = $row[0];
$author = $row[1] ;
$date = $row[2] ;
$title = $row[3] ;
$content = $row[4];

if ($i>$show) {
$blurb = $content.” “;
$blurb = substr($blurb,0,$chars);
$blurb = substr($blurb,0,strrpos($blurb,’ ‘));
$blurb = $blurb.”…”;
}
else {$blurb=$content;}

$wp_users = “wp_” . $tblvar . “users”;
$this_author = mysql_query(”SELECT display_name FROM $wp_users WHERE ID=’$author’”);
if ($this_author) {
$authrow = mysql_fetch_row($this_author);
$byline = $authrow[0];
}
else {$byline=”unknown”;}

$display_block .= ‘<a href=”‘.$path.’/?p=’.$id.’”>’.$title.’</a>

<span class=”byline”>posted by <b>’.$byline.’</b> (’.$date.’)</span>’.$blurb.’<p>’;

$i++;
}
echo $display_block;
}
else {
echo “Could not fetch news feed.”;
}
mysql_close;

getting WASTEd

I had been following, on and off (mostly off lately), the permutations of Jonathan Frankel, the mastermind behind WinAMP and Gnutella. I knew he’d sold WinAmp to AOL and, by most accounts, had sorely regretted the decisions (as expected, WinAmp began to, well, suck as soon as AOL acquired Nullsoft). Anyway, it was at AOL that Frankel developed Gnutella, but AOL, in deference to the RIAA, and in an effort to distance itself from filesharing, told Frankel to kill the project, and a related project called WASTE.

So Frankel quit. And the rumor was that he took WASTE with him — a better p2p system that would be totally invisible to anyone but those using it. (WASTE was sort of like a p2p-specific version of the Free Network Project, which was introduced around 2000, but only recently got off the ground.)

Frankel called it WASTE after Thomas Pynchon’s WASTE (from The Crying of Lot 49), which is a renegade underground postal system operating in plain sight of the status quo, but remaining undetected. A version of the full story is here, but suffice to say I lost track of the WASTE project.

Until now. WASTE was registered at sourceforge in 2003 and enjoyed a few years of development, then quietly died before it really got going. However, just over a year ago the WASTE forum at sourceforge received this post: “Is WASTE alive again? I’m not really sure. After 3 years on the internet, it’s actually more relevant than it was way back in version 1.0b. With government wiretapping, ISP logging, and general sneaky spying, it’s a great time to keep your private matters…well…private … With that, I’d say it’s time to kick this dusty old project back into gear.”

Sadly, to be honest, not much appears to have happened since the announcement (it’s still at v1.5-beta 4), but I think he’s right. So let’s help get this dusty old project back into gear. Start by getting WASTE and setting up your own darknet.

Dad, In Order To Save The World, Sometimes You Have To Push An Old Lady Down The Stairs

Just read that Target is refusing to sell the new video game, Manhunt 2, due to its extremely violent nature. I remember there being a broohaha surrounding this game a few months ago when it had the distinction of earning the not so coveted “Adults Only” rating, thus preventing it from being sold in many retail outlets across the nation. The creator, RockStar Games, went back to the drawing board and self-censored many of the more graphic displays of interactive violence, finally earning a “Mature” rating. Unfortunately for RockStar, Target is still refusing to devote any of its valuable shelf space to the game. My initial reaction was, “Come On!! Is it any worse than the movie “Saw”? Target doesn’t seem to have a problem selling that little gem, even offering the unrated version. I mean it’s fully within their rights to not sell things like this but they should at least be consistent. Don’t stop at Manhunt 2, take all of the violent, disturbing material off the shelves. Don’t get me wrong, like Target’s CEO, I find it disturbing to think of kids wildly bludgeoning a character to death with a Wii controller and I’m not one of those guys that thinks kids aren’t influenced by the games they play…..

Flashback…….

When my oldest daughter was 5 years old, I thought it might be fun to introduce her to Day of The Tentacle, a funny, highly rated, kid friendly, graphical adventure game produced by LucasArts back in the day. It seemed perfect to me…a chance to share some real father-daughter time while saving the world from Purple Tentacle’s evil plan of total world domination. PERFECT!! The game is very benign but there is a part where a character, Bernard Bernoulli, needs to gain access to a VCR by pushing Nurse Edna out of her security room and down the stairs (I should mention that her fall was off-camera). After doing this deed, Bernard gravely proclaims, “IN ORDER TO SAVE THE WORLD, SOMETIMES YOU HAVE TO PUSH AN OLD LADY DOWN THE STAIRS”.

LOL!! (I told you it was funny)

Fast forward to the following weekend.

While standing in a long, slow line of blue haired septuagenarians at the Botanical Garden my young daughter turned to me and proclaimed, “DAD, IN ORDER TO SAVE THE WORLD, SOMETIMES YOU HAVE TO PUSH AN OLD LADY DOWN THE STAIRS”.

Unfortunately, no “LOL” from the grandmothers in front of us.
My wife thought it best that we stop playing the game…. so we did.

So I think it’s pretty obvious that my kid is easily influenced by the video games she plays and if I don’t want to wake up with a Wii controller stuck in my chest I’ll have to keep her from playing Manhunt 2….
but, “Target, I don’t need your help doing this. I’ve got my wife”

Harry’s Paper

Remember Harry Potter’s good old Marauder’s Map? Fantastical fantasy, right?

Ha! Any sufficiently advanced technology is indistinguishable from magic, I say.

Enter eInk, that wonderful invention that allows tiny electrical currents to turn embedded “ink” on and off on a piece of paper, effectively creating a dynamic display with all the visual properties of good old paper.

This is what is going to make Harry Potter’s Marauder’s Map a reality, to say nothing of his animated newspapers.

Though right now we’re constrained to rigidity because of the need for millions of transistors behind the paper to turn the ink “on” and “off”, flexible systems are in the works. This is the start of computers you can fold up and put in your pocket. Near as I can tell, aside from Harry Potter and Doctor Who’s Psychic Paper, this is not a future that has been yet imagined. Someone call the SciFi authors and tell them to get on it.

Amazon’s Kindle is the most publicized product to take advantage of this miraculous technology, at least in the U.S. But there are numerous exciting products out there. My current favorite, the iRex iLead, doubles as an eReader and sketch pad. Go ahead! Take notes in the margins of your favorite eBook! If you have the $700 to buy it, I mean.

eInk. I’m dizzy with possibilities.

coupling with a tandy 102

I use a 22-year-old computer to write my fiction. A Tandy 102, to be exact. And why do I use a laptop from 1985 with only 32K of memory? It’s light, has full size keys, big ass letters on a screen that’s easy to read in any light, every letter typed is saved automatically as you type, it runs on 4 AA batteries (which last about 10 hours), and it’s rugged, ugly, and unlikely to be stolen. Well, less likely to be stolen.

But none of that matters if you can’t get what you type into a modern computer, so it can be edited, formatted, and made pretty. Fortunately, transferring text files from the Tandy 102 to your modern dee-lux PC is simple, but the process is difficult to find laid out simply. So here goes:

  • Get a real, honest, full null modem cable (”full” as in, “with full handshake” — this is very important). I got mine at Club 100 because the guy makes the cables by hand specifically for the Tandy 10x computers. You’ll most likely need 25-pin male to 9-pin female. This’ll set you back about $30.
  • Get an ol’ fashioned terminal program for windoze. Hyperterminal is damn good, and free (from hilgraeve.com).
  • Turn on both computers.
  • On your Tandy:
    • enter the TELCOM app
    • hit STAT (F3)
    • type 98N1E (for 19200 bps) and hit enter
    • hit TERM (F4), then…
  • Set up the connection in Hyperterminal:
    • go to File | New Connection, enter a name for it, and hit OK
    • set the connection port (say, COM1), then hit CONFIGURE
    • Bits per second: 19200 (so it matches the Tandy)
    • Data bits: 8
    • Parity: None
    • Stop bits: 1
    • Flow control: Xon/Xoff
    • hit OK
  • Set up the capture file in Hyperterminal:
    • go to File | Properties then the Settings tab
    • hit the ASCII SETUP button at the bottom
    • select “Echo typed characters locally” and “Wrap lines that exceed terminal width”
    • leave everything else as is
    • go to Transfer | Capture Text
    • use the default file, or browse to your own (subsequent uploads are appended to this file instead of overwriting it)
    • hit start, then…
  • Back in the Tandy (you should still be in TERM at this point)
    • hit UP (F3)
    • type the name of the file to upload (with extension) and hit enter
    • at “Width,” just hit enter
    • repeat for all files to upload (or do one, change the capture file in Hyperterminal, do another, etc.)
  • When done, in Hyperterminal go to Transfer | Capture Text | Stop
  • Voila! Your files from the Tandy are now saved as a txt file (or files) on your PC.
  • Hit F8 a couple of times on the Tandy to close the TELCOM connection and return to the main menu

To delete files from the Tandy, go into BASIC, hit enter, then type KILL “file.do” and hit enter. Be sure to wrap the file name, with extension, in quotes.

Is next: Transferring binaries… and doing it all via Linux.