Wednesday, November 26, 2014

Cygwin and Batch files

The two hardly mix, but sometimes they must. To invoke a batch file from cygwin run:

cmd /c mybatchfile.bat

And it's probably worth mentioning to invoke a batch file from a batch file use:

call mybatchfile.bat

Monday, November 24, 2014

Safety Razor

For all those that shave, I have started down the safety razor journey. Gillette gave me my first razor when I turned 18, and I've tried other razors but the Mach 3 has been my go-to razor ever since. I'm still a total newb to safety razors only having tried one twice to date, but those two shaves have been the best shaves of my entire life! I remember the day when my Grandfather switched from a safety razor to an electric for convenience. Old stuff is sometimes the best.

This safety razor thing seems to be very up coming hipster and there are a lot of options and sky is the limit on what you can spend. I settled on the Merkur Long Handled Safety Razor 38c. Blades are about 6 cents vs $2 or more for Gillette cartridges. Harry's is an interesting option that I might try one day.

The safety razor shave is better for sensitive skin and there are a lot of options for shaving creams which I've just started to research.

Wednesday, November 19, 2014

Android vs iOS

This can be a nearly religious subject for many people. But I'll break my reasoning down to why I prefer iOS.

First there are the technical reasons. When an android device manufacturer get the latest version of android that does not fun on the device, they start with the device drivers. Many of them come from QUALCOMM and Texas Instruments. The OS does not work by default unless the phone is purchased through Google play and is a Google enabled phone. There are a few of those such as the Nexus and certain Samsung phones but you pay more since the price is controlled better so the price of the device is very equivalent to an Apple device. The Motorola phones are getting close to having the ability to upgrade the OS directly but they aren't quite there. Any bugs in the device driver must be fixed in android or the applications. After a month or two of fixing bugs finally the device manufacturer can deliver the newer version of android to their customers. What I don't like about this is where the fixes go. Sometimes it makes sense to fix a bug in a device driver in the application layer, but more often than not it should be fixed in the device driver because those fixes are not portable between devices. And since each device manufacturer makes the modifications themselves those changes do not get percolated back to the android code base. It's a problem that Windows has had for years, but because Microsoft made all of the changes in the OS those modifications went with the OS and weren't solely owned by the device manufactured.

Apple on the other hand has control of the entire stack, which enables them to fix the bugs in the device driver. If they can't fix it in the device driver and there have been cases of this, such as the change of accelerometer chips, then they fix it in an application (Or for a while left it up to the application developer which was absolutely terrible). But this is where having complete control of the devices and the OS comes in handy because they have a small subset of devices (although it is growing and fragmenting but not near as bad as android) and making a change in the application layer isn't a huge deal.

The second technical reason is fragmentation. Because there are so many different devices and device manufacturers and they have the problems mentioned above there is a huge amount of fragmentation within android. This makes it very difficult for developers because an app that works on one device may not work on another device. Windows has had this problem for a long time but came out with much fewer operating systems so the problem was mitigated and as I described above the changes for the device drivers were made in-house. And Microsoft actually did a very good job insulating the developer which android has not. What this means is that users of applications suffer because applications may not work from one device to another and application developers life is pretty difficult. Most users in fact are running an older version of the OS. It's very typical in android space for users to not upgrade their device from the default OS that shipped with it. Now this does have some advantages because it's typical that a newer OS is not faster and by upgrading to the latest OS the older hardware has performance issues.

The third and final nail in the coffin for me is security. As of the time of writing this blog post android has no security to restrict applications usage of services on the platform such as camera, GPS, contacts etc. personally I view this as a non sequitur because without security it isn't something that I can use. This is compounded because of the android app store model. Apple scrubs each app very thoroughly which is not fun for the developers because they don't know if it will get accepted to the app store. But the advantage of this is that generally apps with malicious intent don't get through. It also helps that Apple is very draconian and once they find an issue they remove it. So the chances of downloading an app that will maliciously use services of the device is very high. Now I know android is working on a fix for this, and there was a version of it that some beginning stage of implementation but it was removed to be implemented from scratch and has not returned that I am aware of.

