May 112010

I’ve mentioned my Panasonic BL-C1A network cameras before in a post about monitoring the garage door. I happen to have two of these cameras, and I have automated them to do quite a lot for me. The software that comes with the cameras is pretty lousy, and it makes you think you have to use Internet Explorer and nothing else to look at the images coming out of the camera. Well, I can tell you it’s not true. Although, if you want to use the ActiveX controlling software that comes with the camera, you are limited to only IE. Not good enough for me. I want to be able to see the images on my cell phone, and I don’t like being tied to a single browser, especially IE. For instance, wget (as I used in yesterday’s post about pulling images from a web site) could be used to pull the images from the camera. I also want the images to be saved on a web server so that if my cameras themselves are stolen, or if my home computer is stolen, I will still have a backup of the images. Now, I don’t normally store or watch video from the cameras, but instead focus on storing still images. I can watch video, but I don’t currently know of an easy way to save the video to my web server.

There will be several steps to this process. First install the camera. Next, set up the port forwarding on your router so you can view the camera from outside your local network. Then we will set up some cron jobs on the web server to retrieve and save the images. Finally we will set up a web page so we can view the images that have been saved. If desired, the entire system can be controlled by the home automation system, and I will show you how I did that as well.

The first thing to do is install the cameras. Install the cameras using the software provided, but don’t worry. We won’t be sticking with that software. Make sure you can connect to your camera from a computer on your local network, using the software provided. I would now recommend that you set static IP addresses for your cameras. It defaults that way, so this should not be a problem. The default IP address should be something like 192.168.x.253, where ‘x’ is the same number as the rest of your networked computers, probably a 1 or a 0. Also, set the port to some high number, such as 8001. You will also want to set usernames and passwords for the camera. Next, using the IP address for the camera, use your NON-Internet Explorer web browser to view the images by going to this website:
If that works, then we have lots of other options:




There is a little more information about these addresses here:

Great. Now we can see the images with any web browser. Video still requires a web browser that can handle java. Now let’s set it up so we can view the images from outside our local network by using port forwarding.

If you have a cable modem or DSL that is connected to the internet all the time, then you can probably set up port forwarding with that device. I use the world famous Linksys WRT-54G with the upgraded firmware DD-WRT. I certainly can’t tell you how to do this on every device out there, but port forwarding is quite common and searching google for “port forwarding yourdevicename” should give you a good place to start. However, the idea is simple. You want your router to recognize incoming traffic on a certain port and then automatically forward it to another port, such as 8001 in this case. The idea here is that you could be on a public computer in your library and go to and you will see the video on that camera. If you have more than one camera, you would go to the same site, but a different port number, such as I used the same portnumber, 8001, but you could use a different one. So I can go to http://mysecretsite:8001 from any browser and see the video. So I need to go into the firmware settings for the router, and I will want to forward any traffic that comes into http://mysecretsite:8001 to http://192.168.x.253:8001. The port forwarding rules will not need to know anything about “mysecretsite”, so you won’t find any place to enter that setting. All you will have to enter is the incoming port, outgoing IP address and outgoing port. The incoming and outgoing ports in this case are both 8001 and the outgoing IP address is 192.168.x.253. At this point you could check and make sure the port forwarding is working by going to your router’s IP address (find it by going to followed by :8001, such as

Related to the port forwarding is dynamic DNS. If you are lucky enough to have a static IP address, you can skip this paragraph. Otherwise you will need to follow the steps here to create a dynamic DNS host name. You can set up a free account at Once your account is set up, add a host service with a hostname that you can remember. Have it point to your current IP address for now, but you will want to configure automatic updating. You can either use free software or even easier, you might be able to configure the automatic updating right within your router. If it works, you should be able to go to your new host:×480&Quality=Standard&mode=local

and see the images from the camera. At this point step two is complete. You can save that URL and you will always be able to view your camera from any web browser on the internet.

