Search

12/28/2012

Asynchronous and deferred JavaScript execution explained

Asynchronous and deferred JavaScript execution explained - defer 會先拉, 然後等到 HTML parser 直行完才會跑 javascript, async 會拉完javascript馬上執行, 可以跑一些與 DOM 無關的 javascript, 此外, async是一拉完就執行不保證會按照順序執行, defer會按照順序執行

  • Normal execution <sscript> This is the default behavior of the <script> element. Parsing of the HTML code pauses while the script is executing. For slow servers and heavy scripts this means that displaying the webpage will be delayed.
  • Deferred execution <script defer> Simply put: delaying script execution until the HTML parser has finished. A positive effect of this attribute is that the DOM will be available for your script. However, since not every browser supports defer yet, don’t rely on it!
  • Asynchronous execution <script async> Don’t care when the script will be available? Asynchronous is the best of both worlds: HTML parsing may continue and the script will be executed as soon as it’s ready. I’d recommend this for scripts such as Google Analytics.
HTML5's async Script Attribute
Both async and defer scripts begin to download immediately without pausing the parser and both support an optional onload handler to address the common need to perform initialization which depends on the script. The difference between async and defer centers around when the script is executed. Each async script executes at the first opportunity after it is finished downloading and before the window’s load event. This means it’s possible (and likely) that async scripts are not executed in the order in which they occur in the page. The defer scripts, on the other hand, are guaranteed to be executed in the order they occur in the page. That execution starts after parsing is completely finished, but before the document’s DOMContentLoaded event.

Chrome 線上應用程式商店 - Postman - REST Client

Chrome 線上應用程式商店 - Postman - REST Client - Postman - REST Client Postman - A powerful HTTP client to test web services

Postman is a powerful HTTP client to help test web services easily and efficiently. Postman let's you craft simple as well as complex HTTP requests quickly. It also saves requests for future use so that you never have to repeat your keystrokes ever again. Postman is designed to save you and your team tons of time. Check out more features below or just install from the Chrome Web Store to get started.

12/11/2012

SwipeView

SwipeView

SwipeView is the super simple solution to endless seamlessly loopable carousels for the mobile browser. It’s memory conservative as it uses only three elements at any given time, it’s smooth as velvet since it takes advantage of hardware acceleration, it’s bandwidth friendly with its 1.5kb minified/gzipped footprint.
tag: three panel

@他/她是不是你的靈魂伴侶?--5個方法判斷

@他/她是不是你的靈魂伴侶?--5個方法判斷

只要看看這個和你互動的人,符不符合下面5個標準: (1).他喜歡你表現出最不做作的本真,不喜歡你連自己都討厭。你不愛化妝,他剛好欣賞你清水出芙蓉的自然美;你討厭應酬,他剛好也喜歡宅在家。 (2).他能引導你做更好的自己。但你的驅策力,不是因為他要求,而是純然發自內心,願意為他改善自我,把自己變得更健康、更包容、更快樂。 (3).無論遇到什麼挫折,他都願意和你互動下去。一點小麻煩,就說拜拜的,鐵定不是你的“靈魂伴侶”。廖閱鵬說:“很多人的關係是很淺的,遇到一點阻力,就退縮或放棄;但靈魂伴侶願意跟你一起忍受所有的不舒服,無論美醜,都會勇敢面對彼此內在的真相。” (4).他能和你一起堅持成長。假如只是天長地久廝守,卻不能彼此進步,也不算。長期從事身心靈工作的Anita說:“如果遇到靈魂伴侶,兩個人在一起,進步幅度會比獨自一人快很多倍。” (5).他對生命充滿熱情,願意在生命中付出精力和心血,與你一起勇敢挖掘,探索,體驗。不過,要留神,所有這些都需要你和他相處一段時間以後,才感受得到。千萬別指望第一樣見到,就能知道對方是不是自己的“靈魂伴侶”。在靈魂伴侶這件事上,最好順其自然,而不是四處尋找。

12/10/2012

GENERALIZED INPUT ON THE CROSS-DEVICE WEB

GENERALIZED INPUT ON THE CROSS-DEVICE WEB

$(window).mousedown(function(e) { down(e.pageY); });
$(window).mousemove(function(e) { move(e.pageY); });
$(window).mouseup(function() { up(); });

// Setup touch event handlers.
$(window).bind('touchstart', function(e) {
  e.preventDefault();
  down(e.originalEvent.touches[0].pageY);
});
$(window).bind('touchmove', function(e) {
  e.preventDefault();
  move(e.originalEvent.touches[0].pageY);
});
$(window).bind('touchend', function(e) {
  e.preventDefault();
  up();
});
Microsoft is taking a very smart approach with IE10 to address this issue by introducing pointer events. The idea is to consolidate all input that deals with one or more points on the screen into a single unified model. Unfortunately, it's not being proposed as a standardized spec. Also, because it's not universally available, it will be yet another thing developers need to support (if they want to support Windows 8/Metro apps). So now our sample above gets even more boilerplate, with at least three more calls like the following:
$(window).bind('MSPointerDown', function(e) {
  // Extract x, y, and call shared handler.
});
$(window).bind('MSPointerMove', function(e) {
  // Extract x, y, and call shared handler.
});
$(window).bind('MSPointerUp', function(e) {
  // Extract x, y, and call shared handler.
});

11/23/2012

The State Of HTML5 Video

The State Of HTML5 Video

3. Tag Attributes Internet Explorer ignores the preload=none attribute, which prevent the desktop browsers from reaching a perfect score. The implication here is that IE9 loads a part of your MP4 upon each pageview, instead of waiting until a user actually starts the video. This may add to a substantial increase in your streaming costs. autoplay (video is never played upon page load). We believe this to be the correct approach, hence the N/A sign instead of a red cross. Unfortunately, the video controls on Android 2.2 (nonexisting) and 2.3 (clunky) are not that useful. Android 4 introduced a much better UX, on par with iOS. Note the design of the video controls in each browser is different, but all provide the same options: a play/pause toggle, a time slider, a volume slider and a fullscreen button. IE9 has no fullscreen toggle and iOS/Android omit the volume slider (in favor of hardware buttons). 4. JavaScript API However, we do not agree with Apple's decision to block scripted play() commands. It makes the implementation of advertising or playlists unnecessarily complicated. Last, a string of Android issues make video scripting on this OS a challenge. Luckily, here too Android 4.1 introduced many bugfixes. 7. Adaptive Streaming Adaptive streaming is a core component of online video. It enables buffer control (less waste of bandwidth), fast seeking (to not-yet-downloaded parts), quality adjustments (during playback) and live streaming (possibly with DVR). Currently iOS is the only platform with adaptive streaming, supporting Apple's own HTTP Live Streaming (HLS) protocol. Android introduced HLS support in 4.0, only to have it dropped again in 4.1.

11/21/2012

modify geolocation exif information

1. install exif tool http://www.sno.phy.queensu.ca/~phil/exiftool/

2. get geo location in different format from: http://itouchmap.com/latlong.html

3. modify exif as following command

exiftool -GPSLongitudeRef=E -GPSLatitudeRef=N -GPSLongitude=121.565000 -GPSLatitude=121.565000 *.jpeg 
, via: http://scribblesandsnaps.com/2011/11/23/easy-geotagging-with-exiftool/

4. verify the result from online exif reader: http://regex.info/exif.cgi

11/18/2012

return false, preventDefault, and stopPropagation in jQuery

return false, preventDefault, and stopPropagation in jQuery - return false equals to 'preventDefault + stopPropagation' - stopImmedidatePropagation is 'stopPropagation' and will cancel the event handlers applies to the target

$('a').click( function(event) {
  return false;
});
is equivalent to
$('a').click( function(event) {
  event.preventDefault();
  event.stopPropagation();
});
demo: http://css-tricks.com/examples/ReturnFalse/
  // http://www.w3.org/TR/2003/WD-DOM-Level-3-Events-20030331/ecma-script-binding.html
  jQuery.Event.prototype = {
    preventDefault: function() {
      this.isDefaultPrevented = returnTrue;

      var e = this.originalEvent;
      if (!e) {
        return;
      }

      // if preventDefault exists run it on the original event
      if (e.preventDefault) {
        e.preventDefault();

        // otherwise set the returnValue property of the original event to false (IE)
      } else {
        e.returnValue = false;
      }
    },
    stopPropagation: function() {
      this.isPropagationStopped = returnTrue;

      var e = this.originalEvent;
      if (!e) {
        return;
      }
      // if stopPropagation exists run it on the original event
      if (e.stopPropagation) {
        e.stopPropagation();
      }
      // otherwise set the cancelBubble property of the original event to true (IE)
      e.cancelBubble = true;
    },
    stopImmediatePropagation: function() {
      this.isImmediatePropagationStopped = returnTrue;
      this.stopPropagation();
    },
    isDefaultPrevented: returnFalse,
    isPropagationStopped: returnFalse,
    isImmediatePropagationStopped: returnFalse
  };

  // Run delegates first; they may want to stop propagation beneath us
      for (i = 0; i < handlerQueue.length && !event.isPropagationStopped(); i++) {
        matched = handlerQueue[i];
        event.currentTarget = matched.elem;

        for (j = 0; j < matched.matches.length && !event.isImmediatePropagationStopped(); j++) {
          handleObj = matched.matches[j];

          // Triggered event must either 1) be non-exclusive and have no namespace, or
          // 2) have namespace(s) a subset or equal to those in the bound event (both can have no namespace).
          if (run_all || (!event.namespace && !handleObj.namespace) || event.namespace_re && event.namespace_re.test(handleObj.namespace)) {

            event.data = handleObj.data;
            event.handleObj = handleObj;

            ret = ((jQuery.event.special[handleObj.origType] || {}).handle || handleObj.handler).apply(matched.elem, args);

            if (ret !== undefined) {
              event.result = ret;
              if (ret === false) {
                event.preventDefault();
                event.stopPropagation();
              }
            }
          }
        }
      }

11/16/2012

HTML5 APIs You Didn't Know Existed

HTML5 APIs You Didn't Know Existed Element.classList

// Add a class to an element
myElement.classList.add("newClass");

// Remove a class to an element
myElement.classList.remove("existingClass");

// Check for existence
myElement.classList.contains("oneClass");

// Toggle a class
myElement.classList.toggle("anotherClass");
ContextMenu API The new ContextMenu API is excellent: instead of overriding the browser context menu, the new ContextMenu API allows you to simply add items to the browser's context menu:
Element.dataset The dataset API allows developers to get and set data- attribute values
/*  Assuming element:

  
*/ // Get the element var element = document.getElementById("myDiv"); // Get the id var id = element.dataset.id; // Retrieves "data-my-custom-key" var customKey = element.dataset.myCustomKey; // Sets the value to something else element.dataset.myCustomKey = "Some other value"; // Element becomes: //

11/11/2012

application/x-www-form-urlencoded vs. multipart/form-data

application/x-www-form-urlencoded vs. multipart/form-data

關於application/x-www-form-urlencoded等字符編碼的解釋說明 在Form元素的語法中,EncType表明提交數據的格式用Enctype屬性指定將數據回發到服務器時瀏覽器使用的編碼類型。下邊是說明: application/x-www-form-urlencoded:窗體數據被編碼為名稱/值對。這是標準的編碼格式。multipart/form-data:窗體數據被編碼為一條消息,頁上的每個控件對應消息中的一個部分。text/plain:窗體數據以純文本形式進行編碼,其中不含任何控件或格式字符。 補充 form的enctype屬性為編碼方式,常用有兩種:application/x-www-form-urlencoded和multipart/form-data,默認為application/x-www-form-urlencoded。當action為get時候,瀏覽器用x-www-form-urlencoded的編碼方式把form數據轉換成一個字串(name1=value1&name2=value2...),然後把這個字串append到url後面,用?分割,加載這個新的url。當action為post時候,瀏覽器把form數據封裝到http body中,然後發送到server。如果沒有type=file的控件,用默認的application/x-www-form-urlencoded就可以了。但是如果有type=file的話,就要用到multipart/form-data了。瀏覽器會把整個表單以控件為單位分割,並為每個部分加上Content-Disposition(form-data或者file),Content-Type(默認為text/plain),name(控件name)等信息,並加上分割符(boundary)。
http://en.wikipedia.org/wiki/POST_(HTTP)
When a web browser sends a POST request from a web form element, the default Internet media type is "application/x-www-form-urlencoded".[8] This is a format for encoding key-value pairs with possibly duplicate keys. Each key-value pair is separated by an '&' character, and each key is separated from its value by an '=' character. Keys and values are both escaped by replacing spaces with the '+' character and then using URL encoding on all other non-alphanumeric[9] characters. For example, the key-value pairs
Name: Jonathan Doe
Age: 23
Formula: a + b == 13%!
are encoded as
Name=Jonathan+Doe&Age=23&Formula=a+%2B+b+%3D%3D+13%25%21
Starting with HTML 4.0, forms can also submit data in multipart/form-data as defined in RFC 2388 (See also RFC 1867 for an earlier experimental version defined as an extension to HTML 2.0 and mentioned in HTML 3.2). http://www.w3.org/TR/html401/interact/forms.html#h-17.13.4.1

