Chuck Caplan http://www.chuckcaplan.com/blog/ Because there are just not enough blogs out there. 2007-09-07T15:58:40-05:00 Make Your Computer Sing With Festival http://www.chuckcaplan.com/blog/archives/2007/09/make_your_compu.html Festival is a free speech synthesis system from The Centre for Speech Technology Research at The University of Edinburgh in Scotland. Besides doing typical Text to Speech tasks that most operating systems can do today, Festival has a special Singing mode, which can accept an XML input file full of words to sing, pitches, and durations. Here is an example from the documentation:

<?xml version="1.0"?>
<!DOCTYPE SINGING PUBLIC "-//SINGING//DTD SINGING mark up//EN" 
      "Singing.v0_1.dtd"
[]>
<SINGING BPM="30">
<PITCH NOTE="G3"><DURATION BEATS="0.3">doe</DURATION></PITCH>
<PITCH NOTE="A3"><DURATION BEATS="0.3">ray</DURATION></PITCH>
<PITCH NOTE="B3"><DURATION BEATS="0.3">me</DURATION></PITCH>
<PITCH NOTE="C4"><DURATION BEATS="0.3">fah</DURATION></PITCH>
<PITCH NOTE="D4"><DURATION BEATS="0.3">sew</DURATION></PITCH>
<PITCH NOTE="E4"><DURATION BEATS="0.3">lah</DURATION></PITCH>
<PITCH NOTE="F#4"><DURATION BEATS="0.3">tee</DURATION></PITCH>
<PITCH NOTE="G4"><DURATION BEATS="0.3">doe</DURATION></PITCH>
</SINGING>
I decided to create a song based on a Barbershop Quartet from a book in my collection. To do this, I created one XML file for each of the four parts and played them individually while recording them into an audio program. Then I combined them all into a single audio file. Voila! Here is the final product - a computerized version of the song M-O-T-H-E-R:

Mother.wav (6 MB)
Mother.m4a (580k, for iTunes and QuickTime)

Here are the XML files I created that were inputted into Festival:

mother1.xml
mother2.xml
mother3.xml
mother4.xml

Lyrics:

M is for the million things she gave me.
O means only that she's growing old.
T is for the tears were shed to save me.
H is for her heart of purest gold.
E is for her eyes with love-light shining.
R means right and right she will always be.
Put them all together they spell MOTHER,
A word that means the world to me.

NOTE: Keep in mind that only the source code for Festival is officially released. If you wish to use it, you will need to either build the binaries from the sources or find the binaries somewhere online. I was able to get the Windows binaries from a project called Flinger, which uses speech synthesis to sing based on a MIDI input. I did notice that Flinger did not include all of the configuration files needed for singing via an XML, so I had to also download the Festival sources and add them to my Flinger install. You might have to play around with it a little bit, but you should be able to get Festival/Flinger to sing from an XML file without too much trouble.

]]>
Technology Chuck 2007-09-07T15:58:40-05:00
How to Convert a YouTube Video to an Animated GIF http://www.chuckcaplan.com/blog/archives/2007/07/how_to_convert_1.html With the right tools, it is very easy to convert a YouTube video to an animated GIF in a nearly automated way. This tutorial should work roughly the same way on any operating system as long as you have the required tools:

1. Make sure you have access to all the required tools. As far as command line tools go, you will need wget, grep, sed, and xargs. These come with almost all Linux installations, or on Windows, you can use Cygwin. In addition, you need to have MPlayer installed.

2. Create a script called youtube.sh on the file system with the following contents:

wget -q -O - http://www.youtube.com/watch?v=$1|grep "/watch_fullscreen?.*video_id=.*\&t="|sed "s/^.*\&t=//"|sed "s/\&.*//"|xargs -i wget -O $2 http://youtube.com/get_video?video_id=$1\&t={}

Make it executable by typing chmod +x youtube.sh

3. Find the YouTube video you would like to convert. Make sure it is short, as a 5 minute video will become an animated GIF that is about 36 MB. The URL for the video should look like the following:
http://www.youtube.com/watch?v=34Sb0hGUNIQ
Note the part after the ?v=, e.g. 34Sb0hGUNIQ. Copy this code to your clipboard or write it down.

4. Run the script as follows:

./youtube.sh 34Sb0hGUNIQ ducktales.flv

This will download the video to your computer in Flash Video format. The file will be called whatever you specified when you ran the script, e.g. ducktales.flv. Now we just need to use MPlayer to convert it to an animated GIF.