The last step is to set up some cron jobs on your web server to grab the images from your camera and save them to a specific directory on your web server. This way you will be able to review past images as needed. It will require you to have a web server that you have shell access to. Some web hosts out there that do allow shell access do not allow scripts to run for extended periods of time. I use dreamhost (, which works perfectly.


while :
THISFILE=`date +/home/httpdocs/FamilyRoomWebCam/%Y%m%d%H%M%S.jpg`
wget --http-user=camera_user --http-passwd=topsecret -O ${THISFILE} -q
sleep 20
chmod 644 ${THISFILE}

As long as this script is running it will grab a new image from the camera every 20 seconds. It saves the images with a timestamped file name. You could configure this to start running at server startup, maybe have a cron job that checks to see if it is running periodically (like once an hour) and if it finds that the script is not running, restart it. I have it set up so that whenever I arm my burglar alarm (Elk M1G), the elk sends an email to my web server with a special code. Procmail reads the email and if it sees the special code, it starts (or stops, on disarming) the script. Here is my Procmail script to start the web cam:
* ^Subject:.*SecretStartCode
| /home/script/ &


Finally, I have another cron job to delete old pictures every night. Otherwise the picture directory would get very full very fast. I don’t think dreamhost would like that at all.

find /home/httpdocs/FamilyRoomWebCam -mtime +3 -exec rm {} \;

This will delete any pictures older than three days old.

The very last step is I wrote a small web page to display the images. It uses javascript to play the images in a slideshow, or it can display all images from a specific time period. For now I will leave that up to you, but I will post the code for it in a few days.

May 102010

This isn’t just another “how to rotate your Windows Desktop image” post.  Search for that on Google and you will find many solutions for that.  I am going to show you how to use a specific image that is posted periodically to the web and have that as your desktop image.  For instance, let’s say your favorite cat photo website has a feature where they post the Cat Photo of the Day.  If they always post that image with the same file name (cpotd.jpg, perhaps), each day over-writing the image with the new image, then you could use that image as your windows desktop wallpaper, and whenever the photo is updated, you would have the latest photo on your desktop as well.  Now, there are RSS solutions to do something similar, but the difference here is that the file must always be named the same each time they update the photo.  Actually, this method is quite common for images that are updated periodically.  Many weather sites use the same image name for the latest weather map, for instance.  And many sites that do have a photo of the day feature as I described above use this method of updating their image.  Ready to do it yourself?

There are three parts to this.  First we need to identify an image that is suitable for our needs.   Remember, it must always have the same filename.  This method won’t work if today they name the image “20100509_cpotd.jpg” and tomorrow they name it “20100510_cpotd.jpg”.  Although with a little creative programming (perhaps using windows power shell), this could be worked around quite easily.  Step two involves writing a batch file and creating a shortcut to pull these steps into one small program. The final step will automate a means to download the updated images on schedule.

I am going to use an image from a very cool website,  This site displays an image of the earth rendered in real time, with a correct display for where it is daylight and evening.  It also shows the latest cloud cover.  It makes for a really cool image and it can easily be used for your desktop image.  But first, we need to make sure that the image filename is always the same.  Right click on the image and choose “Copy image URL”.  Then paste the image URL into the address bar of your browser and hit enter.  You should see a “web page” with nothing more than the image itself.  And we can now see the image URL,  Ok, it doesn’t look like they have any time or date strings in there, so my guess is, the filename is always the same.  But why is it named 1024.jpg?  1024 is a common width for desktop resolution, and is a common width for online images as well.  I wonder if a higher resolution is also available?  Let’s change the 1024 to 1600 and see what happens.  Sure enough, that gives us a larger image.  We will use as our source image.  Now, how often is the image updated?  Well, I have been looking at this site for a little while, and it would appear that the image is updated about every half hour.  I’ll keep that in mind as we go along.

Next, we need a means to automate the download and storage of the image.  I like a program called wget which is originally a command line tool for unix/linux just for retrieval of web pages and images.  It’s actually a quite powerful tool, and of course it is free and yes, there is a windows version available for us right here. After you are done with this exercise, I am sure you will find other uses for wget, such as backing up your website. Go ahead and install the windows binary for wget.  I used the “Complete package, except source” setup file.  If you prefer zipped files, go ahead and choose that.  When the installation is complete, wget should be installed in your c:\Program Files\GnuWin32\bin folder.  Open a command prompt by clicking on the start menu and typing “cmd” and pressing enter.  Then type

cd c:\Program Files\GnuWin32\bin

(here’s a hint:  try typing cd c:\Pro{Tab}\Gn{Tab}\bin{enter}).  Once you are in the correct folder, type


and press enter.  You should see wget do its thing and download the file.  The only trouble is, the file is downloaded to the current folder–not a really good thing to do.  Let’s make a folder just for our Earth Image and tell wget to store the image in that folder.  Make a suitable folder somewhere and name it something appropriate.  I used c:\users\skip\Pictures\EarthImage.  I would recommend using a path that has no spaces, like “My Pictures”.  Spaces can sometimes mess up automated programs like this.  Now that we have created that folder, let’s run wget again, this time using the -O option.  Option O tells wget where to store the output.  So the command this time will be: (type this command all on one line. Do not type the &&. That just shows that this line continues to the line below.)

wget -O C:\Users\skip\Pictures\EarthImage\earth.jpg &&

Note that I also changed the name of the file itself to earth.jpg.  Look in the folder and you should see our earth.jpg image, saved and ready to be used.  Now let’s see if we can apply that image as our wallpaper. I like a free program called “command line wallpaper changer portable”. Once it is installed, you just open a command prompt and enter

C:\Users\skip\CLWCP.exe C:\Users\skip\Pictures\EarthImage\earth.jpg

And you should see the image on your desktop. As you can see, I copied the executable clwcp.exe to my profile folder, but you can run it from wherever you want. If that works, step one is complete.

Step two is to automate the retrieval of these images. I want to do a few things to make the scheduling go easier and I also want to prevent the command prompt window from taking focus when it runs (I would like to update the wallpaper in the background without you really noticing that it is happening.) To do this, we will make a batch file called “GetEarthShot.bat” and save it somewhere like a utilities folder (I save mine in my profile folder, c:\users\skip). The batch file will only have two lines:

"C:\Program Files\GnuWin32\bin\wget.exe" -O C:\Users\skip\Pictures\EarthImage\earth.jpg
C:\Users\skip\CLWCP.exe C:\Users\skip\Pictures\EarthImage\earth.jpg

Can you see how it works? When this batch file runs, it will execute those two lines. First it will download the latest image. Then it will apply the image as the wallpaper. Save the file and double-click in in Explorer and you should see the command window pop up and see the two commands execute. Now, in order to make the command window itself NOT pop up (I find it distracting, and it can take the keyboard focus away), we will create a Windows shortcut to the batch file and set some properties to make sure it runs in the background. Right click on the GetEarthShot.bat file in Explorer and choose “Create Shortcut”. You should see the shortcut appear in explorer. Rename it so the “- Shortcut” isn’t there. I renamed mine to the same thing as the batch file itself: “GetEarthShot.bat”. Now right click on the shortcut and choose properties. You should see that the target is set to point to your batch file. Change the “Start in” parameter to “C:\Program Files\GnuWin32\bin\” (including the quotes). Finally set the “Run” parameter to “Minimized”. Click OK to save the changes and test it by double clicking the shortcut. If you watch VERY carefully, you might see the window pop up for a very, very brief moment, and then you may notice the icon on the task bar indicating that the batch file is running. After two or three seconds, the icon should go away and your desktop image should be updated. Now, if you are running this right away after initially setting the image when we first tested it, you may not be applying a NEW image, so you may not notice anything different. Step two is complete. Now let’s automate the whole process.

Go to Control Panel -> Administrative Tools -> Schedule Tasks.  On the left side, if you click on Task Scheduler Library, you will see all of your scheduled tasks in the center pane.  On the right, click on “Create Basic Task”.  I used “Update Earth Image” as the name and I gave it a nice description as well.  Click the “Next” button.  For the trigger, choose “After logon”.   Click “Next”.  Under “Action”, chose “Start a program”.  After clicking “Next” you will enter


And under “Start in”, enter

c:\Program Files\GnuWin32\bin\

Note that the full path to wget is in the command line.  Click “Next”.  Click to enable to “Open the properties dialog for this task when I click finish” and then click finish.  The properties dialog should pop up.  Click the Triggers tab and then “Edit”.  Under Advanced setting, click the “Repeat task every” and set the frequency to 30 minutes, for a duration of Indefinitely.  Click OK to exit and save the task.  This task should now run every 30 minutes.  So now, every 30 minutes, that folder will be updated with the latest earth image, over-writing the image already there.  If you right click on the task and choose “Run”, the task should run. You should see the batch file run minimized as we did before. If all is well, reboot your computer to get the task going. Step three is complete and you are done.

Using the process here, you could do a lot of things with wget setting up some cool rotating images. Good luck!

May 082010

Do you have billions and billions of password to remember? Well, maybe not quite that many, but I can tell you that I currently have 113 username and password pairs that I am remembering, mostly for logins to different websites. What if I told you that most of my passwords are something like “L6qjB5NM04GEXjTTeXeQ”. I try hard to not use the same username and password for every site I visit. I used to. It’s the only way you could possibly remember all those passwords.

Now I use a free program called KeePass to manage my passwords. Every time I register for a new account at a new website, I fire up KeePass and add a new entry. KeePass already has generated a password similar to the one I showed above. I then copy and paste that pre-generated password in the desired password field on the registration for on the website. If the website accepts the new password I save the entry in KeePass. The websites almost always accept the generated password from KeePass, but would you believe that sometimes my passwords are too long and the website forces me to trim down the length of the password? Sad. And that’s it. No more having to remember passwords.

Ahh, but you don’t want to use a password manager because you have multiple computers and you will need access to your passwords no matter where you are. I get that. That was what kept me away from such a program too. Well, I have the perfect solution. And it comes with lots of nice side effect features too. Get yourself a free Dropbox account. Dropbox is a file synchronizer that allows you to automatically sync up files and folders over the internet. If you work on some files at home and work, then you have undoubtedly forgotten your thumb drive once before, or forgot to copy over the latest version before you left. Well, dropbox can easily solve that problem for you. The Dropbox program watches a certain folder (or folders) on your computer. Whenever a file is added, changed, or deleted in that folder, the change is propagated automatically over the internet to any other computers on which you have installed dropox. So when you get to work after adding a new file to your dropbox at home, the file is happily waiting for you in your dropbox folder at work. So, to make this work with KeePass, just save your “key ring” (your database) to the dropbox folder. KeePass allows you to save and open database files from any folder, so this works quite well. Then all you have to do is install KeePass on your work computer too, and tell it to look in the DropBox folder for the key ring, and you will see all of your entries saved their. Now you can easily add new entries on either computer, and the change will be propagated to the other computer. Of course you could also install Dropbox and KeePass on your laptop too, so that you have access to your passwords (and files) when you travel.

Finally, there is an Android app for KeePass too. There is not a dropbox app, so you will have to periodically copy over (or email) the latest database to your phone so it has (a somewhat) up to date database. I try to do it around once a month or so. This also has the added benefit of backing up my database. Dropbox is pretty good about recovering accidentally deleted files, but really bad things can happen, and losing every password would be really bad. By having a copy in my email that I can go back to retrieve a copy, I know that I will always have a fairly recent backup that I can rely on.

And for the record, even though Lifehacker has also given instructions on how to do this, I figured it out before they did :) I just wasn’t smart enough to blog about it.