9 uses for cURL worth knowing

9 uses for cURL worth knowing
http://echo.httpkit.com

curl http://echo.httpkit.com

Set the Request Method

curl -X POST echo.httpkit.com

Set Request Headers

curl -H "Authorization: OAuth 2c4419d1aabeec" \
     http://echo.httpkit.com
curl -H "Accept: application/json" \
     -H "Authorization: OAuth 2c3455d1aeffc" \
     http://echo.httpkit.com

Send a Request Body

Many popular HTTP APIs today POST and PUT resources using application/json or application/xml rather than in an HTML form data. Let’s try PUTing some JSON data to the server.
curl -X PUT \
     -H 'Content-Type: application/json' \
     -d '{"firstName":"Kris", "lastName":"Jordan"}'
     echo.httpkit.com

Use a File as a Request Body

Escaping JSON/XML at the command line can be a pain and sometimes the body payloads are large files. Luckily, cURL’s @readfile macro makes it easy to read in the contents of a file. If we had the above example’s JSON in a file named “example.json” we could have run it like this, instead:
curl -X PUT \
     -H 'Content-Type: application/json' \
     -d @example.json
     echo.httpkit.com

POST HTML Form Data

Notice the method is POST even though we did not specify it. When curl sees form field data it assumes POST. You can override the method using the -X flag discussed above. The “Content-Type” header is also automatically set to “application/x-www-form-urlencoded” so that the web server knows how to parse the content. Finally, the request body is composed by URL encoding each of the form fields.
curl -d "firstName=Kris" \
     -d "lastName=Jordan" \
     echo.httpkit.com

POST HTML Multipart / File Forms

