# Simple life, Complicated mind

## Thursday, August 22, 2013

### How do I convert a JSON string to a JavaScript object in jQuery?

How do I convert a JSON string to a JavaScript object in jQuery?

JSON.parse(string) - parses a JSON string, reconstructing the original JavaScript object.
JSON.stringify(object) - accepts a JavaScript object and returns its JSON equivalent.

## Friday, August 16, 2013

### How to Calculate Upper & Lower Control Limits

How to Calculate Upper & Lower Control Limits

A control chart is a chart used to monitor the quality of a process. The upper and lower control limits are two horizontal lines drawn on the chart. If data points fall outside of these lines, it indicates that it is statistically likely there is a problem with the process. These lines are usually placed three standard deviations from the mean, so there is a 99.73 percent probability that a data point will be within those limits. To calculate the control limits, you will need to first find the mean and standard deviations of your data set. Then you will calculate the upper and lower control limits.

Instructions

Calculating Standard Deviation
1 Find the mean of your data set by adding all the data points and dividing by the number of data points. As an example, take the data set: 2, 3, 5, 5, 7. The mean is 2+2+3+5+5+7 / 6 = 24 / 6 = 4.

2 Subtract the mean from each data point and square the result. Continuing the example: (2-4)^2, (2-4)^2, (3-4)^2, (5-4)^2, (5-4)^2, (7-4)^2 = (-2)^2, (-2)^2, (-1)^2, (1)^2, (1)^2, (3)^2 = 4, 4, 1, 1, 1, 9.

3 Find the mean of the result. Again, from the example: 4 + 4 + 1 + 1 + 1 + 9 = 20 / 6 = 3.33.

4 Take the square root of that mean to get the standard deviation. The standard deviation of the example is sqrt(3.33) = 1.83.
Calculating Control Limits

5 Multiply the standard deviation by 3. From the example = 1.83 x 3 = 5.48.

6 Add the mean of the original data set to the result. This is the upper control limit. The upper control limit for the example data set is 4 + 5.48 = 9.48.

7 Subtract the result of Step 1 from the mean of the original data set to get the lower control limit. The lower control limit of the example data set is 4 - 5.48 = -1.48.

===
STANDARD DEVIATION 標準偏差

Mean:
=AVERAGE(A1:A8)

STANDARD DEVIATION:
=STDEV(A1:A8)

UCL = Mean + 2.66 * Average of moving range.
UCL = Mean - 2.66 * Average of moving range.

Value Moving Range
10
13 3
14 1
15 1
16 1
17 1
14 3
15 1

Average Moving Range 1.571428571
Mean of Value 14.25

UCL=14.25+2.66*1.571428571 = 18.43
LCL=14.25-2.66*1.571428571 = 10.07

http://www.mrexcel.com/forum/excel-questions/508468-help-formula-calculate-upper-lower-control-limits.html

### PI - Performance Indicator

PI - Performance Indicator

• Quantitative indicators that can be presented with a number.
• Qualitative indicators that can't be presented as a number.
• Leading indicators that can predict the outcome of a process
• Lagging indicators that present the success or failure post hoc
• Input indicators that measure the amount of resources consumed during the generation of the outcome
• Process indicators that represent the efficiency or the productivity of the process
• Output indicators that reflect the outcome or results of the process activities
• Practical indicators that interface with existing company processes.
• Directional indicators specifying whether or not an organization is getting better.
• Actionable indicators are sufficiently in an organization's control to affect change.
• Financial indicators used in performance measurement and when looking at an operating index.

http://en.wikipedia.org/wiki/Performance_indicator

sales matrix
sales metrics

### Sales Data Analysis Tools help retail store owners figure out what really matters

Sales Data Analysis Tools help retail store owners figure out what really matters…

On a daily basis, retailers generate sales data that can tell them quite a bit if put under analysis. Monitoring Sales Data plays a pivotal role within a retail organization. BUT, it is difficult for a retailer to make strategic decisions based on this raw data alone.

With the advent of new technology, retailers have the ability to analyse and use this data to improve retail productivity. Data analytics gives a summary on top performers, bottom performers, key value items, sales performance, forecasting, trend and seasonality, in other words, all of the things that daily keep you profitable.

Sales Data Analysis Tools - Whats Happening at Your Retail Store Matters

