Monday, August 31, 2015

tar excluding certain directory

# tar zcvf /home/backup.tar.gz --exclude='/home/backup/tmp1' --exclude='/home/backup/tmp2' /home/backup/

git recover deleted file where no commit was made after the delete

If you want to restore all of the files at once

Remember to use the period because it tells git to grab all of the files.

This command will reset the head and unstage all of the changes:

$ git reset HEAD .

Then run this to restore all of the files:

$ git checkout .

Then doing a git status, you'll get:

$ git status

On branch master
Your branch is up-to-date with 'origin/master'.

Reference:

http://stackoverflow.com/questions/11956710/git-recover-deleted-file-where-no-commit-was-made-after-the-delete

Sunday, August 30, 2015

Failed to issue method call: Access denied

# systemctl enable mariadb.service

Failed to issue method call: Access denied

To show all installed unit files use:

# systemctl list-unit-files

To do this simply list all available services on your Redhat 7 system using below command and find the service you are trying to run. The service name does not always corresponds to a package name thus it may confuse you:

# systemctl list-units --type=service

Django debug toolbar causes loss of static files

When setting DEBUG = False in settings.py:

DEBUG = False

Failed to load resource: the server responded with a status of 404

Solution:

In settings.py:

STATIC_ROOT = "/var/www/html/django/MYCOMP/static/"

In urls.py:

urlpatterns += patterns('',
    url(r'^static/(?P<path>.*)$', 'django.views.static.serve', {'document_root': settings.STATIC_ROOT, }),
)

Saturday, August 29, 2015

putty ssh connection is unstable and keep getting disconnected

I just launched a EC2 instance CentOS on Amazon Web Services (AWS). I have experienced the unstable ssh connection.

Network error: Software caused connection abort

Write failed: Broken pipe

Solution 1 (use this):

# vim /etc/ssh/sshd_config

TCPKeepAlive yes

Note: TCPKeepAlive - Specifies whether the system should send TCP keepalive messages to the other side. If they are sent, death of the connection or crash of one of the machines will be properly noticed. However, this means that connections will die if the route is down temporarily, and some people find it annoying (The default is 'yes').

Note: ServerAliveInterval - Sets a timeout interval in seconds after which if no data has been received from the server, ssh(1) will send a message through the encrypted channel to request a response from the server. The default is 0, indicating that these messages will not be sent to the server.

Note: ClientAliveCountMax – This indicates the total number of checkalive message sent by the ssh server without getting any response from the ssh client. Default is 3.

Note: ClientAliveInterval – This indicates the timeout in seconds. After x number of seconds, ssh server will send a message to the client asking for response. Deafult is 0 (server will not send message to client to check.).

Solution 2:

Mosh (mobile shell) Remote terminal application that allows roaming, supports intermittent connectivity, and provides intelligent local echo and line editing of user keystrokes.

Mosh is a replacement for SSH. It's more robust and responsive, especially over Wi-Fi, cellular, and long-distance links.

Mosh is free software, available for GNU/Linux, FreeBSD, Solaris, Mac OS X, and Android.

https://mosh.mit.edu/

Solution 3:

Client configuration

Try creating the file:

~/.ssh/config
Add the contents:

Host *
ServerAliveInterval 30
ServerAliveCountMax 5

Now ssh to your server and see if your problem is fixed. ClientAliveInterval option is only useful when configuring the ssh server (aka sshd), it does not change a thing on the ssh client side, so don't use it in the above configuration file.

This will send a hello-are-you-there signal to the server if no packets have been received in the preceding 30 seconds (as specified above). However, if the number of consecutive hello-are-you-there signals reach ServerAliveCountMax then ssh will disconnect from the server. This value is defaulting to 3 (so 3*30 = 90 seconds without server activity), increase it if it suits your needs. There are alot more config options to the .ssh/config file and you could read:

Using an SSH Config File

For more information on other options. You may not want to apply this to every server you connect to which this example will. Or restrain it to only a particular server by replacing the line Host * with Host (replace by an IP address, see ssh_config man page).

Server configuration

