The lean method

I knew there was something wrong with the management and how we do things at Yabroad, but it was difficult for me to convince other people what we were doing and how we do things are not the best way to run a startup business. When I talk about pragmatism, people talk about visions and having a long-term goal; when I talk about experiments, people talk about previous experience; when I talk about planning and specific goals, people talk about execution. After reading “The lean startup” and “Running lean”, I’m more convinced about how a business should really operate.

The lean method is really about how to get things done efficiently, be it running a small project, or managing a international corporation. It’s about down-to-earth planning and taking advantage of resources efficiently. It’s a call for doing things that really matters. When proposing a new project, ask not if we think it’s cool, ask how we’re going to satisfy the end users. And the first step to go is really getting to know the actual users, what are the problems they find painful and how other products are approaching the problems, and why our proposal is better than the existing solutions.

We made a mistake at Yabroad that we think people are willing to come to China if we don’t charge them much. While our competitors are charging thousands of euros per application, we charge only a few hundred. But we didn’t see an exponential growth, the increase of applications was only negligible. We talked too much about disruptive innovation and thought lowering the price will piss out all our competitors and help us gain a portion of the market share rapidly. We were wrong.

The decision was made without much evidence to prove our assumption. Price is indeed an important factor when people want to visit a different country, but it’s not the deciding factor. Given the opportunity to visit North Korea or Iran, does it still matter if you want to pay thousands of euros or hundreds of euros? Our customers want security and reliability, lowering the price simply does not help, and let’s hope it doesn’t jeopardize customers’ trust in us.

We were not utilizing validated learning. In fact few of our decisions were made based on solid facts and validated results. Arrogant people often think they are the best in this world and they usually piss of everyone else and complain about “why everyone is against me?” Arrogant companies don’t get customers. What they do is not to satisfy customers, they just want to prove themselves correct.

The build-measure-learn loop should be continuous and iterate in fast pace. Build a minimum viable product and measure how successful it is and learn where it could be improved and improve the MVP and enter the next build-measure-learn loop. Validate minimal concepts at a time. Get the whole project running and receiving income before burning out what you have.

It’s true that starting up is really management — if you know where to put resources and man power, and keep track of the direction the business is running towards, you won’t be too wrong.

Raspberry Pi as a toy web server