These data allow a retailer to target their customers more effectively by campaigns, to improve response time to market changes, to increase employee productivity and to improve customer service at stores.

In order to remain competitive, retailers need to enhance their product offerings, service levels and pricing models. They need the data in their systems to be able to do so. Unfortunately small and midsize retailers have limited resources to be able to do this analysis on the regular basis that they need.

At the same time, being in the store and interacting with your employees and customers can give you a physical sense of what happens daily in your store. While analysis may say one thing, remember that the voices of your customers, their concerns and requests, give you a concrete set of data to use in purchasing and marketing decisions.

Combining the two subsets of sales data will be the best use of all of the information coming into your store on a daily basis!

Sales data analysis tools - My Virtual DMUsing sales data analysis tools like myvirtualdm.com can help you sort through the immense amount of data, figure out what is important and what isn’t and provide you with concrete reports based on the retail sales data analysis that you can rely upon to forecast where your business is heading.
Incoming search terms:
• sales data analysis
• retail sales analysis techniques
• Store customer data
• sales analysis
• how to analyse retail sales data
• retail store sales data analysis
• data analysis retail stores
• sales analysis techniques
• Sales Analysis Tools
• sales data analysis techniques

http://retailsalesmarketingmanagement.com/sales-data-analysis-tools-whats-happening-at-your-retail-store-matters/

## Thursday, August 15, 2013

### VMI - Vendor-managed inventory

VMI - Vendor-managed inventory is a family of business models in which the buyer of a product (business) provides certain information to a vendor (supply chain) supplier of that product and the supplier takes full responsibility for maintaining an agreed inventory of the material, usually at the buyer's consumption location (usually a store). A third-party logistics provider can also be involved to make sure that the buyer has the required level of inventory by adjusting the demand and supply gaps.

### SPC - Statistical process control

SPC - Statistical process control

### TQM - Total quality management

TQM - Total quality management

### Six Sigma

Six Sigma is a set of tools and techniques/strategies for process improvement originally developed by Motorola in 1985.

### How Geniuses Think

How do geniuses come up with ideas? What is common to the thinking style that produced "Mona Lisa," as well as the one that spawned the theory of relativity? What characterizes the thinking strategies of the Einsteins, Edisons, daVincis, Darwins, Picassos, Michelangelos, Galileos, Freuds, and Mozarts of history? What can we learn from them?

For years, scholars and researchers have tried to study genius by giving its vital statistics, as if piles of data somehow illuminated genius. In his 1904 study of genius, Havelock Ellis noted that most geniuses are fathered by men older than 30; had mothers younger than 25 and were usually sickly as children. Other scholars reported that many were celibate (Descartes), others were fatherless (Dickens) or motherless (Darwin). In the end, the piles of data illuminated nothing.

Academics also tried to measure the links between intelligence and genius. But intelligence is not enough. Marilyn vos Savant, whose IQ of 228 is the highest ever recorded, has not exactly contributed much to science or art. She is, instead, a question-and-answer columnist for Parade magazine. Run-of-the-mill physicists have IQs much higher than Nobel Prize winner Richard Feynman, who many acknowledge to be the last great American genius (his IQ was a merely respectable 122).

Genius is not about scoring 1600 on the SATs, mastering fourteen languages at the age of seven, finishing Mensa exercises in record time, having an extraordinarily high I.Q., or even about being smart. After considerable debate initiated by J. P. Guilford, a leading psychologist who called for a scientific focus on creativity in the sixties, psychologists reached the conclusion that creativity is not the same as intelligence. An individual can be far more creative than he or she is intelligent, or far more intelligent than creative.

Most people of average intelligence, given data or some problem, can figure out the expected conventional response. For example, when asked, "What is one-half of 13?" most of us immediately answer six and one-half. You probably reached the answer in a few seconds and then turned your attention back to the text.

Typically, we think reproductively, that is on the basis of similar problems encountered in the past. When confronted with problems, we fixate on something in our past that has worked before. We ask, "What have I been taught in life, education or work on how to solve the problem?" Then we analytically select the most promising approach based on past experiences, excluding all other approaches, and work within a clearly defined direction towards the solution of the problem. Because of the soundness of the steps based on past experiences, we become arrogantly certain of the correctness of our conclusion.

