[SHARE] Charming Python: Iterators and simple generators

Charming Python: Iterators and simple generators
Start your free trial New constructs in Python 2.2 Python 2.2 introduces a new construct accompanied by a new keyword. The construct is generators; the keyword…

via Instapaper http://ift.tt/1YHYelr

[SHARE] Python Programming Interview Questions with Answers Part-1

Python Programming Interview Questions with Answers Part-1
Today we are going to present you Part-1 of top 20 Python programming interview questions. We’ve selected these questions after exhaustive research. The…

via Instapaper http://ift.tt/1VgkfZo

[SHARE] Git Hooks

Git Hooks
Git hooks are scripts that run automatically every time a particular event occurs in a Git repository. They let you customize Git’s internal behavior and…

via Instapaper http://ift.tt/1KFOSfB


[SHARE] What is HDR for TVs, and why should you care? - CNET

What is HDR for TVs, and why should you care? - CNET
Geoffrey Morrison HDR, or high dynamic range, is poised to be the next big thing in TVs. We've been talking about it for several years , but finally a few…

via Instapaper http://ift.tt/1itJrtC

[SHARE] Silicon Valley spends money on people, Asia spends it on marketing

Silicon Valley spends money on people, Asia spends it on marketing
If you’re around Asia’s startup scene long enough, you’ll start to hear the same tunes over and over again: solve a problem, target a big market, develop a…

via Instapaper http://ift.tt/1Mu7uWh


[SHARE] 【創報】Ben Horowitz:初次創業成功最重要的是 PMF,其他都是次要的

【創報】Ben Horowitz:初次創業成功最重要的是 PMF,其他都是次要的
Posted by: der 2015 年 09 月 15 日 in 所有文章 若說 Ben Horowitz 是矽谷最知名、最成功且受人尊敬的創投者之一,應該沒有人會否認。他曾在初期投資了 Facebook、Twitter、Groupon 和 Skype 等後來十分成功的企業,並共同創辦了 Andreessen…

via Instapaper http://ift.tt/1NADmJj



想看的書好多,書單(here)增加的速度遠超過閱讀的速度 XDDD


WISDOM acrostic -- understanding an audience

[W]hat do you want them to learn?
What is their [i]nterest in what you've got to say?
How [s]ophisticated are they?
How much [d]etail do they want?
Whom do you want to [o]wn the information?
How can you [m]otivate them to listen to you?


[SHARE] 5 Questions Every Unit Test Must Answer — JavaScript Scene

5 Questions Every Unit Test Must Answer — JavaScript Scene
Every developer knows we should write unit tests in order to prevent defects from being deployed to production. What most developers don’t know are the…

via Instapaper http://ift.tt/1LJUZWk


[SHARE] nealford.com • Knowledge Breadth versus Depth

nealford.com • Knowledge Breadth versus Depth
Mark Richards , my co-presenter in the Software Architecture Fundamentals video series , is a a deeply knowledgable architect who doesn’t blog much, so I’m…

via Instapaper http://ift.tt/1Q1P0KA



Aberfoyle Springs - Canadian Mountain Spring Water



via Instagram http://ift.tt/1NnUVur

via Instagram http://ift.tt/1O6WgHD

:set relativenumber

Recently I found a setting in vim -- :set relativenumber, that gives a better life. From most tutorials or .vimrc references, I usually see :set number to show line number for better tracking codes. With only line number, however, I need to calculate range of codes in mind for deleting or yanking and often get wrong number. With :set relativenumber, there is no need to manually calculate line numbers. All relative line distances, either up-side or down-side, from current line are shown on side-bar. This is helpful to manipulate several lines of text at one time.

Review of "Apprenticeship Patterns"

This is truly a great reference book for software craftsmanship.

Initially Dave gives the story about his experience of software craftsmanship. Then the definitions of software craftsmanship, being an apprentice, being a journeyman, being a master are given. Also apprenticeship and apprenticeship pattern are introduced. In following chapters, Dave and Ade use Context-Problem-Solution-Action pattern to address different situations we may encounter in our programming life. Every situation is a signal to improve ourselves and this book points "how-to" when we are stuck in these situations.

