Rename Master

January 26th, 2010
Posted in Software

Ever have a bunch of files that you needed updated. For instance, perhaps you have a script or program that generates a bunch of incremental files or maybe you need to fix files that were not named with your naming convention. Rename Master is the free tool that will help you get this done. You can change the case sensitivity, add numbers to the end, replace just part of the name or some letters and more. You can also edit file properties such as MP3 tags, JPEG JFIF and EXIF tags. It also gives you a preview of what your changes will look like, before you implement them. It can be installed or run as a standalone app, so you can put it on a USB flash drive and add it to your arsenal of tools.

VMware Player 3.0

January 25th, 2010
Posted in Software

VMware Player 3.0 rocks. Finally you can create or edit your virtual machines with just this program and not having to use a site like EasyVMX or going through a bunch of hassles hacking together a VHD and VMX that you could boot up into so you could install your OS. I used to install a trial version of VMware Workstation to create any new VMs I needed or if I need to edit them. A few years back I would just have VMware Server 1.0 installed on another machine to do all this, which meant I had to copy over my VMs and then do any creating or editing which was slow and tedious. And don’t get me started on VMware Server 2.0, the web interface is horrible. Vmware Player is much lighter than Vmware Workstation or Vmware Server, so I really didn’t want to just use one of those products by itself.

I believe they included the ability to create and edit the VMs in VMware Player for a few reasons. One of which is that they probably noticed people were either getting the trial version of VMware Workstation or just downright pirating it to do the editing or creating of VMs. The other reason is that VirtualBox maybe starting to eat into VMware’s userbase and since it lets you edit, create and use VMs all in one program, it made sense to have VMware Player do the same. And the same could be said about Virtual PC. Another benefit is that now that there is a GUI for editing the VMs for probably their most popular free program, there will probably be less people having to search and post on their support forums for configuring it manually by editing the VMX file by hand. Want to expand or contract the Virtual Hard Drive size, it can now be done in VMware Player. Although if you need to convert a VM from another program, you’ll need VMware Converter, but that it makes sense that program is seperate.

New Features

  • Virtual Machine with Easy Install — Create a virtual machine and install any supported guest operating system with Easy Install.
  • New User Interface — Use the new user interface to create virtual machines and edit virtual machine settings.
  • Windows 7 — Create and run Windows 7 32-bit and 64-bit virtual machines using VMware Workstation. VMware Workstation has been enhanced for performance and to take advantage of the new Windows 7 features including Live Thumbnails and Aero Peek.
  • Aero Glass — A new Windows Display Driver Model (WDDM) graphics driver has been developed for Windows Vista and Windows 7 virtual machines. The WDDM driver can display the Windows Aero user interface, OpenGL 1.4, and Shader Model 3.0. For more information on the VMware recommended graphics hardware, see the VMware Workstation User’s Manual.
  • Windows XP Mode Compatible — Import a Windows XP Mode virtual machine using VMware Player 3.0 and run the virtual machine without being prompted to enter a Windows XP license key. VMware Player enables the Windows XP Mode virtual machine to take advantage of more than one processor, render high-end graphics, integrate seamlessly with Unity, and transfer files easily with drag and drop, and shared folders. VMware Player also has the ability to run concurrently with Windows XP Mode.
  • 3D Graphics Improvements for Windows XP guests — OpenGL 2.1 and Shader Model 3.0 support is now available for Windows XP virtual machines. The XPDM (SVGAII) graphics driver works with Windows XP, Windows Vista, and Windows 7. However, only Windows XP virtual machines
    install the XPDM graphics driver by default. To switch graphics drivers in the guest operating system, see How to Switch Between SVGAII and WDDM Drivers.
  • Multiple-Monitor Display — Virtual machines can now take advantage of multiple monitors.
  • Advanced Linux Sound Architecture (ALSA) — ALSA significantly improves the sound of virtual machines running on a Linux host and streams the audio from each virtual machine on a separate channel so that multiple virtual machines can be heard simultaneously.
  • Drag and Drop Enhancements — Drag and drop enhancements include support for new file types including images and formatted text and extend the existing ability to drag and drop files to a broader set of guest and host operating systems.
  • On-Demand VMware Tools Download — On-demand download capability provides the latest VMware Tools for the guest operating system. This feature reduces the overall download size of VMware products by downloading only the required set of VMware Tools and enables VMware to release new versions frequently.
  • Virtual Printing — Print from virtual machines without mapping network printers or installing printer drivers in the virtual machine. With virtual printing enabled in the virtual machine setting, all of the printers installed on the host operating system are available in the guest operating system. This functionality is enabled through a partnership with ThinPrint, Inc.
  • VIX API for VMware Player — Software vendors can use the VIX functionality to add their own interface to the VMware Player menu bar.

Calculating the Moon Phase Part 2