In contrast, geniuses think productively, not reproductively. When confronted with a problem, they ask "How many different ways can I look at it?", "How can I rethink the way I see it?", and "How many different ways can I solve it?" instead of "What have I been taught by someone else on how to solve this?" They tend to come up with many different responses, some of which are unconventional and possibly unique. A productive thinker would say that there are many different ways to express "thirteen" and many different ways to halve something. Following are some examples.
6.5
13 = 1 and 3
THIR TEEN = 4
XIII = 11 and 2
XIII = 8
(Note: As you can see, in addition to six and one half, by expressing 13 in different ways and halving it in different ways, one could say one-half of thirteen is 6.5, or 1 and 3, or 4, or 11 and 2, or 8, and so on.)With productive thinking, one generates as many alternative approaches as one can. You consider the least obvious as well as the most likely approaches. It is the willingness to explore all approaches that is important, even after one has found a promising one. Einstein was once asked what the difference was between him and the average person. He said that if you asked the average person to find a needle in the haystack, the person would stop when he or she found a needle. He, on the other hand, would tear through the entire haystack looking for all the possible needles.)

How do creative geniuses generate so many alternatives and conjectures? Why are so many of their ideas so rich and varied? How do they produce the "blind" variations that lead to the original and novel? A growing cadre of scholars are offering evidence that one can characterize the way geniuses think. By studying the notebooks, correspondence, conversations and ideas of the world's greatest thinkers, they have teased out particular common thinking strategies and styles of thought that enabled geniuses to generate a prodigious variety of novel and original ideas.

STRATEGIES

Following are thumbnail descriptions of strategies that are common to the thinking styles of creative geniuses in science, art and industry throughout history.

GENIUSES LOOK AT PROBLEMS IN MANY DIFFERENT WAYS. Genius often comes from finding a new perspective that no one else has taken. Leonardo da Vinci believed that to gain knowledge about the form of problems, you begin by learning how to restructure it in many different ways. He felt the first way he looked at a problem was too biased toward his usual way of seeing things. He would restructure his problem by looking at it from one perspective and move to another perspective and still another. With each move, his understanding would deepen and he would begin to understand the essence of the problem. Einstein's theory of relativity is, in essence, a description of the interaction between different perspectives. Freud's analytical methods were designed to find details that did not fit with traditional perspectives in order to find a completely new point of view.

In order to creatively solve a problem, the thinker must abandon the initial approach that stems from past experience and re-conceptualize the problem. By not settling with one perspective, geniuses do not merely solve existing problems, like inventing an environmentally-friendly fuel. They identify new ones. It does not take a genius to analyze dreams; it required Freud to ask in the first place what meaning dreams carry from our psyche.

GENIUSES MAKE THEIR THOUGHTS VISIBLE. The explosion of creativity in the Renaissance was intimately tied to the recording and conveying of a vast knowledge in a parallel language; a language of drawings, graphs and diagrams — as, for instance, in the renowned diagrams of daVinci and Galileo. Galileo revolutionized science by making his thought visible with diagrams, maps, and drawings while his contemporaries used conventional mathematical and verbal approaches.

Once geniuses obtain a certain minimal verbal facility, they seem to develop a skill in visual and spatial abilities which give them the flexibility to display information in different ways. When Einstein had thought through a problem, he always found it necessary to formulate his subject in as many different ways as possible, including diagrammatically. He had a very visual mind. He thought in terms of visual and spatial forms, rather than thinking along purely mathematical or verbal lines of reasoning. In fact, he believed that words and numbers, as they are written or spoken, did not play a significant role in his thinking process.

GENIUSES PRODUCE. A distinguishing characteristic of genius is immense productivity. Thomas Edison held 1,093 patents, still the record. He guaranteed productivity by giving himself and his assistants idea quotas. His own personal quota was one minor invention every 10 days and a major invention every six months. Bach wrote a cantata every week, even when he was sick or exhausted. Mozart produced more than six hundred pieces of music. Einstein is best known for his paper on relativity, but he published 248 other papers. T. S. Elliot's numerous drafts of "The Waste Land" constitute a jumble of good and bad passages that eventually was turned into a masterpiece. In a study of 2,036 scientists throughout history, Dean Kean Simonton of the University of California, Davis found that the most respected produced not only great works, but also more "bad" ones. Out of their massive quantity of work came quality. Geniuses produce. Period.