5. Do the conversion by typing:

./mplayer -vo gif89a ducktales.flv

It takes about as long as the video normally runs in order to finish converting. When it is done, there will be a new file in the same directory called output.gif. Try dragging it into a browser to see it run.

You have just successfully converted a YouTube video to an animated GIF! Click here to see the final output. Note that if it seems slow, it is most likely because the video (7.5 MB) is still loading.

]]>
Technology Chuck 2007-07-02T15:51:10-05:00
Firefox, Gmail, and GPG Encryption with FireGPG http://www.chuckcaplan.com/blog/archives/2007/06/firefox_gmail_a.html FireGPG is a FireFox extension that hooks into GPG to allow you to encrypt, decrypt, sign, and verify text in the browser using various encryption keys. Though it can work with any text in the Firefox browser, there are also special buttons that appear specifically in Gmail.

For those who don't know, GPG is a GNU version of PGP, which allows data to be encrypted and sign via public and private keys (among other features). GPG is command-line software, but FireGPG hooks it into Firefox in a completely graphical way.

The first step to getting started is to install GPG on your computer. It is available for many operating systems, and can be downloaded here. Make sure to download the binaries for your specific operating system. As an alternative to installing on a Windows machine, you can also install Cygwin and add the GPG package during the Cygwin installation.

Once GPG is installed, you should install FireGPG. The install is very similar to other Firefox extension installs. Make sure to restart the browser when you are finished.

Now that you have both pieces of software installed, you need to make sure that the Firefox extension has the proper path of your GPG install. In Firefox, go to Tools --> FireGPG --> Options. If you get a message about how GPG cannot be found, manually change the path in the options window to the 'gpg' (or gpg.exe in Windows) command in your filesystem. The other options can be left alone, though you can definitely edit them if you have a need.

Now that the Firefox extension is configured properly, we need to generate a private / public key combination for you. Once this is done, you can give other people your public key and they can encrypt messages and send them to you. Only you will be able to decrypt them since you have the private key (and the password you will create). In addition, you can sign a message with your private key and when you send it to others, they will be able to verify that it actually came from you with the public key.

From the command line (in Windows, click on Start --> Run and then type 'cmd' and click 'OK'), change to the GPG directory (in Windows, type:
cd "\Program Files\GNU\GnuPG"). Then, type 'gpg --gen-key'. Follow the instructions to generate your key. You can always hit Enter to accept the default, which is probably a good idea unless you know what you are doing. Make sure to enter your real name and email address. The comment on the key is optional. Once you finish following the prompts, your key will be stored in the GPG keystore. You can now close the command line window.

Now that you have your own key, you want to give others your public key so that they can send you messages. Open Firefox and go to Tools --> FireGPG --> Export, choose the key you just created and click OK. Your public key will be displayed in a new window. Copy the entire thing and paste it into an email, document, etc. in order to give your key to others.

Likewise, other people will most likely be giving their public keys to you so you can send them encrypted messages and verify their signature. To import a key, highlight it on a page in the browser. You can use my signature as an example. Right-click on the selection and choose FireGPG --> Import. Assuming the key is valid, you will see a message that it was imported successfully.

To send someone an encrypted message, highlight some text in the browser, right-click and choose FireGPG --> Crypt. A window will appear asking you to choose which public key. Choose the public key of the person you are sending the message. The encrypted text will appear. Copy the entire thing into your message and send it to them. If you are using Gmail, you can use the new buttons that appear while creating a message for encrypting, signing, etc.

If someone sends you an encrypted message with your public key, you can use your private key to decrypt it by highlighting the message, right-clicking, and choosing FireGPG --> Decrypt.

FireGPG also makes it very easy to sign messages and verify other messages that are signed. To sign a message with your private key, highlight the message, right-click, and choose FireGPG --> Sign. To verify a message that someone has signed with their private key, highlight the signed message, right-click and choose Verify. The window will then prompt you to choose the public key of the person that signed it. Assuming the message verifies, you will get a message saying the signature is valid.

Keep in mind that while FireGPG works great as is, it is still actively being developed, so new features and fixes should be released regularly. There is an active forum that people participate in for troubleshooting and bug reporting. For instance, users have requested to be able to sign and encrypt a message at the same time. In addition, many users do not like the command prompt windows that open and close quickly when using FireGPG with Windows.