May 042010

I hate it when I send an email only to get an email back from the recipient saying that I forgot to include the attachment that I referred to in my email.  How annoying.  I also hate it when I forget to fill in the subject line.  I don’t like receiving emails with no subject lines and I hate it even more when I accidentally send one myself.  So I found some VBA macros that I could add to Outlook which will look for certain criteria which may indicate a forgotten attachment.  The missing subject line is a little more straightforward. I always want a subject line and when I hit the send button, it’s either there or it isn’t, but the attachment detector has to first figure out if I intended to attach something.  So, let’s just jump into the code.  I found the majority of this code at but you will see that I made some changes to it to suit my needs.

Private Sub Application_ItemSend(ByVal Item As Object, Cancel As Boolean)
Dim lngres As Long
If InStr(1, Item.Body, "attach") Or InStr(1, Item.Subject, "attach") <> 0 Then
If Item.Attachments.Count = 0 Then
lngres = MsgBox("word 'Attach' found, but no attachment - send anyway?", _
vbYesNo + vbDefaultButton2 + vbQuestion + vbSystemModal, "You asked me to warn you...")
If lngres = vbNo Then Cancel = True
End If
End If

If InStr(1, Item.Body, "include") Or InStr(1, Item.Subject, "include") <> 0 Then
If Item.Attachments.Count = 0 Then
lngres = MsgBox("word 'include' found, but no attachment - send anyway?", _
vbYesNo + vbDefaultButton2 + vbQuestion + vbSystemModal, "You asked me to warn you...")
If lngres = vbNo Then Cancel = True
End If
End If

