Author: hasin

Update 15th May, 2006 : Whats the story, morning glory

Long ago i have heard the song when oasis and nirvana were fighting to take position in US top chart. I really like nirvana much more than oasis. “Whats the story, morning glory” was a hit song from oasis which rest in top chart for many weeks. Well, that may suit for todays title.

Yesterday I have analysed wordpress and I found some interesting things. Using wordpress, custom fields for each post and get_post_custom_field() function you can develop almost any kind of website. Its amazing.

I was really surprised to see two themes, one is SemiLogic and another is Kiwi.Both enables some amazing administrative panels in wordpress. Using these themes you can trun yout blog into a full featured CMS. WordPress really rocks!!!

gotokal babur jonyo shopping korlam, khub bhalo lagche ekhon. I really cant believe je ami baba hote jacchi ar kichudin porei. ekta amazing feelings. Ayesha ekhon ektu bhalo tobe sarakkhon tense thak operation niye. Oh Allah, save her from all trouble. operation somvoboto 20 tarikher majhei. Ami preparation nicchi ekta leave neyar jonyo, hoyto 3 soptahoer jonyo.

Last night I worked with CURL, just some RnD. Iwas trying to download files in remote server, where the script is running, with resuming. I know I have to pass HTTP_RANGE header anyhow to manage resumed download. Fortunately in CURL there is a option CURLOPT_RANGE which enables you to fetch any range of bytes if you specify them in “start-end” format. that means if I use curl_setopt($curl_resource, CURLOPT_RANGE, “1000-3000”) it will download 2000 bytes started from 1000 bytes. It was amazing.

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.