Similarly you can tell the server to be gentle with your clients. The configuration file is /etc/ssh/sshd_config.

ClientAliveInterval 20
ClientAliveMaxCount 5

You can either deactivate it by setting ClientAliveInterval to 0 or tweak ClientAliveInterval and ClientAliveMaxCount to set a maximum ssh client inactivity without responding to the probes. One advantage of this settings over TCPKeepAlive is that the signals are sent through the encrypted channels, so it is less likely to be spoofable.

http://askubuntu.com/questions/127369/how-to-prevent-write-failed-broken-pipe-on-ssh-connection
http://unix.stackexchange.com/questions/3026/what-do-the-options-serveraliveinterval-and-clientaliveinterval-in-sshd-conf

Friday, August 28, 2015

PHP mcrypt - Basic encryption and decryption of a string

<?php
/*
 * PHP mcrypt - Basic encryption and decryption of a string
 */
$secret_key = "This is my secret key";

$string = "Some text to be encrypted";

// Create the initialization vector for added security.
$iv = mcrypt_create_iv(mcrypt_get_iv_size(MCRYPT_RIJNDAEL_256, MCRYPT_MODE_ECB), MCRYPT_RAND);

// Encrypt $string
$encrypted_string = mcrypt_encrypt(MCRYPT_RIJNDAEL_256, $secret_key, $string, MCRYPT_MODE_CBC, $iv);

// Encodes data with MIME base64
$encrypted_string_base64 = base64_encode($encrypted_string);
$encrypted_string = base64_decode($encrypted_string_base64);

// Decrypt $string
$decrypted_string = mcrypt_decrypt(MCRYPT_RIJNDAEL_256, $secret_key, $encrypted_string, MCRYPT_MODE_CBC, $iv);

echo "Original string : " . $string . "\n";
echo "Encrypted string : " . $encrypted_string . "\n";
echo 'Base 64 String: ' . $encrypted_string_base64 . "\n";
echo "Decrypted string : " . $decrypted_string . "\n";
?>

Wednesday, August 26, 2015

How to (implode) join array elements with a string?

<script>
var testArr = [{"id":9,"name":"Test 0"},{"id":5,"name":"Test 1"},{"id":6,"name":"Test 2"}];

var str = testArr.map(function(elem){
  return elem.name;
}).join(", ");

console.log(str);
</script>

Tuesday, August 25, 2015

In MySQL, can you check if a field is NULL or empty using only one comparison?

Use COALESCE() to 'normalize' the value (convert NULL values to an empty string);

WHERE COALESCE(mycolumn, '') = ''

Read the documentation: COALESCE()

Or the other way around; convert empty strings to NULL;

WHERE NULLIF(mycolumn, '') IS NULL

Documentation: NULLIF()

Of those two, I would prefer COALESCE() as it is part of the ANSI SQL standard

You can experiment with it yourself, just do this;

SELECT 
    mycolumn                      AS orig_value,
    COALESCE(mycolumn, '')        AS coalesce_value,
    (COALESCE(mycolumn, '') = '') AS compare_result
FROM mytable;

This will show the original value, the 'coalesce' value and the result of the comparison side by side for every row in the table

Reference:

http://stackoverflow.com/questions/15980995/in-mysql-can-you-check-if-a-field-is-null-or-empty-using-only-one-comparison

Wednesday, August 19, 2015

400 Bad Request, Your browser sent a request that this server could not understand

Here is a detailed explanation & solution for this problem from ibm.

Problem(Abstract)

Request to HTTP Server fails with Response code 400.

Symptom

1. Response from the browser could be shown like this:

Bad Request Your browser sent a request that this server could not understand. Size of a request header field exceeds server limit.

HTTP Server Error.log shows the following message: "request failed: error reading the headers"

2. You're speaking plain HTTP to an SSL-enabled server port.

3. some jQuery plugin, which in turn uses excess cookie data.

Cause

This is normally caused by having a very large Cookie, so a request header field exceeded the limit set for Web Server.

Diagnosing the problem

To assist with diagnose of the problem you can add the following to the LogFormat directive in the httpd.conf: error-note: %{error-notes}n

