24-volt Relay Controlling 120 volts

 

I decided I wanted to make 120 volt AC things get switched on and off via a 24 volt DC signal — so I bought a nice 10amp, 240volt relay at the local Circuit Specialists electronic store and started wiring stuff up as best to code as I know how. (Every time I see this kind of project online, there’s nothing but comments about how the featured project is totally unsafe… with very little in the way of recommendations on what “acceptably safe” would look like. So please, if you comment, do so by providing reference to alternatives that you’d find acceptably safe.)
relay wiring

First, I figured out which contacts on the relay go to which terminals on the relay socket. A multimeter and 24vdc bench power supply helped a bunch with this.

The first major issue was that this wiring scheme required 120vac power line to be on the same side as the 24vdc signal line — I had hoped to keep them separated on opposite sides, but that’s not how the socket was wired.

 

 

Continue reading

Debunking Lies about ObamaCare

Someone shared with me an article from the Forbes blog The Apothecary (link here: http://is.gd/5rTNEa — not a direct link because I don’t want to support the guy’s PageRank) which claims “Obamacare Will Increase Health Spending By $7,450 For A Typical Family of Four.” There was some debate about whether it’s misleading or not, so I checked it out.

The headline is misleading; “over 8 years” is a significant detail they conveniently omitted to generate clicks. The article projects an increase of $700-900 per year “average health spending for a family of 4.” But that’s a lie too. Well not technically, but practically speaking they’re lying. Here’s what the lie looks like, using the same data the author sourced in the article:

Truth: National Health Spending will increase by $62 billion per year MORE under the ACA than otherwise; in 2012, National Health Spending will be $5 trillion instead of $4.94 trillion.
–>
Lie: “ObamaCare will boost health spending by ‘roughly $621 billion'” (Yeah, that’s OVER TEN YEARS; $62b per year when we’re currently at about ~$3 trillion is way less scary than “600 billion!!1”) Continue reading

Troubleshooting PHP’s exec() or shell_exec() on Windows

So you’re trying to get some random program to work when you run exec() or shell_exec() via PHP in Windows; it works when you run it from the command line, but not when you run the same exact script via the web. Maybe it even returns an elusive 255 retval error code.

The first thing you should do is check file/folder permissions, and use utility commands like whoami, dir, and path to make sure things are sane. Also check if any settings (like cd, or set VARIABLE) are staying across multiple commands; usually they don’t, and you need to string them together && like && this or put them all in a batch file. But if all that doesn’t work, try this.

The last bit of environment to check when running something in Windows is, well, ALL THE ENVIRONMENT VARIABLES. There’s a lot of them. You can see them by running:
set
and likewise change them with:
set VARIABLE=value
In order to get my script working, I had to run set via the command line from the user I wanted it to run as (usually your WWW or Inet user) — after testing that the command actually worked from the command line, of course. Then I ran shell_exec(“set”) via the web and compared the outputs. There were a few missing or different environment variables, like HOMEPATH, TEMP, and APPDATA. Once I made them all match (a batch script helped for some reason) it worked like a charm.

Fixing a Honda civic 2007 si audio jack

The heat killed the 3.5mm line-in port on my car, it wouldn’t sense the cord being plugged in and I had to pull it to one side to get it to work. Fortunately you can pull off the cover and pull out the plug from the front without tearing apart the whole dash. Then I soldered a wire between the sensor pins so it’s always “on” (and I just switch audio sources with the buttons on the nav screen.)

image Continue reading

Rails Localization (i18n) tools

I’m tasked with localizing a huge Rails app, and it’s no fun, so I found some tools to help me and made a couple tools myself.

I now have a great script workflow that:

This workflow should take ten minutes aside from the part where you go through and add what the script missed. The Sublime plugins are especially helpful for reducing tedious <%= %> syntax.