As you can see, FireGPG makes it very easy to encrypt / decrypt and sign / verify messages in Firefox, as well as import public keys. Give it a try and you will see how easy it is to use FireGPG once it is installed. Feel free to send me a message using my public key to chuck at chuckcaplan d o t com and I will respond.

]]>
Technology Chuck 2007-06-06T13:09:56-05:00
Thank Goodness for Wikipedia http://www.chuckcaplan.com/blog/archives/2007/03/thank_goodness_3.html I have always been fascinated by Wikipedia. Even though it shouldn't be used in academic papers, it is still a great resource for finding information on just about anything. There are times that I can go on and just go from page to page, finding information about any number of random things I never would have thought of. I think this comic sums it up nicely:

http://xkcd.com/c214.html

By the way, you can download the little Java app I wrote to make this entry HERE. Just pass in the text file to be converted as an argument. Jakarta Commons IO is required for runtime.

]]>
Technology Chuck 2007-03-01T11:17:16-05:00
What are the Best Super Bowl Squares? http://www.chuckcaplan.com/blog/archives/2007/02/what_are_the_be.html While I don't typically gamble, almost every year I take part in a friendly Super Bowl Squares Pool. This year I thought it would be fun to figure out which numbers win most often, to sort of gauge my likelihood of winning. I figured that 0, 3 and 7 would be the best numbers, just because a team is very likely to either not score or score once. However, I was not sure just how good these numbers were.

To come up with the answer, I started to manually add up all the scores from every Super Bowl using Wikipedia. Then my good friend Chris Federowicz decided to write a PERL script to do the same thing. Here are the results. Each number, 0-9 is shown, as well as how many times that number would have won the pool for a single quarter:

Digit 0: 91
Digit 1: 16
Digit 2: 8
Digit 3: 51
Digit 4: 34
Digit 5: 8
Digit 6: 26
Digit 7: 63
Digit 8: 9
Digit 9: 14

As you can see, 0, 3 and 7 are the big winners, with 1, 4, 6 and 9 coming in much lower. 2, 5 and 8 hardly won any at all.

Since my numbers this year are 9 and 8, I will be needing some serious luck.

UPDATE:
Part 2 of the results - Most popular combinations of scores (Thanks again Chris):
0, 7 = 19
0, 3 = 15
0, 0 = 12
0, 4 = 10
4, 7 = 10
3, 7 = 10
3, 6 = 7
7, 7 = 6
3, 4 = 6
3, 3 = 6
0, 9 = 5
0, 6 = 5
6, 7 = 5
0, 5 = 4
0, 2 = 3
1, 7 = 3
1, 5 = 3
0, 8 = 3
6, 8 = 3
1, 4 = 3
0, 1 = 3
7, 9 = 2
4, 9 = 2
2, 7 = 2
6, 6 = 2
5, 9 = 1
8, 9 = 1
2, 9 = 1
6, 9 = 1
1, 6 = 1
1, 8 = 1
2, 4 = 1
1, 9 = 1
2, 8 = 1
4, 4 = 1
1, 3 = 1

]]>
All Chuck 2007-02-02T13:51:44-05:00
OpenSearch Digg Plugin for Firefox 2 and IE 7 http://www.chuckcaplan.com/blog/archives/2007/01/opensearch_digg.html I created my first OpenSearch plugin, which searches stories at Digg. When you install it, if you are using Firefox 2 and above, Digg will be added to the search engines to the top right of the screen. It will also work with Internet Explorer 7. Thanks to Justin for testing.

To install, click here. The source can be found here.

]]>
Technology Chuck 2007-01-25T14:58:33-05:00
Introduction to AJAX http://www.chuckcaplan.com/blog/archives/2007/01/introduction_to.html An introductory article about AJAX that I have written has been published in the January, 2007 edition of System i News. Access to my specific article would typically require a paid ProVIP subscription. My contract for this specific article, however, allowed me to post the full contents online:

Download file

]]>
Technology Chuck 2007-01-18T10:17:41-05:00
A Quick Printer-Friendly Page In Javascript http://www.chuckcaplan.com/blog/archives/2006/09/a_quick_printer.html In my job, we often have to make printer-friendly views of pages that do not include various headers, footers, and menus so the user can print out exactly what they need.

This can be done either manually (e.g. creating a new page with the content to be printed from scratch) or by having a separate CSS stylesheet that does not display the header, footer, and menus (make sure media="print" is in the stylesheet declaration).