So there you have it, the reasons I can't even consider android. I would consider Windows phone over android.

Now some of those reasons above are reasons why other people can't consider iPhone, such as the lack of openness of the platform and app store. Or the lack of a user changeable battery or upgradable memory. I hear you and I totally agree but as I mentioned the App Store is a blessing in disguise for most users, especially those that don't want to dork around with their phones endlessly, and the memory and battery issues usually aren't much of a problem because the conclusion I've come to is the phone really only last three years anyway and at that point the resale value of an iPhone is considerably higher than android.

The other reason is time. Let me tell you a story. Back in 2003 because of the MS bash virus and a few other things the Missus' computer needed tweaking nearly every weekend. A Windows update would come out and it would break the printer driver or something. After what seemed like a couple years of doing this it seem normal, then she needed a Mac. Long story short why she needed one is her work used Macs and fonts between Mac and Windows are not the same. After a couple weeks I asked how things were going and she said fine. In month went by and she didn't ask for any assistance. I asked her how it was going and she said fine. This happened a few more times and then she said something that stuck with me since then, "it just works." Since then I've switched and it was a difficult transition because I thought everything was on Windows but I found I use Windows less and less. I still use Windows for certain tasks but "it just works" and I find that true with iOS as well. I can't tell you how many friends are using android and are constantly fussing with things. IOS and Mac are not perfect and you will run into things but this is my experience.

Monday, November 17, 2014

Unknown Caller

We've been getting a lot of robo calls on our home phone and cell phones. Unfortunately there really isn't any good way of blocking these. Service providers want extra money to block "Unknown Caller", "No Caller ID" or "Anonymous". The iPhone has a feature to block a contact but they need to have a phone number. I did some digging and it appears that the calls show up with simply a "1", sometimes. So I created a contact for these and blocked "1". We'll see how that works.