What about HTML forms with file uploads? As you know from writing HTML file upload form, these use a multipart/form-data Content-Type, with the enctype attribute in HTML. In cURL we can pair the -F option and the @readFile macro covered above. Like with the -d flag, when using -F curl will automatically default to the POST method, the multipart/form-data content-type header, calculate length, and compose the multipart body for you. Notice how the @readFile macro will read the contents of a file into any string, it’s not just a standalone operator. The “;text/plain” specifies the MIME content-type of the file. Left unspecified, curl will attempt to sniff the content-type for you.
curl -F "firstName=Kris" \
     -F "publicKey=@idrsa.pub;type=text/plain" \
     echo.httpkit.com
{
  "method": "POST",
  "uri": "/",
  "path": {
    "name": "/",
    "query": "",
    "params": {}
  },
  "headers": {
    "x-forwarded-for": "1.34.59.62",
    "host": "echo.httpkit.com",
    "user-agent": "curl/7.19.7 (universal-apple-darwin10.0) libcurl/7.19.7 OpenSSL/0.9.8r zlib/1.2.3",
    "accept": "*/*",
    "content-length": "307",
    "content-type": "multipart/form-data; boundary=----------------------------c8fa62213588"
  },
  "body": "------------------------------c8fa62213588\r\nContent-Disposition: form-data; name=\"firstName\"\r\n\r\nKris\r\n------------------------------c8fa62213588\r\nContent-Disposition: form-data; name=\"publicKey\"; filename=\"idrsa.pub\"\r\nContent-Type: text/plain\r\n\r\n\nhello world\n\r\n------------------------------c8fa62213588--\r\n",
  "ip": "127.0.0.1",
  "powered-by": "http://httpkit.com",
  "docs": "http://httpkit.com/echo"

11/07/2012

document.elementFromPoint - Document Object Model (DOM) | MDN

document.elementFromPoint - Document Object Model (DOM) | MDN

var element = document.elementFromPoint(x, y);

Yiannis Kouros - Wikipedia, the free encyclopedia

Yiannis Kouros - Wikipedia, the free encyclopedia

Yiannis Kouros (Greek: Γιάννης Κούρος),(born February 13, 1956 in Tripoli, Greece) is a Greek ultramarathon runner based in Melbourne. He is sometimes called the "Running God" or "Pheidippides Successor".[1] He holds every men's outdoor road world record from 100 to 1,000 miles and every road and track record from 12 hours to 6 days.[2] In 1991, he starred as Pheidippides in the movie The Story of the Marathon: A Hero's Journey, which chronicles the history of marathon running. Kouros came to prominence when he won the Spartathlon in 1984 in record time[3] and the Sydney to Melbourne Ultramarathon in 1985 in a record time of 5 days, 5 hours, 7 minutes and 6 seconds. He beat the previous record held by Cliff Young.[4] Kouros says that his secret is that "when other people get tired they stop, I DON'T. I take over my body with my mind I tell it that it's not tired and it listens". Kouros has also written over 1,000 poems (several of which appear in his book Symblegmata (Clusters)) and the book The Six-Day Run of the Century.

10/19/2012

[Android] 好用的 Chrome 瀏覽器之開發人員工具 – USB 網頁偵錯功能

[Android] 好用的 Chrome 瀏覽器之開發人員工具 – USB 網頁偵錯功能

adb forward tcp:9222 localabstract:chrome_devtools_remote then connect to http://localhost:9222

How to Launch a 65Gbps DDoS, and How to Stop One

How to Launch a 65Gbps DDoS, and How to Stop One

So You Want to Launch a DDoS So how does an attacker generate 65Gbps of traffic? It is highly unlikely that the attacker has a single machine with a big enough Internet connection to generate that much traffic on its own. One way to generate that much traffic is through a botnet. A botnet is a collection of PCs that have been compromised with a virus and can be controlled by what is known as a botnet herder. Botnet herders will often rent out access to their botnets, often billing in 15 minute increments (just like lawyers). Rental prices depend on the size of the botnets. Traditionally, email spammers purchased time on botnets in order to send their messages to appear to come from a large number of sources. As email spam has become less profitable with the rise of better spam filters, botnet herders have increasingly turned to renting out their networks of compromised machines to attackers wanting to launch a DDoS attack. To launch a 65Gbps attack, you'd need a botnet with at least 65,000 compromised machines each capable of sending 1Mbps of upstream data. Given that many of these compromised computers are in the developing world where connections are slower, and many of the machines that make up part of a botnet may not be online at any given time, the actual size of the botnet necessary to launch that attack would likely need to be at least 10x that size. While by no means unheard of, that's a large botnet and using all its resources to launch a DDoS risks ISPs detecting many of the compromised machines and taking them offline. Amplifying the Attacks Since renting a large botnet can be expensive and unwieldy, attackers typically look for additional ways to amplify the size of their attacks. The attack on Saturday used one such amplification technique called DNS reflection. To understand how these work, you need to understand a bit about how DNS works. When you first sign up for an Internet connection, your ISP will provide you with a recursive DNS server, also known as a DNS resolver. When you click on a link, your computer sends a lookup to your ISP's DNS resolver. The lookup is asking a question, like: what is the IP address of the server for cloudflare.com? If the DNS resolver you query knows the answer, because someone has already asked it recently and the answer is cached, it responds. If it doesn't, it passes the request on to the authoritative DNS for the domain. Typically, an ISP's DNS resolvers are setup to only answer requests from the ISP's clients. Unfortunately, there are a large number of misconfigured DNS resolvers that will accept queries from anyone on the Internet. These are known as "open resolvers" and they are a sort of latent landmine on the Internet just waiting to explode when misused. DNS queries are usually sent via the UDP protocol. UDP is a fire-and-forget protocol, meaning that there is no handshake to establish that where a packet says it is coming from actually is where it is coming from. This means, if you're an attacker, you can forge the header of a UDP packet to say it is coming from a particular IP you want to attack and send that forged packet to an open DNS resolver. The DNS resolver will reply back with a response to the forged IP address with an answer to whatever question was asked. To amplify an attack, the attacker asks a question that will result in a very large response. For example, the attacker may request all the DNS records for a particular zone. Or they may request the DNSSEC records which, often, are extremely large. Since resolvers typically have relatively high bandwidth connections to the Internet, they have no problem pumping out tons of bytes. In other words, the attacker can send a relatively small UDP request and use open resolvers to fire back at an intended target with a crippling amount of traffic.

石碇潭腰&八卦茶園-攝影點分享

石碇潭腰&八卦茶園-攝影點分享
【新北石碇】台灣也有千島湖(前往千島湖拍照最佳指南文) - Clare的生活品味 - 無名小站 google map

Is the use of “utf8=✓” preferable to “utf8=true”?

Is the use of “utf8=✓” preferable to “utf8=true”?

By default, older versions of IE (<=8) will submit form data in Latin-1 encoding if possible. By including a character that can't be expressed in Latin-1, IE is forced to use UTF-8 encoding for its form submissions, which simplifies various backend processes, for example database persistence. If the parameter was instead utf8=true then this wouldn't trigger the UTF-8 encoding in these browsers.

2400 Flag Icon Set — Resources from GoSquared

2400 Flag Icon Set — Resources from GoSquared - free flag icons

We’ve created a flag for every major country in the world, plus a few more. And we’ve created them in several sizes so they’ll look great no matter where you’re using them – 16×16, 24×24, 32×32, 48×48, and 64×64. We’ve also provided them in 2 variants – as flat and standard, and with a lovely glossy finish.

10/12/2012

(我的)信息危机 - est's blog

(我的)信息危机 - est's blog

难得夜深人静反思一下。我个人每天12个小时在网上闲逛,自个觉得我现在有几个值得警惕的危险趋势: 输入越来越多,输出越来越少。创作能力退化。 个人觉得消费信息文化这个风气是由教主Steve Jobs带来的,以iPad为代表的纯内容消费平台给大家带来的各种使用的便利和享受的同时,也剥夺了一项至关重要的权利——创作和生产。 和PC相比,你既可以在上边消磨时光,但同时也可以用来当作生产力工具。我个人觉得PC平台是一种输入输出的平衡 而iPad这类平台不一样,这货带来的风气,就是一种consumer culture。在iPad上外接键盘打字都十分痛苦和不友好。你在上边能做的就是消费弱智游戏,消费视频,消费小清新照片。Android似乎友好一点,甚至android上直接编写android程序。办公什么的也有可行性,但是这也最多是先驱者的尝试和号称而已。 这个问题的各种衍生也深深影响了互联网。我觉得可以叫做consumerism。君不见各大博客、BBS、微博上,除了喷子就是小白。很少有人积极去invent有意义和价值东西了。 过多信息时效化。(我承认我现在患“语体教”病了,我很难找到一个词语来形容这个东西)具体的描述就是,人们更加关心失效性很快的东西,更加耸人听闻的东西,和心理落差更大的东西,而偏向忽略那些永恒的东西。比如关心某软件、ROM、OS的新特性,而不去关心整个业界的完备推进程度。就举一个简单例子。Steve Jobs很喜欢声讨Flash怎么烂怎么搓,但是他从来不告诉你作为一个移动设备的 矢量+音视频多媒体引擎 应该做成什么样子。我们过多的去关心如何打倒Flash,如何打倒IE6,新技术如何做到Flash 10年前也能做的东西,比如apple.com上的wwdc现在都还在用Quicktime®(而不是html5 video)来播放流媒体;在HTML5喧嚣的今天,人们甚至通过WOFF这种奇技淫巧来绘制矢量图标。这是一种悲哀,和对SVG莫大的讽刺。 碎片化。这个就不说了。但同时我觉得我还有另外一个很显然的毛病——老了。各种怀旧各种经典,很少去接触新事物了。手上天天操作和玩的东西,和几年前的并没有实质上的差别。 流行的东西就是王道。即使小众的领域里,相对流行的也能秒杀其他的。人们宁愿附和各种lame的meme,也比自己写一段nobody cares的东西更加有归属感。其实我觉得这个是生态圈的问题。每个个人的能力是有限的,你在一个注定forever alone的小圈子里,是很少能得到反馈的。你甚至渴望信噪比很低的反馈。 信噪比。我觉得现在一个最最最浮躁,但是又欲罢不能的问题就是各种重复信息。各种repost简直是强奸你的接受器官。但是你miss了一系列之后又觉得自己真2b。花那么多时间在网上连这个最泛滥的东西都不知道。各种第三方的aggregate工具,由于依靠全自动化算法,所以coverage由成问题。现在对话题的关注精力投入远远大于收获。 各种挖坑不填。其实最消耗精力的就是没有结局的故事。了结的事情总是让人舒坦。但是现在千头万绪的信息,有始有终的太少啦。新事物,新自造轮子的产生速度大于问题的产生速度。这种让人无所适从。坑多就不说了,我还讨厌选择。所以进一步导致更多的放弃。我越来越发现 问题 - 解决方案 这种线性思路越来越不适应需要了。我现在需要的是一种全新的面向变化的结构。 人物为中心的世界。我十分吃力的去人物化。 我渴望一个SNS,隔绝与hivemind的各种hype,又能自洽。这是一种neo utopia么?我觉得这是我这种introvert的人的病。明明知道任何群体都有4个阶段:适应 - 指数增 - 平衡 - 衰亡。这是注定的命运。 上诉问题都是我个人自己点滴感受。当然,这和我个人所处的环境有关,或许其他人的感受不是这样的。或许只是我自己所处的环境太糟糕了。个性化的互联网就是这样,你很难看到客观一致的东西,你看到的都是你自身的影子。你自己是个挫人,那么你关注的人群也基本都很挫,你得到的东西也是很挫的。

10/03/2012

HTTP persistent connection - Wikipedia, the free encyclopedia

HTTP persistent connection - Wikipedia, the free encyclopedia

HTTP persistent connection, also called HTTP keep-alive, or HTTP connection reuse, is the idea of using a single TCP connection to send and receive multiple HTTP requests/responses, as opposed to opening a new connection for every single request/response pair.

Chunked transfer encoding - Wikipedia, the free encyclopedia

Chunked transfer encoding - Wikipedia, the free encyclopedia

Chunked transfer encoding is a data transfer mechanism in version 1.1 of the Hypertext Transfer Protocol (HTTP) in which a web server serves content in a series of chunks. It uses the Transfer-Encoding HTTP response header in place of the Content-Length header, which the protocol would otherwise require. Because the Content-Length header is not used, the server does not need to know the length of the content before it starts transmitting a response to the client (usually a web browser). Web servers can begin transmitting responses with dynamically-generated content before knowing the total size of that content. The size of each chunk is sent right before the chunk itself so that a client can tell when it has finished receiving data for that chunk. The data transfer is terminated by a final chunk of length zero.

10/02/2012

satine.org – Building CoverFlow for Safari on iPhone

satine.org – Building CoverFlow for Safari on iPhone

The zflow demo in CSS-VFX uses the Apple CSS Visual Effects extensions for hardware accelerated (on iPhone!) 3D perspective correct transforms and easily animated transitions. HTML 5 Canvas is used for simulating reflections. zflow starts by loading each image from the images array. When each image is loaded, we scale the image to fit in a square region, and apply 3D CSS transforms to scale it in place. Reflections – zflow then takes the scaled image and creates a Canvas element that contains a gradient alpha mask of the image’s reflection (using a “reflect” function to do this) and positions the canvas element in place. Touch Controller – zflow creates a TouchController object, who’s job is to field touch events from Mobile Safari and calculate an appropriate offset. Clicking – zflow detects when no move events have been made, and zooms + rotates the focused image forward by setting a “CSS Transition”ed 3D transform on the focused image. Clicking again transitions the image back. Inertia – zflow achieves inertia by setting the “transition timing function” of the “tray” to an “ease-out” function, which slows things down. On the touch end event, we calculate the projected velocity and set the tray’s target position to that location. CSS Transitions handles the decay in velocity as the transition timing function executes — slowing the tray down gradually.

10/01/2012

Initializr - Start an HTML5 Boilerplate project in 15 seconds!

Initializr - Start an HTML5 Boilerplate project in 15 seconds!

Initializr is here to kick-start the development of your new projects. It generates templates based on HTML5 Boilerplate by allowing you to choose which parts you want or don't want from it. A responsive template has also been added to start from a basic design instead of a blank page.
responsive layout

via: html5-boilerplate

documents: https://github.com/h5bp/html5-boilerplate/blob/master/doc/html.md https://github.com/h5bp/html5-boilerplate/blob/master/doc/css.md https://github.com/h5bp/html5-boilerplate/blob/master/doc/js.md https://github.com/h5bp/html5-boilerplate/blob/master/doc/misc.md

超神奇局部烤漆...#39樓#42樓有相關資料 - BMW - Mobile01

超神奇局部烤漆...#39樓#42樓有相關資料 - BMW - Mobile01

若需局部鈑金和烤漆,找華江橋頭的小呂 若是車身的凹痕小酒窩,但是沒有掉漆 想保留新車原漆的話, 就去找重慶北路的"凹痕先生"

The exercise habit

The exercise habit

Right now I’m reading The Power of Habit: Why We Do What We Do in Life and Business by Charles Duhigg and everything suddenly became very clear. Exercise is what Duhigg calls a “keystone habit”: “Typically, people who exercise, start eating better and becoming more productive at work. They smoke less and show more patience with colleagues and family. They use their credit cards less frequently and say they feel less stressed. Exercise is a keystone habit that triggers widespread change.”
via: What happens to our brains when we exercise and how it makes us happier

9/28/2012

Emoji cheat sheet

Emoji cheat sheet

Emoji emoticons are supported on Campfire, GitHub, Basecamp, Turntable.fm, and Teambox. However some of the emoji codes are not super easy to remember, so here is a little cheat sheet.

Google Goggles

Google Goggles

Search by taking a picture: point your mobile phone camera at a painting, a famous landmark, a barcode or QR code, a product, a storefront, or a popular image. If Goggles finds it in its database, it will provide you with useful information. Goggles can read text in English, French, Italian, German, Spanish, Portuguese, Russian, and Turkish, and translate it into other languages. Goggles also works as a barcode / QR code scanner.

ps to css

CSS Hat turns Photoshop layer styles to CSS3 with a click - PSD ...

CSS Hat is a Photoshop plugin that converts layer styles to CSS3 with a single click. PSD to CSS easily.
CSS3Ps - free cloud based photoshop plugin that converts layers to ...
CSS3Ps is a free, cloud based, photoshop plugin for converting layers to CSS3 styles.

First Seed Material

First Seed Material - animation sprite material http://www.tekepon.net/fsm/modules/refmap/index.php?mode=vx-chara via: http://dabblet.com/gist/2076449

icon fonts collection

Icon Fonts | Pictonic.co The Big List of Flat Icons & Icon Fonts | CSS-Tricks iconmelon IKONS - 264 free vector icons from Piotr Kwiatkowski LivIcons - Exclusive Truly Animated Icon Pack!

yeoman/yeoman

yeoman/yeoman

Yeoman uses:

mac tips

大家知道在finder裡頭  選某一個檔案  然後按空白鍵   會出現預覽模式嗎?   這時候可以按上下左右瀏覽檔案 在瀏覽照片的時候很好用

1957-58 Taiwan - Tom Jones - Picasa 網路相簿

1957-58 Taiwan - Tom Jones - Picasa 網路相簿

gdipp - Customizable Windows text renderers - Google Project Hosting

gdipp - Customizable Windows text renderers - Google Project Hosting

The gdipp (codename) project is a replacement of the Windows text render, which brings to you the effect of text like Mac OS and Linux distributions. It is easy to use with ignorable overhead, and it is fully customizable. The project is originated as the relaunch of the suspended gdi++.dll project. Like the InkStone project, we found the source code of gdi++.dll project too complex to manage, and decide to start over a new code base. The goal of gdipp project is to continue the development of gdi++, expand functionality, improve performance, provide better compatibility for the current and future Windows versions (potentially at the cost of removing compatibility for old Windows), create detailed and formal documentation, as well as tools to help using it. gdipp Project supports both 32-bit and 64-bit Windows 7/Vista. You can install 32-bit and 64-bit components separately. The 32-bit components only renders 32-bit applications, while the 64-bit components only renders 64-bit applications in 64-bit Windows. Both components share the same setting file. gdipp also works correctly on Windows XP and 2003. However, due to the significant difference in the system architectures, the rendering may be less stable and compatible. gdi++ or ezgdi are alternative choices of Windows text renderers.

9/25/2012

Adobe® Edge Web Fonts

Adobe® Edge Web Fonts

URL Specification The URL in the JavaScript tag determines which fonts are loaded into your page. Here’s the spec for that URL.
use.edgefonts.net/[<family>[:<fvd...>[:<subset>]]...].js
Let’s break down the parts that are variable. Each of these elements is separated by a colon (:). family The name of a font family. See the available fonts. fvd One or more Font Variation Descriptions separated by a comma (,). subset The name of a subset. The available values are default and all. Include multiple families by separating them with a semicolon (;). Both the fvd and subset parameters are optional. If you omit fvd, the response will contain fonts from the “basic four” set: regular, italic, bold, and bold italic (n4,i4,n7,i7). If a family contains none of the basic four, the response will contain no fonts for that family. If subset is omitted, default will be used.
# One family with default options (results in n4,i4,n7,i7)
# and the "default" subset).
use.edgefonts.net/averia-libre.js

# One family in two styles. Averia Libre Light (n3) and
# Light Italic (i3) in the "default" subset.
use.edgefonts.net/averia-libre:n3,i3.js

# One family, in one style, in the "all" subset.
use.edgefonts.net/averia-libre:n3:all.js

# Two families. Averia Libre Regular (n4) in the "default"
# subset, and Bree Serif Regular (n4) in the "all" subset.
use.edgefonts.net/averia-libre:n4;bree-serif:n4:all.js

# Two families with default options.
use.edgefonts.net/averia-libre;bree-serif.js

9/24/2012

Use CSS to Specify the Aspect Ratio of a Fluid Element

Use CSS to Specify the Aspect Ratio of a Fluid Element - if you want the height of a container is 50% width of it's parent, and want the height of the container the same as its width, pure css.

margin-top:75% gives the box of the dummy element a height that is 75% of the aforementioned width, thus defining the aspect ratio. The key here is that a percentage value for margin-top or margin-bottom (or for padding-top or padding-bottom, for that matter) refers to the width of the containing block. Because the container is an inline-level block container, the height of the container is automatically computed as the height of the dummy element, which is based on the width of the container. Voilà, instant aspect ratio using only CSS.
some text
#container {
    display: inline-block;
    position: relative;
    width: 50%;
}
#dummy {
    margin-top: 75%; /* 4:3 aspect ratio */
}
#element {
    position: absolute;
    top: 0;
    bottom: 0;
    left: 0;
    right: 0;
    background-color: silver /* show me! */
}

dummy element用margin-top:75%, 是取parent container "寬"的75%, 把 #container 撐高, element取決對定位

via: height equal to dynamic width (CSS fluid layout)

CSS LAYOUT GETS SMARTER WITH CALC()

CSS LAYOUT GETS SMARTER WITH CALC()

It gives you two main features to make layout more flexible: Mixing percentages and absolute values. Mixing sizing units.
#bar {
  height: calc(10em + 3px); 
}
With calc() you can use +, -, * and / to add, subtract, multiply and divide values, allowing all sorts of possibilities. You can use calc() anywhere a CSS length or number can be used. We’re also working on adding calc() for angle and frequency properties soon. The calc() property for lengths is available now in Chrome 19 (Dev channel build) by use of the '-webkit-calc’ property, in Firefox since version 8 using the '-moz-calc’ property and in Internet Explorer since version 9 unprefixed.
http://caniuse.com/#search=calc -
ie>=9.0, all firefox, all chrome, safari >= 6.0

9/22/2012

台南/以結婚為前提 和台南交往吧! - 書海漫遊 - 達人帶路玩 - udn旅遊休閒

台南/以結婚為前提 和台南交往吧! - 書海漫遊 - 達人帶路玩 - udn旅遊休閒

