HTML5, JavaScript, life, webdev

Google+ And The New +1 Button

Here is a talk that give you all (=most) the things you wish to know about Google+and its power.

The talk start at 40 minutes and 25 seconds.

Be strong.

Standard
Chrome, life

So What Developer Advocate Do?

Coding, Blogging, Public Speaking And Dealing With Partners

This slideshow requires JavaScript.

Some Coding

Some Blogging

Public Speaking

And Of Course – Business Development

Here are all the things any Developer Advocate do on a daily/weekly bases:

and thanks to @chanezon for the ideas.

Standard
life

Two Performances – One (Crazy) Song

The source

Ninet, with a little help of Red Band


Ninet is amazing.

Standard
life, Sport

Beautiful Electric Bike Ride In Spain

All I’m asking is why not just switch it to mountain biking? You won’t even need to hook it to the grid after the ride… just get some good food (and wine).

Standard
life, php

Rank Your Book Collection

books
I love books. It is due to my parents, that put in me from the age of 4 or 5 this passion to the written word. It might be (also), my literature teacher from high school, that took the only subject I really didn’t like (yep… I enjoyed math, physics and computers but hated literature) and made his course a pure adventure full of joy. I remember lots of moments when you finish a book but keep thinking on the subjects/point of views/heroes years and years after the 4th time you reading it. In a way, my kindle is a wonderful device but I still really like to hold a ‘real’ book.

Last weekend, I’ve decided to ‘sort’ my mobile (=kindle) books. Since I’ve had them (all 1,073) on one big folder, I wrote this little script that build a list of their names and then use amazon to get their rating. From here, the path to a spreadsheet with the data is very short. Now, I know what are the best ones, by harnessing the ‘wisdom of the crowds’.
Happy reading!

Here is the code (or if you like a better version try it on github)

 

/**
 * Description: read a list of books (from a collection on your hard drive)
 * and use amazon review to rank them. This is helpful if you have lots of books.
 * It's good to put the best one on your kindle for the next vacation/conf etc'.
 *
 * @author Ido Green
 * @date 4/24/2011
 * @see https://greenido.wordpress.com/
 * http://amazon.com 
 * http://gskinner.com/RegExr/ - to handle regex IF you want to get ranking from the html
 * 
 */
class scanAmazon {

    private $books = array();
    private $newRankList = array();

    /**
     * Ctor
     * @param type $dir - the path to your directory of books
     */
    function __construct($dir) {
        $this->buildList($dir);
    }

    /**
     * Run on all the books and get the rating, then, save them to a CSV file.
     */
    public function run() {
        $this->getRating();
        $this->saveToFile("booksRanking.csv", implode("\n", $this->newRankList));
    }

    /**
     * build a list of books' name from the file names
     * @param type $dir - the path to your directory of books
     */
    private function buildList($dir) {
        if ($handle = opendir($dir)) {
            while (false !== ($file = readdir($handle))) {
                //echo "$file\n";
                $name = substr($file, 0, strlen($file) - 5);
                if (strlen($name) > 2) {
                    array_push($this->books, $name);
                }
            }
            closedir($handle);
            sort($this->books);
        }
    }

    
    /**
     * Get the rating of the books
     * we are looking for this pattern: Rated 4.7 out of 5.0
     * 1. Use google results:  http://www.google.com/search?sourceid=chrome&ie=UTF-8&q=site%3Aamazon.com+BOOK-NAME
     * 2. Use amazon directly: http://www.amazon.com/s/ref=nb_sb_noss?url=search-alias%3Dstripbooks&field-keywords=BOOK-NAME
     */
    private function getRating() {
        echo "Working on " . count($this->books) . " books\n";
        $i = 1;
        foreach ($this->books as $book) {  
            $searchUrl = 'http://www.amazon.com/s/ref=nb_sb_noss?url=search-alias%3Dstripbooks&field-keywords=' . urlencode($book);
           // this is the pattern "alt="4.3 out of 5 stars"
            $resPage = file_get_contents($searchUrl);
            $matches = array();
            $ind2 = strpos($resPage, "out of 5 stars");
            $ind1 = $ind2 - 4;//strripos($resPage, '"',$ind2);
            
            //google: $ind1 = strpos($resPage, "Rated") + 5;
            //google: $ind2 = strpos($resPage, "out of", $ind1);
            if ($ind2 > $ind1 && ($ind2-$ind1) newRankList, $rank . "," . str_replace(",", " ", $book) . ",".
                        $searchUrl);
                echo "{$i}) {$book} - Ranking: {$rank} out of 5.0\n";
            }
            else {
                echo "{$i} ERR - {$book} got no rating url: {$searchUrl}\n";
            }
            $i++;
            sleep(5); // let not overload amazon server :)
            // $found = preg_match('/Rated (\d\.\d) out of 5.0/gi', $resPage, $matches);
            //if ($found && count($matches) > 0) { $rank = $matches[0]; }
        }
    }

    /**
     * simple saver of data/string to file
     * @param  $fileName
     * @param  $data
     * @return  false when we could not save the data
     */
    function saveToFile($fileName, $data) {
        try {
            $fh = fopen($fileName, 'w');
            fwrite($fh, $data);
            fclose($fh);
        } catch (Exception $exc) {
            error_log("Err: Could not write to file: {$fileName
                    } Trace:" . $exc->getTraceAsString());
            return false;
        }
        return true;
    }

}