GENIUSES MAKE NOVEL COMBINATIONS. Dean Keith Simonton, in his 1989 book Scientific Genius suggests that geniuses are geniuses because they form more novel combinations than the merely talented. His theory has etymology behind it: cogito — "I think — originally connoted "shake together": intelligo the root of "intelligence" means to "select among." This is a clear early intuition about the utility of permitting ideas and thoughts to randomly combine with each other and the utility of selecting from the many the few to retain. Like the highly playful child with a pailful of Legos, a genius is constantly combining and recombining ideas, images and thoughts into different combinations in their conscious and subconscious minds. Consider Einstein's equation, E=mc2. Einstein did not invent the concepts of energy, mass, or speed of light. Rather, by combining these concepts in a novel way, he was able to look at the same world as everyone else and see something different. The laws of heredity on which the modern science of genetics is based are the results of Gregor Mendel who combined mathematics and biology to create a new science.

GENIUSES FORCE RELATIONSHIPS. If one particular style of thought stands out about creative genius, it is the ability to make juxtapositions between dissimilar subjects. Call it a facility to connect the unconnected that enables them to see things to which others are blind. Leonardo daVinci forced a relationship between the sound of a bell and a stone hitting water. This enabled him to make the connection that sound travels in waves. In 1865, F. A. Kekule' intuited the shape of the ring-like benzene molecule by forcing a relationship with a dream of a snake biting its tail. Samuel Morse was stumped trying to figure out how to produce a telegraphic signal b enough to be received coast to coast. One day he saw tied horses being exchanged at a relay station and forced a connection between relay stations for horses and b signals. The solution was to give the traveling signal periodic boosts of power. Nickla Tesla forced a connection between the setting sun and a motor that made the AC motor possible by having the motor's magnetic field rotate inside the motor just as the sun (from our perspective) rotates.

GENIUSES THINK IN OPPOSITES. Physicist and philosopher David Bohm believed geniuses were able to think different thoughts because they could tolerate ambivalence between opposites or two incompatible subjects. Dr. Albert Rothenberg, a noted researcher on the creative process, identified this ability in a wide variety of geniuses including Einstein, Mozart, Edison, Pasteur, Joseph Conrad, and Picasso in his 1990 book The Emerging Goddess: The Creative Process in Art, Science and Other Fields. Physicist Niels Bohr believed that if you held opposites together, then you suspend your thought and your mind moves to a new level. The suspension of thought allows an intelligence beyond thought to act and create a new form. The swirling of opposites creates the conditions for a new point of view to bubble freely from your mind. Bohr's ability to imagine light as both a particle and a wave led to his conception of the principle of complementarity. Thomas Edison's invention of a practical system of lighting involved combining wiring in parallel circuits with high resistance filaments in his bulbs, two things that were not considered possible by conventional thinkers, in fact were not considered at all because of an assumed incompatibility. Because Edison could tolerate the ambivalence between two incompatible things, he could see the relationship that led to his breakthrough.

GENIUSES THINK METAPHORICALLY. Aristotle considered metaphor a sign of genius, believing that the individual who had the capacity to perceive resemblances between two separate areas of existence and link them together was a person of special gifts. If unlike things are really alike in some ways, perhaps, they are so in others. Alexander Graham Bell observed the comparison between the inner workings of the ear and the movement of a stout piece of membrane to move steel and conceived the telephone. Thomas Edison invented the phonograph, in one day, after developing an analogy between a toy funnel and the motions of a paper man and sound vibrations. Underwater construction was made possible by observing how shipworms tunnel into timber by first constructing tubes. Einstein derived and explained many of his abstract principles by drawing analogies with everyday occurrences such as rowing a boat or standing on a platform while a train passed by.

GENIUSES PREPARE THEMSELVES FOR CHANCE. Whenever we attempt to do something and fail, we end up doing something else. As simplistic as this statement may seem, it is the first principle of creative accident. We may ask ourselves why we have failed to do what we intended, and this is the reasonable, expected thing to do. But the creative accident provokes a different question: What have we done? Answering that question in a novel, unexpected way is the essential creative act. It is not luck, but creative insight of the highest order. Alexander Fleming was not the first physician to notice the mold formed on an exposed culture while studying deadly bacteria. A less gifted physician would have trashed this seemingly irrelevant event but Fleming noted it as "interesting" and wondered if it had potential. This "interesting" observation led to penicillin which has saved millions of lives. Thomas Edison, while pondering how to make a carbon filament, was mindlessly toying with a piece of putty, turning and twisting it in his fingers, when he looked down at his hands, the answer hit him between the eyes: twist the carbon, like rope. B. F. Skinner emphasized a first principle of scientific methodologists: when you find something interesting, drop everything else and study it. Too many fail to answer opportunity's knock at the door because they have to finish some preconceived plan. Creative geniuses do not wait for the gifts of chance; instead, they actively seek the accidental discovery.