But, to my criticism. Phone companies need to stop trying to profit on this tactic. Any phone call needs to block-able by default. I know there are apps on Android that do this which one reason to want to switch to Android, which I'm starting to get a small list, but still doesn't outweigh the benefits of iOS (I'll post on this later). Every phone OS out there needs to have a very simple yet complete set of rules to block phone calls. And it would be very handy to block based on the caller ID text rather than the caller ID number.

I'm adding this to my iOS Feature Request post.

Thursday, November 13, 2014

Halloween 2014

Last years we did the Star Wars Cantina in our garage. This year we did Alice in Wonderland. If you've wondered why I haven't posted very much lately, it's because I'm still dealing with the cleanup!

This years I was the Mad Hatter. I even built an LED hat. Watch the video to see it in action. Soon I'll post instructions about how to built your own.

Wednesday, November 12, 2014

Open Source .NET

Parts of .NET have been open source for some time, but this looks like Microsoft will be open sourcing the entire thing!

Voice Recognition Microphones

A while back I got tired of typing since voice recognition has matured enough to be useful. And to be clear I mean voice dictation not digital assistants like Google Now, Siri or Cortina. Those are all terrible except for setting alarms.

One of the keys to successful voice-recognition is a good microphone. If you read negative reviews I have found 90% of the time it's because of the microphone and the reviewer/user doesn't even know it. The other problem is accents. A California accent works best.

I've tried a number of microphones on my Mac with varying success but the best one has been the Sennheiser ME3Andrea Pure Audio USB Adapter and Plug Adapter for Sennheiser ME3 has really good reviews if you want something different or to read reviews. The headset that comes with the Dragon Dictate software is a piece of junk. I do still use it in a pinch but it has no noise cancellation and it isn't as sensitive as other microphones. Note that the best microphones are headsets. Anything that sits on your desk and is more convenient will not work as well. If you're looking for something that sits on your desk, I have had very good success with the Yeti Blue microphone.

The Sennheiser does have a few quirks. It fits over the back of the head and over the years. The left side has a pad. The adhesive that holds the pad to the headset is lacking in adhesiveness. It will come off in about six months and I've been too lazy to figure out a solution, but I will post about a solution once I come up with one.

There are also a couple complaints that I have. It would be nice if the headset had a normal audio plug, but it has a screw style which makes sense given what its intended purposes; on stage so it does not come off, but not very useful if you are sitting at a desk because you have to buy another adapter. Also because the microphone plug on all computers is meant for a different purpose you need to get a USB audio adapter. Once you get everything working it isn't a problem. Below I provided three links to the headset, the adapter and a USB audio adapter to make it easy. You can also buy a kit from here but it costs more. It took me a ton of research to figure this all out so hopefully it saves somebody some time.

P.S. I wrote this entire article using Dragon for Mac and only made minor updates with a keyboard after.


Wednesday, October 29, 2014

ComPtr for Visual Studio 2010

If you aren't using Visual Studio 2010, then you might like to use this class if your doing C++ and COM:

template <typename T>
class AutoPtr {
    T* FData;
    AutoPtr(T* Value) {
        FInterface = Value;
    ~AutoPtr() {
        if (FData != NULL) {
    operator T* () const {
        return FInterface;
    T&amp; operator* () const {
        return *FInterface;
    T* operator->() const {
        return FInterface;
    T** operator&() {
        return &FInterface;
    T* operator=(const T * rhs) {
        FInterface = rhs;
        return FInterface;
    T* operator=(const IUnknown * rhs) {
        FInterface = rhs;
        return FInterface;

Tuesday, October 28, 2014


Constantly improving, kaizen, is something keep on the tip of my brain. And I think you should too.

Monday, October 27, 2014

Strip Invalid Identifier Characters

I don't do much Delphi anymore (any really) but this has been hanging around in my inbox for a while so I cleaned it up. This is a simple function that is a modification of IsValidIdent to strip invalid characters from a string.

function StripInvalidCharacters(const Ident: string): string;

  function Alpha(C: Char): Boolean; inline;
    Result := TCharacter.IsLetter(C) or (C = '_');

  function AlphaNumeric(C: Char): Boolean; inline;
    Result := TCharacter.IsLetterOrDigit(C) or (C = '_');

  I, L: Integer;
  L := Length(Ident);
  if (L > 0) and Alpha(Ident[1]) then
    Result := Ident[1];

  for I := 2 to L do
    if AlphaNumeric(Ident[I]) then

  Result := Result + Ident[I];

  LocalVal: string;
  LocalHash: Integer;
  if IsValidIdent(Value) then
  LocalVal := StripInvalidCharacters(Value)

Wednesday, October 22, 2014

Hamster Wheel

Since I'm into ergonomics a number of friends have sent me this link on the hamster wheel desk. I think it's very funny and I thought I'd share with everyone here.

In my opinion however, this is not very ergonomic. Studies have shown that holding onto the handle bars of a treadmill forces your upper body to be very static and not dynamic as you normally would when walking. This influences the dynamics of your walking in such a way that isn't natural and puts your posture in a position that you don't want. That can be applied to typing while you are walking as well. So while I think this is hilarious and I would love to actually have one I wouldn't recommend using one for long periods of time. In fact just get up and take a walk every 50 minutes for 10 minutes and you will be way better off. Also use a standing desk.

Tuesday, October 21, 2014


A simple design always takes less time to finish than a complex one. Maybe not always. But it should. So always do the simplest thing that could possibly work. If you find something that is complex replace it with something simple. It's always faster and cheaper to replace complex code now, before you waste a lot more time on it. Keep things as simple as possible as long as possible by never adding functionality before it is scheduled. Beware though, keeping a design simple is hard work.