If InStr(1, Item.Body, "enclose") Or InStr(1, Item.Subject, "enclose") <> 0 Then
If Item.Attachments.Count = 0 Then
lngres = MsgBox("word 'Enclose' found, but no file enclosed - send anyway?", _
vbYesNo + vbDefaultButton2 + vbQuestion + vbSystemModal, "You asked me to warn you...")
If lngres = vbNo Then Cancel = True
End If
End If

strSubject = Item.Subject
If Len(Trim(strSubject)) = 0 Then
Prompt$ = "Subject is Empty. Are you sure you want to send the Mail?"
If MsgBox(Prompt$, vbYesNo + vbQuestion + vbMsgBoxSetForeground, "Check for Subject") = vbNo Then
Cancel = True
End If
End If
End Sub

The first thing to notice is that this macro is executed whenever you click the send button (or press ctrl-enter). Whenever you start the send process, this macro executes. The first three parts of the code look for the words “Attach”, “Include” and “Enclose” in the body of the email as well as the subject line. Sometimes I just send an email with the subject line “Final report attached” and nothing in the body. I want the trigger to recognize this. Also, the triggers are not case sensitive and they will also hit on other forms of the word, such as “Attached”. So, if one of those key words is found, it will then check to see if there are any attachments in the email. If there are no attachments, a dialog box is presented stating that one of the keywords was spotted yet there were no attachments found. Do you still want to send the email? It can happen that you might be replying to a quoted email that someone sent you and had the word “attach” in it. Most people when they reply to an email, they include the original sender’s quoted email. You may not have any intention of including an attachment in this case, but the macro will still find the word “attach”, so it gets triggered. I wish there was a way to have the macro only look at the new text that you added, but there doesn’t seem to be. If you answer “No” to the question “Do you still want to send”, then the send process is cancelled and you will have a chance to add your attachment. If you choose “Yes” then the email is sent as usual.

