Tuesday, April 6, 2010

Add Facebook friends' birthdates to Google calendar

Here is a Perl application which add all your friends birth dates in your Google calendar:

run it like this:

perl facebook_gcal.pl --google_user yourgoogleaccount

some features still need improvement like make events recurrence. now it just add all birth dates in 2010. you can change it if you like :)

*The script need following modules:

install them with this command:


Tuesday, January 12, 2010

Edit magic

Use following command in Firebug to edit any webpage inline:

document.designMode= "on";

Then click on any text in page and edit that. you can play with images size also.

Sunday, January 10, 2010

Javascript Testing

Testing javascript codes needs proper design otherwise it can be a headache. Here i want to suggest a testing technique, which may be immature and can be improved.
Write assertion function like this :

function assert(expression, comment)
var currentTime = new Date();
var caller = arguments.callee.caller.name;
var error_message = currentTime.getTime()+"\nASSERTION FAILED: '"+comment+
"' \nCALLER: '"+caller+"'";
return 0;
return 1;

Then use it like this to check if the current condition is acceptable or not( you can check precondition at the beginning of each method and postconditions at the end):

function sortArray(input_array)
if(!assert(input_array, "input_array is undefined")) return 0;

//do the sort stuff
var sorted_array = ...

This way you can have much cleaner code instead of cheking each parameter one by one with "if" statement. You need to define two method "showError" and "log". Simple definition of "showError" can be an alert. and for "log" function you can report the erro via ajax call to server or just log it in Firebug console. After this you should never see blocks like this in your Javascript code:

alert("error"); // or any thing else
return 0;

Friday, August 21, 2009

IE8 Session problem in IFrame

Yesterday i've worked about a day to find out why my application authentication is not working well on IE8. it was working fine on all other browser but IE8.

IE started to implement P3P privacy policy from version 7. IE8 default privacy setting need P3P header. after lots of investigation found that some of the responses for css didn't have P3P header,
then adding following line to apache config solved issue:

"P3P" "policyref="/w3c/p3p.xml", CP="NON CURa TIA"