// start the party
$scanner = new scanAmazon("PATH TO YOUR BOOKS");
$scanner->run();


Standard
life

Questions For CEOs

There are few things you want to check before you starting a new venture/job/work relationship.
Over the years, I found that with very few questions (asked right), you can tell if the person in front of you can ‘get things done’ or they just repeating the buzz words they collected over the years.

Here are some questions from a larger set that I’m using from time to time:

  1. Which CEOs outside your industry do you admire?
    Why?
  2. What are the three most important things (Critical Success Factors) for your company?
  3. Which competitor do you most admire?
    Why?
  4. How do you allocate your time on a daily basis?
  5. What qualities are must-haves when you’re looking at a new hire?
  6. What would you do with a ‘gift’ of $100M?
  7. What book is your favorite one?
  8. What activity you like most?
  9. Things you can’t live without?

Another great set of famous questions are from Bernard Pivot.
It’s a ‘lighter’ version that is better over a drink:

  1. What is your favorite word?
  2. What is your least favorite word?
  3. What turns you on?
  4. What turns you off?
  5. What sound or noise do you love?
  6. What sound or noise do you hate?
  7. What is your favorite curse word?
  8. What profession other than your own would you like to attempt?
  9. What profession would you not like to do?
  10. If Heaven exists, what would you like to hear God say when you arrive at the Pearly Gates?

 

Standard
life

Einstein/Wild Quotes

Oscar Wild

  • A dreamer is one who can only find his way by moonlight, and his punishment is that he sees the dawn before the rest of the world.
  • A gentleman is one who never hurts anyone’s feelings unintentionally.
  • A  little sincerity is a dangerous thing, and a great deal of it is absolutely fatal.
  • A man can be happy with any woman, as long as he does not love her.
  • A man can’t be too careful in the choice of his enemies.
  • A man who does not think for himself does not think at all.
  • A man’s face is his autobiography. A woman’s face is her work of fiction.
  • A poet can survive everything but a misprint.
  • A thing is not necessarily true because a man dies for it.
  • A true friend stabs you in the front.
  • A work of art is the unique result of a unique temperament.
  • Ah, well, then I suppose I shall have to die beyond my means.
  • Alas, I am dying beyond my means.
  • All art is quite useless.
  • All bad poetry springs from genuine feeling.
  • All women become like their mothers. That is their tragedy. No man does. That’s his.
  • Always forgive your enemies – nothing annoys them so much.
  • Ambition is the germ from which all growth of nobleness proceeds.
  • Ambition is the last refuge of the failure.
  • America is the only country that went from barbarism to decadence without civilization in between.

