What Exactly Are ATL’s BEGIN_COM_MAP, END_COM_MAP, and COM_INTERFACE_ENTRY Macros?

There are many places where ATL’s COM_MAP macros are documented, but I haven’t seen it plainly stated what they actually mean.

Simply put, BEGIN_COM_MAP implements _InternalQueryInterface. COM_INTERFACE_ENTRY indicates that your class supports the specified interface. END_COM_MAP finishes the _InternalQueryInterface implementation.

Note: A QueryInterface implementation which calls this _InternalQueryInterface method must either be hand-coded, or supplied by CComObject, CComAggObject, etc.

For example:

class MyClass :
    public CComObjectRoot,
    public ISomeInterface
{
public:
    BEGIN_COM_MAP(MyClass)
        COM_INTERFACE_ENTRY(ISomeInterface)
    END_COM_MAP()
};

CComClass myInstance = new CComClass;

The COM_INTERFACE_ENTRY line indicates that MyClass implements ISomeInterface. If QueryInterface is called to requests an ISomeInterface pointer, the call will succeed. Without the COM_INTERFACE_ENTRY line, the QueryInterface call would fail.

Posted in C++, COM, Technology, Windows | Leave a comment

Skype 5.5 Cannot Display Asian Characters

After upgrading to Skype 5.5, I found that Japanese and Chinese characters showed as a series of boxes. I could type or paste them and they would be visible on the other end, but not on my end. Similarly, if the other person wrote Asian characters, they would not render correctly, like this:


A temporary fix is to change the IM font to Arial Unicode MS, which may have to be enabled from the control panel. Here are the steps:

  1. In the Skype menu, select Tools | Options, then click on “IM & SMS”, then “IM appearance”:


  2. Click on “Change font” to bring up the font dialog:


  3. If “Arial Unicode MS” is available, select it, click OK, then Save, and you’re done.

    If “Arial Unicode MS” is not available, then click “Show More Fonts” to bring up the Control Panel’s Font selector:


  4. Locate “Arial Unicode MS”, click on it to select it, then click on “Show” in the toolbar. Close the Fonts window (click the red X). You will have to close the Font dialog as well, then reopen it, in order for the Arial Unicode MS font to be displayed.

Posted in Technology | Leave a comment

Things That Suck: Ubuntu Unity

I just upgraded my virtual machine to Unity. All the negatives I’d read rang true. The interface really does seem like a poor copy of OS X, for tablets. Complaints are often dismissed with a curt suggestion to switch distributions. However, there is an inescapable truth:



If the #2 Google suggestion is “your product sucks”, you can take it as strong evidence that you’ve made a poor product development decision.

Personally, I’m rolling my virtual machine back to a prior snapshot.

Posted in Linux, Technology | Leave a comment

Virgin Mobile USA – No Data Connection (3G)

If you’ve been battling Virgin Mobile USA’s technical support drones and have been unable to get 3G data access, check that 3G data is enabled on your phone.

From the main screen:

  • Press the menu button
  • Select Settings
  • Select Wireless & Networks
  • Scroll to the bottom of the menu and select Mobile Networks
  • Make sure “Data Enabled” has a green check mark next to it

Virgin Mobile USA (i.e. Sprint) was unable to solve this after three phone calls over the course of a day. Their technical support script jumps straight into cellular network settings and battery removal.

Posted in Technology | Leave a comment

Activating a Virgin Mobile Phone in a Different Area Code – Vanilla Visa Payment Problems

As an experiment in semi-anonymity, I thought I would see if I could activate my Virgin Mobile Optimus V in a more desirable area code than my own. After a bit of research, I decided to buy a $50 Vanilla Visa prepaid debit card from Walgreens. They claim the card can be used for online purchases, but you’ll need to register the card and provide a zip code for verification. You can enter any zip code you like, and no personal information is required.

I was able to successfully create an account with Virgin Mobile in the desired area code. However, the payment was rejected. One possible reason is that Virgin Mobile may not be able to process a credit card with an expiration date so far in the future. The initial payment form used a text field for expiration year, so I could enter anything I wanted. When I revised my payment method, the web form only allowed selection up to, I believe, 2016. After I changed my payment method to a different, real credit card, the account was activated (though I still had problems with the phone being activated on the network).

So, first off, I’m pretty sure you could get the Virgin Mobile phone number in any area code you want, anyway, because the first step in their registration process asks your zip code. Billing is done at a later point in the process, with its own zip code field. Second, Vanilla Visa cards claim they can be used online, but since they have expiration dates far in the future, the website you want to buy from may not be set up to process them correctly. Basically, the entire process was interesting, but a waste of time.

At some point, it might be fun to try again using a pseudonym. When the online payment fails, one could call and attempt to resolve the payment over the phone. The effort involved would quickly exceed my interest in anonymity, but it might be a fun exercise.

Posted in Technology | Leave a comment

Source Control Use: Git, Mercurial, Bazaar, DARCS, Subversion, Team Foundation Server, CVS

What version control system is really most popular? Not in terms of getting mentioned on blogs, but in real-world terms of jobs?

Source: this HN comment, though I added CVS to the mix.

Posted in Technology | Leave a comment

Getting Started with Android Deployment and Debugging