One thing that we have noticed is that with the CSS solution, users still want the link to the printer-friendly page, even though all they have to do is print the original page and the printer-friendly version will be printed. Therefore, we had to figure out a way to have a printer-friendly link that could be easily added without us having to manually make printer-friendly pages for each page that needs to be printed. Enter Javascript.

The following HTML code has a DIV tag with the content that needs to be printed. The printer friendly link simply opens a new window to the page print.html. Since print.html knows it was opened via another HTML page, it can use Javascript to access the calling page and output the contents of the caller's DIV tag on its own page. Since the only thing showing on print.html will be the content that needs to be printed, the user can manually print that page like they would with a normal printer friendly page.

The advantage of this is that the only code needed is the 1 line of Javascript it takes to access the calling page's DIV tag. A disadvantage is that at this point, the id of the DIV tag must be hard-coded, though I am sure it can be passed to the printer-friendly page with little modification.

Calling Page:

<html><head><title>Calling Page</title></head><body>
HEADER GOES HERE<br><br>
<a href="print.html" target="blank">Printer Friendly Version</a>
<div id="mainContent">CONTENT I WISH TO PRINT</div>
<br>FOOTER GOES HERE
</body></html>


Printer-Friendly Page (print.html):

<html><head><title>Printer-Friendly Page</title></head><body>
<script language="javascript">
document.write(window.opener.document.getElementById("mainContent").innerHTML);
window.print();
</script>
</body></html>

]]>
Technology Chuck 2006-09-01T11:17:50-05:00
KeePass Password Safe - Manage all of your passwords easily. http://www.chuckcaplan.com/blog/archives/2006/06/keepass_passwor_1.html When it comes to passwords, most people only have one, which they use for a multitude of machines and websites. The problem with this is that anyone who finds out that one password now has your password to everything. In addition, if you ever decide to change that password, it would be very time-consuming and you probably would not be able to remember all the places that you need to change.

Enter KeePass Password Safe. KeePass is a password manager and secure password generator that allows you to have a different password for each website you frequent. In fact, I don't even know any of my passwords except for the one password needed to get into KeePass. All I know is that they are all different and they are all a jumbled mix of letters, numbers, and other characters.

Now, if someone hacks a website I frequent and gets access to my password, they will not be able to log on to anywhere else because all my passwords are different.

Some other features include an optional key-disk (so even if someone steals my password file and knows the master password, they still won't be able to access anything without the key-disk), a secure password generator, the ability to export the database, and support for multiple languages. The program also allows you to categorize your passwords into different groups (shopping, discussion boards, etc.) and can put an expiration date on passwords that need to be changed after a certain length of time.

Of course, KeePass is open-source so if there is a feature you want, you can always add it (the program is written in C++). There is also a plug-in architecture that you can take advantage of to extend the program even more.

The core KeePass program is only for Windows, but there are ports to Linux, Mac OS X, PalmOS, and Pocket PC so it can be used pretty much anywhere. I would recommend keeping your password file on a USB drive or FTP site so that you can easily access it from anywhere.

Give it a try. I am sure that once you do, you will wonder how you functioned without it.

]]>
Technology Chuck 2006-06-27T16:50:37-05:00
In the Trenches – J2EE Software Developer http://www.chuckcaplan.com/blog/archives/2006/06/in_the_trenches.html The technology job search-engine Dice.com recently published an article in their Career Resources section that I wrote about getting a job as a Java Developer. The article explains what beginning Java programmers should know about interviews, what companies are looking for, what skills they should have, etc.

Check it out.

]]>
Technology Chuck 2006-06-19T13:21:53-05:00
Survivor http://www.chuckcaplan.com/blog/archives/2006/06/survivor.html I'd like to veer away from my usual technical posts and instead post an abbreviated conversation that happened recently between myself and a friend:

Friend: Hey Chuck, have you read any good books lately?

Me: Well actually, I am reading Survivor by Chuck Palahniuk right now.

Friend: That's cool. How many pages is it?

Me: Around 290.

Friend: Nice. And what page are you on?

Me: 275.

Friend: So you are almost done?!

Me: Well, no...


.

]]>
Personal Chuck 2006-06-15T11:48:36-05:00
JavaOne 2006 http://www.chuckcaplan.com/blog/archives/2006/06/getting_to_know.html Last month I was sent to Sun's JavaOne Developer Conference. It was held in San Francisco's Moscone Center and had several hundred Java-related sessions and labs. I took some pictures and also uploaded a summary PowerPoint presentation of everything I saw that I made for work. Check it out.

