HJCotton.net

August 15, 2010

Google Power Meter

by @ 6:04 pm. Filed under Tweet-A-Watt.

I had heard that the Tweet-A-Watt could now be hooked up to Google Power Meter, so I decided to give it a go. It’s actually pretty easy – I just followed the instructions here and had it up and running in a few minutes.

I have actually been trying to track down the cause of a recent increase in my electricity usage, and it’s more than likely to be the fault of the dehumidifier in my basement (I have a strong dislike for these things already, necessary though they are). This little guy actually draws a LOT of electricity, but I already knew that. Still, it will be really useful to see the power usage trends over time and find out what it really costs me to run. Given an average cost per kilowatt hour,  Power Meter will give you some useful figures back about the cost to run a device. Based on my latest bill from PP&L (is it worth switching?), my average cost has been 13 cents / kW h since the rate caps expired in PA.

google_power_meter

July 29, 2010

No need to read the privacy policy

by @ 9:43 pm. Filed under Humorous, Technology.

This is the confirmation dialog that appears when you install the Speed Tracer extension in Google Chrome.

Google Speed Tracer

“This extension needs access to: All data on your computer and the websites you visit.”

If only spyware installations were so up front about their intentions!

July 26, 2010

Attachment filenames containing special characters and cfmailparam

by @ 7:30 pm. Filed under Coldfusion.

When you use cfmailparam to attach a file to an email being sent within cfmail, you may get an error that the file cannot be found (even when it actually exists). I noticed this particular condition when the attachment filename contained a plus sign ‘+’, but it probably occurs for other special characters as well. It doesn’t appear that cfmailparam can handle these well, and they get replaced with spaces. Based on the blog posts I’ve read, there doesn’t seem to be a quick workaround.

<cfmail from="#fromEmail#" to="#toEmail#" subject="Email w/ Attachment" type="html">
    I attached this file for your review. I <strong>swear</strong>, it's not a virus!
    <cfmailparam file="#ExpandPath('FileC+D.doc')">
</cfmail>

The solution I ended up using? Use ReReplace to replace invalid characters. This means that the attachment’s filename will have to change, but it is the only workaround I could find.

In ColdFusion 7, you’ll have to do this when the file is uploaded or just prior to it being attached. In 8 and beyond, you may be able to skip that intermediary step of using cffile to copy and save the file in order to get the filename you want. Instead, you may be able to use the content attribute of cfmailparam to feed in the contents of the file and give the content the filename to use, as per Ben Nadel’s excellent post here.

July 25, 2010

Socialist!

by @ 9:46 pm. Filed under Humorous, Political.

Just one of literally dozens of great songs by Roy Zimmerman.

April 1, 2010

Attending NCDevCon?

by @ 7:41 pm. Filed under Uncategorized.

NCDevCon follows on the heels of the free CFinNC held in Raligh, NC last October. I attended CFinNC and was impressed with the overall quality of the conference. Granted, many of the presentations seemed to be re-badged presentations from CFUnited, but in the end, it matters not: you can’t beat the price for these presentations! There are plenty of inexpensive hotels within a few miles of the campus, so even though I’m an out-of-towner, this conference isn’t something that breaks the bank! See you there!

March 18, 2010

Ruby Arduino Development

by @ 8:32 pm. Filed under Arduino, Ruby.

My CPRuby presentation from Thursday, March 18 2010: “Physical Computing with Ruby and Arduino”

RAD-CPRuby03182010.zip

December 12, 2009

CF9 Ternary Operator

by @ 11:22 pm. Filed under Coldfusion.

Coldfusion 9 finally has a ternary operator. It’s certainly a lot prettier to use than an IIF(), and you won’t have to deal with those odd occasions where you need to use DE() to get things to work. Here’s an example of how it works in CF9 and the equivalent using an IIF() and a standard “if” (keep in mind that the loops are to demonstrate performance only – they are otherwise quite out-of-place):

<cfparam name="URL.name">
<cfparam name="URL.isLight">
 
<cfset startTernary = GetTickCount()>
<cfloop from="1" to="10000" index="i">
	<cfset beerName = !URL.isLight? URL.name & " is a good beer" : "No light beers in this list!">
</cfloop>
<cfset endTernary = GetTickCount()>
 
<cfset startIIF = GetTickCount()>
<cfloop from="1" to="10000" index="i">
	<cfset beerName = IIF(!URL.isLight, "'#URL.name# is a good beer'", "'No light beers in this list!'")>
</cfloop>
<cfset endIIF = GetTickCount()>
 
<cfset startIf = GetTickCount()>
<cfloop from="1" to="10000" index="i">
	<cfif URL.isLight>
		<cfset beerName = "No light beers in this list!">
	<cfelse>
		<cfset beerName = "#URL.name# is a good beer">
	</cfif>
</cfloop>
<cfset endIf = GetTickCount()>
 
<cfoutput>
	Ternary: #endTernary - startTernary#ms<br />
	IIF: #endIIF - startIIF#ms<br />
	If: #endIf - startIf#ms<br />
</cfoutput>

Even over 10,000 iterations, the ternary option is head-to-head with a standard if statement, and only slightly faster than an IIF:
Ternary: 62ms
IIF: 77ms
If: 62ms

I’ve always heard that IIFs were slow, but I’ve always found them so handy that I overlooked whatever the performance consequences might be. While noticeable in these tests, it’s not something that would affect most projects at all. These results are also backed up in this post by Ben Nadel.

I won’t be using CF9 in a production setting in the immediate future, so until then it’ll still be IIFs for me. Still, some of these new language improvements and features are definitely worth looking into (even if they should have been added long ago!).

WITF Car Donation

by @ 7:01 pm. Filed under Humorous.

Dear Hadyn,