SUMMARY

Recognizing the common thinking strategies of creative geniuses and applying them will make you more creative in your work and personal life. Creative geniuses are geniuses because they know "how" to think, instead of "what" to think. Sociologist Harriet Zuckerman published an interesting study of the Nobel Prize winners who were living in the United States in 1977. She discovered that six of Enrico Fermi's students won the prize. Ernst Lawrence and Niels Bohr each had four. J. J. Thompson and Ernest Rutherford between them trained seventeen Nobel laureates. This was no accident. It is obvious that these Nobel laureates were not only creative in their own right, but were also able to teach others how to think creatively.

Michael Michalko is the author of the highly acclaimed Thinkertoys: A Handbook of Creative Thinking Techniques; Cracking Creativity: The Secrets of Creative Genius; ThinkPak: A Brainstorming Card Deck and Creative Thinkering: Putting Your Imagination to Work.
- See more at: http://www.creativitypost.com/create/how_geniuses_think#sthash.XRO1e7bC.dpuf

http://www.creativitypost.com/create/how_geniuses_think

### What does it mean by "ever since"?

It just means 'since'. Its generally used in sentences that don't have years or time explanations.
Example-

Since 1995 I have lived in Chicago.
Ever since I left I have missed New York.
Ever since my aunt died I have been sad.

Edit- you can also use 'since then' if you are not explaining the time or specific event----
Since then I have been very happy.
Since I cut my hair I have been very happy.

===

It means "continually following"...

Ever since the surgery, I have had a pain under my arm.

Continually following the surgery, I have had a pain under my arm.

ever = continually
since = following

===

Ever since

from the end of an event or time frame to the present

### 要成為「創業家」，請每天做「思想的舉重」

1. 有一隻左眼看不見的貓，牠的主人叫做麗莎

2. 麗莎的寵物左眼看不見，牠是一隻貓

3. 麗莎的貓左眼看不見

51. 麗莎的貓只有右眼看得見

52. 麗莎的貓只有一眼看得見，但那不是左眼

201. 麗莎的貓只能用右眼看這個世界

202. 麗莎的貓看左邊的時候，必須要整個人向左轉

203. 麗莎如果一直站在貓的左邊，她可以不被她的貓發現

http://mrjamie.cc/2012/05/02/mind-workout/

### PDCA - plan–do–check–act or plan–do–check–adjust

is an iterative four-step management method used in business for the control and continuous improvement of processes and products. It is also known as the Deming circle/cycle/wheel, Shewhart cycle, control circle/cycle, or plan–do–study–act (PDSA). Another version of this PDCA cycle is OPDCA. The added "O" stands for observation or as some versions say "Grasp the current condition." This emphasis on observation and current condition has currency with Lean manufacturing/Toyota Production System literature.[1]

http://en.wikipedia.org/wiki/PDCA

### The Trello Tech Stack

Trello started as an HTML mockup that Justin and Bobby, the Trello design team, put together in a week. I was floored by how cool it looked and felt. Since Daniel and I joined the project to prototype and build Trello, the challenge for the team has been to keep the snappy feeling of the initial mockups while creating a solid server and a maintainable client.

The Initial Trello Mockup
That led us toward a single-page app that would generate its UI on the client and accept data updates from a push channel. This is pretty far from any of the work we’ve done before at Fog Creek, so from a technical perspective Trello has been an adventure.
Initially, we were wondering how interesting and far-out the stack could be before management got nervous, but our concerns were addressed in an early meeting with Joel, when he said “Use things that are going to work great in two years.”
So we did. We have consistently opted for promising (and often troublesome) new technologies that would deliver an awesome experience over more mature alternatives. We’re about a year in, and it’s been a lot of fun.

## CoffeeScript