Resolving the problem

For server side: Increase the value for the directive LimitRequestFieldSize in the httpd.conf: LimitRequestFieldSize 12288 or 16384 For How to set the LimitRequestFieldSize, check Increase the value of LimitRequestFieldSize in Apache

For client side: Clear the the cache of your web browser should be fine.

Reference:

http://stackoverflow.com/questions/10309751/bad-request-your-browser-sent-a-request-that-this-server-could-not-understand
http://serverfault.com/questions/413984/increase-the-value-of-limitrequestfieldsize-in-apache
http://www-01.ibm.com/support/docview.wss?uid=swg21384722
http://www.getnetgoing.com/HTTP-400.html

Tuesday, August 18, 2015

Simple way to clear the cache memory in Linux

Although linux has an efficient memory management, sometimes the cache memory grows so much that it uses almost all your memory.

Mem:   8176884k total,  7542820k used,   634064k free,    16672k buffers
Swap:  3905460k total,        0k used,  3905460k free,  6935016k cached

You can force the system to clear it using the following command:

# sync; echo 3 > /proc/sys/vm/drop_caches

Note: sync flushes the file system buffers

After doing it, you’ll see that there’s more free memory in your system:

Mem:   8176884k total,   254456k used,  7922428k free,    32328k buffers
Swap:  3905460k total,        0k used,  3905460k free,    91500k cached

Reference:

http://sysadmin.carlusgg.com/?p=366

A cheap way to have your own security video system

Would you like to know what’s happening in your house when you are away? Or try to record a funny video like this one?

Well then, there is a very cheap way to do it with a simple webcam, a linux server, and Motion. Motion is a program that records the signal of your webcam every time there’s a movement.

First of all, if you are using a USB cam, make sure you have all the drivers installed. Then, install Motion:

$ apt-get install motion

Default configuration (/etc/motion/motion.conf) is almost enough to make it work; you should only set the videodevice and where you want to save the videos recorded by motion.

# Videodevice to be used for capturing  (default /dev/video0)
# for FreeBSD default is /dev/bktr0
videodevice /dev/video0
 
# Target base directory for pictures and films
# Recommended to use absolute path. (Default: current working directory)
target_dir /home/motion/videos/

If you are using an ip webcam, you can set it with netcam_url variable

There are a lot more options available to optimize your videos..if you want to learn more, here you have a complete list.

Finally, you only have to start the program by doing:

$ /etc/init.d/motion start

* Starting motion detection daemon : motion         [ OK ]

and your house/room/office or anywhere you want, will be watched over!

Reference:

http://sysadmin.carlusgg.com/?p=42

How to figure out what is causing an apache segmentation fault

Having an apache segmentation fault on your server can drive you crazy trying to solve it… So, I’m gonna explain you how I figured out what was causing the last apache segfault I had.

My server was running under Debian Squeeze, with Apache 2.2 and PHP 5.3, and I got randomly segmentation faults:

[Jun 08 17:38:07 2012] [notice] child pid 5646 exit signal Segmentation fault (11)
[Jun 08 18:21:34 2012] [notice] child pid 8278 exit signal Segmentation fault (11)
[Jun 08 18:44:59 2012] [notice] child pid 5665 exit signal Segmentation fault (11)

I supposed the problem was on some php extension, so I deactivated some of them…but the problem was still there :(

After spending a lot of time looking for what was causing it, I decided to debug apache with gdb. I installed it through backports because I needed an upper version than gdb 7.0 (7.0.1-2 is the current version on squeeze stable repository) otherwise I got this: “warning: The current binary is a PIE (Position Independent Executable), which GDB does NOT currently support. Most debugger features will fail if used in this session.” when I was trying to debug apache:

$ echo "deb http://backports.debian.org/debian-backports squeeze-backports main" >> /etc/apt/sources.list && apt-get update
$ apt-get -t squeeze-backports install gdb

Well, I had the debugger installed, but I also needed the php and apache debug symbols:

$ apt-get install apache2-dbg php5-dbg

Once I had installed all I needed, I configured apache to create a core dump file every time it had a segfault by adding in /etc/apache2/httpd.conf the following line:

CoreDumpDirectory /tmp/apache-coredumps

Previously, I had created the /tmp/apache-coredumps directory

By default, my system core file size was 0, so I had to change it through ulimit:

$ ulimit -c unlimited
$ ulimit -a

core file size          (blocks, -c) unlimited
[...]

I restarted apache, and I only had to wait for the next Segmentation fault… and I didn’t have to wait too much …

[Jun 08 20:16:52 2012] [notice] child pid 7976 exit signal Segmentation fault (11), 

possible coredump in /tmp/apache-coredumps

Then, as the message said, I had a core file in /tmp/apache-coredumps, and I was closer to finding out what was causing segfaults :)

