As of June 25th, 2008 I just saw Karan Johar's weblog and was shocked! Here is why:
Take a look at this snapshot of Karan Johar's weblog taken on June 25th, 2008
And here is a snapshot of Snook's blog, take on June 25th, 2008
See the shocking similarity ? - The design elements are almost the same. Frankly, the designer on Karan Johar's weblog wasn't even "creative" enough to add some cool colors to make it look better. This is really sad. Jonathan Snook has a weblog presence since as long as I can remember.
I really don't have a bias but the truth is, people like Jonathan Snook are an inspiration for me and I am sure for most of the young emerging free lance web developers. Heck! even Indian movies are copy pastes of good Hollywood movies. Don't they have PRIDE in what they do? I'm sure Karan Johar doesn't even know that his weblog was a copy paste of another and not "just another" guy's weblog, but Jonathan Snook's weblog who is in fact followed by thousands of people in the web development industry. Snook is a mentor of quite a few people like me so obviously this did "shiver me timbers" to write this post.
If these guys take Pride in their work they will never do such a thing. I just can't digest the idea of a media famed person doing something like this ? (or in this case someone doing this TO him) It's true that his show "Coffee with Karan" didn't capture people like me in it's audience ever. But here is a fact: People in the U.S of A and Europe find it hard to differentiate between Pakistanis and Indians because the way we speak / dress and all that - it's quite similar. Anything we do, or they do, pretty much sums up for both of us in the web dev industry. Although there are significant differences between us and our cultures along with "significant" similarities, but one never knows unless he has been in contact with either of us for some time. Anyhow, my verdict of this situation is simple: I am still dying to see some "creative" web designers from India. Any One ? Please .... any one ? .... or all you guys were forced out of India as the Industry got taken over by cheap skates ? Who am I kidding, this seems to be happening over here too but hasn't reached to this extent yet. And I pray it doesn't too.
Karan - although I am not a fan of yours but .... your weblog's design is going to put your "international" web presence in danger. If in a million chances you see this post, DUDE ! get a REAL deisgner !
Behold! One of the coolest behaviors "Bindable" is now included in CakePHP's core. Many thanks to Mariano and Felix for their efforts and including this in CakePHP's core as "Containable" behavior. I have found this behavior to be the most useful by far. I remember the nightmares I used to forgo in controlling model bindings in CakePHP 1.1, specially when coding DustJacketReview. We had to pull up so much data for a single page that we were forced to write custom queries to make it as light weight as possible. But ever since I shifted to CakePHP 1.2, things got a lot better. I have to admit that I had to find some workarounds for some situations when working with CakePHP 1.1 and specially for multiple Ajax paging within a single page. But now these nightmares are over!
Although one thing I am still concerned about is the built in pagination. It's brilliant no doubt but still I can't control the model bindings when paginating any model. I observed the code and found out that it instantiates a new instance of the model when paginating it, so even if I set the bindings to persistent, it has no effect as they are not persistent with the new object. Anyhow, a post on this matter is in the pipeline, I still need some more information to actually formally voice the issue on cake's trac. Currently I have a workaround that's working really good for me. Let's just say that I wanted more than "paginate" function to be specified within a model, and I got it ![]()
Like most people, I also think up of ways to improve my self constantly. I decided to start observing my self to get to know what exactly are the conditions in which I perform better and what can add to my inspiration and motivation. Most code jockeys I know of course do not indulge in sports, but benchmarking your own self really does give you that ecstasy of an athlete
Continue reading 'Striving to become a better code jockey'
A Very Naughty Kitten
Ah ... Finally! I get the pics for our latest "addition" in the family. This guy is really really NAUGHTY. Heck!, my bro had to HOLD him TIGHT for me to take his pics. He has a very wicked look on his face too, and he aint afraid of anything either ... not good if you'd ask me when it comes to disciplining the creature. Also, as usual, we couldn't agree on a name so we had to again go for a weird ass name, just like as in the case of Guggoo Cat. So he's "called" TINKOO by every one. May be the word was unconsciously picked by everyone as it adds a dash of "wicked" with "innocence" or "cuteness" etc.
CakePHP 1.2 Pagination explained
Today I spent a lot of time trying to figure out how to have CakePHP 1.2 pagination with all the flexibility. Because all I wanted to do was to filter the records of my model AND also unbind ALL associated models. I found the information in tits and bits a bit scattered around. So I've decided to make one spot for it, at least for my own future reference. Here is what I've understood:
There are 2 parts you have to take care of, one for the component and the other for the helper. Here is a generic example for the Post model,
/** function index () in your Posts controller **/ $this->paginate['Post'] = array( 'limit'=> 20, 'order'=> "Model.field ASC", // for example i.e. 'fields'=> array( 'Post.id', 'Post.name', //..... ), 'url'=> array( 'controller'=> 'Posts', // could be $this->name 'action'=> 'index', // could be $this->action 'created'=> '02-02-2008', 'active'=> 1, // ... modelField/Value pairs you'd like to set as filters ) ); $posts = $this->paginate( 'Post', array( "Post.created = '02-02-2008' AND Post.active = 1" ) ); $this->set('posts', $posts); $this->set('paginationUrl', array('url'=>$this->paginate['Post']['url']));
This will let the component do the math and calculate how many rows are being returned. Since pagination component executes a simple "findAll()", so it will treat all modelField / Value pairs it finds in the URL key as search criteria i.e. conditions just like you'd specify conditions as array in any "findAll()" call.
To keep or switch between the modelField / Value pairs throughout the pages, you can pass these as URL parameters. So your URL should look kind of like this:
http://yourhost/cake_root/controller/action/page:2/modelField:value/modelField:value/ ....
Now for the pagination helper, we'd use $paginationUrl array that we set for our view:
/** after rendering all posts **/ pr($posts); /* or you can use Cake's built in function to display the $posts array */ echo $paginator->prev("<< Prev", array("url"=>$paginationUrl)); echo $paginator->numbers(array("url"=>$paginationUrl)); echo $paginator->next("Next >>", array('url'=>$paginationUrl));
And that's it, now the paginator links would render your given modelField / Value pair. But there is or "was" a downside about it that my db fields would be seen via the URL. For example, the URL for the above action would be like this:
root/controller/action/page:2/created:02-02-2008/active:1
and that was unacceptable for me, so I created a masking scheme for my field / value pairs. May be I'd make a component out of it, but that won't be as generic as you'd still have to pass the Masks / Fields pairs as an array.
Ahh !! so what about unbinding associated models ? ... well ... what I do is that I use the cool unbindAll function by Othman Ouihibi. I've been using it since CakePHP 1.1 days. But there's a behavior that supports this functionality too on the Bakery, pretty cool. So I just unbindAll models except the ones I need before every paginate call in my controller and that does the trick. Any suggestions / comments would be highly appreciated.
This article was originally made by collecting information from the comments here, so I'd strongly advise anyone who wants to know advance paging to read that article.
HAPPY BAKING !!!
Benazir Bhutto Assasinated
I ask my self, did our fore fathers gave their lives for Dictators ? - Today I had taken my 2 fat cats for their regular shots to the vet. When a friend called me and asked me, "where are you ?" and I told him that I was at the vets place (by that time I had decoded the anxiety in his voice and I knew something wasn't right) - He told me turn on the radio in my car and that Benazir Bhutto had been assassinated. I went into state of disbelief and told my friend that he's joking, but his tone said otherwise. Immediately I began praying for my country and cursing the dictators of Pakistan. This was a sad sad moment in our history as a nation.
Believe me you would have seen a smirk on my face if it were Musharraf (the self proclaimed ruler of my country - the bastard) instead of Benazir. Let me tell you that I disagreed with Ms. Bhutto's agenda because it was too westernized, but I was hoping she would find out if she was elected and I did not like her as a leader of Pakistan too. But nonetheless she had a very strong vote bank and if there was any man with true leadership qualities was her father Zulfiqar Ali Bhutto. Although he did have drawbacks too. But then again, he was hanged by a dictator. Who are these people ? Don't they have any respect for the civilians ? And I'm bewildered when I see the west supporting Musharraf when they themselves proclaim to be the beacons of democracy. It's truly hypocratic.
The place where Ms. Bhutto was assassinated is like the head quarter of all the intelligence agencies. Then how on earth something like this could happen ? I don't believe in Voodoo or shit like the number 13 being unlucky but the facts point out that that is a favourite place for the government to assasinate civilian leaders.
This dictatorship shit must end once and for all, and our army should keep it in their pants, they don't have to use it on the very people they are supposed to protect. There should be a pact between the people Pakistan and the army that whatever happens, they should not take part in the local administration, it's not their job. I don't know when they'd learn. History speaks for itself of what has happened to dictators, from Hitler to Zia-ul-haq. I have so much rage against them as they suppress the masses and get hold of the SCUM of society to come up and govern. Because they just can't rely on people with a conscious. Our government says that it has strengthened the economy of Pakistan - BULLSHIT! all they have done is more chaos. We would have been a better state if these bastards would have let the civil government complete it's term. They fail to understand that democratic process is slow but permanent. And now the generals in our army should take a hint, we as a nation loath them for their actions and mourn today in grief - army chiefs / generals / core commanders --> SHAME ON YOU! for your guy has let Pakistan down. If you have even a tiny dot of "ghairat" in you then you would keep your faces towards the border and NOT towards the president's house in Islamabad. I am aware of the fact that it's like a small group of powerful people in the army doing this and that not all of our brothers are involved.
May Allah almighty give peace to our people and bless the state of Pakistan with a true leadership of the people that would take our country booming.
P.S. My feet are sore and my eyes weep, for I have come a long way and got miles to go before I sleep, miles to go before I sleep, miles to go before I sleep :'(
objects as arguments fail in IE
Microsoft did it once again ! - tried to pass an object to a function but didn't work out. So this is the work around I cooked up ... sleazy eh !
was trying this:
<li onclick="myFunction( { listObject:this, customOption: 1 } )" > List text bla bla </li>
Now this above code worked in FireFox flawless ! but IE started giving me problems. More specifically, I wanted to highlight the li item and call another script via AJAX for which I needed the value for my customOption. But hell no ! Professor IE says the world goes round my way and the WebStandardsProject would keeping on feeling my shoe in their backside ! BLEKH ! - so I cooked up this workaround. Its fail safe:
<li onclick="this.prototype.customOption = 1; myFunction(this);">List text bla bla</li>
Now this is pretty cool. You can add any property or even a function using the "prototype" global function. It would really help if you read a bit more about it here these netscape guys were the creators of the JavaScript in the first place and this handbook here is pretty cool.
There is a downside to this workaround however, imagine there are many options, your code will SUCK! - I hope these evils are undone in IE 7 and other versions to come. However I'm still wondering why does IE not take "{ propertyName1: value, propertyName2: value, ..... }" model as arguments properly ... anybody out there has a clue let me know ! - I'd really appreciate your comments.
Darn it !!
Shifting me theme again
the previous one was having usability problems ... as much as I like it. The thing is me n my friend are knee deep in work and since we are damn lazy too so not finding time to rectify the theme. Anyways, lets see when does this cycle break !
Meet Guggoo Cat !
Alrighty mates ! ... here is my big fat cat. Since he is so fluffly and all, we've named him Guggoo CAT. I mean, we tried to call him SAM - but just can't help it! ... he IS a GUGGOO CAT only !~ hehehe
![]()
Alright! so now I've got this blasted itchy craving to deploy this blog in CAKE!!!! MMMMmmmMMMmmmMMMmm ! Let's see how well it goes.
Yeesh! sometimes I think I might become really fat (im fat already) - to be honest, all that cake is like an AFRO-DEZIAC for me ..... yum yum !
Search
Blogs I like
CakePHP Resources
Recent entries
- Karan Johar Copy Pastes Snooks Weblog
- Bindable now Containable Behavior in CakePHP Core
- Striving to become a better code jockey
- A Very Naughty Kitten
- CakePHP 1.2 Pagination explained
- Benazir Bhutto Assasinated
- objects as arguments fail in IE
- Darn it !!
- Meet Guggoo Cat !
- A Full blown CakeBlog is upcoming!
- DA BULL IS BACK !
About
This is the about text