As usual with Android, getting started on a process usually involves a few hiccups. Here is a complete list of the steps it took for me to get started with deploying apps directly to my Android phone from my Windows development box.

  1. Install the Android SDK.
  2. Add the Android SDK’s Platform Tools directory to your path (so that you can run the adb tool).
    • Click Start
    • Right click on Computer, select Properties from the menu
    • Click Advanced System Settings on the left
    • Click Environmental Variables
    • Double-click on PATH in the User Variables list, append a semicolon and the Android SDK Platform Tools folder [e.g. ";C:\Program Files (x86)\Android\android-sdk\platform-tools"])
  3. Install the ADB driver for your device.
    • If you have a Google device (e.g. Nexus One), install the Google ADB driver.
    • If you have a non-Google device (e.g. LG Optimus V), search for “[your device brand and product name] adb driver”, which should turn up the necessary driver. Using the example of the LG Optimus V (VM670 aka LG LGP500), the LG Mobile Support Tool must be installed (be prepared for a uniquely awful user interface).
  4. On your Android device, go to Settings | Applications | Development. Enable USB debugging. You might as well enable the other two options, as well.
  5. Plug in your Android device.
  6. Create and compile an Android project. Locate the .apk file, which will be in your project’s bin directory.
  7. Open a command prompt and type, adb install pathToYourPackage.apk. If you have an emulator running, you may need to tell adb to only reference the USB device with the -d switch.

    Incidentally, I had some trouble getting my PC to recognize the Android over USB initially. It took a few minutes for me to realize that the power adapter for my USB hub had come unplugged.

Posted in Android, Technology | Leave a comment

Saving Money on Arduino Basic Starter Kit

Several sites are selling Arduino “basic starter kits” for around $55. That’s not a bad deal, but they tack on around ten dollars in shipping! These kits generally include:

  • Arduino UNO board
  • “Getting Started with Arduino” book
  • Breadboard
  • Jumpers
  • USB A to B cable

I put together my own bundle on Amazon, with free shipping, which costs significantly less:

The total price was $42.84, with free shipping. I saved $22, and the only things missing are a USB cable and some wire jumpers for the breadboard. I have a $2 roll of solid core wire from the local electronics shop for jumpers, and who doesn’t have USB cables laying around?

If you really want purpose-built jumper wires, I have read good things about the NKC Electronics 70 pack ($4.95 + $4.75 S/H) and the CanaKit Premium 30-pack ($7.95 + a whopping $12.52 S/H) looks like it has very high-quality, rectangular connectors.

Posted in Electronics, Technology | Leave a comment

Eclipse for Android: No Build Targets

I installed the Android SDK and the Eclipse IDE for Java and Report Developers, but when I tried to create a new project, the Build Target list was empty.

I had already followed the instructions given in this newsgroup post:

  1. Run the Android SDK and AVD Manager from the Start menu or a command prompt (Start | All Programs | Android SDK Tools | SDK Manager, or C:\Program Files (x86)\Android\android-sdk\tools\android.bat). Do not run it from Eclipse’s Window menu: the Settings tab won’t be available!
  2. In Settings, check “Force https:// … sources to be fetched using http:// …”.
  3. In Available Packages, if “Android Repository” is not present, then:
    1. click Add Add-on Site.
    2. enter “‘https://dl-ssl.google.com/android/repository/repository.xml”.
    3. check “Android Repository” then check the desired APIs and SDKs.
    4. click Install Selected.

Unfortunately, I still had no targets available in Eclipse. It turned out that problem was that I had no path configured in Eclipse for the Android SDK! This should have been obvious, since when I selected Window | Android SDK and AVD Manager, Eclipse complained that no path was set, but since I always lauched the SDK & AVD Manager from a command prompt, I never received the error dialog. The solution was to open Window | Preferences and browse to C:\Program Files (x86)\Android\android-sdk, then press Apply:

Posted in Technology, Uncategorized | 1 Comment

Enabling Wake-On-LAN on a Toshiba Satellite A505

This post describes how I fixed my Wake-On-LAN problem using the powercfg tool. My Toshiba Satellite A505-S6986 wouldn’t respond to magic packets sent over the network.

Before using powercfg, I first checked the following:

  1. Wake-On-LAN was enabled in the BIOS.
  2. All settings related to Wake-On-LAN were enabled in the adapter’s Advanced properties tab:
    • Shutdown Wake-On-Lan
    • Wake on Magic Packet
    • Wake on pattern match
  3. All wake-related settings were checked on the Power Management properties tab:
    • Allow this device to wake computer
    • Only allow a magic packet to wake the computer

Even with these settings configured properly, my laptop still wouldn’t respond to magic packets.
First, I opened a command prompt as administrator. A regular user doesn’t have the access rights to change power options.

Then, I checked to see if the LAN adapter is in the list of devices which can wake Windows:

C:\Windows\system32>powercfg -devicequery wake_armed
HID Keyboard Device (002)
HID-compliant mouse (001)
Logitech USB Wheel Mouse (004)

The Ethernet adapter isn’t in there, so I looked at the list of wake-programmable devices in order to find out the name of my LAN adapter:

C:\Windows\system32>powercfg -devicequery wake_programmable
HID-compliant device
Realtek PCIe FE Family Controller            <=== LAN adapter
HID Keyboard Device (002)
TOSHIBA Software Modem
HID-compliant mouse (001)
HID-compliant consumer control device (001)
Logitech USB Wheel Mouse (004)

Finally, I enabled wake for my Ethernet device, using the name "Realtex PCIe FE Family Controller":

C:\Windows\system32>powercfg -deviceenablewake "Realtek PCIe FE Family Controller"

(if you see an error like, "Invalid Parameters -- try "/?" for help," it most likely means that you mistyped the device name)

I am now able to wake my laptop from sleep and hibernate modes using the Wake On Lan app for my Android device.

Posted in Technology, Windows | 1 Comment