只要是台南人,不管是那種在台南住了三代以上的家族,或是在台南出生成長而後移居他鄉,還是嫁到台南,在台南工作,在台南當兵,在台南讀書,或短暫住過幾年,或男友女友恰好是台南人,或某一年之後就在台南租屋買屋入籍…… 對這些廣義的台南人或台南周邊人口來說,一年之內起碼要被諮詢好幾次,台南哪裡好玩,哪裡好吃。 做為這些想要靠短期衝刺就把台南好吃好玩好悠閒的滋味一次嚐盡的導覽人,有時候也要煩惱錯誤的指引,會不會導致朋友們從此討厭台南。畢竟是自己喜愛的地方,有深情有牽掛,免不了內心湧現難以言喻的壓力。其實隨便搪塞一本旅遊導覽或資訊誌也行,可是這樣輕率簡直對不起台南各寺各廟的眾神明,三言兩語或兩天一夜就要把台南採取All You Can Eat的模式推銷出去,隱約還是感覺不夠誠意。 身為台南人,如果只是讓朋友來花園夜市吃到吐,一天半時間快速衝刺美食,而不帶他們去小巷散步,在廟口聊天,在悠閒的轉角老屋喝一杯咖啡或茶,那就是身為台南人的失職。 我自己反覆煩惱了很長一段時間,某次在準備一場網路聚會(Punch Party)的三十分鐘演說時,索性就將存在自己內心的台南畫出重點,也就在圖文整理成投影片的過程中,那個「三分靦腆、三分守舊、外加四分低調」卻還是抖不掉某種自豪成分的台南人性格,安安靜靜,就上身了。 若說那是台南人的老靈魂也不為過,某種被附身的高濃度使命感,就那樣坐在體內的中心點,最靠近心臟的位子,不斷耳提面命,剎那間,總算懂了。 要跟這個城市產生感情的方式,根本不是倉促短暫的一夜情,而是以「結婚為前提」的長久交往才是啊! 那時,心內立即浮現出生在府城台南的文壇耆老葉石濤的身影,有幾年讀著葉老的書,城內那些巷弄的時空磁場隨即倒轉,這個城市獨有的氣味簡直像老店的糕餅,入喉,就回甘了。葉老說,「台南是一個適合人們作夢、幹活、戀愛、結婚、悠然過活的地方」,每次自己發出小小聲音,反覆讀頌這段話,心胸就緩緩敞開來,猶如台南夏天盛開的鳳凰花那樣,再也沒有比這段話更能說出這個城市的優雅面容了。 對於那些教人如何短期衝刺的美食教戰密笈,總覺得對這個靜好的城市不成敬意,起碼應該醞釀那種深邃長久的交情,而不是走馬看花吃吃喝喝的一夜情,畢竟,台南是整個台灣歷史的縮影: 你應該知道熱蘭遮城與普羅民遮城的歷史地位,而不是匆促地去吃一碗蚵仔煎或棺材板; 妳可以走出車站月台就開始調整語言頻道,聽聽韻尾優美的府城腔調,即使去銀行辦事情也能夠台語一路暢通; 你應該去民權路走一走,那裡從明鄭時期就已經是台灣最早有商業行為的大街,有最早的律師事務所,最早的氣象觀測站,所謂戒嚴時期的黨外第一街。據說鄭和下西洋時,曾經繞道此地大井頭取水,而今那大井頭就躺在柏油路面,成為歷史的印記…… 譬如我們常常開玩笑說,台南即使被稱為「台獨基本教義派的城市」,卻有在地職棒球團名為「統一」; 九點過後,看棒球轉播的收視人口多過談話性節目; 某些店家老闆喜歡一邊做生意一邊唱卡拉OK; 即使穿短褲穿拖鞋也可以去逛百貨公司; 或上身穿得很潮,腳上一雙夾腳拖鞋也OK; 那些穿著有破洞的無袖汗衫,坐在亭仔腳吃麵的阿伯,有可能是某某老闆某某董事長…… 即使是偏僻的小巷內,也會出現幾百年歷史的廟宇; 那些坐在廟口下棋聊天的阿公,只要開口幾乎都是歷史的活字典; 一年到頭都有廟會祭典,台南人早就習慣開車騎車等紅燈的時候,旁邊站著七爺八爺媽祖關聖帝君或三太子…… 除非是颱風天,否則這個城市不太需要隨身攜帶無法折疊的大傘,連午後雷陣雨都乾脆,嘩啦啦一陣爽快,隨即撤退。 所以來到台南,抵達車站,踏上月台,不要被所有人整齊劃一的脫外套舉動嚇一跳,因為這個城市熱情乾爽,而且很堅強,不愛哭。 台南也有不可思議的反骨與念舊,號稱國際連鎖事業最難攻打的頑固戰區,譬如星巴克與三皇三家曾經打得難分難解; 早期在成大落腳的麥當勞曾經敗給89漢堡; 美而美比不上勝利早餐店; 養老乃瀧拚不過沙卡里巴「赤崁」老店; 五星級名廚打不贏阿霞飯店; 十年老店只是「細漢仔」,百年老店才是「老大」…… 台南還有超強的棒球基因,早年的郭泰源、莊勝雄、謝長亨; 闖蕩美國職棒的陳金鋒、王建民、郭泓志、胡金龍、林哲瑄; 挑戰日本職棒的林恩宇和鄭凱文; 還有年年出英雄的熱血高校野球傳統強隊南英小將…… 跟台南交往之前,先讀些書,譬如葉石濤的《紅鞋子》《賺食世家》; 譬如蕭麗紅的《桂花巷》; 譬如蔡素芬的《鹽田兒女》; 或者蘇偉貞的《租書店的女兒》……小說或敘事散文能給的,是一種深植內心的情緒,比那些地圖導覽還要來得深邃飽滿。 走吧,出發了。去那個適合作夢、幹活、戀愛、結婚、悠然過活的地方。 先把馱在肩上的身段與節奏一腳踢開; 找一個非假日,穿一雙好走的鞋,找一間老街的小旅館住幾晚; 或找台南人當嚮導,如果可以的話,乾脆住在他家; 借一部腳踏車,騎起來會嘎嘎叫的最好,要不然悠閒散步也很棒; 如果是開車前來,請關掉車上的衛星導航系統,因為台南的路是「長在嘴上」…… 跟著台南人的作息步調:早睡、早起,一定要睡午覺,一定要吃早餐…… 切記切記,每個台南人的心中,都有一張不容挑戰的美食地圖; 旅遊指南與觀光團常去的店家,不一定是最棒的; 不用瓷碗的店家就失格; 到了台南還只是想著台北永康街昂貴的芒果冰就遜掉; 夏天吃挫冰,冬天吃桂圓米糕糜; 沒吃到薑糖醬油大蕃茄,等於沒來過台南; 在台南吃米糕與肉粽,千萬不能要求店家給妳紅吱吱的甜辣醬,那不是台南人吃米糕與肉粽的規矩…… 找一家老餅舖吃傳統台式糕餅; 一定要吃台南滷麵; 一定要嚐嚐北部很少見的水煮珍珠玉米; 一定要去菜市場,譬如大菜市、水仙宮市場、鴨母寮菜市、東菜市和崇誨空軍市場; 一定要去逛夜市,大東、武聖、花園。去撈金魚、打彈珠、吃雞蛋冰,找玻璃牛奶瓶…… 夏天記得來看鳳凰花,如蕭麗紅在《千江有水千江月》描述的:「從窗戶望出去,都是火紅紅、燒開來的鳳凰花……」 一定要去全美戲院朝聖,那是李安導演的青春和所有台南學子的新天堂樂園; 一定要去台南舊都廳改建的台灣文學館; 不要錯過小巷弄的老房子和大馬路旁邊的古樓,因為台南是一個對老房子有感情的地方; 一定要去昔日「末廣町」……今天的中正路瞧一瞧「林百貨」和對面的「勸業銀行台南支店」也就是今天的土地銀行…… 我常常覺得,一個城市如果沒有記憶,那就是死了,而一個城市要有記憶,老房子的身世就絕對不能草率被怪手剷平。應該是媽祖保佑,台南有一批年輕世代號召成立了「老房子事務所」,讓新行業進入老房子的靈魂,因而有了重生的機會。 譬如南門路的「草祭水又書店 」「小說咖啡」和「窄門咖啡」; 公園路氣象站對面的「奉茶」; 大菜市的「謝宅一號店」與保安路的「謝宅三號店」; 衛民街的「鹿早茶屋」; 民生路的「破屋」與青年路鐵道旁邊的「Kinks」; 長榮路的「A Room」咖啡; 正興街的「IORI」茶館; 台南人在七夕做16歲的七娘媽亭附近也有「甘單咖啡」與「寮國咖啡」; 還有躲在東寧路小巷內的「咖啡是實」…… 我很貪心,像個嘮叨的帶路人,唯恐閃失,漏掉什麼,倘若這樣,就愧對這個城市曾經耐心餵養我的諸多美好。 然後你也許就清楚了,這個「一言難盡」的城市,這個每走幾步路就想要坐下來吃點東西也剛好都不會讓人失望的美食勝地,許多店家即使與你不熟識,還是跟你招呼「來坐」。倘若你有機會走進一條小巷弄,一個村落,看見那些阿叔阿嬸阿公阿嬤,他們不只招呼你「來坐」,還問你「呷飽未」,你說不定在內心想著,到底是怎樣的歷史基因,讓這個城市那般從容不迫。 我其實不愛那些行銷字眼,說這裡有「王城氣度」,說這裡是「沒落的貴族」,但明明台南人的氣度或即使有某種隱性的驕傲,向來都掩藏得好好的。有時候不熟的人來了,就只是微笑,倘若對方有脾氣,那也只是微笑,內心決定不得罪,但也決定不深交就是了,沒必要爭辯。可是捍衛的城池那樣明確,不管是實體的或是內心的,一旦被激怒了,台南人又是那般反骨,不妥協。你說這樣子也未免太抽象了,但我身為台南的女兒,約莫能解釋的就是如此了。那些無法言喻的情感,如非在這裡住上三代,好像也說不出個所以然,但嘴裡說得那樣華麗多彩,還不如內心彼此理解就好。 反正,我喜歡安安靜靜,恬恬淡淡,有脾氣,卻不尖銳的台南。 來吧,歡迎來到這個適合作夢、幹活、戀愛、結婚、悠然過活的地方。請以結婚為前提,和台南交往吧! 圖片故事:【全美看板】 全美戲院,台南學子心目中的「新天堂樂園」。我在這裡看過無數的經典西片,雖然是二輪,兩片同映,但無損於這個戲院綻放出來的青春光澤。 全美的前身是日治時期的「第一全成戲院」,位於大宮町一丁目,至今仍然是專業師傅的手繪電影看板,照片中的右下角,逆向機車等待紅燈的位置,是「大井頭」遺跡所在。 全文網址: 台南/以結婚為前提 和台南交往吧! - 書海漫遊 - 達人帶路玩 - udn旅遊休閒 http://travel.udn.com/mag/travel/storypage.jsp?f_ART_ID=53400#ixzz27Bouk14R Power By udn.com

bashmarks - directory bookmarks for the shell

bashmarks - directory bookmarks for the shell

installation
git clone git://github.com/huyng/bashmarks.git
cd bashmarks && make install
add source ~/.local/bin/bashmarks.sh from within your ~.bash_profile or ~/.bashrc file
shell commands
s  - Saves the current directory as "bookmark_name"
g  - Goes (cd) to the directory associated with "bookmark_name"
p  - Prints the directory associated with "bookmark_name"
d  - Deletes the bookmark
l                 - Lists all available bookmarks
where bashmarks are stored All of your directory bookmarks are saved in a file called “.sdirs” in your HOME directory.

justfont blog - 字體123:我可能不會注意的字體冷知識

justfont blog - 字體123:我可能不會注意的字體冷知識