Therefore, it was time to use gdb:

$ gdb apache2 -core /tmp/apache-coredumps/core

GNU gdb (GDB) 7.3-debian
Copyright (C) 2011 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later 
<http://gnu.org/licenses/gpl.html>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.  Type "show copying"
and "show warranty" for details.
This GDB was configured as "x86_64-linux-gnu".
For bug reporting instructions, please see:
<http://www.gnu.org/software/gdb/bugs/>...
Reading symbols from /usr/sbin/apache2...Reading symbols from 
/usr/lib/debug/usr/sbin/apache2-mpm-prefork...done.
done.
[New LWP 7961]
 
warning: Can't read pathname for load map: Input/output error.
[Thread debugging using libthread_db enabled]
Core was generated by `/usr/sbin/apache2 -k start'.
Program terminated with signal 11, Segmentation fault.
#0  0x00007f9aa0bffa5d in do_bind_function (opline=0x7f9a8e9ea1a8, 
function_table=0x7f9aa842c230, compile_time=0 '\000')
     at /tmp/buildd/php5-5.3.3/Zend/zend_compile.c:2956
2956    /tmp/buildd/php5-5.3.3/Zend/zend_compile.c: No such file or directory.
     in /tmp/buildd/php5-5.3.3/Zend/zend_compile.c

I had a problem with php as I thought, and I was able to find more information about it. And after Googling for a few minutes, I found there is a bug with the PHP and APC version that I was using! (more info here)

After that, I could solve the problem and until now I haven’t got more segfaults on this server :)

Using gdb will not solve your segmentation faults, but at least, you will be able to figure out what’s causing it, and you’ll get more info to solve it.

Reference:

http://sysadmin.carlusgg.com/?p=197

Get the current URL

<?php
$currentUrl = Mage::helper('core/url')->getCurrentUrl();
$url = Mage::getSingleton('core/url')->parseUrl($currentUrl);
$path = $url->getPath();

echo $currentUrl;

print_r($path);
?>

Tuesday, August 4, 2015

rest assured - 保證沒問題

rest assured - 保證沒問題

A phrase that is utilized to express positiveness, a guarantee, or just general "knowing" of a person, subject, or event.

reluctant - 不情願

reluctant - 不情願

unwilling and hesitant; disinclined.

Saturday, August 1, 2015

人窮的時候,要少在家裡;富有的時候,要多在家裡!太中肯了

人窮的時候,要少在家裡;富有的時候,要多在家裡!太中肯了

人窮得時候,錢要花給別人,

富的時候,錢要花給親人和愛人!

很多人,都做顛倒了。

【一】學會捨得

1,人窮的時候,要少在家裡,多在外面。

富有的時候,要多在家裡,少在外面。

這就是生活的藝術。

2,人窮的時候,不要計較,

對別人要好,這叫人窮志不窮。

富的時候,要學會讓別人對自己好。

自己對別人更好,學會捨得!

這些奇妙的生活方式,很少人能夠明白。

3 .窮的時候一定要大方,

富的時候,就不要擺闊了。

生命已經恢複了簡單,已經回到了寧靜。

4. 年輕是最大的富有,

但要倍加珍惜時光,貧窮無需害怕。

懂得培養自己,懂得什麼是貴重物品,

懂得該投資什麼,懂得該在哪裡節約,

這是整個過程的關鍵。

5. 別亂買衣服,少買一點,

但是可以買幾件很有品味的。

多在外面吃飯,要吃就請客,

要請,就請比自己更有夢想的、

更有思想、更努力的人。

6. 一旦生活需要的錢已經夠了,

最大的快樂,就是用你的收入,

完成你的夢想!

去放開你的翅膀大膽地實現,超越夢想!

去讓生命經曆不一樣的旅程。

【二】幸福不會遺漏任何人

多想想自己的錯,

就會慢慢忘記別人的過。

請你不要冒然評價我,

你只知道我的名字,

卻不知道我的故事。

你只是聽聞我做了什麼,

卻不知道我經曆過什麼。

一個真正強大的人,

不會把太多心思

花在取悅和親附別人上面。

所謂圈子、資源,都只是衍生品。

最重要的是提高自己的內功。

只有自己修煉好了,才會有別人來親附。

自己是梧桐,鳳凰才會來棲;

自己是大海,百川才來彙聚。

你只有到了那個層次,

才會有相應的圈子,而不是倒過來。

沒有人陪你走一輩子,

所以你要適應孤獨...

沒有人會幫你一輩子,

所以你要一直奮鬥。

人生本就是一種承受。

當愛你的人棄你而去,

任你呼天搶地亦無濟於事,

生活本是聚散無常;

當背後有人飛短流長,

任你舌如蓮花亦百口莫辯,

世道本是起伏跌宕。

(圖片來源)

得志時,好事如潮漲,

失意後,皆似花落去。

不要把自己看得太重,

委屈了、無奈了、想哭了,

這些都是你生命中不可或缺的一部分。

一個人總在仰望和羨慕著別人的幸福,

一回頭,卻發現自己正被別人仰望和羨慕著。

其實,每個人都是幸福的!

只是,你的幸福,常常在別人眼裡...

幸福這座山,原本就沒有頂、沒有頭。

你要學會走走停停,

看看山嵐、賞賞虹霓、吹吹清風,

心靈在放鬆中得到生活的滿足。

幸福不會遺漏任何人,

遲早有一天它會找到你。

人生就是這樣充滿了大起大合,

你永遠不會知道下一刻會發生什麼,

也不會明白命運為何這樣待你。

只有在你經曆了人生種種變故之後,

你才會褪盡了最初的浮華,

以一種謙卑的姿態看待這個世界。

無論你今天怎麼用力,

明天的落葉還是會飄下來。

世上有很多事是無法提前的,

活在當下,正向提升。

【三】學會快樂

沒有人會為你的痛苦買單,

心情是自己的,時刻提醒自己:我愛你!

1. 學會自我欣賞

蘋果最光輝的時刻,

就是砸在牛頓頭上,

相信自己是最好的,

說不準下一個被砸的就是你。

2. 學會自己照顧自己

沒有人會攙扶你一輩子,

你總得為自己謀一個吃飯的本事。

3. 學會對痛苦說拜拜

愛情使人忘記時間,

時間也會使人忘記愛情,

不要讓太多的昨天占據你的今天,

請相信:是你的不管你怎樣任性他都不會離開你;

失去的其實從未真正屬於過你。

(圖片來源)

4. 學會淡看得失

這世界上除了生命,

其實沒什麼東西讓你迷失自己,

學會笑著承受,笑著對風風雨雨說:

沒什麼了不起!

5. 學會善良

善良是做人的基本,

不要為了名利而失去本性。

6. 學會寬容

女人不是因為美麗而可愛,

而是因為可愛才美麗,

一點寬容會讓別人感激一生。

7. 學會高傲

女人應該有一點清高的資本,

這資本源於自己不懈的努力,

記得時刻充實自己,永不放棄。

8. 學會堅強

我愛你時,你才那麼閃耀;

我不愛你時,你什麼都不是。

這句話不但適用於愛情,也適用於人生。

9. 學會珍惜

人人都覺得永遠很遠,

其實它可能短得你都看不見,

珍惜你認為值得珍惜的,

別讓生命留下惋惜。

Reference:

http://www.cmoney.tw/notes/note-detail.aspx?nid=39170

全球頂尖CEO推薦的25本書必讀書單,你讀過哪些?

優秀的人從不停止學習。CEO即使日理萬機,他們也總是在百忙之中抽出時間來閱讀。Inc.專欄作家John Ramton整理出全球頂尖CEO推薦對他們的成長有益的書。
圖說明

1.《長日將盡》(The Remains of the Day)
亞馬遜創辦人貝佐斯(Jeff Bezos)將日本作家石黑一雄的經典作品列為他最喜愛的書籍之一,表示這本書能教導讀者人生與遺憾的課題。

2.《船上的男孩:9位美國人的1936年奧林匹亞征途》(暫譯:原書名《The Boys in the Boat: Nine Americans and Their Epic Quest for Gold at the 1936 Olympics》)
講述業餘的划船隊前進柏林奧運的故事,摩根士丹利董事長詹姆斯高曼(James Gorman)深受啟發,即使是平凡的業餘選手,他們下定決定後也能有不凡的成就。

3.《權力的終結》(暫譯,原書名《The End of Power》)
Facebook創辦人佐伯克(Mark Zuckerberg)今年宣示每兩週讀一本書,這是他選的第一本書。本書談的是權力在過去100年來的演進。

4.《創新的兩難》(The Innovator's Dilemma)
談論科技創新的經典書籍,已故蘋果創辦人賈伯斯列入他自己的書單中並表示自己深受此書影響。

5.《時基競爭》(Competing Against Time)
談論時間在商業競爭上的重要性。蘋果現任CEO庫克(Tim Cook)曾發這本書給公司同仁。


6.《拿破崙》(暫譯:原書名《Napoleon》)
前甲骨文CEO艾利森(Larry Ellison) 對這本拿破崙傳記的心得是,出身寒微的人也可以改變他的人生,另一方面,他也認為從拿破崙身上可以看到歷史如何遭到扭曲。

7.《魅力學》(The Charisma Myth)
拆解魅力的組成元素,認為任何人都可以變成有魅力的人。Yahoo執行長梅麗莎(Marissa Mayer)對此書表示支持,本書的發表會就是在她家舉辦。

8.《搜尋你內心的關鍵字》(Search Inside Yourself)
Zappos執行長謝家華(Tony Hsieh)推薦此書作為心靈成長的指南,認為這本書有改變人生、帶來快樂的潛能。

9.《智慧型股票投資人》(The Intelligent Investor)
世界知名的投資者巴菲特(Warren Buffett)的愛書,表示本書形塑了他的投資哲學。

10.《商業冒險》(Business Adventures)
微軟(Microsoft)創辦人比爾蓋茲(Bill Gates )經由巴菲特的推薦讀了本書。本書收納了12個1969年華爾街上的真實故事,從此成為比爾蓋茲的最愛。


11.《亂世中的快樂之道》(The Art of Happiness)
LinkedIn執行長傑夫韋納(Jeff Weiner)從這本達賴喇麻所著的書當中學到同理心的真諦。

12.《君王論》(The Prince)
黑石集團CEO史蒂夫·施瓦茨曼(Stephen Schwarzman)將本書列為永恆經典。

13.《孫子兵法》
Salesforce執行長馬克‧貝尼奧夫(Marc Benioff)曾說他應用孫子兵法的觀念出奇制勝,打敗敵手。

14.《挺身而進》(Lean In)
Facebook營運長桑德柏格(Sheryl Sandberg)的著作。思科創辦人錢柏斯(John Chambers)認為這是促進女性經理人升遷的絕佳機會,並發送這本書給公司主管。

15.《有種感覺叫快樂》(A Short Guide to a Happy Life)
Facebook營運長桑德柏格(Sheryl Sandberg)除了自己的著作外,還推薦這本關注女性角色與自我認知的書。

16.《你要如何衡量你的人生?》(How Will You Measure Your Life?)
前紐約市市長,也是商業鉅子的彭博(Michael Bloomberg)推薦這本探索工作與人生意義的書。

17.《杜拉克談高效能的五個習慣》(The Effective Executive)
亞馬遜創辦人貝佐斯(Jeff Bezos)認為這本有助於時間管理與決策。

18.《貨幣崛起》(The Ascent of Money)
可口可樂執行長穆塔肯特(Muhtar Kent)從這部記錄世界金融歷史的書籍中汲取靈感。

19.《玩成大贏家》(Playing to Win: How Strategy Really Works)
惠普CEO惠特曼(Meg Whitman)將本書列為惠普員工的必讀書,認為書中關於制定和執行策略的方法是成功的關鍵。

20.《引爆趨勢》(The Tipping Point)
洛克希德·馬丁(Lockheed Martin)集團執行長休森(Marillyn Hewson) 十分讚賞暢銷作家葛拉威爾的著作。

21.《尼古拉特斯拉自傳》(暫譯,原書名《My Inventions: The Autobiography of Nikola Tesla》)
Google創辦人佩吉(Larry Page)小時候讀了這本特斯拉的自傳,並對特斯拉發明了交流電深感驚奇。

22.《檢查表:不犯錯的祕密武器》(The Checklist Manifesto: How to Get Things Right)
Twitter和Square創辦人傑克多西(Jack Dorsey)經常引述書中的話並將此書發給公司新進員工。

23.《麥田捕手》(The Catcher in the Rye)
微軟(Microsoft)創辦人比爾蓋茲(Bill Gates )除了推薦商業書之外,將這本小說列為經典必讀,讚揚書中描繪出青少年的聰慧。

24.《世界是平的》(The World Is Flat)
摩根大通執行長傑米戴蒙(Jamie Dimon)在他一長串的書單中首推這本。

25.《阿特拉斯聳聳肩》(Atlas Shrugged)
艾克森美孚(ExxonMobil)執行長雷克斯·蒂勒森(Rex Tillerson)與其他許多成功人士都相信本書是當代最有影響力的書之一。

原文出自: 經理人月刊

Reference:

http://www.bnext.com.tw/article/view/id/37366

Tesla 創辦人 Elon Musk 都看什麼書?他說這 9 本一定不能錯過

Tesla 創辦人 Elon Musk 都看什麼書?他說這 9 本一定不能錯過

當Tesla創辦人Elon Musk小時候還住在南非的時候,

就已經非常熱衷於閱讀,從科幻小說到歷史偉人傳記,

各個領域都是他的涉略範圍。

當他成為Tesla and SpaceX的CEO時,

他說了「是閱讀教我創造出火箭的」。

因此,《Entreprenur》雜誌整理了多年來的訪談,

歸納出 9本對他影響最深刻的書籍,

推薦給所有想創業的電商老闆們...

繼續看下去...

1. 魔戒(The Lord of the Rings)— J. R. R. Tolkien

Musk說,當他在閱讀這類英雄小說時,

都會產生一股對世界的責任感,想要讓這個世界更好。

這是本超級暢銷書,在描述哈比人勇敢冒險精神,

不屈不撓的奮鬥故事,度過重重難關,

不僅抵抗覬覦魔戒的邪惡軍團,

同時最後成功消滅魔戒。

人雖然渺小,但只要堅持到底,可能就會出現貴人,

一起和你完成任務。

2. 銀河便車指南(The Hitchhiker`s Guide to the Galaxy)­— Douglas Adams

