DIY Raspberry Pi Zero “Clapper”

“Clap on! Clap off! The Clapper!”

This project will walk you through the creation of a DIY “Clapper”.  It uses the Adafruit MAX4466 Microphone Amp to detect when the claps occur, then sends an RF signal to RF-controlled power plugs.

Continue reading “DIY Raspberry Pi Zero “Clapper””

Kinect support for Raspberry Pi using libfreenect

Developing apps for the Raspberry Pi that utilize the Xbox 360 Kinect is best accomplished with libfreenect. Libfreenect is an open-source library that provides access to the sensors and motors on the Kinect.

Raspbian’s apt repository has version 0.2 of libfreenect, which is quite old and seems to be missing a lot of the features that the latest code has. I’ve documented the steps for building the latest LibFreenect source code and dependencies, below (0.5.3 as of this post).

Continue reading “Kinect support for Raspberry Pi using libfreenect”

Office 2016 and licensing error 0x8004FC12

Several people on the TechNet forums (and other interwebz sites) have encountered error 0x8004FC12 with Office 2013, 2016 and even Windows. It seems most of these cases have gone unresolved or only gotten fixed by refreshing or reinstalling Windows. I recently found myself in the same boat. When I would try to activate Office 2016, I received the error:

“We’re sorry, something went wrong and we can’t do this for you right now. Please try again later. (0x8004FC12)”

The application event log had:

“Acquisition of End User License failed. hr=0x8004C12”.

Continue reading “Office 2016 and licensing error 0x8004FC12”

Waiting (or “sleeping”) in a batch file

Commands like timeout.exe were added to Windows to make waiting in a batch file easier. Unfortunately timeout.exe still leaves much to be desired. There are several alternatives people use to simulate a delay in the Windows Command Prompt (cmd.exe).

Below you can see an analysis of the suggestions from this StackOverflow post, along with one additional suggestion I have that will increase precision (method 1 below).

The key factors I’m analyzing is the time precision of a command and I attempt to determine the compatibility with past versions of Windows. I also want this to work out-of-the-box with Windows and not require an external executable to be loaded.

My test consisted of the following methods:

  • Method 1: Custom Function
    Command: call :waitfor 5000>nul (see below for implementation details)
  • Method 2: Ping.exe (dummy IP, timeout)
    Command: ping.exe -n 1 -w 5000 >nul 2>&1
  • Method 3: Ping.exe (localhost, 1 sec between pings)
    Command: ping.exe -n 6 -w 1 >nul 2>&1
  • Method 4: Powershell.exe
    Command: powershell.exe -command "Start-Sleep -Milliseconds 5000">nul
  • Method 5: Timeout.exe
    Command: timeout.exe /t 5 /nobreak >nul 2>&1
  • Method 6: VBScript (cscript.exe)
    Command: echo WScript.Sleep^(WScript.Arguments^(0^)^) >"%temp%sleep.vbs" && cscript "%temp%sleep.vbs" 5000 >nul

Continue reading “Waiting (or “sleeping”) in a batch file”

Debugging Windows Service Projects (C#)

Many developers find it annoying to debug the built-in Windows Service projects in Visual Studio. You can’t simply create a new project and click the “Run” button in Visual Studio and expect it to run with a debugger attached, like you can with most other project types. Normally you would install the service, start it, and attach a debugger to the process, but this is a hassle and doesn’t help much if you need to debug issues in the OnStart method.

To solve this problem and help with diagnostics, I typically add some boilerplate logic to my Windows Service projects. By passing in command line args to my service .exe, I can either have it launch in a light-weight debug console or make it wait to call the OnStart method until a debugger is attached.

Continue reading “Debugging Windows Service Projects (C#)”

Launching RDP from KeePass 2.x with auto-login

Configuring KeePass to launch RDP:

If you manage all of your RDP connections through KeePass, you may notice there’s no direct or easy way of launching Remote Desktop Client and automatically logging into a remote machine.

The following few steps will help guide you through configuring KeePass to automatically launch an RDP connection through a menu item or accelerator key on that entry in KeePass.

Continue reading “Launching RDP from KeePass 2.x with auto-login”

Running Nokia and Samsung WP8 apps on the HTC 8x

There is a pretty well known proxy hack that will allow Windows Phone users to simulate other device manufacturers when visiting the Windows Phone Store. This allows you to download and install Windows Phone 8 software that is exclusive to other devices. As any HTC Windows Phone user probably knows, they’ve basically been left in the dust by HTC. HTC hasn’t provided any decent apps or updates in months and they seem to be totally neglecting their Windows Phone users. I feel like I made a huge mistake by choosing HTC over Nokia (and yes, I’m very bitter because of it).

So that leaves us with a few choices, either just deal with it and receive no updates or support from a company that doesn’t care about you, get a new phone (and the only way to go is Nokia if you want to stick with WP8), or use this hack to get some of the cool Nokia and Samsung features on your phone.

Continue reading “Running Nokia and Samsung WP8 apps on the HTC 8x”