2007-04-10

Windows MAC Addresses

There's at least three ways to get MAC addresses for Windows computers:

  • Open Network Connections applet from the Control Panel, Device Manager or run ncpa.cpl, then look at the properties of each network adaptor. This method is rather hit-and-miss and depends on the information provided by the drivers. My Intel PRO/Wireless driver shows the MAC address in the Advanced property sheet but the Realtek NIC driver doesn't show the MAC address at all.
  • In the command shell, enter ipconfig /all. ipconfig provides a lot of networking information and you have to look for the Physical Address field.
  • In the command shell, enter getmac /v. getmac provides just information about network adaptors.

The last method, getmac -v, provides just the required information. If you use the /fo csv option, you can even get the output formatted for a spreadsheet or database.

Why is it useful to know MAC addresses? If you're setting up a wireless router, you can restrict the computers that can use the router by specifying a list of allowed MAC addresses. If your company uses a software license manager such as FlexLM, you may need to provide the MAC address of your users' computers to your software vendor to obtain node-locked licences.

2007-04-04

Drag-and-drop and Alt-Tab

Unexpected but nice feature in Windows. You can grab and start dragging an object with your pointer, then use Alt-Tab to bring the required application window to the foreground where you can drop the object. Previously, I thought both the originating and destination windows had to be visible at the same time on the desktop for a drag-and-drop action. Useful if you usually maximize your work windows on your desktop. For example, if you have your Excel window maximized, then realise you have to insert a TXT data file, you can either locate the file using the file browser dialog or drag-and-drop from Explorer into Excel.

2007-04-01

OpenOffice 2.2 Database Connection

OpenOffice.org has released version 2.2 of their office suite. Seems to be just a bug-fix release. Having installed the latest version, I thought I'd connect the Base product to my test MySQL database. It should have been painless but I kept getting a JDBC driver could not be loaded error. After some head-scratching, it turns out that the MySQL JDBC driver had to be copied into the Java Runtime (JRE) ext folder. Here's how I set up a connection between OpenOffice and MySQL.

  1. Download and extract mysql-connector-java-5.0.4-bin.jar.
  2. Copy mysql-connector-java-5.0.4-bin.jar to C:\Program Files\Java\jre1.5.0_11\lib\ext\ folder.
  3. Start OpenOffice and select Tools / Options menu item, then select Java from the tree pane.
  4. In Java Options pane, select the appropriate JRE and select the OK button.
  5. In OpenOffice, select File / New / Database menu item.
  6. In Select Database step, select Connect to an existing database radio button, select MySQL from the drop down list, then press the Next button.
  7. In Set up MySQL connection step, select Connect using JDBC (Java Database Connectivity) radio button, then press the Next button.
  8. In Set up JDBC connection step, press Test class button. If your connector is copied in the JRE's ext, then the JDBC Driver Test dialog should report The JDBC driver was loaded successfully. If the test fails, it will report The JDBC driver could not be loaded. Close the test dialog and continue configuring your database connection.
  9. Enter the Name of the database (e.g. test), Server URL (e.g. localhost) then press the Next button.
  10. In Set up user authentication step, enter User name (e.g. root) then press Test Connection button. If the connection was unsuccessful, the Connection Test dialog should report Access denied for user 'X' to database 'Y'. Close the test dialog and press the Next button.
  11. In Save and proceed step, use the default options then press the Finish button. OpenOffice will prompt you to save the database connection as an .odb file.

Notes: OpenOffice doesn't find the MySQL driver class after setting the CLASSPATH in the Options dialog. Another bug is that I can't remove a wrong JAR entry from the Options dialog.

Virtual CDs with MagicDisc

Tired of inserting a key disk whenever you want to play a game? Worried that your kids might destroy your CD drive? Or just annoyed with Windows' Autoplay spinning up your CD drive each time you insert a new CD*. One solution: install a virtual CD drive. There's plenty available; I chose MagicDisc because the instructions were straightforward.

*Of course, you can also disable Autoplay. Here's one way:

  1. Run gpedit.msc.
  2. In Group Policy dialog, select Computer Configuration / Administrative Templates / System / Turn off Autoplay.
  3. In Turn off Autoplay dialog, select Enabled radio button.