1. Tell my router to route certain traffic to the Raspberry Pi. For example, I route HTTP and SSH traffic to one of my Pi’s. I disabled password login for  SSH, using public key authentication instead: in /etc/ssh/sshd_config, use the following setting and restart SSH service using `sudo service ssh restart’.

2. Getting my IP address of the Raspberry Pi. I firstly created a PHP script on my domain to record the IP address in a text file.

Then tell the Raspberry Pi to report its IP address every 5 minutes, using crontab:

After a while the IP address is recorded in the text file and updated every 5 minutes.

3. Optionally create a DNS record for the Pi. I use Cloudflare to manage DNS settings by myself, so just add/update an entry in Cloudflare’s settings. I point pi.daoyuan.li to the IP address of one Pi. This can be done automatically in the future.

4. Install Flask on the Pi.

5. Install nginx and uwsgi on the Pi.

6. Set up nginx along with uwsgi and Flask.

Edit nginx config:

Edit uwsgi config:

Create a simple Flask app:

Start up uwsgi:

7. Done! http://pi.daoyuan.li:5000/

 Update on June 24, 2014:

Getting the external address in step 2 can be done by running this command in Raspberry Pi:

See: http://www.commandlinefu.com/commands/view/5427/get-your-external-ip-address

What’s important for a start-up

A friend of mine is considering to set up a startup company , here are the things I think are important for startup. Usually when people think of a startup they think of new ideas. However I don’t think good ideas are so important. It’s not difficult to come across a good idea, but it is extremely difficult to get one idea realized. People usually don’t buy ideas, they pay for products and services. Besides, ideas can be easily copied, while its more difficult to copy the implementation of the idea. Furthermore, one can easily judge if one idea is novel or not, by comparing with current solutions; while it’s not so straight to claim one idea to be better than others. Ideas  solve problems and good ideas solve problems in a better way. However, before a problem is actually solved (that is when an idea is realized), ideas are nothing but plain wishful thinking.

I think the most valuable and important  thing for a startup company is the team. The team decides where the company is going towards, what the company is going to do, how they are going to do it and whom they are going to do business with and sell the product to. The team determines how fast company will move and turn and act. Since the only advantage of a startup company has over a large corporation is its fast decision making process and execution, the team is the deciding factor of a startup’s survival or death.

It doesn’t matter really if you have a good idea or not, as long as you have a good team and given some time, you definitely will come up with a fantastic idea. An ideal team for me would be something like this: everyone has his/her domain of expertise and others can completely rely on his/her capability of getting things done in his/her domain. Members in the team has slightly intersecting capabilities and as a team form the whole capability map. Someone brings everyone else together and keep everyone motivated and moving; someone is a technical guru and has the insight of solving problems efficiently; someone knows customers and is able to sell them everything he/she has in hand; someone is keen to budget control and at the same time knows where exactly to spend money; someone has extremely good relationships with the rest of the world. Members in the team does not have to agree with each other and they should be able to discuss or argue and reach a decision in a timely manner. They should have the insight into problems and the analytic skills to identify and prioritize tasks.

And still among the team the founders are even more important. They are really what the startup is. They give the startup a life if done correctly; or else the bad genes will follow the company forever. They are the startup’s creators, parents and baby-sitters. They should have the courage to risk everything they already possess for a glimmer hope of success. They believe and love what they are doing not because they don’t have other choices, but rather choose to not to have a choice. They believe they are doing the right thing and are willing to take responsibilities for what they are doing.

When people think of startups, people immediately think the ultimate goal for a company is to go public and get listed in major exchanges. That’s not startups’ goal. Companies need to make money. And founders need to consider this task from day one, if not day zero. Making money is not the same as getting funded by angel investors or venture capitalists. Getting funded is one way out of many to get the ideas recognized but not the ultimate goal. People fund startups because they think the companies are going to make a huge amount of profit. Making profits is about proving to the world that what the startup does is meaningful. What’s the point of keeping burning cash anyway?

When big companies like Google and Facebook purchase small or startup companies, what they’re really buying is the customers, the technologies, and the talents. And among these three, talents are the most important to me, since without the talents the customers and technologies will be found nowhere. In short, you’re destined to success or failure the day you choose the team members for your startup.

NumPy’s ndarray indexing

In NumPy a new kind of array is provided: n-dimensional array or ndarray. It’s usually fixed-sized and accepts items of the same type and size. For example, to define a 2×3 matrix:

When indexing ndarray, it supports “array indexing” other than single element indexing.  (See http://docs.scipy.org/doc/numpy/user/basics.indexing.html)

It is possible to index arrays with other arrays for the purposes of selecting lists of values out of arrays into new arrays. There are two different ways of accomplishing this. One uses one or more arrays of index values. The other involves giving a boolean array of the proper shape to indicate the values to be selected. Index arrays are a very powerful tool that allow one to avoid looping over individual elements in arrays and thus greatly improve performance.

So you basically can do the following:

Besides, when you do equals operation on ndarrays, another ndarray is returned by comparing each element:

Statistics of insurance sold on Taobao.com on Valentine’s Day

On Feb. 14th Taobao launched a campaign to sell insurance products, which promises 7% yearly interest rate. The sales data is public, so I wrote a script to crawl them down and did a brief study on this data. Here’re the results.

On that day (actually sold out in less than two hours in total) more than 40,000 people participated, resulting a total sales of almost one billion CNY (the exact number: 980,270,000 CNY). Two companies participated in this sales campaign: Zhujiang and Tian’an. The sales statistics are:

Zhujiang Tian’an Total
# of Customers 13831 29092 42923
Sales mean (k CNY) 24.922059 21.847003 22.837872
Sales min (k CNY) 1 1 1
Sales 25% (k CNY) 1 2 2
Sales 50% (k CNY) 10 10 10
Sales 75% (k CNY) 20 25 22
Sales max (k CNY) 1000 900 1000
Sales total (k CNY) 344697 635573 980270

The histograms of how many people pay for each amount.

le100kgt100kle100k

Zhujiang was extremely popular: in 2 minutes and 56 seconds it reached a sales of 200,212,000 CNY, that’s more than 1 million CNY sales PER SECOND! Indeed Chinese are crazy about online shopping. 😀

MapReduce in MongoDB

http://docs.mongodb.org/manual/core/map-reduce/

http://docs.mongodb.org/manual/reference/command/mapReduce/

The MapReduce code I used to analyze the 20 million hotel reservation records:

 

The Last Battle: Long-term vs. Short-term Gains

During yesterday’s meeting the boss mentioned that our unpaid salary and bonus will be paid, when we have enough money, maybe in April when we receive the other half of high interest loan. Personally I don’t think paying the money will do any good to the company, and eventually it may harm ourselves, since if the company can not move on, everyone, including me, will be disappointed. However, as I’m involved in this, I’m not willing to give up the money I’m supposed to receive. And asking for the money will make me look like as if I don’t care about the company and everyone else’s future, especially when I’m the one speaking out for a few of us. So now I’m caught in a dilemma: I’m not willing to give up the potential short term benefits, which in turn may jeopardize my long term gains.

And the reason for this is that I’m different from others; I care about short-term gains while others can afford not to. And that’s why I feel helpless. I can not expect anyone to help me get things done; I’m on my own. And even if I stand up for myself and gain some short-term benefits for others, they will accept them without appreciating my efforts.

I’m completely trapped, by myself, with my colleagues’ help of standing away from me — neither stopping nor encouraging me and neither refusing nor appreciating my favor — and I didn’t even know how I entered the trap in the first place.

The Last Battle: My Fear

The day we reach an agreement to cut off employees was not a difficult day for me, as I always knew there would be a day like that coming; I was prepared. In the evening when I was talking with Xin, he said he feared not being able to reach the goal when planned during the day, which I fear not. What I fear was returning to the old pattern again, the patten that make the boss keep trying to find funding for us without actually focusing on how to achieve our established goals. I was afraid that he keeps borrowing money to pay off previous debts, while we struggle to reach our goals. I was worried that the boss prioritize fund raising over proving our values.

Yesterday came a challenge: the local government finally seemed to approve one of our projects: letting us operating a part of one restaurant building inside our community, which means we can again get loans from banks with relatively low interest rate. The boss hesitated. According to Xin, the boss wondered if it’s still necessary to lay off people.

Now it looks like the boss has overcome his reluctancy. He finally sent out an email telling everyone about our plan. What remains to be seen, though, is how the restaurant operates in the future and whether it could bring us profit. And even if it does, does it help us?

The boss has one thing I could learn from: he sure knows how to connect with people and never gives up unless he reaches his goals. As for the many things that I contempt about, there’re many.

He never listens to anyone. He is so dedicated to his own thoughts that nobody seems to be able to change his mind. Talking with him is of no use; he likes reading from elsewhere. Yesterday I was irritated by him when he shared something he read about and it was about things we already mentioned to him earlier for several times. A man who trust his eyes more than his ears, I’d say.

He is over-confident about almost everything. He always overcommit. I don’t know a single occasion when he reach his goals or fulfilled his commitments.

He has many things I couldn’t bear with, but what the heck I’m doing with him?

The Last Battle: Our Problems

After yesterday’s 6-hour meeting we finally made a decision: focus on programs that may immediately make money and make sure we survive in the following six month; and cut off more than half of our employees — which makes me think what a pity it is for those being laid off, because it’s mainly the executives’ fault. Or to be specific, it’s the boss’s problem that lead to the current situation.

So what he is doing wrong? Not focusing on the business. Since day zero he is always looking for fundings to support our business, which he fails to define; but he always fails to find enough funding to support the company. Each borrowing was used to pay previous debts, which leads to a situation defined in the book “Scarcity”: the poor gets poorer, the busy gets busier. We are always solving problems that are urgent but not necessarily important — we tunnel and we pay for doing this.

But what’s important anyway, for a startup? Finding out what’s unique about your company and proving that this uniqueness has its value. It sounds easy but think about this: is there a startup that isn’t unique. Every startup claims to be unique; so what’s left is about proving the value of the uniqueness, which is your core business activity and which is what tells you apart from others. If you fails doing so, what you’re doing must be wrong or inappropriate at best. For us, we claim that our business model is superior than those traditional agencies and facilitates young people to travel beyond boards. The results? For one and half years we spent roughly 5 million CNY and attracted around ten customers, which by the way, is less than the number of our employees. So if you keep telling me you’re unique, go and slap yourself until you realize you’re just wasting money.

To prove your value you need the right team. There has to be salesmen that are able to get customers, product developers that make sure the product or service is attractive, and managers to setup goals and coordinate the team members. For us, we are incomplete and incompetent. Basically everyone of us is from an engineering background and knows nothing about marketing and sales; yet this is the most important aspect for our company. When everyone is expecting others to generate revenue, no one will. It also strikes me that, when you feel your efforts will not significantly contribute to your company’s cash flow, you’re in the wrong place. Switch to another position or another company. I don’t think there’re more choices for you.

Make sure you have control over your career path; do not focus too much on pressing tasks; step out of the tunnel and also see the big picture. Keep this in mind.

Debugging Apache configuration files on Mac OS X

Sometimes I make some modification to my site’s apache config and apache stops functioning, but I cannot get enough information from /var/log/apache2/error.log. Here’s a command that will tell you where the problem is:

It starts apache for debugging and prints out the messages on screen, so that hopefully you can find something useful.

mod_wsgi and mod_xsendfile on OS X 10.9 Mavericks

Updated on Nov 4, 2013: The following tricks may still work, however I have found a much easier solution. Simply install Xcode command line developer tools and you should be able to compile source code without issues:

After upgrading my Mac from 10.8 to 10.9 Mavericks my apache stopped working, so I have to reinstall mod_wsgi and mod_xsendfile. However, tricks are needed to compile and install these mods successfully.

Upgrade Xcode

Upgrade Xcode in App Store. As mentioned by Valerie:

I had to manually upgrade Xcode (after Mavericks upgrade) from the App Store & agree to its license because ./configure hung forever until I did that.

mod_wsgi

For mod_wsgi installation, create a soft link to OSX10.9.xctoolchain:

Then run configure under mod_wsgi source code directory:

It will generate a Makefile similar as follows:

However, this Makefile is not correct and running ‘make’ the compiler will complain something like:

Prepend the following line to CPPFLAGS value:

Save the Makefile and it will look something like:

Then make && install:

Modify /etc/apache2/httpd.conf to enable mod_wsgi:

mod_xsendfile

Use the following command to compile and install mod_xsendfile:

Enabling HTTPS/SSL

After upgrading OS X the apache configuration was reset, but your original config is save to /etc/apache2/httpd.conf.pre-update. I need to enable SSL in httpd.conf again by uncommenting the following line:

Restart Apache and everything should work fine

Solution: dd too slow on Mac OS X

When I was cloning SD cards on Mac OS X using dd', it takes ages to get things done. I was using the following command:

It takes much less time when using /dev/rdisk2 instead of /dev/disk2:

The reason is that rdisks are "raw" thus resulting in a higher R/W speed, according to man hdiutil` [1]:

/dev/rdisk nodes are character-special devices, but are “raw” in the BSD sense and force block-aligned I/O. They are closer to the physical disk than the buffer cache. /dev/disk nodes, on the other hand, are buffered block-special devices and are used primarily by the kernel’s filesystem code.

[1] http://superuser.com/questions/631592/mac-osx-why-is-dev-rdisk-20-times-faster-than-dev-disk

Online Shopping in China

For those who have been to China but have not tried online shopping, they haven’t really been to China. Online shopping is probably the fastest growing industry in China. Here are some numbers to testify that:

  • In 2012, online sales counts for 5.5% of all domestic retail trade in China; whereas in the U.S. the figure is 5.1%. Chinese love online shopping more than Americans!
  • On Nov. 11, 2012, the sales on Taobao & Tmall (both belongs to Alibaba) reached 19.1 Billion CNY ($3.12 billion), dwarfing American’s Cyber Monday sales, which totaled $1.5 billion. And that $3.12 billion went to just one company in on day!
  • In 2012, online sales totaled $212.4 billion, playing a catching up with the U.S., where online sales totaled $228.7 in 2012.
  • The industry was growing by 75.3%, 66.3% and 48.5% in 2010, 2011 and 2012 respectively.

If the above figures do not impress you, consider this scenario: on Monday morning you go to work and one of your colleagues recommends you a lipstick that she finds excellent. You go to your favorite online shopping website and added the lipstick to your shopping cart and check out without really paying for it, choosing to pay when the lipstick is delivered to you. Then you continue working and have lunch. After lunch the delivery guy showed up and your lipstick is here. You pay for it and you just bought a lipstick and are already trying it!