Thanks so much for recently donating your car to public broadcasting through the Car Talk vehicle donation program. Your thoughtfulness resulted in a net gift of $35.00 to WITF.

Excellent! Almost enough for a case of good beer… but not anywhere near what the sticker suggests:

HJ Chevrolet Free2.jpg

November 4, 2009

Abandoned PA Turnpike (PikeToBike Trail)

by @ 8:25 pm. Filed under Adventures.

Last Saturday, Alison and I headed to see the “abandoned” portion of the PA turnpike, which is now an 8.5 mile trail. There’s all sorts of video and photos online about it, and it surprised me that I hadn’t even known about it prior to stumbling upon PikeToBike.org while looking up some Appalachian Trail info. Perhaps the biggest reason it’s worth going to see is that this section of the turnpike has been abandoned since 1968 and contains both the longest (and shortest) tunnels on the PA turnpike. The whole stretch has kind of a “Centralia, Highway 61″ feel to it because of the cracked roadway, illegal dumping and ample graffitti, but it is nonetheless quite a cool place to visit.

img_4131.jpg

PikeToBike has a lot of information about the trail. It’s not officially open, but is apparently well traveled. We didn’t encounter anyone the entire time we were there. The Sidling Hill tunnel is supposedly 1.3 miles long (I didn’t measure) and… far darker than I expected. The damp tunnels eat light! If darkness weren’t pressing in from outside, too, I’d have liked to explore the ends of the tunnels a bit more. There are some huge fans sitting on top of the entrance of the Sidling Hill tunnel that I’ll have to explore next time. There’s also an air space in the upper part of the tunnel that can be accessed, which would be pretty cool to get into had I been armed with a more powerful flashlight. It was kind of an eery feeling just walking/riding through this tunnel with such a limited amount of light. For some reason I expected to be crashing into abandoned vehicles, old mattresses and the homeless, but both tunnels are barren throughout. However, the effects of vandalism and time are apparant in the entire length of the tunnels and particularly on the tunnel entrances.

PikeToBike lists some of the projects that would be worthwhile on the property; including paving one of the four lanes (in order to make it accessible via road bike) and adding some minimal lighting the the tunnels. This is on top of tunnel maintenance and repair, which is also pretty badly needed. The roadway is pretty rough but is fine for mountain biking. If you’re going through the tunnels, bring a real flashlight!

Go check it out for yourself!

September 18, 2009

Weekend Project: Tweet-A-Watt

by @ 6:50 pm. Filed under Tweet-A-Watt.

I’ve been eying up the Tweet-A-Watt project for a few weeks now. I think the idea is pretty cool, taking an off-the-shelf power monitoring device (a Kill-A-Watt P3) and tying it to a wireless transmitter in order to get the data from the device to a PC. The tweeting part of the project doesn’t really interest me, but storing power usage data in a database would let me see some long term trends in electricity usage. I might even be able to quell the feeling I have that the “Reduce exterior moisture / Save energy” switch inside of my refrigerator doesn’t do anything.

What I tackled this past weekend was the construction of the wireless reciever (which plugs into my PC via a USB cable) and the transmitter that gets hooked up to the Kill-A-Watt. The entire parts list and assembly instructions are available from ladyada.net. I opted to get the kit out of simplicity. It’s a little pricey, but includes everything you need for the project.

The instructions are pretty good. Provided you are alright with a soldering iron, you can manage just fine – at least up until attaching the power and data wires to four individual pins on the tiny chip found on newer Kill-A-Watts. That part is a little trying. A helping-hands type device is a must have for a project like this and I know that it made things much easier for me. So did a new, super-tiny tip for my soldering iron.

I put the whole thing together according to the instructions and plugged it in. And… nothing happened! I got no display on the LCD and the XBee activity light didn’t blink. The super capacitor takes a while to charge up, but no matter how long I waited, I got no info out of it except for the fact that it would make the standard beeps when the buttons on the front of the unit were pressed. I took it back apart to double check the connections to the tiny chip underneath the LCD display and they seemed fine. I couldn’t see any possible short circuits, but I did read on the forums that it would be important to cut a pathway halfway through the foam on the underside of the display to let the wires out. I also filed a notch in the side of the PCB so that the wires would not be pinched. The LCD has to sit flat in the right location for it to work at all. I double checked the transmitting XBee and discovered that it was not working. I figured I must have fried it as X-CTU couldn’t even communicate with it when plugged into the USB cable. There are instructions about how to revive an XBee that has been put into sleep mode on the forums at ladyada.net. I had to perform the process a few times and it eventually started working again. Upon reassembly, I found that the LCD worked – but there was still no activity light. The LED flashes once when the Kill-A-Watt is plugged in, but that’s it. It works though, so I’m not complaining.

For the moment, the wattcher.py script available from ladyada.net is the extent of the logging I’m doing. By default, it logs to a csv file every five minutes. There is also code for connecting to Twitter and to Google App Engine. Eventually, I’d like to log to MySQL and display the power usage right on my blog. Someday…

tweet-a-watt-inside_smalltweet-a-watt_small datalog_small

Anyway, Tweet-A-Watt is a pretty cool and possibly useful project. It’s on the expensive side if you go the kit route, but no matter how you build it, you end up with parts that can be used on other projects (mainly, the XBee chips and their adapters) if you ultimately decide that this project is not what it should be.

HJCotton.net

pages:

categories:

search:

archives:

September 2010
S M T W T F S
« Aug    
 1234
567891011
12131415161718
19202122232425
2627282930  

So it goes.
— Kurt Vonnegut

general links:

Dscn0656.jpg

Dscn0656.jpg

01-23-2010

01-23-2010

other:

Page 1 of 6FirstLast

19 queries. 3.229 seconds