Leam to Kem? Learn to Kern? 上面這張圖的意思是說,如果沒有好的kerning,就會把rn連在一起,變成了m;拉丁字中有特定幾個字若是太近,會影響辨識度,就有如上面的例子。kerning的技巧正是在此時派上用場,調整特定字母的距離,增加字體的辨識程度。話說,"typograpy"原本是來自於活版印刷。早在這種古早年代,西方人就發現會有這樣的問題。例如下圖的T,如果沒有特殊處理,會跟兩邊的字母隔得太遠,導致有"SEE YOU A T NINE."這種令人不解的拼字。所以他們就發明了Kerning這個技巧,來把特定字母與兩邊字母的距離正常化。 如同所見,右邊的T稍微突出方塊,才能在印刷時與前一個字母保持合理距離。 其實,"kerning"一詞的字源來自"corner",強調的是一個字母語兩邊合宜的距離關係。"kerning"這個詞在k與e之間,r與n之間其實就有kerning,保持適當距離,提高辨識度。只是,kerning並不能被理解為「字元間距」,字元間距是上面那張圖的第二個:tracking。 每個字元的距離就是tracking 在網頁排版的css語法中,相對應"tracking"的語法就是letter-spacing,描述的是每個字母之間的平均距離。例如這個單字tracking就採取了0.5em的字元間距。tracking與kerning具體而言的差異是,tracking只是有關於調整每個字母之間的「平均」距離;而kerning雖然也是調整距離的概念,但強調的是一個單字中,特定字母的合宜距離,這種距離對辨識度很重要。 Leading不是領導,是行距 其實在typography中,leading發音為"ledding",而不是領導的進行式那個發音。但說來也巧,leading可以說是字型排版學中一個無比重要的觀念,有如引領眾規則的老大。因為適當的行距給了字體呼吸空間,當然也就讓內容更加好讀了;但如果連呼吸空間都未顧及,那麼其他再好的排版設計都沒有用。而且行距的設定其實也是有學問的。在傳統的平面設計中,垂直的韻律就是一種設定行距的規則,而且不管印刷或螢幕顯示都相當適用。 字型、字體,傻傻分不清楚 其實寫文章的時候,我們也會兩者混用。但字型(fonts)與字體(typeface)是不完全一樣的概念。這仍舊要追溯到古早的活字。那個時候,一個字型就是一塊金屬(鉛塊、木頭)上面刻的字,它的樣式(例如粗體、斜體)以及大小是固定不變的。嚴格來說,這才叫做一種「字型」;而「字體」則是同一款字型的「集合」:在相同的風格中,一套字體有不同的粗細、大小與樣式。例如,信黑體W3的12號字是一種字型,但信黑體本身是一套「字體」。然而,在數位時代中,數位字型可以被輕易的放大縮小,以至於字型與字體兩種概念的分野似乎不再那麼重要。但我們還是希望能夠強調字體這種成「套」的概念。因為在設計上很少只用到一種字型,必須要使用字體,才能同時風格一致,又能用各種不同粗細大小的字互補。

The Making of Octicons

The Making of Octicons

Glyph - font creating/editing tool Font Squirrel @font-face generator. - convert ttf/otf to other font format and generate css syntax http://maxvoltar.com/archive/-Webkit-font-smoothing
-webkit-font-smoothing: none;
-webkit-font-smoothing: subpixel-antialiased;
-webkit-font-smoothing: antialiased;
http://www.usabilitypost.com/2010/08/26/font-smoothing/
The first one will turn font smoothing off, showing your text with jagged sharp edges. The second one is what we see as default font smoothing on modern operating systems. It uses subpixel rendering to increase the apparent resolution of the display, which helps render crispier, sharper text. The last one is most interesting. It turns subpixel rendering off and instead uses the standard antialiasing technique to make fonts look smoother. Here’s a good article on the three Webkit modes together with some examples. I’m starting to see more and more sites using Webkit’s antialising font smoothing mode instead of the default subpixel one. I think it’s a pretty bad idea, especially when applied to body font. See, subpixel rendering is used for a very good reason. Each pixel on the screen isn’t just one little square of light, it’s actually three stripes (sometimes circles or squares) colored red, green and blue. Each of these subpixels can be turned to different intensities, which allows them to be used for extra detail. So instead of using all 3 simultaneously as one pixel, we use these subpixels individually to draw sharper shapes at very small sizes. The antialiasing mode of font smoothing turns this feature off and instead uses whole pixels to render the fonts. This makes the fonts look thinner, weaker and blurrier because the resolution is now effectively lower than before. Some say that the standard OS X font rendering is quite thick and strong—that may be compared to Windows (because OS X doesn’t rely on font hinting which aligns fonts at small sizes to individual pixels)—but its use of subpixel rendering also makes it sharp at small sizes. Turning subpixels off just makes it less readable, even if at first the thinner lines seem appealing. It’s surprising that even the BBC is doing it on their new site. I think it’s a case of using something just because it’s there, and not really thinking through the reasons behind it. Actually, I can’t find a good reason to use antialiasing right now instead of subpixel rendering. I’m not sure that taste is a good argument for this because what you do get are fonts rendered at lower resolution, which are weaker and less crisp than their subpixel counterparts. Don’t sacrifice readability for appearance.

9/17/2012

iTunes 10 for Mac: Add items to your library without copying them to your iTunes folder

iTunes 10 for Mac: Add items to your library without copying them to your iTunes folder

To add files to your library without adding them to your iTunes folder: Choose iTunes > Preferences, and click Advanced. Deselect the “Copy files” checkbox. From now on, when you drag a file to your library or choose File > Add to Library, the item appears in iTunes, but the actual file isn’t copied or moved.

9/16/2012

What Mark Zuckerberg's really said about HTML5 at Disrupt yesterday.

What Mark Zuckerberg's really said about HTML5 at Disrupt yesterday.

Yesterday, at Disrupt SF, Mark Zuckerberg discussed Facebook's mobile strategy. In the process he made a few comments about HTML5. Predictably news outlet and social media were quick to jump on them. Quotes were taken out of context and conclusions hastily drawn. In order to set the record straight, I wanted to share the transcript with you and let you draw your own, informed conclusions: "When I'm introspective about the last few years I think the biggest mistake that we made, as a company, is betting too much on HTML5 as opposed to native... because it just wasn't there. And it's not that HTML5 is bad. I'm actually, on long-term, really excited about it. One of the things that's interesting is we actually have more people on a daily basis using mobile Web Facebook than we have using our iOS or Android apps combined. So mobile Web is a big thing for us." --Mark Zuckerberg, Disrupt SF, September 2012.

9/13/2012

麥米魯

麥米魯 - 啤酒批發, 團購

The Download Attribute a[download]

The Download Attribute a[download]

syntax:

<a href="../../dr-evil-802.jpg" download="evil">download me</a>
window.addEventListener('load', function (e) {
    var MIME_TYPE = 'text/x-vcard';

    var link = document.getElementById('virtual-file-link');
    var contact = document.getElementById('contact');
    var obj = navigator.microformats.get('hCard', contact);

    obj = obj.microformats.vcard[0];
    var name = obj.fn.replace(/ /gi, '_');
    var vcard = hCardtovCard(obj);

    window.URL = window.webkitURL || window.URL;
    window.BlobBuilder = window.BlobBuilder
        || window.WebKitBlobBuilder
        || window.MozBlobBuilder;
    var builder = new window.BlobBuilder();
    builder.append(vcard);

    link.download = name + '.vcf';
    link.href = window.URL.createObjectURL(builder.getBlob(MIME_TYPE));
});
DownloadUrl Support - Dragging files to the desktop
var link = document.getElementById('draglogo');

link.addEventListener("dragstart", function (e) {
    e.dataTransfer.setData("DownloadURL", 
        "image/png:logo.png:http://glennjones.net/images/logo16.png");
});
Offer files for download in HTML5: a[download]
The new attribute download for <a> tags allows one to offer a file for download – instead of displaying it in the browser. Previously. Normally, when you click on an <a> tag, the web browser visits the file it refers to. Sometimes, you instead want the file to be downloaded. Most browsers usually ask the user to confirm before starting the download. Previously, you had to send the following HTTP header to make that happen.
Content-Disposition: attachment; filename=my-icon.png
Now. The new attribute download ensures that a file is downloaded and not displayed.
    <a href="http://example.com/3zw1456.png"
       download="my-icon.png"
    >download me</a>
Giving the attribute a value allows you to control the name of the file that is saved to disk. Use case. This feature is especially useful if you are working with URLs coming from Blob instances (which include File instances in the user’s file system) and FileEntry instances (in browser-local sandboxed file systems). With download, their data becomes downloadable.

http://chunghe.googlecode.com/svn/trunk/experiment/html5.download.attribute/index.htm

9/10/2012

javascript - Resizing an image in an HTML5 canvas - Stack Overflow

javascript - Resizing an image in an HTML5 canvas - Stack Overflow

demo:

http://chunghe.googlecode.com/svn/trunk/project/canvas-resize/index.htm
//returns a function that calculates lanczos weight
function lanczosCreate(lobes){
  return function(x){
    if (x > lobes) 
      return 0;
    x *= Math.PI;
    if (Math.abs(x) < 1e-16) 
      return 1
    var xx = x / lobes;
    return Math.sin(x) * Math.sin(xx) / x / xx;
  }
}

//elem: canvas element, img: image element, sx: scaled width, lobes: kernel radius
function thumbnailer(elem, img, sx, lobes){ 
    this.canvas = elem;
    elem.width = img.width;
    elem.height = img.height;
    elem.style.display = "none";
    this.ctx = elem.getContext("2d");
    this.ctx.drawImage(img, 0, 0);
    this.img = img;
    this.src = this.ctx.getImageData(0, 0, img.width, img.height);
    this.dest = {
        width: sx,
        height: Math.round(img.height * sx / img.width),
    };
    this.dest.data = new Array(this.dest.width * this.dest.height * 3);
    this.lanczos = lanczosCreate(lobes);
    this.ratio = img.width / sx;
    this.rcp_ratio = 2 / this.ratio;
    this.range2 = Math.ceil(this.ratio * lobes / 2);
    this.cacheLanc = {};
    this.center = {};
    this.icenter = {};
    setTimeout(this.process1, 0, this, 0);
}

thumbnailer.prototype.process1 = function(self, u){
    self.center.x = (u + 0.5) * self.ratio;
    self.icenter.x = Math.floor(self.center.x);
    for (var v = 0; v < self.dest.height; v++) {
        self.center.y = (v + 0.5) * self.ratio;
        self.icenter.y = Math.floor(self.center.y);
        var a, r, g, b;
        a = r = g = b = 0;
        for (var i = self.icenter.x - self.range2; i <= self.icenter.x + self.range2; i++) {
            if (i < 0 || i >= self.src.width) 
                continue;
            var f_x = Math.floor(1000 * Math.abs(i - self.center.x));
            if (!self.cacheLanc[f_x]) 
                self.cacheLanc[f_x] = {};
            for (var j = self.icenter.y - self.range2; j <= self.icenter.y + self.range2; j++) {
                if (j < 0 || j >= self.src.height) 
                    continue;
                var f_y = Math.floor(1000 * Math.abs(j - self.center.y));
                if (self.cacheLanc[f_x][f_y] == undefined) 
                    self.cacheLanc[f_x][f_y] = self.lanczos(Math.sqrt(Math.pow(f_x * self.rcp_ratio, 2) + Math.pow(f_y * self.rcp_ratio, 2)) / 1000);
                weight = self.cacheLanc[f_x][f_y];
                if (weight > 0) {
                    var idx = (j * self.src.width + i) * 4;
                    a += weight;
                    r += weight * self.src.data[idx];
                    g += weight * self.src.data[idx + 1];
                    b += weight * self.src.data[idx + 2];
                }
            }
        }
        var idx = (v * self.dest.width + u) * 3;
        self.dest.data[idx] = r / a;
        self.dest.data[idx + 1] = g / a;
        self.dest.data[idx + 2] = b / a;
    }

    if (++u < self.dest.width) 
        setTimeout(self.process1, 0, self, u);
    else 
        setTimeout(self.process2, 0, self);
};
thumbnailer.prototype.process2 = function(self){
    self.canvas.width = self.dest.width;
    self.canvas.height = self.dest.height;
    self.ctx.drawImage(self.img, 0, 0);
    self.src = self.ctx.getImageData(0, 0, self.dest.width, self.dest.height);
    var idx, idx2;
    for (var i = 0; i < self.dest.width; i++) {
        for (var j = 0; j < self.dest.height; j++) {
            idx = (j * self.dest.width + i) * 3;
            idx2 = (j * self.dest.width + i) * 4;
            self.src.data[idx2] = self.dest.data[idx];
            self.src.data[idx2 + 1] = self.dest.data[idx + 1];
            self.src.data[idx2 + 2] = self.dest.data[idx + 2];
        }
    }
    self.ctx.putImageData(self.src, 0, 0);
    self.canvas.style.display = "block";
}
Lanczos resampling - Wikipedia, the free encyclopedia

Color Hex - ColorHexa.com

http://www.colorhexa.com/faaceb - compute 'Analogous Color', 'Complementary Color' along with others

Gradient generator Color blender 216 web safe colors Colors by name

Amazon’s Pure CSS Solution to Avoid Cutting Off Text

Amazon’s Pure CSS Solution to Avoid Cutting Off Text - oldie but goodie

background-image: -webkit-linear-gradient(bottom, white 15%, rgba(255, 255, 255, 0) 100%);
Update: Syd Lawrence points out that it’s worth using pointer-events: none on the mask. This is the CSS property that makes the front layer porous, allowing mouse clicks to cheekily slip through to the element behind it.