That was not exaggerating at all, especially if you live in big cities like Beijing, Shanghai, and Guangzhou. If you happens to live in smaller cities like I do, I still get most of my purchases within 10-24 hours. I usually buy books at night and the next morning they’re delivered to me. That’s probably I bought a lot of books! When I was living in Finland, the delivery often takes days, if not weeks. You will definitely feel the difference the first time you try online shopping in China.

But the fast delivery is not the only reason why online shopping is popular in China, most people buy stuff online because it’s convenient and you can compare things. And often you have many choices. Online stores ofter many different models for the same product. Different stores sell different things. And you can literally find everything you need online. Clothes, shoes, books, tickets? Of course! Meat, vegetables, eggs? Why not? Gold, investments, Cars, apartments, helicopters? No problem, how many do you want? OK, you made your point. How about boyfriends and girlfriends? Hell yeah, pay now and you’ll have one tomorrow!

Besides, things are cheap online, even if you count in delivery fees. Clothes are sold from a few dollars to a few hundred. Most are of good quality. And if you are not satisfied, you can most likely ask for a refund. Most stuff sold online are warranted. What? Chinese only make cheap crappy stuff? Jesus, from whom do you hear that from? Your grandma? Well, we may have different standards for “crappy stuff”, but I do believe most things are more than worthy of the money you paid for.

I’m not here to persuade anyone to try online shopping in China, but I assure you if you do, you’ll be amazed. I was amazed when I first come back from a few years of stay in the Nordics. If you ask me for advice, there just one: check your credit card regularly so that you do not shop too much!

Anyway, bellow are the top online stores in China. They are mostly in Chinese and you should ask your Chinese friends for help.

http://www.taobao.com/ and http://www.tmall.com/, they are the largest online shopping store in China, both belonging to Alibaba. Taobao is mainly C2C and Tmall is mainly B2C. Often stuff on Tmall are also available on Taobao, but Tmall stuff usually are of better quality.

http://www.jd.com/, the second largest online store, mainly B2C. Best known for its fast delivery.

http://www.yihaodian.com/, online supermarket. Meat, vegetables, seasoning stuff, imported food, etc.

Happy shopping!