How to check if DOM is ready on ajax?

Maybe you need to check if the DOM is already loaded but you need to do it with ajax, you can use the code below or as I named, the equivalent of windows.load on jquery is:

var chkReadyState = setInterval(function() {
    if (document.readyState == "complete") {
        // clear the interval
        // finally your page is loaded.
}, 100);


How to distribute shares in an Internet startup


It is a difficult question. And in addressing it one is supposed to, as they say, “ Take the bull by the horns”.  But we soon find out that having a bull by the horns is very dangerous.


It is virtually impossible to create a great company without a good team. You’ll need the best you can get. Leaders with character, intelligence, and talent; who share a vision and ambition to change the world.  People who are possessed of a mad confidence that only says, “Yes, we can do this.” Who also have the energy, commitment, and will work tirelessly to conquer an Everest of difficulties almost daily.

Such people do not grow in the trees.  And such people deserve and expect recognition and reward for their efforts. Reward is one way of measuring the value of their contribution. And such a team will certainly create something of value.

The day arrives, someone has to decide, “How to divide the cake?”. It may help to keep in mind that the “cake” is presently made of smoke, the vaporous dreams of one and all. Assembled with an incomplete recipe. And, pushing the metaphor, cakes can be half baked or burned and sometimes fall in the oven due to outside disturbances.

The most obvious response to the question will include words like “fair” and “reasonable”. The first answers that come to mind are also the easiest, subjective and useless: “The deal must be fair”, “reasonable”, “fair” … is like saying nothing.

I assure you: if you do not do your homework well in advance, soon you will meet their counterparts “that’s unfair!”, “You’re being unreasonable!”, “Your proposal is not fair!”. You will find out what it is like to be  holding the “bull by the horns.” What usually comes next is not pretty: physical, emotional, and bad vibes all around.

Meet the parties

The first is deciding between those who have to deal with. Many entrepreneurs believe the problem is reduced to decide how corresponds to each founder. Nothing is further from reality. The life of a company can be long and go through different phases. Each will require different types of people and help. Decide how many actions for all these phases and to all the people:

Founders: If there is only one, the problem of the distribution is resolved (the bad news is to be prepared for moments of solitude very hard). If more than one, it is usually the same percentage is allocated to all. “So we avoid discussions”. Personally, I think that is an option but not the only one. Sometimes each founder provides different experience, knowledge and dedication. In such cases, the “all equal” is what just bringing discussions.

Key employees: They will help founders turn your dream into reality. They are exceptional in their work (in a start-up always lacking resources and inefficient they have screwed to hide) and low risk aversion. Many end up being friends for life after sharing mutual respect, hours (and hours) of work, uncertainties and risks. The reward should be on par.

Plan of action: Once the thing starts, the risk for new employees is lower and therefore the reward. Yes, it is smaller does not mean it does not exist.

Advisory Board: Includes board members and advisors. People with know-how and know-who, no famous zip and friends of bla-bla-bla. Experience and contacts to derail a train but down to earth. We have to go walking and must be willing to get their hands dirty making calls, investing, finding partners and visiting potential clients if necessary (and it is). And if no door.

Investors: Includes both “business angels” or initial informal investors such as venture capital companies or institutional investors rarely invest less than seven figures.

Some think they do not need some or all of these groups to the project you have in mind. That’s perfect!. I’m just saying, if you think that you need, decide how many shares you will give them.

The size of the pie at the time of eating

The issue is tricky: Suppose you are an entrepreneur with 100% of the shares of your company. Your service has become very popular and receives many visits and some income. Decide it’s time to look for an investment to grow the project (more employees, servants, advertising, agreements, sales force, etc.). Find an investor interested in entering values ​​your business to US$ 2,000,000 and wants to invest US$ 2 million. The pre-money valuation (before between money) Company is US$ 2 million and the post-money valuation (after between money) will be US$ 4 million (2 + 2). However, the investor will want shares in exchange for their investment. As it provides 2 million to create a company of four million, accounts for 50%. Your rate of 100% is just “dilute” the 50% in order to give input to new investment partner. It’s okay, you’re still just as “rich” (100% – 2 = 50% – 4). Now you should put that money to work to grow the pie (company).

The “dilution” because of the entry of investors not only affects the entrepreneur, but to all shareholders who accompany him, managers, consultants, employees … even those investors who have invested in a previous round. The problem is that everyone will agree on a percentage of shares before starting work but will do so taking into account the number of rounds of financing (and dilution) that they believe will cross the company and the value of this at the time of the “exit” (IPO or sale). The entrepreneur must also consider this and estimate (bet) regarding providing each group. The differences in estimates of each other can lead to discussions. All talk of “justice”, “fair” and “unfair”. If the entrepreneur gives everyone who asks can end without action or a ridiculous percentage not justify the effort. Conversely, if dealt too little, you risk losing valuable collaborators in a market full of competitors fighting dog face to attract talent. A difficult but key decision. He better not be wrong.

How to distribute shares in an Internet startup:

The market

A friend of mine always says that you have to settle a dispute with justice and equity, “external legitimacy”, ie objective criteria external stakeholders should be used. Here we go.

The response of the entrepreneur

Charlie Tillett was CFO of NetScout for 10 years. Before leaving office in 2000, he completed two rounds of financing of 6 and 45 million dollars and the IPO of the company in August 1999. Now advises technology start-ups. In 2003 he made a presentation at MIT that summarizes much of what he learned and, I think, is excellent. According Tillet percentages at the time of the “exit” might look like this:

Founders: 35.1%

Key Employees: 5.3%

Plan of action: 3.5%

Advisors: 1.1%

Investors: 55%

If you are interested deepen as you arrive at these numbers, I have made the presentation data in this spreadsheet that describes how the percentages change over rounds of funding. Includes two scenarios:

Scenario 1: A company that receives $ 570,000 from business angels and $ 5.7 million in a first round of venture capitalists. Is the case just described above.

Scenario 2: A company that receives three rounds: $ 745,000, $ 7,450,000 and, again, $ 7,450,000.

Inverter response: Key Employees and Plan of Actions

Guy Kawasaki is a former Apple evangelist, now converted to VC at Garage Technology Ventures, a Silicon Valley venture capital. He is the author of the famous book “The Art of the Start” speaks regularly on entrepreneurship in your blog and lectures around the world.

Kawasaki wrote a post recommending a range of percentages for “key employees” and the “plan of action” in a company that has achieved a first round 1-3 million $ and has more than 15 employees:

Key Employees:

CEO (“adult supervision” to replace the founder): 5-10%

Vice-presidents: 1.5-3%

Architect (man or woman “Main”, though single contributor): 1-1.5%

Plan of action:

Senior engineers: 0.3-0.7%

Engineers media: 0.2-0.4%

Product manager: 0.2-0.3%

Kawasaki advised not to go to the ceiling but take into account salary, bonus, geographic location and most importantly, the perceived value. If you look closely, you’ll see that these percentages are in line with the percentages of Tillet in a phase similar company. Other factors include the training of entrepreneurs, their status as “star” and the smooth running of the company. For example, Silicon Valley the standard for a veteran CEO is 10%. However, Pierre Omydiar, the founder of eBay, Meg Whitman hired as CEO by 6.6% (Eboys, p. 58). Larry Page and Sergei Brin, founders of Google, Eric Schmidt hired as CEO for 6%. Niklas Zennström and Janus Friis went further by not hiring any CEO and distribute only 1% among its 150 employees. Of course, when the cake (sale to eBay) has a size of $ 2,600 million, plus $ 1.500 million if certain targets are met, sure employees bear no grudges.

Inverter response: Board and Advisors

Brad Feld is another VC blog. Works at Mobius Venture Capital where he invested in (and is a trustee of) companies such as FeedBurner and NewsGator (he seems to have a weakness for pastedGraphic.pdf RSS). He has written focusing on the reward of board members and advisory board. Again, your recommendation is consistent with the presentation of Tillett:

Tip: From 0.25% to 1% by board member with “vesting” year over 4 years and acceleration upon a change of control. The vesting assumed that the person does not own the shares but the right to acquire a symbolic price at a given time. Suppose a council member who is granted the 1% with an annual vesting of four years. Each year, may exercise its right to acquire 0.25%. If you leave the company before the expiry of the deadline, you will lose rights not exercised (un-vested options). The “acceleration” means that you may exercise all of its rights at once if you change the control of the company (eg: because it has been sold or has gone public). Board members must understand these terms clearly not receive cash compensation (only reimbursement of expenses incurred because of the company) and should be given the option of investing in each round of funding under the same conditions that venture capital .

Advisory: No figures. It depends on the perceived value of their contribution. Your contribution is less than that of a director of the board and, therefore, their percentage must also be lower. Feld recommends not using vesting with advisers. Since his greatest contribution is generally the beginning, it is best to deliver shares (no picture) for one year and re-evaluate the situation annually to ensure that the relationship remains the expectations of both parties.

How to distribute shares in an Internet startup: The case of Google

In general, investors do not disclose if they have shares, where and how. Often companies use the entry of a new investor to take out a press release and get media presence. It is a good opportunity to know who invests, where and how much, but there is a unwritten rule: never mention the pre-money valuation and the resulting shares. This scene appreciates the secret and shadows.

Google is a good case study because thanks to its IPO in May 2004 was forced to disclose to the SEC (the US agency charged with protecting investors) partial information about shareholders and percentages. Moreover, its undeniable success presaged many investors fabulous returns and could not resist the temptation to show off its stakes in Star web. For once, the veil is lifted …

Founders – 31.3%

Larry Page – 15.7%

Sergey Brin – 15.6%

Key employees – 7.9%

Eric Schmidt, Google CEO – 6%

Omid Kordestani, Google Sr VP Sales – 1.9%

Advisory Board – 0.68%

Excluding investors or their representatives (see below)

Wayne Rosing: 0.60%

John Hennessy, President of Stanford University: 0.03%

Arthur Levinson, Chairman and CEO of Genentech: 0.03%

Paul Otellini, Intel president and COO of 0.03%

Investors – 25%

Venture capital firms in Silicon Valley, each invested 25 million over 5 years:

Kleiner Perkins Caufield & Byers, represented by John Doerr: 9.7%

Sequoia Capital, represented by Michael Moritz: 9.7%

Business Angels principal, invested $ 1 million among all:

Ram Shriram, a former executive at Netscape and Amazon: 2.2%

Andy Bechtolsheim, founder of Sun Microsystems: 1.10% (estimated)

David R. Cheriton, professor of computer science at Stanford: 1.10% (estimated)

Unknown Investors: 1.10% (estimated)

Unknown – 35%

And here ends the investigation and the facts and speculation begin. Everything mentioned so far amount to 65%, where the remaining 35% is ?. Here are some Google investors whose shares are not known:

Angel Investors Venture Fund: investment fund (failed despite the success of Google) that included contributions from celebrities like Tiger Woods, Shaquille O’Neal, Henry Kissinger, Arnold Schwarzenegger, Frank P. Quattrone, Marc Andreessen (Netscape founder) Pierre M. Omidyar (eBay founder), Shawn Fanning (founder of Napster) and Bill Joy (founder of Sun Microsystems).

Stanford University: The university where they studied the founders of Google owns the pagerank technology. In exchange for the license, Google gave them an undisclosed amount of shares (“a bit of stock”) and pays royalties annually.

Yahoo !: Yahoo! In the 2000-2001 technology used Google as their search engine. At that stage Yahoo! invested $ 10 million in Google in exchange for an unknown participation. The Google IPO should leave a sour taste pastedGraphic_1.pdf.

AOL: In 2002 America Online (AOL), Time Warner now closed an agreement with Google that allowed him to buy 2 million shares of the Seeker (1% of total) for $ 22 million. Almost certainly exercised the option.

Playing the guessing, that 35% into the wrong hands could have ended well: 10% Angel Venture Fund, Stanford University 5% 4% Yahoo, AOL 1%, 4% shares Plan, Other members of the Board and Advisory Council 1%, other key employees 2% and 8% unknown investors. Result (it clear that is a guess):

Founders: 31.3%

Key employees: 10%

Plan of action: 4%

Advisory Council: 1.7%

Investors: 53%

Conclusions: The risk of unrealistic expectations

This concludes the series of posts “How to distribute shares in an Internet startup”. No (never will be) one answer, the exact percentage depends on the company, the perceived value of partner / investor, when the company and your negotiating skills are. However, a certain correlation is detected on responses from Charlie Tillett, Guy Kawasaki, Brad Feld and the case of Google. Using external objective criteria gives a pattern very helpful in setting realistic expectations from everyone and increase the chances of agreement.

An example of unrealistic expectation is the entrepreneur who wants to start a business of this nature and retain control of it. It is virtually impossible. Even the founders of Google had to reduce its initial stake of 100% at baseline to 31.3% of the IPO. Of course there are always exceptions. The paradigmatic case here is eBay investors sought not for money (entering $ 400,000 / month) but to get the “seal of confidence” in theory provides an institutional investor having so we can hire a good CEO. When they went public, this was the deal (The Perfect Store, hardcover, 150 pp.):

Founders – 70% (42% Omydiar Pierre & Jeff Skoll 28%)

Key employees – 6.6% (Meg Whitman, CEO)

Investors – 21.5% (Benchmark Capital)

Another example of unrealistic expectation is the business angel who wish to support the “next eBay” but wants to keep 50% of the company in exchange for € 250,000 or advisor you want 15% of the company in exchange for their sporadic services. They ask too much and will be difficult to reach an agreement.

In the case of Google, besides the parade fortunes and famous, striking his early investors were successful entrepreneurs before. History repeats itself again and again: not only the founders reinvest their fortune in new projects this culture but also extends to their employees. Do not idealize but clearly have the recipe for the cake and the exact weight of ingredients: both percentages and effort. Fairy tales aside, creating a giant like Google required talent, collaboration of many heavyweights with contacts, nearly 65 million investment and share the benefits into perspective. Everyone understands the mechanics of the cake, contribute to the “virtuous circle of Silicon Valley” … and have realistic expectations.

Android L

If you are like me, and can’t wait for the update, and get an error that said archive does not contain ‘boot.sig‘, just follow this steps:

1. Create a backup of your phone.

2. Download the Factory Image on these link:

3. Start the device in fast boot mode, one way to do this is:

  • Using a key combo: Turn the device off, then turn it on and immediately hold down the relevant key combination for your device. For example, to put a Nexus 5 (“hammerhead”) into fastboot mode, press and hold Volume Up + Volume Down + Power as the device begins booting up.

4. Extract all the file on the same folder

5. Run these commands manually:

  • fastboot flash bootloader bootloader-hammerhead-hhz12d.img
  •  fastboot reboot-bootloader
  •  fastboot flash radio radio-hammerhead-m8974a-
  •  fastboot reboot-bootloader
  •  fastboot flash system system.img
  •  fastboot reboot-bootloader
  •  fastboot flash userdata userdata.img
  •  fastboot flash recovery recovery.img
  •  fastboot flash boot boot.img
  •  fastboot erase cache
  •  fastboot flash cache cache.img
  •  fastboot reboot


host key error

In case you get this error:

@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ @ WARNING: REMOTE HOST IDENTIFICATION HAS CHANGED! @ @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ IT IS POSSIBLE THAT SOMEONE IS DOING SOMETHING NASTY! Someone could be eavesdropping on you right now (man-in-the-middle attack)! It is also possible that the RSA host key has just been changed. The fingerprint for the RSA key sent by the remote host is 06:ea:f1:f8:db:75:5c:0c:af:15:d7:99:2d:ef:08:2a. Please contact your system administrator. Add correct host key in /home/user/.ssh/known_hosts to get rid of this message. Offending key in /home/user/.ssh/known_hosts:4 RSA host key for has changed and you have requested strict checking. Host key verification failed.

The solution is:

ssh-keygen -R (don't forget to change for your domain)

ERROR: Error installing pg -v ‘0.16.0’ Failed to build gem native extension.

If you get the error

ERROR: Error installing pg:
ERROR: Failed to build gem native extension.

It’s because you probably have your pg_config on other location, in my case was located on /library/ you can use locate pg_config and add the option –with-pg-config=/path_of_pg_config.

If you get the error:

invalid option: –with-pg-config=/library/PostgreSQL…..

You must separate the options with — like this:

gem install pg -v ‘0.16.0’ — –with-pg-config=/path-of-pg_config