Update 12th May, 2006

I have been so robotic that I cant find an appropiate title for my posts. Maybe someday I will turn into a complete robot and start writing in binary format. These days I spend a very critical time. My wife is pregnant and her delivery date is 23rd or 24th next. So I have to goto market to buy necessary things. Last week there was a deadline of escenic project, We met that successfully, but the debug part still continuing. It is actually a long term project, so I will work for this project upto end.

I am about to sign my contract paper with Packt about my new book. So spending also a very busy time writing that book. 5 chapters almost finished, I have to deliver 4 more chapter. Soon I will publish the details.

After reviewed by Ajaxian, zephyr got a huge response and I am also receiving many emails. But unfortunately I am runnign out of time to reply them all. I replied some of them, but I really feel the necessity to reply them all. Because a project could not live longer if the support system is weak.

I am about to take a long leave for 3 weeks from my office. Somewherein offers all the standard facility which you cant even imaging in some IT firms in Bangladesh. Well, thats why probably I am enjoying working in somewherein for more than one year.

Janina keno still there is something ja mon kharap kore dey majhe majhei. tension kaj kore khub beshi. Hoyto asolei robot hoye jacchi. Robotder abar feelings bole kichui thakena. 🙁

Hoytoba amar lekha kobitata tumi
Porona ar, ghum jokhon asena
Chokh buje kolponate megher sathe ar
purono diner moto veshe berao na

Akash tomar somoy hole ektu themo
Amar kichu prosner jobab diye jeo
Ar kotokal thakbo boshe kar ashay
Evabe je amar din kete jay…

Hallelujah

I’ve heard there was a secret chord
That David played, and it pleased the Lord
But you don’t really care for music, do you?
It goes like this
The fourth, the fifth
The minor fall, the major lift
The baffled king composing Hallelujah

Hallelujah, Hallelujah
Hallelujah, Hallelujah

Your faith was strong but you needed proof
You saw her bathing on the roof
Her beauty
in the moonlight
overthrew you
She tied you
To a kitchen chair
She broke your throne,
she cut your hair
And from your lips she drew the Hallelujah

Hallelujah, Hallelujah
Hallelujah, Hallelujah

Maybe I’ve been here before
I know this room, I’ve walked this floor
I used to live alone before I knew you
I’ve seen your flag on the marble arch
love is not a victory march
It’s a cold and it’s a broken hallelujah

Hallelujah, Hallelujah
Hallelujah, Hallelujah

There was a time you’d let me know
What’s real and going on below
But now you never show it to me do you?
Remember when I moved in you?
The holy dark was moving too
And every breath we drew was hallelujah

Hallelujah, Hallelujah
Hallelujah, Hallelujah

Maybe there’s a God above
And all I ever learned from love
Was how to shoot at someone who outdrew you
It’s not a cry you can hear at night
It’s not somebody who’s seen the light
It’s a cold and it’s a broken hallelujah

Hallelujah, Hallelujah
Hallelujah, Hallelujah

Number of dates in a month

Find numbers of day in a month

Well, that may be a tricky question but if you are oversmart, well that is no problem at all. take a look at the following code

<?
//total number of days in march, 2006
echo Date(“t”,strtotime(“04/0/2006”));
?>

so do you get the point? when you just set the day=0, that also means the last day of previous month.

Dont use “d” in your dateformat string cause it wont return the expected value for PHP 5.1.1 and laters. Use “t” which works pretty fine for all PHP versions.

Creating Action Queue for AJAX Calls

In ajax, there are several cases where you need to call a bunch of actions synchronously. That means one action must finish before another one called. You can do it by checking the status of ajax request of previous calls and if that was in finished state, you can call next action. This process may be resource extensive if you dont care for checking. So here is a simple actionChain object which will help to put numbers of actions in a chain (or you better say, queue) and call them one of after one smartly. I just demonstrate how it works

<script>
var actionChain = {
curIndex: 0,
actions: new Array(),
fire: function()
{
if (this.curIndex<this.actions.length)
{
alert(this.actions[this.curIndex]);
this.callback();
}
else
{
alert("finished");
}
},
increase: function()
{
this.curIndex++;
},
addAction: function(actionName)
{
this.actions[this.actions.length] = actionName;
},
initialize: function()
{
this.curIndex=0;
this.actions = new Array();
},
callback: function(){}
}

actionChain.callback=checkVar;

function checkVar()
{
actionChain.increase();
actionChain.fire();
}

for(i=1;i<11;i++)
actionChain.addAction("hello"+i);
actionChain.fire();

actionChain.initialize();
for(i=1;i<4;i++)
actionChain.addAction("hello"+i);
actionChain.fire();
</script>