To be level up, we need to forget who we are first (emptying the cup). Then think about what we want and the long-term goal (walking the long road). Once the direction is chosen, just do it and don't be afraid of failures (accurate self-assessment). There is no really end of software craftsmanship, and all we could do is to get better and better in our whole life (perpetual learning, construct your curriculum).

In Chinese Kong-Fu, there are two categories. One is to train our skill, and the other is to train our mind. "Apprenticeship Patterns" is more like the latter category. Instead of hard skills, this book gives us some guidances in each stage of software craftsmanship on self-improvement.


Check if socket is broken in Python

You set up a socket from client to server for communication. And you want to get informed when socket is broken.

If the socket is closed from server, client side receives no more data from socket. However, if server is shutdown in accident or network connection is broken, you may not get any hint.

Set socket option with TCP keep-alive as following:

_socket.setsockopt(socket.SOL_SOCKET, socket.SO_KEEPALIVE, 1)
except socket.error as e:

When socket is broken, TCP keep-alive is failed. Then socket.error is raised while socket.recv(). By default keep-alive time is no less than two hours and this exception may be raised up to two hours. If you want more responsive on socket broken, need to reduce the keep-alive time.

For Linux:
_socket.setsockopt(socket.IPPROTO_TCP, socket.TCP_KEEPIDLE, after_idle_sec)
_socket.setsockopt(socket.IPPROTO_TCP, socket.TCP_KEEPINTVL, interval_sec)
_socket.setsockopt(socket.IPPROTO_TCP, socket.TCP_KEEPCNT, max_fails)

For OSX:
_socket.setsockopt(socket.IPPROTO_TCP, TCP_KEEPALIVE, interval_sec)

For Windows:
_socket.ioctl(socket.SIO_KEEPALIVE_VALS, (1, keepalive_time_msec, keepalive_interval_msec))

Note on Windows platform, the unit of time is millisecond.

[1] https://docs.python.org/2/library/socket.html
[2] http://stackoverflow.com/a/14855726/1249320
[3] https://msdn.microsoft.com/en-us/library/dd877220%28v=vs.85%29.aspx


[SHARE] Code Review Best Practices

Code Review Best Practices
At Wiredrive, we do a fair amount of code reviews. I had never done one before I started here so it was a new experience for me. I think it’s a good idea to…

via Instapaper http://ift.tt/1EYnN7M

[SHARE] 如何入門敏捷專案開發?(導讀)

我第一次接觸到敏捷開發這個詞,大約是 2008 年。本來剛入門對於這個詞是懵懵懂懂,但隨著經歷大大小小過百個專案,試過十數套專案進行方式後。在這七年當中,我逐漸累積建立自己一套系統性的心法與作法。 常有朋友問我「敏捷開發」要如何學習? 當然,最快的方式,我會推薦你來報 敏捷專案管理班2015年版…

via Instapaper http://ift.tt/1Ng1dO0

[SHARE] Overview of Single vs. Multi Server Architecture

Overview of Single vs. Multi Server Architecture
Each time I post a setup guide for configuring a Django server there are questions about how I came upon the Nginx and Apache multi-server approach as opposed…

via Instapaper http://ift.tt/1NgV3x8


Staple-less Stapler

Staple-less Stapler
I first encountered these tools on a site that dealt with Japanese imports. Apparently they’re more popular there than in North America. They’re basically…

September 4, 2015 at 11:10AM
via Instapaper http://ift.tt/1J3rSHr

日本的「咖啡文化」——內涵不斷深化,形式愈發多樣 | nippon.com 日本網

日本的「咖啡文化」——內涵不斷深化,形式愈發多樣 | nippon.com 日本網
地方城市的咖啡館:現代日本咖啡文化的象徵 店員引領我就座後,打開菜單,只見咖啡欄下的飲品足足有20多種。比如「Saza調」、「Saza Glorious(哥倫比亞)」、「Gorda Los Pirineos農場(薩爾瓦多)」、「肯亞」、「曼特寧(印尼)」、「Geisha Natural…

September 4, 2015 at 11:09AM
via Instapaper http://ift.tt/1Ofed3x