The last section of code looks for blank subject lines. The methodology is the same as the other sections, and is probably self explanatory.

To make this code work in your Outlook, just copy the code to the clipboard, open Outlook and press alt-F11. On the left side, you will see a standard navigation tree. Under Project1 (VbaProject.OTM) expand Microsoft Office Outlook Objects. Double Click on “ThisOutlookSession” and then paste the code in the code pane. Save your work, close Outlook and restart it. Try and test the code by sending yourself some test emails.

I hope this helps some of you.

Apr 302010

Sony announced today that as of March, 2011, they will no longer produce 3-1/2 inch floppy disks.  I seriously cannot remember the last time I used a floppy disk.  I seem to recall people here and there trying to give me a document on one a couple of times over the last four or five years, and I always remember looking at them with bewilderment.  I’m not going to miss it, that’s for sure.  I wonder if I even have one in a box in the house anywhere.  Attic?  Garage???  Good riddance.

By the way, is it just me, or does Windows decide on its own when it wants USB devices and slots to be 2.0 or 1.1?  About half the time when I stick my thumb drive in, I get the friendly Windows “suggestion” that my device could perform faster if I plugged it into a 2.0 slot.  **Sigh.**

Apr 302010

Do you rip your movies to your hard drive?  I have a five-year-old daughter and we own about half of the Disney collection.  Some old and some new.  Most are on DVD, but we have started getting some on blu-ray.  One thing that I learned a little over a year ago was that it sucked looking for the movie that my daughter said she wanted to watch (what?  You put all of your movies back in the case as soon as you are done watching them and then put the movie back where it belongs? Riiiight…)  Furthermore, those DVDs and Blu-rays can get scratched, and we have ruined a couple of discs by them getting damaged one way or another.  Fortunately about that time, home theater personal computers, or HTPCs were becoming really popular.  Now, I have actually had an HTPC for about six years.  That’s a little longer than my daughter is old.  Yeah, I love HTPCs and the convenience they provide.  I have my music collection on there, many of my photos, and my daughter’s movies.  Using Windows Media Center, I can listen to that music, look at those pictures, and watch all of those movies.  And I don’t have to get out of my couch.  I can display a menu on the TV that shows cover art and posters from all the movies in the collection so my daughter can point to the movie she wants to watch.  I just click on the movie she chooses and it starts to play.  What could be simpler?  But that’s another post, so I will leave that for another day.