Trello started out as a pure JavaScript project on both client and server, and stayed that way until May, when we experimentally ported a couple of files to CoffeeScript to see how we liked it. We loved it, and soon converted the rest of the code over and started coding CoffeeScript exclusively.
CoffeeScript is a language that compiles to readable JavaScript. It existed when we started Trello, but I was worried about the added complexity of having to debug compiled code rather than directly debug the source. When we tried, it, though, the conversion was so clean that mapping the target code to the source when debugging in Chrome required little mental effort, and the gains in code brevity and readability from CoffeeScript were obvious and compelling.
JavaScript is a really cool language. Well-written CoffeeScript smooths out and shortens JavaScript, while maintaining the same semantics, and does not introduce a substantial debugging indirection problem.

## The Client

The Trello servers serve virtually no HTML. In fact, they don’t serve much client-side code at all. A Trello page is a thin (2k) shell that pulls down the Trello client-side app in the form of a single minified and compressed JS file (including our third-party libraries and our compiled CoffeeScript and Mustache templates) and a CSS file (compiled from our LESS source and including inlined images). All of that comes in under 250k, and we serve it from Amazon’s CloudFront CDN, so we get very low-latency loads in most locations. In reasonably high-bandwidth cases, we have the app up and running in the browser window in about half a second. After that, we have the benefit of caching, so subsequent visits to Trello can skip that part.
In parallel, we kick off an AJAX data load for the first page’s data content and try to establish a WebSocket connection to the server.

### BACKBONE.JS

When the data request returns, Backbone.js gets busy. The idea with Backbone is that we render each Model that comes down from the server with a View, and then Backbone provides an easy way to:
1. Watch for DOM events within the HTML generated by the View and tie those to methods on the corresponding Model, which re-syncs with the server
2. Watch the model for changes, and re-render the model’s HTML block to reflect them
Neat! Using that general approach, we get a fairly regular, comprehensible, and maintainable client. We custom-built a client-side Model cache to handle updates and simplify client-side Model reuse.

### PUSHSTATE

Now that we have the entire client app loaded in the browser window, we don’t want to waste any time with page transitions. We use HTML5 pushState for moving between pages; that way we can give proper and consistent links in the location bar, and just load data and hand off to the appropriate Backbone-based controller on transition.

### MUSTACHE

We use Mustache, a logic-less templating language, to represent our models as HTML. While ‘harnessing the full power of [INSERT YOUR FAVORITE LANGUAGE HERE] in your templates’ sounds like a good idea, it seems that in practice it requires a lot of developer discipline to maintain comprehensible code. We’ve been very happy with the ‘less is more’ approach of Mustache, which allows us to re-use template code without encouraging us to mingle it with our client logic and make a mess of things.

## Pushing and Polling

Realtime updates are not a new thing, but they’re an important part of making a collaborative tool, so we have spent some time on that layer of Trello.

### SOCKET.IO AND WEBSOCKETS

Where we have browser support (recent Chrome, Firefox, and Safari), we make a WebSocket connection so that the server can push changes made by other people down to browsers listening on the appropriate channels. We use a modified version* of the Socket.io client and server libraries that allows us to keep many thousands of open WebSockets on each of our servers at very little cost in terms of CPU or memory usage. So when anything happens to a board you’re watching, that action is published to our server processes and propagated to your watching browser with very minimal latency, usually well under a second.

### AJAX POLLING

It ain’t fancy, but it works.

Early Architecture Drawing
When the client browser doesn’t support WebSockets (I’m lookin’ at you, Internet Explorer), we just make tiny AJAX requests for updates every couple of seconds while a user is active, and back off to polling every ten seconds when the user goes idle. Because our server setup allows us to serve HTTPS requests with very little overhead and keep TCP connections open, we can afford to provide a decent experience over plain polling when necessary.
We tried Comet, via the downlevel transports for Socket.io, and all of them were (at the time) shaky in one way or another. Also, Comet and WebSockets seemed to be a risky basis for a major feature of the app, and we wanted to be able to fall back on the most simple and well-established technologies if we hit a problem.
We hit a problem right after launch. Our WebSocket server implementation started behaving very strangely under the sudden and heavy real-world usage of launching at TechCrunch disrupt, and we were glad to be able to revert to plain polling and tune server performance by adjusting the active and idle polling intervals. It allowed us to degrade gracefully as we increased from 300 to 50,000 users in under a week. We’re back on WebSockets now, but having a working short-polling system still seems like a very prudent fallback.