January 4th, 2010
Posted in Web Development · Tags: ,

In an older post about Calculating the Moon Phase, I converted the some code I found to PHP. However the Lunar Phase Calculator has some more information (ecliptic latitude and longitude in degrees, the moon’s distance in Earth radii, etc.), the other one doesn’t, so I went ahead and converted it from JavaScript to PHP.
Read the rest of this entry »

RSS Cron Job

December 14th, 2009
Posted in Web Development · Tags: ,

If you are on shared web host, you might not have the ability to run lots of cron jobs or be limited to a certain number per hour or day. You might know about the “Poor Man’s Cron Job”, which is basically not to run a task (usually caching some data or fetching a feed, api, etc.) in the background until someone visits a page. Which isn’t ideal, because often the page will be slow or sometimes it won’t be up to date until the second visit (if you run that task after outputting the cached data).

Well one way to get around this is to setup an RSS feed for the data you are caching or outputting and access it with a query string such as “?rss=2.0″ or http://example.com/index.php?rss=2.0. Then you can check to see if the RSS variable was passed and output a RSS feed with just enough data for a feed, no need to put sensitive data in there or anything. I would suggest putting in a ttl node in the RSS feed and set it to something the aggregators like Google Reader, should obey (that way they hit your page more or less frequently, depending on your needs). The item portion of an RSS feed only needs a title or a description, although its probably a good idea to put some kind of guid in there (check the RSS 2.0 spec for more info on creating RSS feeds).

Anyway here is some sample code. It isn’t complete but gives you an idea what I mean.

if ($_GET['rss'] == 2.0)
{
//create RSS 2.0 feed
header('Content-Type: text/xml');
$output = '<' . '?xml version="1.0"?' . '>' . "\n";
$output .= '<rss version="2.0">' . "\n";
$output .= '<channel>' . "\n";
//...
//process your data and output it into RSS 2.0 format
//...
$output .= '</channel>' . "\n";
$output .= '</rss>';
}
else
{
//process your data as normal
}

Then to make sure the page is hit often, place your RSS feed into Google Reader or Bloglines or some other RSS aggregator. Then your site will be visited often and forced to update. No one else really needs to know about your RSS feeds, unless you want them to be public as well.

WordPress Email Exposure

November 3rd, 2009
Posted in Web Apps · Tags: ,

I’ve noticed WordPress’s blog by email feature has the possibility of allowing anyone to see other email addresses. This feature can be turned on in the Admin in Settings->Writings and then Post via e-mail. Let’s say you set that email address as wordpressposts@example.com, that address will stay hidden. However anyone that emails that address will can have their address exposed on your blog by going to http://example.com/wp-mail.php (assuming that’s where you have WordPress installed at http://example.com). Chances are most people will have this set to a cron job and have it check it every so often, but it might be possible for others to request the page beforehand. And when you do go to that page, it shows something like this:

Author is myworkaddress@example.net

Author: 1

Posted title: Some Blog Post Title

Mission complete. Message 1 deleted.

Thus, if you are using your a email address you’d like to keep private and you are emailing wordpressposts@example.com, that email address has the possibility of showing up to people. Which is not good if you email from the same email address that checks the posts. And even worse if you email from a email address for a user in WordPress and has the rights to post contents because the email will get “publish” status rather than “pending” and will go live on the site. And if someone has the email address that is a user and has posting rights, they can easily send fake emails from that address, because all WordPress checks is the From or Reply-To line (whichever it finds first).

It’s easy to prevent it from showing email addresses by opening up wp-mail.php and looking for this line of code

echo '<p>' . sprintf(__('Author is %s'), $author) . '</p>';

And this line of code

echo "\n<p>" . sprintf(__('<strong>Author:</strong> %s'), esc_html($post_author)) . '</p>';

And then you could comment those lines out by putting // in front of both of them.

I understand WordPress outputs this information so you can see logged from any cron jobs you have setup or if you visit the page manually, as a way of just knowing whats going on. However, it could be done better to prevent the addresses from being shown to everyone. A simple solution is to setup a query string and have a secretkey (don’t make this your blog’s password however). For example, lets say your blog is installed at http://example.com/, we are going to know require the following URL to check Posts via e-mail http://example.com/wp-mail.php?secretkey=abc123. And if someone doesn’t send the right secretkey, it won’t check the email address or echo anything out.

So before this line of code

/** Make sure that the WordPress bootstrap has run before continuing. */

Let’s add

if ($_GET['secretkey'] != 'abc123')
exit();

Feel free to change the secretkey to whatever you wish. You can also change it to be called something other than secretkey. If you have a cron job, you’ll have to point to that new URL as well http://example.com/wp-mail.php?secretkey=abc123. If you use the secretkey method you can leave the lines where it echoes out the email address if you like (the 2 lines I showed you could comment out).