November 2007
S M T W T F S
« Sep   Dec »
 123
45678910
11121314151617
18192021222324
252627282930  

November 21, 2007

Energizer Batteries

Category: Various — Josh @ 7:31 pm

A while ago I wrote to Energizer about an article I had read on-line. I didn’t put much effort into what I wrote. In fact, this is all I sent:

Please explain:

http://www.newstarget.com/PhotoTour_Energizer_Batteries_3.html

Basically, someone opened up an Energizer D-cell rechargeable battery and found that inside the big battery, there is a much smaller battery. Not only that, but the battery has a lifespan of only 2500mAh, which is comparable to other batteries (such as AA batteries) that are much, much cheaper. Surprisingly, I actually received a reply to my not so well-written inquiry. (I use an alias when doing stuff like this in order to track sources of spam. My name is actually Mr. Ebben.)

Dear Mr. Hajo,

Thank you for contacting Energizer and for your inquiry.

All Energizer NiMH batteries have the mAh capacity on the label. There is no deception concerning the battery capacity and the D size designation only represents the batteries physical dimensions. We have found that most D sized devices will work satisfactorily with the Energizer NiMH batteries and the rechargability of the product is a true advantage of this chemistry.

D size rechargeable batteries have historically used a smaller internal unit cell. The main driving force behind this design is to keep the battery affordable to the average consumer. High capacity rechargeable batteries are more expensive than our standard rechargeable D size battery due to the increased volume of materials needed. In addition, they require a higher capacity charger to deliver acceptable recharging times which are also more expensive. Our research indicates that the high upfront cost for the high capacity rechargeable batteries and special charger would discourage many users from trying these batteries.

Clearly a high capacity D size NiMH battery would be beneficial in certain applications but we have found that the market for this type of battery is minimal due to overall cost. Energizer will continue to evaluate this market and look for a cost effective opportunity for higher capacity NiMH batteries.

Thank you for contacting Energizer. If you need further assistance, please do not hesitate to contact us.

Wow. Well, first of all, this reply was much better than the one I received from Carl’s Jr. asking whether Hardees is superior because their logo advertises Charbroiled Thickburgers rather than Charbroiled Burgers (they said they’d contact me with more information and never did).

The Energizer reply does seem to make sense from an economical standpoint. It’s cheaper for them to sell lower-capacity batteries, regardless of the form factor. However, I really have to question whether these batteries are so expensive to make. I assume that Energizer still makes a hefty profit on their ~$12 rechargeable D batteries and that they’re trying to spin it so that it looks like the consumer is actually saving money.

In reality, many consumers probably don’t even know what ‘mAh’ is. They just think they’re getting a big battery. After all, shouldn’t a physically larger battery have more energy? That seems intuitive. Would it be impossible for them to make a higher-capacity battery and sell it for $12 and still make money? Well, I don’t have their R&D team so I can’t answer that question.

Finally, I also have to question whether a higher-capacity battery would actually require a “special”, “more expensive” charger. I will grant them that recharging a higher-capacity battery might take longer, but with a lower capacity battery, you’d just have to recharge it more often. Where’s the benefit?

Creating a PHP-based CSS style switcher

Category: computer guides — Josh @ 6:47 pm

If you look at the bottom of this page, in the footer, you’ll notice some (currently two) color bars. If you click one of the color bars, the “skin” of this site will change based on the color bar you clicked. I thought this would be a neat functionality to have, but I had a very difficult time finding pre-made scripts that would do exactly what I wanted. So, I came up with something, based partly on A List Apart’s guide. It works pretty well, is easy to configure, and is expandable to any number of styles. At some point I’m hoping to make it a little more portable (easier to configure). In the meantime, I’m learning my way around PHP, but I decided to post my style switcher in case it could benefit anyone else.

The style switcher uses cookies so that the stylesheet settings aren’t lost as the visitor navigates the site. The cookie duration can be set for a session only, meaning the next time the user visits the site, the default style is used. Alternatively, the cookie can be set for a longer duration so that the user doesn’t have to change the style on subsequent visits (this is how the cookie is set in the example).

Where you may wish to start is with a simple PHP script to set the cookie, based on input sent to it from a link or form. In the case of my site, when a user clicks one of the color bars in the footer, a variable is passed to the switcher.php script, which looks like this:

<?php
require( dirname(__FILE__) . ‘/wp-config.php’);
$style = $_GET['set'];
setcookie(’sitestyle’, ” . $style, time() + 864000, COOKIEPATH);
wp_safe_redirect(wp_get_referer());
?>

If you aren’t using a WordPress installation, the line beginning with “require” can be removed. You’ll have to change “COOKIEPATH” to include the path and domain name, as in

setcookie(’sitestyle’, $style, time() + 864000, ‘/’, ‘domain.tld’);

The line beginning with “wp_safe_redirect” would also be changed, maybe to something like:

header(’Location: ‘.$_SERVER['HTTP_REFERRER']);

There are probably better ways of doing this, but you’ll want to keep in mind the general idea of redirecting back to the page the user came from. Otherwise, they won’t be able to switch the style and reliably stay on the same page.

Anyway, you may have noticed that basically any text could be passed to the switcher script and saved into a cookie. This isn’t a huge deal since there aren’t really any benefits to a user intentionally garbling their cookie. Regardless, the next script will read the contents of the cookie and decide which style to use based on the contents. If the cookie contains something that isn’t expected, the script will simply use the default style. This script can be used directly with the page on which you’re actually setting the stylesheets:

<?php

$path = “http://www.joshebben.com/wp/wp-content/themes/main/”;

if (isset($_COOKIE['sitestyle'])) {
$style = $_COOKIE['sitestyle'];
if ($style == “default”) {
$style = $path . “style.css”;
}
elseif ($style == “contrast”) {
$style = $path . “style-contrast.css”;
}
else {
$style = $path . “style.css”;
}
}
else {
$style = $path . “style.css”;
}

?>

Following the flow of the program, it first checks to see if a cookie is set called “sitestyle”. If it isn’t set (the very final ‘else’), the default style will be used. If the sitestyle cookie does exist, the script checks to see what the contents are. If the contents are something unexpected (the second to last ‘else’), again, the default style will be used. Otherwise, a style will be chosen based on the predefined contents of the cookie. You could add more elseif statements if you wanted more style possibilities. Of course, keep in mind that each style requires an independent stylesheet with this setup.

Finally, you’ll need to replace your current stylesheet tag:

<link rel=”stylesheet” type=”text/css” media=”screen” title=”User Defined Style” href=”<?php echo ($style) ?>” />

This will grab the $style variable, which was just set a moment ago when the cookie was checked.

Feel free to adapt this and use it however you want. Thanks to the guide on A List Apart for providing a base for me to work with.

Contents of this website are (C) Josh Ebben. Do not repost any content without providing credit.

Temperance High Contrast Text Mode