主角福特是一位銀河便車指南計畫的宇宙漫遊者,

他要到處搜集銀河系的資料。

他在地球待了15年當中認識了地球人亞瑟,

並且在渥罡人要摧毀地球時把亞瑟救走。

後來發現數百萬年前老鼠是超高智慧的生物,

它們創造了一台超級電腦,

而電腦說關於生命、宇宙的任何意義來自數字「42」,

不過這個問題始終沒有解答。

Musk說這本書告訴他,

如果你能夠完全表達清楚一個問題,

那麼答案其實很簡單。

3. 富蘭克林傳(Benjamin Franklin: An American Life)— Walter Isaacson

Musk如此形容富蘭克林,

他說「他是位創業家,他剛開始什麼都沒有,

就只是個離家出走的孩子。」

這樣一個什麼都沒有的人,

竟然是美國獨立宣言的起草者,也在駐法時期,

得到了法國對美國獨立的支持重要推手,

其餘許多的發明與對美國社會的貢獻,不堪枚舉。

4. 愛因斯坦(Einstein: His Life and Universe)— Walter Isaacson

Musk說他從這本偉人傳記裡學到非常多。

這本書是在說關於一個天才

如何運用他超高等的智慧和堅持不懈追求的目標,

來改變這個世界。

每個人都有自己的專長,

