PowerGenix NiZn batteries

3 Mar 2010 In: General

nizn battery

I managed to pick up a PowerGenix 4-pack of NiZn (Nickel-Zinc) rechargeable batteries and a charger while I was at the International CES in Las Vegas - I saw them demoed at Lunch@Pieros and they were nice enough to donate a pack.

Well, that was back at the beginning of January. I've had them in my Wiimote since then, and my battery is still at 100% from a full charge. I thought they were full of bologna, telling me that it was the "next generation" of battery technology, geared towards high-draw use - seriously, how many times have we heard this in the past?

I have a pack of NiCds gathering dust now. They would be on their 37th charge if I was using them in my Wiimote this long.

It seems like we've finally seen a STRONG contender towards alkaline AA's. These batteries even put out 1.6v, a little more than most AA's, and the same as the best high-capacity lithiums. I really don't have to mention that it puts the 1.2v of NiCd rechargables to shame.

And another thing, they are cheap.

20 Feb 2010 In: General

for some reason, node_save was timing out inside of a hook_workflow block. hook_workflow is passed the operation, old state, new state, and the node being operated on.

 
function custom_workflow($op, $old_state, $new_state, $node) {
        $new_state_array = workflow_get_state($new_state);
        $new_state_name = $new_state_array['state'];
        if ($op=="transition post")
        {
                if ($new_state_name=="Published")
                {
                        $node->status=1;
                        node_save($node);
                }
        }
}
 

this wasn't working. when the workflow changed to Published, the page would hang and then die. it processed the node save, but the workflow never advanced. I'm not entirely sure why, but this quick fix made it work:

 
function custom_workflow($op, $old_state, $new_state, $node) {
        $new_state_array = workflow_get_state($new_state);
        $new_state_name = $new_state_array['state'];
        if ($op=="transition post")
        {
                if ($new_state_name=="Published")
                {
                        $node = node_load($node->nid); //here
                        $node->status=1;
                        node_save($node);
                }
        }
}
 

don't ask me why reloading the node (which was...already loaded) made it work. I just had a feeling that maybe something inside the node object hook_workflow was giving me might have been wonky. works perfectly now.

actually just posting this so I'll google it in the future and will get to this page. for some reason sound only comes out of the front speakers and is impossible to route to any others. adding this model parameter makes it happen.

/etc/modprobe.d/local.conf

options snd-hda-intel model=6stack

rinse and repeat, I mean, reboot

ten what?

7 Oct 2009 In: General

A man goes in to see his doctor, and after some tests, the doctor says, "I'm sorry, but you have a fatal disease."

Man: "That's terrible! How long have I got?"

Doctor: "Ten."

Man: "Ten? What kind of answer is that? Ten months? Ten years? Ten what?"

The doctor looks at his watch. "Nine."

i play maximal

16 Sep 2009 In: General

mysqli prepared statements

15 Sep 2009 In: General

one way to make sure that sql injections NEVER happen is to use a prepared statement

perl has been doing it for ages, so by now it should be mainstream, yeah? I wish. but if you're behind the curve, no worries, here's how to do it. this is for a simple contact form.

 
$stmt = $mysqli->stmt_init();
//prepare the statement, use ?'s for where you want to put variables
$stmt->prepare("insert into tbl_contact(contact_fullname,contact_phone,contact_email)
							values (?,?,?)");
//bind your variables to the statement, in order. "sss" means string-string-string
$stmt->bind_param("sss", $_POST['fullname'], $_POST['phone'], $_POST['email']);
$stmt->execute();
 
  • use a question mark for every time you want to use a variable
  • for bind_param, the "sss" means I am going to be substituting 3 strings for the question marks. if I said "sis" that would mean I have one string, then an integer, then a string

still using Internet Explorer 6? why? I could go on and on about specifically why you should upgrade from an almost 10 year old piece of software, but I'll keep it simple.

web programmers have to develop with all users in mind (well, they should). but, developers shouldn't be wasting time trying to ensure that their feature-rich website has backwards-compatibility with archaic software such as IE6.

IE6 is a detriment to progress in web-based technologies, and degrades the overall user experience.

SO: the point of this post!

please visit http://www.browserforthebetter.com

this website will donate 8 meals to Feeding America for each upgrade to IE8 through September 30th. it's FREEand I promise you, it's the same internet...just better.

About this blog

Just a blog about my journeys through PHP...oh, and life