## The Server

• node.js
• HAProxy
• Redis
• MongoDB

### NODE.JS

The server side of Trello is built in Node.js. We knew we wanted instant propagation of updates, which meant that we needed to be able to hold a lot of open connections, so an event-driven, non-blocking server seemed like a good choice. Node also turned out to be an amazing prototyping tool for a single-page app. The prototype version of the Trello server was really just a library of functions that operated on arrays of Models in the memory of a single Node.js process, and the client simply invoked those functions through a very thin wrapper over a WebSocket. This was a very fast way for us to get started trying things out with Trello and making sure that the design was headed in the right direction. We used the prototype version to manage the development of Trello and other internal projects at Fog Creek.
By the time we had finished the prototype, we were good and comfortable in Node and excited about its capabilities and performance, so we stuck with it and made our Pinocchio proto-Trello a real boy; we gave it:
Node is great, and getting better all of the time as its active developer community churns out new and useful libraries. The huge amount of continuation passing that you have to do is an issue at first, and it takes a couple of weeks to get used to it. We use a really excellent async library (and the increased code brevity of CoffeeScript) to keep our code under control. There are more sophisticated approaches that add features to JavaScript to automate continuations, but we’re more comfortable with just using an async library whose behavior we understand thoroughly.

### HAPROXY

We use HAProxy to load balance between our webservers. It balances TCP between the machines round robin and leaves everything else to Node.js, leaving the connections open with a reasonably long time to live to support WebSockets and re-use of a TCP connection for AJAX polling.

### REDIS

Trello uses Redis for ephemeral data that needs to be shared between server processes but not persisted to disk. Things like the activity level of a session or a temporary OpenID key are stored in Redis, and the application is built to recover gracefully if any of these (or all of them) are lost. We run with allkeys-lru enabled and about five times as much space as its actual working set needs, so Redis automatically discards data that hasn’t been accessed lately, and reconstructs it when necessary.
Our most interesting use of Redis is in our short-polling fallback for sending changes to Models down to browser clients. When an object is changed on the server, we send a JSON message down all of the appropriate WebSockets to notify those clients, and store the same message in a fixed-length list for the affected model, noting how many messages have been added to that list over all time. Then, when a client that is on AJAX polling pings the server to see if any changes have been made to an object since its last poll, we can get the entire server-side response down to a permissions check and a check of a single Redis value in most situations. Redis is so crazy-fast that it can handle thousands of these checks per second without making a substantial dent into a single CPU.
Redis is also our pub/sub server, and we use it to propagate object change messages from the server process making the initiating request to all of the other server processes. Once you have a Redis server in place, you start using it for all sorts of things.

### MONGODB

MongoDB fills our more traditional database needs. We knew we wanted Trello to be blisteringly fast. One of the coolest and most performance-obsessed teams we know is our next-door neighbor and sister company StackExchange. Talking to their dev lead David at lunch one day, I learned that even though they use SQL Server for data storage, they actually primarily store a lot of their data in a denormalized format for performance, and normalize only when they need to.

Trello Today
In MongoDB, we give up relational DB features (e.g. arbitrary joins) for very fast writes, generally faster reads, and better denormalization support — we can store a card’s data in a single document in the database and still have the ability to query into (and index) subfields of the document. As we’ve grown quickly, having a database that can take a fair amount of abuse in terms of read and write capacity has been a very good thing. Also, MongoDB is really easy to replicate, back up, and restore (the Foursquare debacle notwithstanding).
Another neat side benefit of using a loose document store is how easy it is to run different versions of the Trello code against the same database without fooling around with DB schema migrations. This has a lot of benefits when we push a new version of Trello; there is seldom (if ever) a need to stop access to the app while we do a DB update or backfill.
This is also really cool for development: when you’re using hg (or git-) bisect and a relational test DB to search for the source of a bug, the additional step of up- or downgrading a test db (or creating a new one with the properties you need) can really slow things down.

## So we like it?