In addition, PDF's of all of the technical sessions have been posted online.
The catalog to search for specific sessions is here.

]]>
Technology Chuck 2006-06-05T15:59:34-05:00
Cold, Hard (Geo) Cache http://www.chuckcaplan.com/blog/archives/2006/03/cold_hard_geo_c.html Now that it is starting to get a little warmer, I would like to start taking advantage of Columbia, MD's pathways and trails again. When Columbia was first built (by Edward Norton's grandfather, no less), they purposely planned to have these pathways throughout the entire city. It makes it very easy to walk from one place to another and also allows me to get some much needed exercise.

Since I am also a technology buff, I have recently started getting into Geocaching, which allows me to exercise and use technology at the same time.

In the activity of geocaching, someone hides a 'cache', which is typically a plastic container full of a few trinkets and a log book. They then post the latitude and longitude of the location of the cache (found with a GPS) online at a site like geocaching.com. Other people will then plug the coordinates into their own GPS and try to find it. Once found, they can sign the log book, swap out a trinket for one of their own, take a picture, etc. They would also post online that they found the cache.

There are many variations of geocaching and they are found all over the place. For instance, there are 64 caches listed that are 5 miles or less from my house. The closest one was about a 10 minute walk.

I highly recommend this activity and hope to find about one cache a week for the duration of the Spring and Summer. You can track my progress by looking up user ChuckCaplan on geocaching.com.

Here are some other links that I recommend:
Maryland Geocaching Society
Reading a GPS using Java

]]>
Technology Chuck 2006-03-22T12:23:27-05:00
The Acid2 Browser Test http://www.chuckcaplan.com/blog/archives/2006/03/the_acid2_brows.html Digg recently had a story on the front page about the latest build of Opera passing the Acid2 Test. I decided to verify this for myself, as well as check how Firefox and Internet Explorer did.

For those who don't know, the Acid2 Test tests how well web browsers conform to certain standards. If the browser passes, the page should like like a smiley face. Otherwise, it will look bad. How bad depends on how well the browser conforms to the tested standards.

Opera Build 8265 (Looks great!)

Firefox 1.5.01 (Disappointed)

Internet Explorer 6.0.2900.2180 (Looks HORRIBLE)

On the bright side, I have heard that the IE 7.0 beta passes the test and I am sure that Firefox won't be far behind.

read more | digg story

]]>
Technology Chuck 2006-03-10T14:53:34-05:00
Bookmarklets Old and New http://www.chuckcaplan.com/blog/archives/2006/02/bookmarklets_ol.html Note: The bookmarklets in this entry are designed for Firefox.

According to Wikipedia, a Bookmarklet is:

"A small JavaScript program that can be stored as a URL within a bookmark in most popular web browsers, or within hyperlinks on a web page."

Here is what the bookmarklets in my browser currently look like (outlined by a red rectangle):

Bookmarklets

As you can see, it is now very easy for me to post something to del.icio.us, email a page, look up something on Wikipedia, etc. All of these bookmarklets have integrated Javascript that pop up windows for search queries or use text that I have highlighted on the screen as the query input.

I have been using bookmarklets for a long time, but had never actually written any myself. Here are 2 new ones that I hope someone will find useful. To install these, drag the links to your Bookmarks Toolbar.

1. Calculator - This bookmarklet either pops up a window asking you for an equation or uses the text currently selected on the screen as the equation and then shows you the result. This may be handier than opening a Calculator program every time you need to do a simple calculation. To test, install this bookmarklet, highlight the following text, and run it: 6 * (5 / 3) - 3 + (7 / 2)

2. ROT13 Encrypter / Decrypter - ROT13 Encryption is a very simple encryption scheme that is used on newsgroups and on my new favorite site Geocaching.com. Here is a description of how it works and why it is used. Much like the calculator bookmarklet, you can either enter the encrypted / decrypted text in a popup window or select the text on the screen first. To test, install this bookmarklet, highlight the following text, and run it: Pbatenghyngvbaf! Gur obbxznexyrg vf vafgnyyrq.

Here are the ones I use that other people have made. These are links to the pages describing the bookmarklets, not the actual bookmarklets themselves:

]]>
Technology Chuck 2006-02-23T14:42:11-05:00