tiltShift.js - a jQuery plugin using CSS3 filters to replicate the tilt shift effect

tiltShift.js - a jQuery plugin using CSS3 filters to replicate the tilt shift effect

9/09/2012

Russia in color, a century ago - The Big Picture - Boston.com

Russia in color, a century ago - The Big Picture - Boston.com

In those years, photographer Sergei Mikhailovich Prokudin-Gorskii (1863-1944) undertook a photographic survey of the Russian Empire with the support of Tsar Nicholas II. He used a specialized camera to capture three black and white images in fairly quick succession, using red, green and blue filters, allowing them to later be recombined and projected with filtered lanterns to show near true color images. The high quality of the images, combined with the bright colors, make it difficult for viewers to believe that they are looking 100 years back in time - when these photographs were taken, neither the Russian Revolution nor World War I had yet begun.

Pose running technique training (before and after)

Pose running technique training (before and after)

9/01/2012

台南 日租 民宅 民宿

台南 日租 民宅 民宿

復興路。小隱

有方公寓

鐵花窗民居

正興咖啡館

木子到森 Mozidozen

木‧18

六圓(南)

毛屋‧台南漁光島

跳屋子

銅錢草B&B,tea house

屎溝墘客廳

轉圈圈Home stay

宿囍 Backpacker

Dorm 1828

油行尾

慢步。南國

靜巷十號

來七逃旅店

台窩灣

跳房子

Tavern L

Dodoro's hostel

Iris tower

波夏122

台南夢想套房

許願宿

8招健身2/腹肌無力 仰臥起坐練再多 無效!

8招健身2/腹肌無力 仰臥起坐練再多 無效!

1.趴臥,採取膝蓋的「四足跪姿」,之後慢慢將屁股抬高,膝蓋脫離地面,利用手肘的力量把身體撐起來。最好的姿勢是膝蓋懸空、腿打直的「棒式」,但女性如果手臂較無力、撐不太起來,則可以將膝蓋跪地做支撐。 2.每次撐起時間維持30秒,30秒時稍休息3至5秒後,再撐起30秒,總共進行1分鐘的時間,男性可以加做腳左右旋轉的作用,可以強化側腹肌的鍛鍊。 小叮嚀:這個動作可練習腹部的肌肉,而撐地的動作,手臂「拜拜肉」的肌肉也會練習到,男性加做腿部的左右旋轉,增加扭力,可以使腹部、腿和側腹肌更強化。 1.躺臥,兩手張開平貼在地面,可做為輔助支撐,之後雙腿一起抬起,盡量和身體呈90度腳,Luke說,動作的重點要注意腰和臀必須平貼著地面,後腰僅能留一個手掌高度的空隙,以維持人體弧形脊椎。 2.整個動作維持1分鐘。腿力較好者,可採取進階版,將雙腿彎曲,大腿和小腿呈90度角後,再伸直、再彎曲。 小叮嚀:Luke表示,很多女性年過30以後,腹肌幾乎完全無力,所以不管怎麼努力做仰臥起坐,因為腹肌無力,所以練到的都是頸部肌肉或是背部肌肉,腹部肌肉還是沒有練到,腹肌依舊無力。仰臥抬腿主要動用到腹肌的力量,比仰臥起坐更有效練到腹肌。

8/30/2012

jquery trigger event

jquery trigger event - trigger event 的 event handler 第一個參數是一個虛擬的 event object


  function handleRangeChange(e, index) {
    if (e.hasOwnProperty('isTrigger')) {
      console.log ('from trigger event', arguments);
      $('#range').val(index)
    }
    else {
      console.log ('from native event', arguments);
      index = e.currentTarget.value
    }
  }

  $range = $('#range');
  $range.on('change', handleRangeChange);
  $('#changer').on('click', function( ) {
    $range.trigger('change', 5);
  });

8/26/2012

CSS property: -webkit-user-select

CSS property: -webkit-user-select

syntax
-webkit-user-select: auto | none | text;
Values auto The user can select content in the element. none The user cannot select any content. text The user can select text in the element.

網聚 的優質場所 < DeRoot休閒空間> at 凱蒂的部落格|凱蒂與布丁的生活記事

網聚 的優質場所 < DeRoot休閒空間> at 凱蒂的部落格|凱蒂與布丁的生活記事

有興趣了解DeRoot 休閒空間, 可以到DeRoot 的站 : http://zh-tw.facebook.com/DeRoot 平日每人120元不限時段 週六及週日每人150元限單時段(早12-18晚18-24) 續時段每人加收50元 地址:台北市新生南路一段60號B1 營業時間:1200-2400(周四公休) 聯絡電話:(02)2393-5300, 0913638885

殺手級的胸肌訓練 (Killer Home Chest Workout)

殺手級的胸肌訓練 (Killer Home Chest Workout)

這段影片是2006年的影片,教你在家如何使用啞鈴去訓練你的胸肌。動作一共有三個:伏地挺身(Push-Ups)、啞鈴飛鳥(Dumbbell flys)及平躺啞鈴上推(Dumbbell Press),訓練的方法很簡單: 伏地挺身(Push-Ups)做到...掛(請平緩的上及下)。 啞鈴飛鳥(Dumbbell flys)做到...掛。 平躺啞鈴上推(Dumbbell Press)做到...掛。 動作與動作之間【不休息】,啞鈴請使用比平常更輕的重量,這三個動作為一組,一共做5~8組,組與組之間休息2~5分鐘,適自己情況來調整休息的時間。作者強調,啞鈴一定要拿比平常舉的重量更輕,以避免受傷。因為伏地挺身做到掛時,通常已經沒力了,所以要使用比平常輕很多的啞鈴來做接下來的動作囉。

8/24/2012

backbone tricks

1. _.bind, $.proxy的作用
2. 怎樣再 initialize 呼叫 event handler 並維持本來的 execution scope
3. 怎樣針對 mobile browser 用 'touchstart' event 而不是 'click' evnet

  FooView = Backbone.View.extend(
    el: $('#main')
  
    initialize: ->

      
      if navigator.userAgent.match(/(iphone|ipod|ipad|android)/i)
        $('#frames .frame').on('touchstart', _.bind(@handleFrameClick, @))
        $('#controller').on('touchstart', '.icon-play-circle', _.bind(@play, @))
        $('#controller').on('touchstart', '.icon-th-large', _.bind(@toggleFilmMode, @))
        $('#controller').on('touchstart', '.icon-sign-blank', _.bind(@toggleFilmMode, @))
      else
        $('#frames .frame').on('click', _.bind(@handleFrameClick, @))
        $('#controller').on('click', '.icon-play-circle', _.bind(@play, @))
        $('#controller').on('click', '.icon-th-large', _.bind(@toggleFilmMode, @))
        $('#controller').on('click', '.icon-sign-blank', _.bind(@toggleFilmMode, @))

    events:
      'change #range': 'rangeChange'
  )


  new FooView
其中
    events:
      'click #frames .frame': 'handleFrameClick'
      'click #controller .icon-play-circle': 'play'
      'click #controller .icon-th-large': 'toggleFilmMode'
      'click #controller .icon-sign-blank': 'toggleFilmMode'
要放在 initialize 要寫成
        $('#frames .frame').on('click', _.bind(@handleFrameClick, @))
        $('#controller').on('click', '.icon-play-circle', _.bind(@play, @))
        $('#controller').on('click', '.icon-th-large', _.bind(@toggleFilmMode, @))
        $('#controller').on('click', '.icon-sign-blank', _.bind(@toggleFilmMode, @))
_.bind(@handleFrameClick, @)可以改變 @handleFrameClick 裡面 this 的值, 作法跟 $.proxy(@handleFrameClick, @) 是一樣的

8/21/2012

style input.range element

http://chunghe.googlecode.com/svn/trunk/project/input.range/index.htm

input[type='range'] {
  -webkit-appearance: none;
  background-color: #fff;
  height: 5px;
  padding: 0;
  width: 960px;
  margin: 50px 0 0;
}

input[type='range']::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 32px;
  height: 32px;
  border-radius: 16px;
  -webkit-box-shadow: 0 0 4px #000;
  cursor: pointer;
  background: url(./assets/knob.jpg) center center no-repeat;
}