We like our tech stack. As Joel observes, we’ve bled all over it, but I’ve never seen a team make an interesting app without tool- and component-related bloodshed, and not everyone can say that they really like what they’ve ended up with. As is true of most applications, no component or implementation detail is necessary to its nature; however, we think that this excellent set of open-source projects has sped up our development, left us with a solid and maintainable code base that we’re eager to move forward with, and made Trello a more responsive and beautiful app. Thanks to everyone who has contributed to them; it’s a great time to be a programmer.
Sound neat? Try Trello! It’s free.
Just can’t get enough tech stack talk? Here’s a Prezi I made for a recent talk on Trello.
* The Socket.io server currently has some problems with scaling up to more than 10K simultaneous client connections when using multiple processes and the Redis store, and the client has some issues that can cause it to open multiple connections to the same server, or not know that its connection has been severed. There are some issues with submitting our fixes (hacks!) back to the project – in many cases they only work with WebSockets (the only Socket.io transport we use). We are working to get those changes which are fit for general consumption ready to submit back to the project.

http://blog.fogcreek.com/the-trello-tech-stack/

### ROI - Return On Investment

ROI - Return On Investment

## Sunday, August 11, 2013

### Using Trello for project management

Trello Development - Trello

I’ve been using a free web tool called trello to manage my projects for 6 months now. I think it is an amazing, easy to use tool that every non-profit organization should be using for project management. Here is a tutorial and some real examples of others using it. Many of the lean startups that will be the next Google or Apple are probably already using this.
Some aspects of project management

According to some other dudes that offer a certificate in “project management”, this is what it means to manage a project:

Project life cycle
– understand why projects fail and avoid it

Project design
– needs assessment
– stakeholder analysis
– log frames
– problem and objective trees

Implementation
– work plans
– network analysis
– GANTT charts
– RACI matrix

Monitoring and evaluation
– S.M.A.R.T. (Self-Monitoring, Analysis and Reporting Technology; often written as SMART) indicators

End of project transition

Of these, trello is the best tool for project design, implementation, and monitoring. It also is useful for transition and archiving old projects.

http://chewychunks.wordpress.com/2012/09/09/using-trello-project-management/

## Friday, August 2, 2013

### SFTP 和 FTPS 的区别是什么？

SFTP 和 FTPS 的区别是什么？

SFTP 和FTPS都是为ftp连接加密，协议非常相似。

ssl是为http/smtp等加密设计的，ssh是为telnet/ftp等加密、建立传输通道而设计的。

### FTP vs. FTPS vs. SFTP

FTP vs. FTPS vs. SFTP

FTP is an unsecure protocol used for transferring files to and from a remote location, while SSH is a secure network protocol that lacks the simplified file transfer commands of FTP. These two protocols were very popular during the early days of the internet, but when the need for a secure protocol for transferring files arose, there were two likely paths to follow. Either, FTP capabilities should be added to SSH, or FTP should be made more secure. SFTP was the result of the former, while FTPS was the result of the latter. SFTP (SSH File Transfer Protocol) is completely different from FTP, as it was built from the ground up, to add FTP capabilities to SSH, while FTPS (FTP over SSL or FTP Secure) is an extension to FTP that uses the security mechanism of SSL, to protect the information from eavesdropping.

The two are very different from each other, although they both aim to serve the same purpose. SFTP uses a single channel to transmit and receive all the pertinent data, while FTPS uses another channel that is dynamically decided for the data. FTPS often had problems when passing through a firewall, as it did not know the port that was being used by the data, and failed to allow traffic through the port. FTPS sends messages in a text format, allowing people to read logs and determine what happened during the session. This is not possible with SFTP, as the messages are not in text, but in binary.

As mentioned above, both can be used to achieve a secure connection for transferring files, but there are points to consider for each. FTPS has the advantage of being well-known and familiar to users who have already used FTP. This is because it uses the same, or very similar commands to FTP. On the other hand, SFTP is more secure, since it comes from a secure network protocol.

Summary:

1. FTPS was created as an extension of FTP to add security mechanisms, while SFTP is an extension of SSH that adds easy file transfer capabilities to the already secure SSH.

2. FTPS uses two channels to facilitate communications and data transfer, while SFTP only uses one.

3. FTPS sends and receives messages in a human readable format, while SFTP sends and receives messages in binary.

4. FTPS has the advantage of being widely known, while SFTP has the advantage of being more secure.

Read more: Difference Between FTPS and SFTP | Difference Between | FTPS vs SFTP http://www.differencebetween.net/technology/internet/difference-between-ftps-and-sftp/#ixzz2arpAr0N0