也許我們不像愛因斯坦這麼偉大

可以成為諾貝爾物理獎的得獎主,

對世界有這麼大的貢獻,但我們仍可以盡一己之力,

學習他的精神,促進社會有小小的更好的改變。

5. 結構:物體為什麼不會落下來(Structures: Or Why Things Don`t Fall Down)— J. E. Gordon

Musk說,如果你對材料學有興趣,

那麼就要看這本結構工程師推薦的專業好書,

這對啟蒙結構設計會有很大的幫助。

這本書裡在討論為何懸吊的橋樑上有八線道的車子

在通行卻不會垮掉,為何水壩可以裝載

這麼多加侖的水,也不會崩裂。

一些日常生活覺得稀鬆平常的事情,

這本書都提出了科學上的疑問。

一方面可以幫助人們反思,從新的角度看事物,

另一方面也能從結構學的角度,來學習更多科普知識。

6. 點火:液體火箭推進劑野史(Ignition!: An informal history of liquid rocket propellants)— John D. Clark

這本1972年的書在探討火箭科學的演進史,

是本非常有趣的書,Musk推薦說。

1926年3月16日,羅伯特於美國麻州奧本鎮

發射了世界第一枚液態燃料火箭,

開始了人類登入宇宙的冒險,

才有1970年阿波羅13號登入

有人類登上月球的輝煌故事。

相信這本書是啟發Musk事業的最大燃料,

喜歡Musk的人千萬不能錯過這本書喔。

7. 超級智能:人類遺作或救星?(Superintelligence: Paths, Dangers, Strategies)— Nick Bostrom

霍金在許多場合都說過

「當人工智慧過度發展,將會導致人類滅絕。」

作者Nick Bostrom是牛津大學人類未來學院

(Future of Human Institute)的教授,

他的調查顯示未來電腦的人工智慧會勝過人類的智商,

當他們學習到了自我修復的功能後,

就會讓自己計算的速度更快,

時時讓自己不停地修正及優化,人類會無法阻止他們,

失控的變成所謂超級智能。

而Musk看完這本書後,

他覺得我們應該要非常小心提防人工智慧,

因為它可能比核子武器還要危險。

8.從0到1:打開世界運作的未知祕密,在意想不到之處發現價值(Zero to One: Notes on Startups, or How to Build the Future)— Peter Thiel

作者Peter Thiel是PayPal和Palantir共同創辦人,

臉書第一位外部投資人,

他在書中分析關於「新創」這個哲學觀點,

其中在矽谷被津津樂道最著名的一個想法就是「破壞」

(disruption)。這本書裡面有他創業的過程,

是從0到1,而非複製別人的模式,

因為複製總是比創新簡單,

做大家都知道怎麼做的事、提供更多熟悉的東西,

這是由1到n,所以是相當值得學習的一本書。

9.霍華.休斯:他的生活和瘋狂 (Howard Hughes: His Life and Madness)— Donald L. Barlett& James B. Steele

Musk說霍華是位另類的電影製作人及航空巨頭。

霍華在他的後半人生是過得非常精彩的,

而Musk也陶侃的說:

「我非常確定我是個不留長指甲

也不會尿在牛奶罐裡的人」,

這可以對比出霍華的瘋狂行徑。

但也就是拜讀過去美國

這麼一個狂放不羈的歷史人物的傳記,

才可以給他這麼多有趣的靈感和幽默。

有時候點子並不一定出自專門學科的書,

很多不一般的人,

往往給我們更多天馬行空的突發奇想。

Reference:

http://www.cmoney.tw/notes/note-detail.aspx?nid=38180