Einstein

  • Any intelligent fool can make things bigger, more complex, and more violent. It takes a touch of genius — and a lot of courage — to move in the opposite direction.
  • Imagination is more important than knowledge.
  • Gravitation is not responsible for people falling in love.
  • I want to know God’s thoughts; the rest are details.
  • The hardest thing in the world to understand is the income tax.
  • Reality is merely an illusion, albeit a very persistent one.
  • The only real valuable thing is intuition.
  • A person starts to live when he can live outside himself.
  • I am convinced that He (God) does not play dice.
  • God is subtle but he is not malicious.
  • Weakness of attitude becomes weakness of character.
  • I never think of the future. It comes soon enough.
  • The eternal mystery of the world is its comprehensibility.
  • Sometimes one pays most for the things one gets for nothing.
  • Science without religion is lame. Religion without science is blind.
  • Anyone who has never made a mistake has never tried anything new.
  • Great spirits have often encountered violent opposition from weak minds.
  • Everything should be made as simple as possible, but not simpler.
  • Common sense is the collection of prejudices acquired by age eighteen.
  • Science is a wonderful thing if one does not have to earn one’s living at it.
  • The secret to creativity is knowing how to hide your sources.
  • The only thing that interferes with my learning is my education.
  • God does not care about our mathematical difficulties. He integrates empirically.
  • The whole of science is nothing more than a refinement of everyday thinking.
  • Technological progress is like an axe in the hands of a pathological criminal.
  • Peace cannot be kept by force. It can only be achieved by understanding.
  • The most incomprehensible thing about the world is that it is comprehensible.
  • We can’t solve problems by using the same kind of thinking we used when we created them.
  • Education is what remains after one has forgotten everything he learned in school.
  • The important thing is not to stop questioning. Curiosity has its own reason for existing
  • Do not worry about your difficulties in Mathematics. I can assure you mine are still greater.
  • Equations are more important to me, because politics is for the present, but an equation is something for eternity.
  • If A is a success in life, then A equals x plus y plus z. Work is x; y is play; and z is keeping your mouth shut.
  • Two things are infinite: the universe and human stupidity; and I’m not sure about the the universe.
  • As far as the laws of mathematics refer to reality, they are not certain, as far as they are certain, they do not refer to reality.
  • Whoever undertakes to set himself up as a judge of Truth and Knowledge is shipwrecked by the laughter of the gods.
  • I know not with what weapons World War III will be fought, but World War IV will be fought with sticks and stones.
  • In order to form an immaculate member of a flock of sheep one must, above all, be a sheep.
  • The fear of death is the most unjustified of all fears, for there’s no risk of accident for someone who’s dead.
  • Heroism on command, senseless violence, and all the loathsome nonsense that goes by the name of patriotism — how passionately I hate them!
  • No, this trick won’t work…How on earth are you ever going to explain in terms of chemistry and physics so important a biological phenomenon as first love?
  • My religion consists of a humble admiration of the illimitable superior spirit who reveals himself in the slight details we are able to perceive with our frail and feeble mind.
  • Yes, we have to divide up our time like that, between our politics and our equations. But to me our equations are far more important, for politics are only a matter of present concern. A mathematical equation stands forever.
  • The release of atom power has changed everything except our way of thinking…the solution to this problem lies in the heart of mankind. If only I had known, I should have become a watchmaker.
  • Great spirits have always found violent opposition from mediocrities. The latter cannot understand it when a man does not thoughtlessly submit to hereditary prejudices but honestly and courageously uses his intelligence.
  • The most beautiful thing we can experience is the mysterious. It is the source of all true art and all science. He to whom this emotion is a stranger, who can no longer pause to wonder and stand rapt in awe, is as good as dead: his eyes are closed.
  • A man’s ethical behavior should be based effectually on sympathy, education, and social ties; no religious basis is necessary. Man would in deeded be in a poor way if he had to be restrained by fear of punishment and hope of reward after death.
  • The further the spiritual evolution of mankind advances, the more certain it seems to me that the path to genuine religiosity does not lie through the fear of life, and the fear of death, and blind faith, but through striving after rational knowledge.
  • Now he has departed from this strange world a little ahead of me. That means nothing. People like us, who believe in physics, know that the distinction between past, present, and future is only a stubbornly persistent illusion.”
  • You see, wire telegraph is a kind of a very, very long cat. You pull his tail in New York and his head is meowing in Los Angels. Do you understand this? And radio operates exactly the same way: you send signals here, they receive them there. The only difference is that there is no cat.
  • One had to cram all this stuff into one’s mind for the examinations, whether one liked it or not. This coercion had such a deterring effect on me that, after I had passed the final examination, I found the consideration of any scientific problems distasteful to me for an entire year.
  • …one of the strongest motives that lead men to art and science is escape from everyday life with its painful crudity and hopeless dreariness, from the fetters of one’s own ever-shifting desires. A finely tempered nature longs to escape from the personal life into the world of objective perception and thought.
  • He who joyfully marches to music rank and file, has already earned my contempt. He has been given a large brain by mistake, since for him the spinal cord would surely suffice. This disgrace to civilization should be done away with at once. Heroism at command, how violently I hate all this, how despicable and ignoble war is; I would rather be torn to shreds than be a part of so base an action. It is my conviction that killing under the cloak of war is nothing but an act of murder.
  • A human being is a part of a whole, called by us _universe_, a part limited in time and space. He experiences himself, his thoughts and feelings as something separated from the rest… a kind of optical delusion of his consciousness. This delusion is a kind of prison for us, restricting us to our personal desires and to affection for a few persons nearest to us. Our task must be to free ourselves from this prison by widening our circle of compassion to embrace all living creatures and the whole of nature in its beauty.
  • Not everything that counts can be counted, and not everything that can be counted counts.
Standard
life

Life and Exotic Chemistry – The Big Hisotry

Very impressive talk in the last TED. All of history (as we think we know it).

Main points I’ve noticed:

  • DNA – learning from errors in its copies!
  • In the past 4b years we was it time after time.
  • 2b years ago – it started…
  • Our language is what gave us our power and our history.
  • Collective learning.
  • Farming was energy bonanza.
  • 7B people are one huge brain today.
  • Goldilocks condition are in danger.
  • The big history show us the challenges and dangers we are facing
Standard
life

What If Compassion Was Fun And Profitable?

Great TED talk about compassion in Google. It shows the happiest man in the world (for real) and how ‘level 5’ leaders (humble + ambition) can create a huge change in life.

I liked the fact that Chade-Meng Tan talked about ‘search inside yourself’ (after all, he is from the search giant).

His  main steps are: Search inside yourself: Attention -> quality mind (=clear) -> self knowledge -> Focus on happiness (of the other).

‘if you want others to be happy, proactive compassion. if you want to be happy, proactive compassion.’ – Dalai Lama

Standard
Business, life

Clif Bar – Great Company/Bars/Story

Five or six years ago I’ve notice this ‘new’ tasty bar that was changing the market for athletes that are doing long (long) hours on the roads.
Here is a short video that tell this story of Clif Bar and its epiphany ride:

Standard