Monday, November 13, 2006

PHP date strtotime Limitation

No Sheep » PHP strtotime Limitation

Faced this problem in PHP 5 when retreiving a datetime value from MySQL using mysql_result results in a proper date. But when I try to format it using date($format, strtotime($dateVal)), the function fails for dates prior to 1970. Online debates on the bug blamed it on the O/S's limitation to represent dates before Linux Epoch (Jan 1, 1970) in signed integer, which seems so lame. Anyway, found this article that works around the issue and fixed the problem for me.


powered by performancing firefox

Friday, October 27, 2006

Windows Update Error - RunAs component at fault

I kept getting an error message whenever I would try to manually install Windows Updates using Tools > WindowsUpdate on a Windows XP computer. On most computers, the update happens automatically through Group Policy from a single server except this one (because of which I realized it does not even have SP1 installed on it). Although, the Automatic Updates is set to automatically install every update I approve on the server, this one computer never got updated. I manually downloaded SP2 and installed it. Didn't fix the problem. I upgraded IE to 7.0. Didn't fix the problem. I realized that even some Group Policy rules did not get enforced on this computer. I don't know why.

When I googled the error message "Updates were unable to be successfully installed", someone mentioned that he had the same problem when trying to install from a administrative "runas" instance of IE from a non-administrative login. But that's how I always did it. Anyway, I logged out and logged in with an administrative account, and voila it installs just fine. I guess some instances of XP have the "runas" component broken.

Saturday, April 08, 2006

Colors ...

Found a nice utility at a website that suggests complemetary / combination colors depending on any color you choose.

ColorMatch 5K
http://www.colormatch.dk/

ColorBlender
http://colorblender.com/

Featured in Web 2.0 Awards
http://web2.0awards.org/

Saturday, April 01, 2006

AJAX

I tried implementing an AJAX call to retrieve the URL for a random photo to be displayed in a static html page.

A List Apart had a good article to get me started.
Getting Started with AJAX

Ran into a problem where IE implementation of XMLHttpRequest ActiveX Object automatically caches all GET requests. This wikipedia article about XMLHttp gave a workaround by inserting a dummy random parameter in the URL.

Tuesday, March 21, 2006

DIVs and Javascript

I just discovered that I cannot manipualte multiple DIVs using Javascript's document.getElementsByName().

Apparently, there is no legal way of using the name attribute for such tags such as div or span, according to W3C HTML 4.01 specs. You must confine the usage of this attribute to such tags as input, img, frame, iframe, form, map, param, meta, object, A, select, applet, textarea, or button.

Click Here.

So remember to use document.getElementsByTagName() instead and go through all DIVs and check for a user-defined attribute to achieve your goal. Although this seems inefficient if you have a lot of DIVs, it's legal and the DOM model should be efficient enough to not cause too much processing time.

Also bear in mind that replacing document.getElementsByName() with document.getElementsByTagName() may not be backward compatible with some older browsers such as IE4.

IE CSS Bugs

Wow! IE Bugs have been so prevalent that there are entire websites dedicated to workarounds. I've found the use for one today.

How To Attack An Internet Explorer (Win) Display Bug
http://www.communitymx.com/content/article.cfm?page=1&cid=C37E0

Table-less div pages are a boon, in the sense that it is very easy to manage / modify. But IE CSS implementation is so buggy that it can become a nightmare.

I had some nested divs that were static, absolute, visible, hidden, floating. Basically a reasonably complicated page for the intended look I wanted. Then certain divs starting behaving erratically when they would disappear along with text inside them. More popularly knows as ...

The Peekaboo bug
http://www.positioniseverything.net/explorer/peekaboo.html

Some basic hacks will help solve the problems.

- Whenever possible, give an explicit dimension to all block elements. This helps IE a lot.
- If you want to keep certain elements liquid, then use the following hacks

{position: relative}

This CSS code solves some IE bugs such as Eric Meyer's Punch Out Demo. Divs contained inside another, get hidden if you try to use them to hide the borders (for example) of the container div (using negative margins for example). By using the above CSS hack, this problem is solved without any side effects on other browsers.

The Holly Hack
{height: 1%}

When you need a liquid div and provide no dimensions to a div, sometimes IE fails to display it properly during resize, etc. This hack helps IE and solves the problem (only when the content actually exceeds the prescribed dimension of the div. Since 1% is small enough for even a little content, it works). Not exactly W3C compliant but it does. But this can have a side effect on other non IE/Win W3C compliant browsers. So we need to apply this and other such IE specific hacks in combination with other hacks.

To hide the holly hack side effect from IE5/Mac, use the IE5-Mac hack

/* Hides from IE5-mac \*/

/* End hide from IE5-mac */

The backslash at the end of first line serves as an escape character in IE5/Mac and any code in between the 2 lines is treated as comments.

Tan Hack

* html .buggybox {height: 1%;}

"* html" is an IE (Win and Mac) only specific CSS element and is ignored by other browsers. So the above code is an implementation of the Holly Hack using the Tan Hack.

Wednesday, February 22, 2006

DVD Packet Writing

I bought a cheap DVD Burner to archive my files and realized the free Sonic RecordNow software that came along with it does not support Packet Writing. The better versions support this, but of course have to buy it by spending at least $20.

Sonic Solutions: DLA (Driver Letter Access)
http://www.sonic.com/products/Consumer/DLA/

Found this reference for free packet writing software

Argentum: Backup Software Reviews
http://www.argentuma.com/backup/software/dla.html

The Dell DLA worked for me.

Dell DLA Version 4.95, November 2004, 9 MB

Monday, February 20, 2006

Breached! A Security Manager's Nightmare

Here is an article about how Google is influencing yet another aspect of the IT world. Forcing webmasters to redesign their architecture.

Breached! A Security Manager's Nightmare

Friday, February 17, 2006

Diagnostic Tools

Some useful diagnostic tools available on a bootable CD. Looks interesting.

http://www.ultimatebootcd.com/

http://www.ubcd4win.com/

Monday, January 30, 2006

CSS Order Matters

Order matters in CSS.

When you define text-decoration for an a tag as follows

a:link {text-decoration: none}
a:hover {text-decoration: underline}
a:visited {text-decoration: none}


visited links do not get the hover style. They continue to use the visited style, since that is the last defining attribute. The following is the right way.

a:link {text-decoration: none}
a:visited {text-decoration: none}
a:hover {text-decoration: underline}

Wednesday, January 25, 2006

Mike Davidson: Converting CGI Movable Type Templates to PHP

Mike Davidson: Converting CGI Movable Type Templates to PHP

Was thinking of using MovableType, but my hosting provider has only PHP for my cheap account. This might help convert the perl templates to php and use it. Let's see.

Tuesday, January 03, 2006