Rant

Too much comment SPAM

I just disabled comments because of too much SPAM

No votes yet

This is a ghost town ...

I haven't really felt compelled to keep this blog updated, and ever since I installed ghost on one of my servers, I am having a lot of fun writing stuff over there ... See you on the other side in 10
No votes yet

Conservative Electorate

Here is what I think is wrong with the republican electorate ...

  • prenatal exposure to pesticides is associated with lower IQ
  • farmers use a lot of pesticides
  • most rural areas overwhelmingly vote republican
Your rating: None Average: 3.9 (11 votes)

PHP casting an object to an array

This just cost me a day. I had a JSON structure that I wanted in an array.
{
   "10": {
      "foo": "bar"
   },
   "20": {
      "baz": "fup"
  }
}
So the easiest way to do this (I thought) would be:
$content = (array)json_decode($some_json)
but I could not access any array element event though I could clearly see that the key existed
print_r($content[10]);
PHP Notice:  Undefined offset: ...
After slowly going insane I found a stackoverflow post that pointed to this
If an object is converted to an array, the result is an array whose elements are the object's properties. The keys are the member variable names, with a few notable exceptions: integer properties are unaccessible; private variables have the class name prepended to the variable name; protected variables have a '*' prepended to the variable name. These prepended values have null bytes on either side. This can result in some unexpected behaviour:

This is fucking insane. Who comes up with this shit!?

Your rating: None Average: 5 (7 votes)

Guilty as charged

Your rating: None Average: 4.9 (11 votes)

iOS7: Do you want to trust this computer?

Don't we all hate when we plugin our iOS7 devices to our trusted Mac and suddenly the mobile device asks us "Do you want to trust this computer"? And we go, of course! We have been syncing together for a while, what about this sudden hostility?

Your rating: None Average: 4.7 (7 votes)

PHP case sensitivity @#&^%!

The other day I finally figured out why some people are so violently opposed to PHP. When using object oriented features of PHP5 I discovered the hard way that PHP has some weird, backwards compatibility issue rules how it handles case.

In a nutshell, variables are case sensitive, but function names, and object methods (!!!) are not.

That explains why the following code does not work

<?php
class A {
function
GET($url) {
 
// retrieve the url
}
}
class
B extends A {
private var
$foo;

function
get($var) {
  return
$this->foo;
}
}
?>

Your rating: None Average: 1.5 (2 votes)

IE keeps giving ...

A friend just told me a nice little "easter egg" of IE6 that is doggone hard to debug when one doesn't know about Redmond's little secrets plot to make a web developers life hell (me conspiracy theorist? never!)

Turns out that IE6 has a css file limit per page that kicks in with the 32nd file, where it simply doesn't seem to read the contents of the file. And if you are mindful of this and slap all your CSS into less than 32 files, the beast still gets you by the nuts because there also is a total CSS size limit.

Go do yourself a favor and download firefox ....

No votes yet

jquery href hover

Contrary to what you can find on the web, when trying to set the window.status when hovering over a link, you need to return false at the end of the hover function, otherwise the standard mouseover event is going to kick in overwrite your window.status

The following jQuery works

$('a').hover(function(){window.status=this.title?this.title:'';return false;},function(){window.status='';return false;})

If you return true, the window status is going to display the URL instead, which is the standard.

Your rating: None Average: 2.5 (6 votes)

Comment Spam Curbed?

Since several weeks I require captch for comment posting, and voila, no more spam in my comments! Well, I don't get a lot of comments anyways, so I don't know if commenting on my crap is not possible at all, or ... oh heck, as long as the spammers can't comment I am happy. All you other people who wish to contact me, you know who I am and how to get a hold of me ...

No votes yet
Syndicate content