so here you see, an actionChain object is created and then we add some actions. Then we call the fire() method. This fire() method simply invoke callback function with current action in queue. And the call back function just increases the counter. So when the counter reaches at final offset, it will terminate.

Here I show a basic demo, just modifying it a bit you can create your full fledged ajax action chain object ( i mean a proper object which stores the action, their url, parameters and response callback etc…)

Thanks

Dive into greasemonkey

Mark pilgrim wrote the book “Dive into greasemonkey” which is a cool book to start with. If you want to read it online, just visit this url

http://diveintogreasemonkey.org/

For those who are interested to know what is greasemonkey, read this intro taken from that book.

Greasemonkey
reasemonkey is a Firefox extension that allows you to write scripts that alter the web pages you visit. You can use it to make a web site more readable or more usable. You can fix rendering bugs that the site owner can’t be bothered to fix themselves. You can alter pages so they work better with assistive technologies that speak a web page out loud or convert it to Braille. You can even automatically retrieve data from other sites to make two sites more interconnected.

Greasemonkey by itself does none of these things. In fact, after you install it, you won’t notice any change at all… until you start installing what are called “user scripts”. A user script is just a chunk of Javascript code, with some additional information that tells Greasemonkey where and when it should be run. Each user script can target a specific page, a specific site, or a group of sites. A user script can do anything you can do in Javascript. In fact, it can do even more than that, because Greasemonkey provides special functions that are only available to user scripts.

Zephyr Beta 2.0 Released

visit : Zephyr

After a long time since the beta 1.0, today we released the second beta versionof zephyr. It is more optimized than the previous one. This version comes with many new features but major improvements are

1. Prototype is now a part of Zephyr
2. SQLite support
3. Multilevel Filters
4. Multiple pre action processors
5. Supports Multiple database concurrently (From same/different providers)
6. Overall performance tuning
7. Embeded script execution
8. Multibyte strings are supported
9. Package Initializers

We have worked hard to make this release. We hope we can release its final version pretty soon.

Download : Here

Zephyr Beta 2 : Upcoming Features

Yesterday night I added some great functionality in zephyr. Developers can use “Filtersâ€? in zephyr packages. In primary stage I just implemented two type of filters, one is “pre-filterâ€? and another is “post-filterâ€?. Pre filters are a simple object which is invoked when visitors input data. Before passing these data to actions, zephyr will call “process()â€? method of pre filter object. After processing them, these data will be passed to action.

Pre filters are of great use of you want to implement some sort of input filtering. Beside submitted data from users, Prefilters will also receive the action name which is responsible to handle those data. So it will remain flexible to developers.

Second type of filter that I implemented is “postfilterâ€?. After rendering the view, this filter is invoked with the rendered content and action name. So developers can polish the rendered output if they need to.

Day by day I will also add filter in different execution level of zephyr core. I am also planning to implement JSON support in zephyr. Here is a comprehensive list of implemented features for upcoming version of zephyr beta 2.0

1. Multiple Database Support (For both same provider and different provider)
2. SQLite support
3. Prototype is now a part of zephyr. So users can take advantage of this great library.
4. Automatic display of “loadingâ€? image when an action is called.
5. Multiple PHP file loading capability
6. Multiple Javascript file loading capability
7. Multiple pre action processors
8. Supports exchanging non printable characters as response and request.
9. Easy loading of PEAR packages.
10. Package Initializer, a special object that will be invoked while loading the package for first time.
11. Abstract DBInfo class, to simplify sharing db information.
12. flexible execute() method in DAO
13. Better exception management.

Zephyr : Preparing for Beta2

zephyr2.jpg I start development of second beta version of zephyr. This time I got two fellow developers with me. One is Raisul Kabir from Paradigm, an Exceptionally expert javascript and actionscript developer. He can contribute his expertise to upgrade the ajax experience of zephyr. Another one is Ramesh Bhardawaj, a decent developer from a1Technology.

I added Sam Stephensons famous Prototype library to zephyr yesterday night, at 2 AM :D. this library will save my sleep for many nights. I will also add some of these great Javascript libraries tonight.

1. MooFx
2. Nifty Corners
3. Scriptaculous
4. Tabifier

i am creating an update plan in details. Very soon I will publish it. But be sure, zephyr is going to be coolest AJAX based Framework for PHP5 Developers.

keep yourself uptodate with Planet-PHP

planet-php.gifPlanet php is the one stop place where you will find all the php news those are happening around. This site collects informations from more than 40 blog from popular php developers. This site updated twice a day, so you can always find latest news here.

Planet PHP also aggregates latest PHP feeds from del.icio.us which is a bonus. You will also find latest news about PEAR/PECL releases. If you are PHP fan, planet-php is a must see site for you.