input[type='range'].plane::-webkit-slider-thumb {
  background:-webkit-linear-gradient(top, #f9f9fa, #c5c5c5);
}

input[type='range']::-webkit-slider-thumb:hover {
  -webkit-transform: rotate(45deg);
}
/* active state */
input[type='range']::-webkit-slider-thumb:active {
  background: #cecece;
}

BigVideo.js - The jQuery Plugin for Big Background Video

BigVideo.js - The jQuery Plugin for Big Background Video

BIGVIDEO.JS THE JQUERY PLUGIN FOR BIG BACKGROUND VIDEO (AND IMAGES) Created by John Polacek at Draftfcb Chicago This plugin makes it easy to add fit-to-fill background video to websites. It can play silent ambient background video (or series of videos). Or use it as a player to show video playlist. BigVideo.js can also show big background images, which is nice to have for showing big background images for devices that don’t have autoplay for ambient video. BigVideo.js is built on top of Video.js from zencoder. So big thanks to them!

8/18/2012

在Mac OS X 10.5 中打開PHP支援 - 雨蒼的終端機- 點部落

在Mac OS X 10.5 中打開PHP支援 - 雨蒼的終端機- 點部落 - document root 預設在 [/Library/WebServer/Documents], use 'sudo apachectl -k start/stop' to start/stop apache

Mac OS X 10.5原本就內建Apache 2.2.6 與PHP 5.2.4 不過預設分享網頁後(也就是啟動Apache之後),PHP的module並沒有掛上 以下就來說明要如何掛上。 由於小弟比較習慣用終端機,因此底下的操作都在終端機底下執行,並以root權限配合vim編輯。 首先打開/etc/apache2/httpd.conf 此為Apache主要設定檔。找到關於PHP的設定: 113 LoadModule bonjour_module libexec/apache2/mod_bonjour.so 114 #LoadModule php5_module libexec/apache2/libphp5.so #就是這行 115 #LoadModule fastcgi_module libexec/apache2/mod_fastcgi.so 移除開頭的註解(#)後,使該行成為 114 LoadModule php5_module libexec/apache2/libphp5.so 修改並存檔後,回到/etc中,將php.ini.default複製為php.ini。 # cp /etc/php.ini.default /etc/php.ini 預設是只有比較重大的錯誤才會回報,可提升效能。 如果希望每個錯誤都回報的話,請編輯第305行的 305 ;error_reporting = E_ALL & ~E_NOTICE 改為 305 error_reporting = E_ALL 存檔之後就可以了。 最後進入系統偏好設定中,打開分享中的網頁分享,你的網頁伺服器就開始運作囉! 如果懶的話,也可以利用Apache提供的工具 # apachectl -k restart 如果您要測試的話,那麼就在/Libary/WebServer/Documents/新增一個測試的檔案test.php 內容為 用瀏覽器打開 http://127.0.0.1/test.php 如果出現PHP模組的各種資訊,就代表網頁伺服器已經可以支援PHP囉! 另外,如果希望可以將網頁存放於個人資料夾中的Sites資料夾的話 確定/etc/apache2/users/中含有已你的使用者名稱為名的$USER.conf 若無,則從/etc/httpd/users中複製到/etc/apache2/users/即可。 cp /etc/httpd/users/$USER.conf /etc/apache2/users/ Mac OS X 10.5原本就內建Apache 2.2.6 與PHP 5.2.4 不過預設分享網頁後(也就是啟動Apache之後),PHP的module並沒有掛上 以下就來說明要如何掛上。 由於小弟比較習慣用終端機,因此底下的操作都在終端機底下執行,並以root權限配合vim編輯。 首先打開/etc/apache2/httpd.conf 此為Apache主要設定檔。找到關於PHP的設定: 113 LoadModule bonjour_module libexec/apache2/mod_bonjour.so 114 #LoadModule php5_module libexec/apache2/libphp5.so #就是這行 115 #LoadModule fastcgi_module libexec/apache2/mod_fastcgi.so 移除開頭的註解(#)後,使該行成為 114 LoadModule php5_module libexec/apache2/libphp5.so 修改並存檔後,回到/etc中,將php.ini.default複製為php.ini。 # cp /etc/php.ini.default /etc/php.ini 預設是只有比較重大的錯誤才會回報,可提升效能。 如果希望每個錯誤都回報的話,請編輯第305行的 305 ;error_reporting = E_ALL & ~E_NOTICE 改為 305 error_reporting = E_ALL 存檔之後就可以了。 最後進入系統偏好設定中,打開分享中的網頁分享,你的網頁伺服器就開始運作囉! 如果懶的話,也可以利用Apache提供的工具 # apachectl -k restart 如果您要測試的話,那麼就在/Libary/WebServer/Documents/新增一個測試的檔案test.php 內容為 用瀏覽器打開 http://127.0.0.1/test.php 如果出現PHP模組的各種資訊,就代表網頁伺服器已經可以支援PHP囉! 另外,如果希望可以將網頁存放於個人資料夾中的Sites資料夾的話 確定/etc/apache2/users/中含有已你的使用者名稱為名的$USER.conf 若無,則從/etc/httpd/users中複製到/etc/apache2/users/即可。 cp /etc/httpd/users/$USER.conf /etc/apache2/users/

desandro/imagesloaded

desandro/imagesloaded

A jQuery plugin that triggers a callback after all the selected/child images have been loaded. Because you can't do .load() on cached images.
$('#my-container').imagesLoaded( function( $images, $proper, $broken ) {
  // callback provides three arguments:
  // $images: the jQuery object with all images
  // $proper: the jQuery object with properly loaded images
  // $broken: the jQuery object with broken images
  // `this` is a jQuery object of container
  console.log( $images.length + ' images total have been loaded in ' + this );
  console.log( $proper.length + ' properly loaded images' );
  console.log( $broken.length + ' broken images' );
});
var dfd = $('#my-container').imagesLoaded(); // save a deferred object

// Always
dfd.always( function(){
  console.log( 'all images has finished with loading, do some stuff...' );
});

// Resolved
dfd.done( function( $images ){
  // callback provides one argument:
  // $images: the jQuery object with all images
  console.log( 'deferred is resolved with ' + $images.length + ' properly loaded images' );
});

// Rejected
dfd.fail( function( $images, $proper, $broken ){
  // callback provides three arguments:
  // $images: the jQuery object with all images
  // $proper: the jQuery object with properly loaded images
  // $broken: the jQuery object with broken images
  console.log( 'deferred is rejected with ' + $broken.length + ' out of ' + $images.length + ' images broken' );
});

// Notified
dfd.progress( function( isBroken, $images, $proper, $broken ){
  // function scope (this) is a jQuery object with image that has just finished loading
  // callback provides four arguments:
  // isBroken: boolean value of whether the loaded image (this) is broken
  // $images:  jQuery object with all images in set
  // $proper:  jQuery object with properly loaded images so far
  // $broken:  jQuery object with broken images so far
  console.log( 'Loading progress: ' + ( $proper.length + $broken.length ) + ' out of ' + $images.length );
});

8/16/2012

蝸牛角上爭何事 - 阿三哥記事簿 - Yahoo!奇摩部落格

蝸牛角上爭何事 - 阿三哥記事簿 - Yahoo!奇摩部落格

白居易〈對酒詩〉:「蝸牛角上爭何事,石火光中寄此身。隨富隨貧且隨喜,不開口笑是痴人。」這首詩傳達了「與世無爭」、「隨遇而安」的豁達思想。   前兩句是互文,可拆成四句:「蝸牛角上爭何事,石火光中寄此身。蝸牛角上寄此身,石火光中爭何事。」也可合為一句:「蝸牛角上石火光中寄此身爭何事。」人在浩瀚無垠的天地之間就如同蝸牛角上,那麼一丁點兒,那麼的渺小;生命短暫有如石火電光中,一閃即逝;這樣渺小又短促的生命在時空中有如暫歇一宿的過客,想開了,有什麼好爭的呢?又為什麼要爭呢?   既然沒有什麼值得爭的,就任遇而安,是富貴是貧賤,都能歡喜自在。幹嘛愁眉苦臉?不能開口常笑歡喜度日的人是傻瓜。      你認同這種思想嗎?真得沒什麼好爭的嗎?   什麼都不爭,那支持我們活在世間的力量是什麼?   人為何而活?      「豁達開朗、與世無爭」的生命情調往往會被誤解為「消極避世」,於是佛家、道家思想的精華就被扭曲、被棄捨了。「蝸牛角上爭何事?」爭「進德修業」、爭「力爭上游」、爭「當仁不讓」、爭「大是大非」、爭「大名大利」,什麼都不爭,豈不了無生趣?   佛法中的「八正道」:正見、正思惟、正語、正業、正命、正精進、正念、正定。所謂正道須能「與邪爭勝」,才能夠邪不勝正。不是去與別人一爭高下,而是自己要在內心清楚思辨,建立正知正見。如果混淆不清,是非不明,才真是「痴人」呢!   有人說:佛教徒消極,妨害國家社會的發展,這一方面是世人的誤解,但另一方面也是部份佛教徒自己沒把教理弄懂。八正道裡頭不是明明白白揭示著「正精進」嗎?   「正精進」是什麼意思?就是要正確去爭,爭什麼?跟自己內心的煩惱爭。跟無明三毒貪瞋痴爭,把這個無始劫來的大冤家打敗。如果什麼都不爭,那麼人只能隨波逐流,放任自己的臭習氣作怪,一輩子不長進。   孔子「志學、而立、不惑、知命、耳順、不踰矩」終身成長,佛陀「出家、降魔、成道、說法」不住涅槃。古來聖賢豪傑、諸佛菩薩,其生命無不有著一股剛健不息的奮鬥毅力,為參贊天地之化育而自強不息、為離苦得樂而對治煩惱、為解救群生而六度萬行,這些在在都不是「蝸牛角上爭何事」一語所能簡單含攝的。   有些人學習佛老,或者迷戀無為自然,或者高談隨喜自在,標舉著「與世無爭」的口號,學成了野狐禪。自誤誤人,貽害非淺。願以此為戒,不要修行修成不知長進、狂妄自大的無賴還不自知。

8/10/2012

Errorception - Painless JavaScript Error Tracking

Errorception - Painless JavaScript Error Tracking

//@ sourceURL

A simple example of //@ sourceURL eval naming

Using //@ sourceURL we can name eval's. This demo uses the client side Coffee Script compiler and will name the comiled code so it appears with a friendly name in your dev tools. Using the "Name your code" field you can give the eval'd code a any name. Check your scripts panel and you'll notice that the compiled CoffeeScript will have a name.

demo: http://dl.dropbox.com/u/2192156/blog/sourceURL/target-script.html

via: pmuellr: debugging concatenated JavaScript files

8/07/2012

Nicholas Zakas: Progressive Enhancement 2.0

slides: http://www.slideshare.net/nzakas/progressive-enhancement-20

8/06/2012

Extreme Core Killer 核心肌群殺手級的訓練

Extreme Core Killer 核心肌群殺手級的訓練

這一篇文章原本是放在一個舊的部落格「在家健身(Home Workout)」,受到將近千人的「讚」,山姆伯伯將他重新放置到這裡。Youtube上一個訓練核心肌群的影片Extreme Core Killer,不需任何器材,13項動作,項目間不休息,而且教練親自示範一次給你看囉。 當然一開始你可能會抓不到動作的技巧或是肌耐力沒這麼好會需要休息一下,這沒關係,不斷的練習及哀嚎下,你的核心肌群會慢慢強壯的。 Mountain Climbers x 50次 Rocking Elbow Plank x 50次 Side Plank Dips x 20 a side(每邊各20次) Spiderman Lunges x 30次 Alternating Reaching Elbow Plank 10 a side with 3 second hold each(每邊各10次,每次停留3秒) Balance Pushups x 20次 Cross Body Mountain Climbers x 50次 Up Down Plank 15 a side(每邊各15次) Sit Outs x 20次 Burpees x15次 Fire Hydrants x 30次 Side Plank Reach Unders 15 a side(每邊各15次) Double Leg Lifts x 20次 這訓練不需要器材,集結了常見的幾個動作Mountain Climbers、Plank、Pushups、Burpee等,一定要實際體會一下這標題為「殺手級」的核心訓練。

台式風格 - 華華咖啡廳 - PChome 個人新聞台

台式風格 - 華華咖啡廳 - PChome 個人新聞台

在室內設計中,台式風格為美式現代風格的旁支,以快速入門、材料替換便利為主要特色,在結構上則以大量交錯的複雜線條為基礎,呈現出多角層次的視覺感,而為了線條的平整,在施工上則非常要求牆面平滑度、角度、方正等等。翻開任一本台灣的室內設計雜誌、年鑑、年誌、精選案例等書即可看到大量台式風格空間,同質性極高。 台式風格與台式建築思維密不可分,台式居家建築有大量小窗戶、半窗、特殊位置窗戶、大樑縱橫、大樑壓頂等主要概念,讓台式室內設計師可以針對這些建築上的缺失來用裝修工程彌補,目的是讓顧客覺得工程後的成品充滿設計感,這種台式設計感多半是在跟建築的侷限做對抗,讓台式設計師與台式建築公司形成一個互利共生的複合鏈,即便雙方都不認識彼此的陌生。 台式設計思維的出現與<台式建築總綱>有絕對關連,該規則的制定者、制定日期已不可考(但相信是在西元80年代中期或之後),但總結當中的關鍵規則如下: 1. 利用"一般大眾對風水的懼怕"為主要概念,建商必須將居家建築區分為「零亂空間」、「公寓空間」、「談判空間」等三大類型。 2. 在零亂空間、公寓空間中,大量運用牆面轉折來阻止光線進入室內,而在談判空間中則以大採光面積來做為售價談判的籌碼。 3. 與會建築師及各會員需負責將規範裡的概念傳遞給所屬公司同仁,並嚴密遵守協議,倘若未來無法以公司守則規範,而導致全國違反協議之繪圖人員達到百分之一以上,本會將以強制介入的方式鎖定全部電腦繪圖軟體,確保最後出圖的空間能維持大樑柱與小窗戶的原則。 (其餘內容請參閱<台式建築總綱>) 何謂「談判空間」很好理解,就是提供好的採光、寬敞的動線、大房間、大浴室來跟高階收入的買主喊價,即便這些條件只是許多其他國家的最基本、連想都不用想的配置。 但也正因為如此,把基本的居家建築舒適元素抽掉後,才形成普遍給老百姓住的怪房子,由這些條件不好的房子來凸顯談判式空間的「價值」,是的,這很令人心痛,同一種族的人是用此種方式來往上爬。 「零亂空間」以現在觀點來看,應指我們看到格局詭異的房子,比方當我們上網搜尋出租房屋或市場主流的房屋商品都屬之,九成九都符合零亂空間,大量畸零的角落、轉角、小凹洞分散於房屋內各處,當然樑下、雙梁交界處、牆與柱連接的地方更是少不了這種構造。這些零亂空間如果太小,就會補起來,如果稍微大一點,則會做成所謂的收納空間,弄個小門或做個小櫃子上去,裡面只能放些橡皮筋或壓扁的鐵鋁罐、過期的洗衣粉之類。 零亂空間中更弔詭的是那種「只能放的下一張床」的房間,小到不能再小,頂多再放一把吉他進去...。 這樣的空間在社區型公寓很常見,舊式公寓則不太會有這樣的狀況,因為三十年前<台式建築總綱>還未發表,也就是說零亂空間的作用還有一個,就是嘗試以空間的狹隘來造成居住者的心智負面發展。 我們都知道過去中世紀到工業社會前期,一般百姓的居住空間狹小,五~八個以上的人們居住在一個小房子裡面是常有的事,不但缺乏隱私,也不一定會有現在大家必備的家具、沙發、桌椅等,而加上工作環境不良,使得當時人們的壽命不長。 台灣這種「一張床小空間」在設計的目的上就是要住在裡面的人產生封閉感,進而抑制在教育、工作上的成就,達到社會流動性的穩定。這以人本觀點來看是不太人道,畢竟現代社會中「自由」是普遍被接受的天賦人權,用這類隱性手段來達到間接抑制個人發展,似乎類似古代的賤民制度,值得受到評議。 零亂空間的繪製和設計雖然複雜,但在台灣的數量卻非常驚人,使得市井小民、剛起步的上班族、打工族、學生族、逃家族、重新開始族,通通被迫進入零亂心情,這也是為什麼台灣科技進步、國際品牌進駐,卻在整體人文素養上成長不多。 請注意,人文素養絕非靠有多少時尚配件或消費力大小衡量。只要快速進入富裕階級,消費力當然可以提昇,但若社會九成以上的人,每一代都要從新開始起步,由最粗糙的空間和家具來踏入美感思維,那就會永遠在原地打轉,我們可以由公寓空間切入。 若你的父母是經濟起飛那一代的上班族,後來買房成家立業,那你的老家很有可能就是「公寓空間」,一般以三房兩廳、兩房一廳為主,理想的狀態是每個成員都能有一個自己的私人空間,然後搭配一個互動的客廳、餐廳,佈置出家庭自我的歸屬感,並期待當大家生活舒適後,能在事業上有所發展,進而幫助自己和整體社會提昇生活水準。 而由老式的公寓空間進入到台式風格的幾個關鍵為: 1. 間接照明天花板 2. 繁複直角線條結構 3. 維持牆面主色白色 4. 提昇電視牆地位 這也常稱為台式室內設計風格的四大法則。 由於「裝飾」的概念在台式風格中並非關鍵元素,因此裝飾思維中所需要的配色、尺寸比例、視覺取捨也就不被重視,而使得台式室內設計風格的入門門檻不高,弔詭的是,反而是材料和施工經驗變成台式設計的重點專業,常常會看到許多自視甚高的中年從業人員逢人便問「做這個一尺多少錢你知不知道?」 這讓大眾對台式設計的印象變成「施工才是設計者的主導專業」。 這些概念好處是加快了台式設計的速度,通常不論一般師傅、助理工作者、資深設計師,只要進入空間找到了客廳和廁所的位置之後,就會馬上下指令「這裡一條間照過去,那裡再打一條間照過來!」考慮了一下後再補充「左右再做假間照讓它對稱!」而完成空間主軸。 最妙的地方在於,一般人從舊式公寓的平頂天花板或<國王炸雞>的彩繪玻璃鄉村風天花板換到間接照明的新房子時,心裡的確是覺得:哇!明亮又特別!真棒~ 可是等到當人們第二次換房、第三次換房時,卻還是覺得這種天花板很棒,這就令人匪夷所思了,但答案並不複雜,原因就在於:間接照明是台式風格的首要法則。 他們沒有別的選擇,所以即便是預算增加,也是在材料上做變化,但變化又不大,所以不論五十萬、一百萬、兩百萬、三百萬的裝潢,看起來都差不多,只是一些金屬、玻璃的多寡程度,這也造就了一個宣傳詞彙:台式小豪宅。 而那些出社會闖蕩的朋友,從租屋處或小套房中,好不容易存了半輩子積蓄可以買房時,也會覺得: 「終於可以買到別人都有的間照家了!」 「終於能買到小時候羨慕別人家都有的間照了!」 甚至是想說: 「終於可以買到『豪宅』才有的間照了!」而感到夢想達成,開心無比。 過去的觀點認為「換房次數」是造成台式風格二十年如一日的主因,但後來證明為是「可選擇的選項固定,以及相關資訊接觸時間過短」所造成。 當大眾有機會可以換房或預算增加,只會去臨時去看一些刊物、電視節目介紹,內容大同小異、風格也沒有其他選項,所以沒有辦法意識到什麼靈感,只希望下一個房子能有點不一樣的感覺,實際該怎麼做不清楚。 台式風格則在此提供了材料的變化,用大量的材料、突出物、凹凹凸凸,這樣的複雜線條讓多數民眾覺得很有「設計感」,因為抓不到這些線條的由來和原因,而也知道自己無法自製這類線條,而覺得有得到該有的設計,但其實這還是跟之前說的「施工為設計專業判準」有關。 一面牆壁的顏色挑選也許非常困難,可是民眾無法理解難在哪裡? 但一面牆壁多一個凸出邊條,一般人就覺得「這我們自己做不出來,超有設計感的!」 這就是為什麼台式設計年鑑、雜誌、巨大預算的案例,看起來就是那個樣子,很複雜,但是很沒主軸,若要說真的有放置一個焦點,那就是電視牆了。 電視牆 TV Wall 從零到有的生活讓人感到美好,快速賺到錢的炫富滋味甜美。 以前說過,許多人很容易變得有錢,這跟學歷、知識、品性等通通無關,在這個高速流動的小島上,做零售生意致富的人非常多,而我們不是探討身價數十億的富翁,而是那些可以買三戶房子、兩台汽車以上的人就列入討論,這樣聽來好像不是很難吧,也不一定需要什麼哈佛MBA學位或看多少書就能買房、換屋了。 一般人在家裡最長時間花的地方在哪? 說是「床」這一點不會有很大爭議,其他花的時間則因人而異,可是床主要就是床墊的機能型訴求,但床架呢?有聽到人在討論嗎? 甚至問一個讓人訝異的事實:哪裡有賣床架? 床架喔? 你腦海中浮現一連串跟床有關的牌子都是賣床墊哦,不是床架,當然IKEA、特力屋、寢具賣場會有賣,但是...床架的牌子?大家腦海中空無一物,網路上有非常多的千元床(注釋1),而居家雜誌廣告裡的都是五萬、十萬起跳的高級床,那請問給一般人睡的一般床架在哪?要去哪裡買? 好像介於幾千元跟數十萬元的地帶是空的!不相信的人去搜尋看看,你覺得價位不要太高但是又不要太爛的床在哪,最後大家的確是會回到大賣場購買,若你發現一些家具店、柚木店有賣,那也不是床架專賣,而是兼賣。 所以台式風格的重點跑去哪了? 是電視牆。 但電視牆有啥了不起? 很遺憾,電視對多數台灣人來說非常了不起,因為工作沒有樂趣、生活沒有熱情,加上閱讀並不是國人的主要消遣,因此電視變成工作與睡眠的重要支撐橋樑。多少人捨不得睡只想再看一下電視,即便沒什麼好看,但就是享受一直轉台;彷彿對工作的憤怒、不滿和無奈都寄託在電視上了,聽名人老婆講自己的生活、聽名嘴講這個社會,好像自己就有所參與,但實際上又根本沒有參與,最後撐不住關機上床睡覺,日復一日。 對許多人來說,考上大學是一個人生轉折點,欣喜若狂!但自己升官的那一天可沒有特別的轉折感,因為沒有象徵性,你無法狂歡慶祝一個月。 人生彷彿沒有其他轉折了,在學生的夢想與工作永無止境的起床當中,還有什麼能讓自己覺得終於又有成就了? 結婚?算。 生小孩?算。 買房?算。 這些成就都需要宣揚讓別人知道,所以有婚紗照、彌月禮盒,以及電視牆。 新家請朋友來,如果看不到一個吸引目光的東西,那要炫耀什麼? 於是花草壁紙電視牆、大理石電視牆、對花大理石電視牆、木紋電視牆、磚紋電視牆、水晶電視牆、生態樹脂電視牆(太貴,沒有人用)、金屬電視牆(太洋派、少見)等等紛紛出籠,電視牆成為空間的主軸,沙發、展示櫃、茶几、燈光等一切都跟著電視跑,而其他的牆面則維持白色,因為用別的顏色...會不會很怪啊?一般人這樣猶豫著,算了!用白色沒錯! 那電視擺好以後還要做點什麼呢?好像大家就可以坐下來看電視了! 因此「電視牆、複雜線條、白色牆面、間接照明天花板」這四大法則構成台式風格。 而值得注意的是,在過去某一年的某一天,報紙上一份報導指出「黃色光是最接近太陽光、讓空間溫暖...」等字樣出現後,一夕之間風雲變色,從此台灣結束了舊式公寓的白色日光燈管時代,進入了黃光間接照明紀元,當你下次漫步在河堤或經過新蓋好的住宅區,請抬頭看看,每一戶都一模一樣:間照黃光天花板。 這不是同一個公司設計的,而是由台式室內設計師所給這塊土地的台式風格。 台式風格跟台式設計師的資歷、背景無關。根據調查,不論是留學北美系、歐洲系、南半球系國家等設計學院者,回台灣後所呈現的依然是台式風格,證明台式風格並非教育所影響,而是當事人的成長環境對思維美感的影響,以及後來的<台式建築總綱>的餘韻,因為多數新一代的從業人員早已沒聽過該規範,電腦也並未受到該會的中央控管,可是繪製出來的設計圖依舊。 許多台式設計者的文宣總是講著自己經驗豐富、風格獨特地鏗鏘有力,但一看到放置的大頭照片是「台式站姿」和「台式表情」就漏底了(注釋2),足見台式設計思維已對本島大部分的人有全面性地影響。 值得注意的是,台式風格原初概念不只是空間設計,在生活思維或其他設計類型、演員表演與音樂領域也有類似的描述,就產品面來說,除了少數自幼在國外長大的創作者,另外就是要大量涉獵國外編製元素的人才有可能跳脫台式風格,但目前這樣的人多半在音樂領域為主,前者如陶喆,後者如周杰倫等,當這些音樂人的影響發酵,讓一些國外靈魂樂、饒舌或nu-metal元素融入華語歌曲而漸漸為大眾所接受後,本土的設計藝術還有很長的一段路要走,行進緩慢,而且就樂觀面來說,或許接下來也只會先進入目前台式風格的進階版。

lipka/piecon · GitHub

lipka/piecon · GitHub

50歲前別急著買房 - 專案管理的生活思維

50歲前別急著買房 - 專案管理的生活思維

7/26/2012

Will v./ will be v.~ing?

Will v./ will be v.~ing?

1. We'll be visiting you next Monday. 2. We'll visit you next Monday. Is there any difference between them? Thanks.
I would say there is only a subtle difference in emphasis. The first sentence emphasizes the process of visiting, and might be more likely to be used if you are going on to discuss what will happen during the visit. (We will be visiting you Monday, so we can more about this in person. We will be visiting George, so if you are looking for us, call us at his house.) The second sentence simply states the fact that the visit will take place. (We will visit you on Monday. On Tuesday we will go to the museum, and on Wednesday we will go to the beach.) The difference is slight - in most conversational situations, either sentence could be used.
Yes, elinor, there is a difference -- the usual difference between progressive and non-progressive structures. 1. We will be [in the act of / in the situation] of doing some visiting with you next Monday. The time period of visiting will be during next Monday. This is a descriptive form. It describes what will be going on. 2. The following event will take place next Monday: We will make a visit to you. This is a fact-stating form. It states the facts of the event as a whole, as if the visit were an item on a schedule of tasks to be accomplished next Monday. The progressive forms express actions and situations as they unfold in time. The non-progressive forms express 'event-facts'. Such-and-such an event will happen. With the future, the progressive is much more likely when the activity has been prearranged. Example: -- Can you go swimming with us next Monday? -- No, because we'll be visiting grandmother then. (You can't easily answer: No, because we'll visit grandmother then.) -- We have to visit grandmother next week. -- OK. Let's get it over with. We'll visit her next Monday. (You can't easily answer: OK. We'll be visiting her next Monday. It sounds like you've already prearranged the visit.)

