I was learning unix commands and regular expression on the mac sitting on office desk, and did a little exercise: a shell script that terminates a running application given the name of the app.
The shell script goes like this:
#!/bin/sh
ps auxc | grep -i "$1" | awk "{print $2}" | xargs kill
That was it. Now let me explain.
The line is composed of four individual commands piped together with the piping operator "|".
The first command, "ps auxc" lists all the running processes. The output of this command is piped into the second command, "grep -i "$1"", which takes the first argument of the script, i.e. the name of the Application that you want to terminate, and returns the line that contains that name. The third command scans that line, and returns the second field in the line, which is the process ID of the application to be terminated. Finally, the last command, "xargs kill" takes the process ID generated above as an argument, and passes it to the termination program "kill", to terminate the application.
I am fascinated by a lot of stuff, such as foreign policies, social justice, education, technology and economics. Recently I found myself passionate about street photography.
Monday, November 22, 2010
Back
Being a blog is kind of pathetic. Number one, nobody reads it; number two, the author himself neglects it. I decided to revitalize the blog after a long hibernation. There're some changes in my life. But mostly, Yali and I moved to Boston and we have a new member in our family: our dog Max! Welcome back to my blog.
Tuesday, August 4, 2009
Why High-Speed Railway Is Not Cost-Effective in America?
Harvard economist Edward Glaeser recently made a ballpark cost-benefit analysis, and argued why high-speed railway is not cost-effective right now in America. In order to make rail feasible economically, one has to increase the people who would prefer train to air by at least 600%.
Is President Obama’s vision of hyper-fast trains racing through America a sound transportation policy or a costly boondoggle? Last week, I began a four-part series on the costs and benefits of high-speed rail. The readers of last week’s post seemed particularly eager to get to traffic congestion and the environment, but space constraints compel me to push these off until next week. Today I will get mired in the sometimes dull arcana of rail costs and direct benefits to users.
I’m going to frame the discussion around an imaginary 240-mile link between Dallas and Houston, but the basic formula for direct costs and benefit is general:
Number of Riders times (Benefit per Rider minus Variable Costs per Rider) minus Fixed Costs.
I’m simplifying, but a formula needs to be simple if interested parties can seriously debate the numbers, and the only way that America is going to get to the right answer on public investments is if numbers trump rhetoric. I will plug illustrative figures into the formula, but not only am I well aware that every number here is debatable, I am hoping for just that debate.
Last week, I cited data from the Government Accountability Office suggesting that $50 million a mile was a reasonable construction cost figure. To make this one-time cost comparable to everything else, which is an annual flow, the fixed cost needs to be converted into an annual cost, which is done by multiplying by an interest rate, capturing the opportunity cost of capital. If that cost of capital is 5 percent (as I said, everything is debatable), then the up-front capital cost is $2.5 million a mile per year, or $600 million for a 240-mile line.
The other cost that is independent of the number of riders is track maintenance. One recent European estimate puts that cost at $140,000 a mile per year for a two-track system. A feasibility study of high-speed rail in Britain came up with the considerably higher figure of $493,000 a mile for surface trains. I’ll stay closer to the lower estimate and go with $200,000 a mile per year, which brings the fixed costs of the track up to $648 million per annum.
Other train costs — rolling stock purchase and maintenance, personnel — more or less scale up or down with the number of passenger miles. Unfortunately, there is plenty of range on these cost estimates. A 12-year-old classic in this field has a number of 10.5 cents amile (in today’s dollars), but one recent European study comes out at 50 cents a passenger mile. Amtrak’s operating expenses run at about 45 cents a passenger mile. I’ll average between 10 and 50 and plug in 30 cents a passenger mile in operating costs, which comes to $72 for a 240-mile trip.
I estimate benefits by comparing rail to air. A train going from Dallas to Houston at 150 miles an hour would take 96 minutes. Southwest Airlines takes an hour for the same route, but the need to arrive early could add on an extra hour. I’ll add on an extra 36 minutes for the driving time to the airports, which means that the train saves an hour. The per-passenger benefit from the high-speed rail line is the saved cost of the Southwest ticket ($80) plus an hour’s worth of time (let’s say $40, which seems generous), plus any added benefits from the comfort of the train (let’s say $20 more). All told, benefits per trip are $140. Since the variable costs are $72 for the trip (30 cents a mile times 240 miles), benefits minus variable costs come to $68 a trip. If these numbers were right (and I think that they are very kind to rail), then the system should be able to run a healthy operating surplus.
How many riders will take high-speed rail between Houston and Dallas? Amtrak gets about 11 million customers in the Northeast Corridor, which has four large consolidated metropolitan areas together totaling 44 million people. If that four-to-one ratio held in Texas, then the high-speed rail link could expect three million riders, and more to come as Texas grows.
But as President Obama has said one of the appeals of high-speed rail is “walking only a few steps to public transportation, and ending up just blocks from your destination.” That’s bad news for Texas. In Dallas less than 5 percent of the population takes public transportation to work, and more than 60 percent of all jobs are more than 10 miles from the city center. For these reasons, driving will continue to be extremely attractive for travelers who want to save parking fees and need cars once they arrive. I’ll go with 1.5 million trips a year (even including future growth), which would make the new rail line about as popular as all airplane flights between the two cities are today.
Now it’s just down to multiplying: 1.5 million trips times $68 a trip means $102 million for benefits minus operating costs. Annual capital costs came in $648 million, more than six times that amount. If you think that the right number is three million trips, then the benefits rise to $200 million, and the ratio between the per rider net benefits and costs drops to one-to-three. This is the cruel arithmetic faced by people, like myself, who would love to be pro-rail. One hint for train lovers who would like to make this comparison look better: make a compelling case that the interest rate should be much lower, as nothing else makes nearly as much difference. Also keep in mind that I haven’t brought in the environment or congestion. They’re up next week.
Is President Obama’s vision of hyper-fast trains racing through America a sound transportation policy or a costly boondoggle? Last week, I began a four-part series on the costs and benefits of high-speed rail. The readers of last week’s post seemed particularly eager to get to traffic congestion and the environment, but space constraints compel me to push these off until next week. Today I will get mired in the sometimes dull arcana of rail costs and direct benefits to users.
I’m going to frame the discussion around an imaginary 240-mile link between Dallas and Houston, but the basic formula for direct costs and benefit is general:
Number of Riders times (Benefit per Rider minus Variable Costs per Rider) minus Fixed Costs.
I’m simplifying, but a formula needs to be simple if interested parties can seriously debate the numbers, and the only way that America is going to get to the right answer on public investments is if numbers trump rhetoric. I will plug illustrative figures into the formula, but not only am I well aware that every number here is debatable, I am hoping for just that debate.
Last week, I cited data from the Government Accountability Office suggesting that $50 million a mile was a reasonable construction cost figure. To make this one-time cost comparable to everything else, which is an annual flow, the fixed cost needs to be converted into an annual cost, which is done by multiplying by an interest rate, capturing the opportunity cost of capital. If that cost of capital is 5 percent (as I said, everything is debatable), then the up-front capital cost is $2.5 million a mile per year, or $600 million for a 240-mile line.
The other cost that is independent of the number of riders is track maintenance. One recent European estimate puts that cost at $140,000 a mile per year for a two-track system. A feasibility study of high-speed rail in Britain came up with the considerably higher figure of $493,000 a mile for surface trains. I’ll stay closer to the lower estimate and go with $200,000 a mile per year, which brings the fixed costs of the track up to $648 million per annum.
Other train costs — rolling stock purchase and maintenance, personnel — more or less scale up or down with the number of passenger miles. Unfortunately, there is plenty of range on these cost estimates. A 12-year-old classic in this field has a number of 10.5 cents amile (in today’s dollars), but one recent European study comes out at 50 cents a passenger mile. Amtrak’s operating expenses run at about 45 cents a passenger mile. I’ll average between 10 and 50 and plug in 30 cents a passenger mile in operating costs, which comes to $72 for a 240-mile trip.
I estimate benefits by comparing rail to air. A train going from Dallas to Houston at 150 miles an hour would take 96 minutes. Southwest Airlines takes an hour for the same route, but the need to arrive early could add on an extra hour. I’ll add on an extra 36 minutes for the driving time to the airports, which means that the train saves an hour. The per-passenger benefit from the high-speed rail line is the saved cost of the Southwest ticket ($80) plus an hour’s worth of time (let’s say $40, which seems generous), plus any added benefits from the comfort of the train (let’s say $20 more). All told, benefits per trip are $140. Since the variable costs are $72 for the trip (30 cents a mile times 240 miles), benefits minus variable costs come to $68 a trip. If these numbers were right (and I think that they are very kind to rail), then the system should be able to run a healthy operating surplus.
How many riders will take high-speed rail between Houston and Dallas? Amtrak gets about 11 million customers in the Northeast Corridor, which has four large consolidated metropolitan areas together totaling 44 million people. If that four-to-one ratio held in Texas, then the high-speed rail link could expect three million riders, and more to come as Texas grows.
But as President Obama has said one of the appeals of high-speed rail is “walking only a few steps to public transportation, and ending up just blocks from your destination.” That’s bad news for Texas. In Dallas less than 5 percent of the population takes public transportation to work, and more than 60 percent of all jobs are more than 10 miles from the city center. For these reasons, driving will continue to be extremely attractive for travelers who want to save parking fees and need cars once they arrive. I’ll go with 1.5 million trips a year (even including future growth), which would make the new rail line about as popular as all airplane flights between the two cities are today.
Now it’s just down to multiplying: 1.5 million trips times $68 a trip means $102 million for benefits minus operating costs. Annual capital costs came in $648 million, more than six times that amount. If you think that the right number is three million trips, then the benefits rise to $200 million, and the ratio between the per rider net benefits and costs drops to one-to-three. This is the cruel arithmetic faced by people, like myself, who would love to be pro-rail. One hint for train lovers who would like to make this comparison look better: make a compelling case that the interest rate should be much lower, as nothing else makes nearly as much difference. Also keep in mind that I haven’t brought in the environment or congestion. They’re up next week.
Thursday, May 21, 2009
The Norway Model
Recently an article from New York Times talks about how Norway's economy is still thriving and manages to grow by 3% in GDP last year while the rest of the world is sliding deep into the recession caused by the Global Financial Crisis in 2008. Naturally it makes people wonder, which is the better model, the scandinavian socialistic model, characterized by generous social welfare and high tax, or the Anglo-Saxon laissez faire model, characterized by a privatized social safety net, education and a lightly regulated financial system.
Norway's story is not typical. Its GDP per capita in 2008 is $53,450, ranked No.3 after Luxemburg. Norwegian people feel blessed that their country not only has the stunningly beautiful fjorks, but also sits on top of rich petroleum and natural gas resources near the North sea. The country is also rich in hydropower, which makes refining aluminum, another rich resource they have, feasible. Norwegian fishermen have access to one of the largest salmon fields in the world.
Rich natural resources and a small population might already explain half of the Norway's economic successful story. The other half lies in norwegians' frugal fiscal policy. More than 80% of the oil and gas revenue goes directly to the sovereign wealth fund, which is used to buy assets around the world, such as US treasuries or Japanese stocks. Although the fund's holding takes a hit in this financial crisis, the cost for the assets are actually cheaper than ever. Savers like Norway could take this opportunity and buy up more assets.
The public spending of the norwegian government is much lower compared to other developed countries, thanks to the lack of a strong military program. The saved money is spent in the norwegian tax payers: all norwegian citizens get free health care, free education (including higher education) and a generous financial aid for people out of work. In return, 40-50% of personal income in Norway is taxed. Another important feature in Norway's social structure is that, the income gap between the "rich" and the "poor" is relatively smaller compared to United States. Doctors, lawyers and businessmen make less than 3 times of what a waiter/waitress could make.
People in U.S. might argue that, in system like Norway, no one has the incentive to work. As the petro-resources run up, the country has to face the reality. I partially agree with this view. What makes America the most dynamic economy in the world, partly is that entrepreneurship is strongly encouraged in U.S.'s economic system. People have incentive to take risk, work hard and innovate. Such dynamic entrepreneurship-based economy has dynamic consequence too: companies frequently find the need to lay off or hire people in America, depending on whatever opportunity present. A flexible labor market is needed for a dynamic economy, since entrepreneurs could allocate the most effective resources as they see fit. This is exactly lacking in countries like Japan, Germany or France. The more dynamic the economy is, the more new jobs can be created.
The downside of America's model, compared to the Norway's one, is that the basic social safety net does not support the dynamic economy and risk taking. A nationalized health care plan and free college education for their children, could free workers' minds from worrying about losing their jobs. A worry-free worker is more willing to take risk and pursue what they could potentially achieve entrepreneurship-wise. Additionally, a free health care and free higher education can mobilize people from different social classes, not to mention narrowing the income gap, and therefore maximize the availability and quality of the workforce, and improve the nation's overall productivity.
Norway's story is not typical. Its GDP per capita in 2008 is $53,450, ranked No.3 after Luxemburg. Norwegian people feel blessed that their country not only has the stunningly beautiful fjorks, but also sits on top of rich petroleum and natural gas resources near the North sea. The country is also rich in hydropower, which makes refining aluminum, another rich resource they have, feasible. Norwegian fishermen have access to one of the largest salmon fields in the world.
Rich natural resources and a small population might already explain half of the Norway's economic successful story. The other half lies in norwegians' frugal fiscal policy. More than 80% of the oil and gas revenue goes directly to the sovereign wealth fund, which is used to buy assets around the world, such as US treasuries or Japanese stocks. Although the fund's holding takes a hit in this financial crisis, the cost for the assets are actually cheaper than ever. Savers like Norway could take this opportunity and buy up more assets.
The public spending of the norwegian government is much lower compared to other developed countries, thanks to the lack of a strong military program. The saved money is spent in the norwegian tax payers: all norwegian citizens get free health care, free education (including higher education) and a generous financial aid for people out of work. In return, 40-50% of personal income in Norway is taxed. Another important feature in Norway's social structure is that, the income gap between the "rich" and the "poor" is relatively smaller compared to United States. Doctors, lawyers and businessmen make less than 3 times of what a waiter/waitress could make.
People in U.S. might argue that, in system like Norway, no one has the incentive to work. As the petro-resources run up, the country has to face the reality. I partially agree with this view. What makes America the most dynamic economy in the world, partly is that entrepreneurship is strongly encouraged in U.S.'s economic system. People have incentive to take risk, work hard and innovate. Such dynamic entrepreneurship-based economy has dynamic consequence too: companies frequently find the need to lay off or hire people in America, depending on whatever opportunity present. A flexible labor market is needed for a dynamic economy, since entrepreneurs could allocate the most effective resources as they see fit. This is exactly lacking in countries like Japan, Germany or France. The more dynamic the economy is, the more new jobs can be created.
The downside of America's model, compared to the Norway's one, is that the basic social safety net does not support the dynamic economy and risk taking. A nationalized health care plan and free college education for their children, could free workers' minds from worrying about losing their jobs. A worry-free worker is more willing to take risk and pursue what they could potentially achieve entrepreneurship-wise. Additionally, a free health care and free higher education can mobilize people from different social classes, not to mention narrowing the income gap, and therefore maximize the availability and quality of the workforce, and improve the nation's overall productivity.
Sunday, May 17, 2009
Sunday, April 26, 2009
Touched
Today my wife let me read her MSN profile. In her profile, she wrote that she wishes to find someone who can enjoy "Castle in the sky" and "Shaun of the Dead", and someone who is as cute as Do la A Meng (a little robotic cat in a Japanese cartoon).
Her profile is about me.
I feel lucky that I could share my life with someone who could and would connect with me spiritually. She and I have a lot in common. Often times we feel happy for the same causes, and angry for the same reasons. We sometimes end up being mad at each other simultaneously, because she's probably having the same feeling that I have. In a sense, it's easy to make her happy, because I feel happy the same way too.
I wish that wife and I could share a same ideal, and a same perspective of what a good and enjoyable life journey is. I am a person who could be easily be touched emotionally, and I am happy about it because I am feeling life. Isn't life is about being touched and touching others' hearts?
Her profile is about me.
I feel lucky that I could share my life with someone who could and would connect with me spiritually. She and I have a lot in common. Often times we feel happy for the same causes, and angry for the same reasons. We sometimes end up being mad at each other simultaneously, because she's probably having the same feeling that I have. In a sense, it's easy to make her happy, because I feel happy the same way too.
I wish that wife and I could share a same ideal, and a same perspective of what a good and enjoyable life journey is. I am a person who could be easily be touched emotionally, and I am happy about it because I am feeling life. Isn't life is about being touched and touching others' hearts?
Sunday, April 19, 2009
Subscribe to:
Posts (Atom)

