Monday, August 01, 2016

Cut, copy and paste keyboard shortcuts for left-handers

Usually, to cut, copy and paste, we use the Ctrl+X, Ctrl+C, and Ctrl+V respectively.

But if you use mouse with left hand then it is difficult to use the above mention shortcuts. So alternatives shortcuts are as follows.
  • Cut: Shift+Delete
  • Copy: Ctrl+Insert
  • Paste: Shift+Insert
They work on Windows, Gnome and KDE.

Important : In Windows Shift+Delete is shortcut for deleting file permanently without sending it to recycle bin. 

Tuesday, July 12, 2016

Caching Queries in CakePHP

Configure Cache in app/Config/bootstrap.php

Cache::config('long', array(
    'engine' => 'File',
    'duration' => '+1 hours',
    'probability' => 100,
    'path' => CACHE . 'long' . DS,

cache file will be written in app\tmp\cache\long

In controller (ArticlesController)

public function latest_news ($limit=NULL) {
    $data = Cache::read('latest_news', 'long');
        if (!$data) {
        $data = array('fields'=>array('id','title'),

        'order'=>'Article.created DESC',
        'limit'=>$limit)    ;
            Cache::write('latest_news', $data, 'long');

        return $this->Article->find('all', $data);

cache file will be named in app\tmp\cache\long\latest_news

In element

$latest_news = $this->requestAction('/Articles/latest_news/10');

Sunday, May 29, 2016

Disable submit button after form submission

     $(".class_of_button").click(function () {
       $(".class_of_button").attr("disabled", true);


Saturday, May 28, 2016

Game of Thrones

Lord Snow (s1, Ep3)
Benjen Stark: You know, my brother once told me that nothing someone says before the word "but" really counts. 

A Golden Crown (s1, Ep6)
Syrio Florel: There is only one god and his name is Death, and there is only one thing we say to Death: "Not today". 

You Win or You Die(S1, Ep7)
Cersei Lannister: When you play the game of thrones you win or you die. There is no middle ground.

Petyr 'Littlefinger' Baelish: ... and only by admitting what we are can we get what we want.
Ros: And what do you want?
Petyr 'Littlefinger' Baelish: Everything, my dear. Everything there is.

Tywin Lannister: A lion doesn't concern himself with the opinion of a sheep.

Tywin Lannister: Your mother's dead. Before long I'll be dead, and you and your brother and your sister and all of her children, all of us dead, all of us rotting underground. It's the family name that lives on. It's all that lives on. Not your personal glory, not your honor... but family. You understand?

The Pointy End(S1, Ep8)
Theon Greyjoy: Are you afraid?
[Robb's hand is shaking]
Robb Stark: I must be.
Theon Greyjoy: Good.
Robb Stark: Why is that good?
Theon Greyjoy: It means your not stupid.

What Is Dead May Never Die (s2, Ep3)
Lord Varys: Power resides where men believe it resides. 

Garden of Bones (s2, Ep4)
Stannis Baratheon: A good act does not wash out the bad, nor a bad the good.

Petyr 'Littlefinger' Baelish: If war were arithmetic, the mathematicians would rule the world.  

The Ghost of Harrenhal (s2, Ep5)
Arya Stark: You're practicing for a fight. You should practice right.

Petyr 'Littlefinger' Baelish: I have always found revenge to be the purest of motivations.  

A Man Without Honor(S2, Ep7)
Tyrion Lannister: It's hard to put a leash on a dog once you've put a crown on its head.

Ser Jorah Mormont: No one can survive in this world without help.

Theon Greyjoy: It's better to be cruel than weak.  

Blackwater (S2, Ep9)

[Varys listens to the bells toll the alarm before the battle]
Lord Varys: I've always hated the bells. They ring for horror. A dead king, a city under siege...
Tyrion Lannister: A wedding.
Lord Varys: Exactly.

Sansa Stark: [talking about Joffrey] The worst ones always live.  

The Climb (S3, Ep6)
Lord Varys: Although, who doesn't like to see their friends fail now and then.

Petyr 'Littlefinger' Baelish: Chaos isn't a pit. Chaos is a ladder. Many who try to climb it fail and never get to try again. The fall breaks them. And some, are given a chance to climb. They refuse, they cling to the realm or the gods or love. Illusions. Only the ladder is real. The climb is all there is.

Anguy: Your eye knows where it wants the arrow to go. Trust your eye.  

The Bear and the Maiden Fair(S3, Ep7)
Daenerys Targaryen: And what happens to things that don't bend?

Second Sons(S3, Ep8)
Davos Seaworth: I think mothers and fathers made up the gods because they wanted their children to sleep through the night. 

The Rains of Castamere (S3, Ep9)
Daario Naharis: I have no interest in slaves. A man cannot make love to property.

Mhysa (S3, Ep10)
Joffrey Baratheon: I am the king! I will punish you!
Tywin Lannister: Any man who must say, "I am the king" is no true king.

Tywin Lannister: You really think a crown gives you power?

Tyrion Lannister: It's not easy being drunk all the time. Everyone would do it if it were easy. 

Oathkeeper (S4, Ep4)
Petyr 'Littlefinger' Baelish: So many men, they risk so little. They spend their whole lives avoiding danger, and then they die. I'd risk everything to get what I want.
Sansa Stark: And what do you want?
Petyr 'Littlefinger' Baelish: [pauses] Everything.

Grey Worm: A single day of freedom is worth more than a lifetime in chains.

Barristan Selmy: Sometimes it is best to answer injustice with mercy.
Daenerys Targaryen: I will answer injustice with justice.

First of His Name(S4, Ep5)

Cersei : It's ironic that we are so powerful but you couldn't save you sister and I couldn't save my son. What good is power?
Oberyn Martell: You can avenge them.

The Laws of Gods and Men(S4, Ep6)

Oberyn Martell: 'Tis a big and beautiful world. Most of us live and die in the same corner where we were born and never get to see any of it. I don't want to be most of us.

Mockingbird(S4, Ep7)
Arya Stark: Nothing can be worse than this.
Dying Man: Maybe "nothing" is worse than this.
Arya Stark: "Nothing" isn't better or worse than anything. Nothing is just... Nothing... 

The Wars to Come(S5, Ep1)
Mance Rayder: The freedom to make my own mistakes was all I ever wanted.

Lord Varys: Any fool with a bit of luck can find himself born into power. But earning it for yourself, that takes work.

The House of Black and White (S5, Ep2)
Tyrion Lannister: Because I liked it. Power. Even as a servant.

High Sparrow (S5, Ep3)
Jon Snow: I heard it was best to keep your enemies close.
Stannis Baratheon: Whoever said that didn't have many enemies.

Kill the Boy (S5, Ep5)
Maester Aemon: Kill the boy, And the let the man be born.  

The Gift(S5, Ep7) 
Stannis Baratheon: We march to victory. Or we march to defeat. But we go forward; only forward.

Petyr 'Littlefinger' Baelish: The past is the past, the future is all that is worth discussing. 

The Dance of Dragons (S5, Ep9)
Doran Martell: I believe in second chances. I don't believe in third chances.

Shireen Baratheon: I wouldn't have chosen either. It's all the choosing sides that made everything so horrible.

Ellaria Sand: It's always changing, who we're supposed to love and who we're not. The only thing that stays the same is that we want who we want.

The Red Woman (S6, Ep1)
Daario Naharis: Isn't it frustrating wanting someone who doesn't want you back?

Home (S6, Ep2)
Three-Eyed Raven: It's beautiful beneath the sea, but if you stay too long, you drown. 

Oathbreaker (S6, Ep3)
High Sparrow: There's so much good in all of us. The best we can do is to help each other bring it out.

Book of the Stranger (S6, Ep4)
Tyrion Lannister: We make peace with our enemies, not our friends.

The Broken Man (S6, Ep7)
Brother Ray: Violence is a disease. You don't cure a disease by spreading it to more people.
Sandor 'The Hound' Clegane: You don't cure it by dying, either.

Tuesday, May 24, 2016

CrystalDiskInfo: open source hard disk monitoring

We may be able to save our valuable data before it's too late if we know the condition of our hard drives. Normally hard drive crashes are not random. All modern drives have a monitoring technology called S.M.A.R.T. (Self Monitoring Analysis and Reporting Technology) that continuously monitors a number of parameters on a hard drive. Many parameters can be monitored by S.M.A.R.T. including read and write error rates, seek error rates, spin up time, temperature and much more.

CrystalDiskInfo is a great monitoring program that can warn us if the temperature and the health of our drive is deteriorating. This is Open Source software. There is a portable version as well as an installer.

Other features are resident monitoring, alarm for temp and health, shows temp for each drive in system tray, S.M.A.R.T. and general info about internal/external hard drives, settings to adjust AAM /APM.