Marissa Mayer Has a Secret Weapon

Marissa Mayer Has a Secret Weapon

So Mayer came up with an idea: Google would hire computer science majors who just graduated or had been in the workplace fewer than 18 months. The ideal applicants must have technical talent, but not be total programming geeks — APMs had to have social finesse and business sense. Essentially they would be in-house entrepreneurs. They would undergo a multi-interview hiring process that made the Harvard admissions regimen look like community college. The chosen ones were thrown into deep water, heading real, important product teams. (As the first APM, Rakowski was asked to launch a nascent project called Gmail. By the way, I hear Rakowski is taking over the program now that Mayer is gone.) “We give them way too much responsibility,” Mayer once told me, “to see if they can handle it.” Also, Google had APMs perform tasks for top management, like note-taking at high-level executive meetings or drawing up white papers on ambitious potential products.

Meteor – The next Ruby-on-Rails?

Meteor – The next Ruby-on-Rails?

7/20/2012

Micha’s Golden Rule

Micha’s Golden Rule

Micha Gorelick, a data scientist in NYC, coined the following rule: Do not store data in the keys of a JSON blob. This is Micha’s Golden Rule; it should always be followed when forming JSON for use in D3, and will save you many confusing hours. This means that one should never form JSON like the following:
{
"bob": 20,
"alice": 23,
"drew": 30
}
Here we are storing data in both the key (name) and the value (age). This is perfectly valid JSON, but breaks Micha’s Golden Rule, which is bad. Instead, we would form the following as a list:
[{
    "name": "bob",
    "age": 20
}, {
    "name": "alice",
    "age": 23
}, {
    "name": "drew",
    "age": 30
}]
Here, we store data only in the values, and the keys indicate only what the data repre- sents. If you are in the unfortunate position of having JSON that breaks Micha’s Golden Rule, consider using d3.entries() to make the conversion.
via: O'Reilly Getting Start with D3