In order to be able to watch my movies in this fashion, I have to rip my movies from their physical medium to my HTPC hard drive.  By the way, “rip” means “copy” here.  It’s not like ripping a page out of a book.  No, it’s more like photocopying a page from a book. But we call it ripping.  If you search for “rip dvd” or “rip blu ray”, you will get thousands of software solutions to help you with this.  I personally use a program called DVD Fab 6, but this past week when I went to rip my first blu-ray movie (Ratatouille), I had to look for something new to help me.  DVD Fab says it can rip blu-rays, and it looked like it was ripping the movie correctly, but there was no sound at all from the saved AVI when it was done.  So I looked around for another program to see if it would work better for me, and I came across AVS Video Converter 6.4.  And this is where it gets interesting.  According to their documentation, all you have to do when ripping a blu-ray is select the index.bdmv file on the disc as the source, and that should automatically bring the entire movie along with it.  Well, that didn’t work for me.  Next, i tried selecting the individual m2ts files in the stream folder.  But then the movie was out of order.  It wasn’t looking promising for this program either.  I was actually beginning to think that ripping blu-rays was still not quite ready for prime time, which was disappointing because the only copy of Ratatouille I had was on blu-ray.  Finally, I had an idea.  What if it wasn’t the software, or my processing, but instead, what if it was something unique about the Ratatouille disc?  I did some searching and what do you know?  I happened to pick what is probably the hardest disc in the American movie collection to rip as my first disc.  It turns out that Ratatouille is a “Seemless branching disc” and also has multiple viewing angles.  I found a web page that actually listed the correct order for the Ratatouille m2ts chapters, put them in that order, re-ripped the disc and it worked perfectly!

I don’t know if DVD Fab actually ripped the movie in the right order because since it didn’t have any sound, the rip was useless to me and I only watched a few minutes of the movie just to verify that it did not have any sound.  In any case, neither program worked perfectly, but ultimately AVS Video Converter pulled it off, with some serious finagling from me.  I think ripping blu-rays is still kind of “tip of the spear” stuff, and full automation for the majority of the discs is probably still a ways off.  Or maybe not.

Just in case the web page with the Ratatouille chapters goes away, I am going to post the correct order for the chapters here:
00027.m2ts + 00028.m2ts + 00000.m2ts + 00001.m2ts + 00002.m2ts + 00005.m2ts + 00008.m2ts + 00009.m2ts + 00012.m2ts + 00013.m2ts + 00016.m2ts + 00018.m2ts + 00021.m2ts + 00017.m2ts + 00033.m2ts + 00034.m2ts + 00049.m2ts + 00037.m2ts + 00050.m2ts + 00040.m2ts + 00051.m2ts + 00043.m2ts + 00052.m2ts + 00046.m2ts + 00053.m2ts + 00056.m2ts + 00054.m2ts + 00059.m2ts + 00055.m2ts + 00062.m2ts + 00065.m2ts