• <ins id="pjuwb"></ins>
    <blockquote id="pjuwb"><pre id="pjuwb"></pre></blockquote>
    <noscript id="pjuwb"></noscript>
          <sup id="pjuwb"><pre id="pjuwb"></pre></sup>
            <dd id="pjuwb"></dd>
            <abbr id="pjuwb"></abbr>

            XGuru's Blog

            技術,是一種態度。關注:高性能后端技術/服務器架構/C++/C/LAMP

               :: 首頁 :: 聯系 :: 聚合  :: 管理
              20 Posts :: 0 Stories :: 93 Comments :: 0 Trackbacks

            公告





            twitter / xoXGuru

            feedsky
            抓虾
            google reader
            鲜果
            QQ邮箱
            九点

            常用鏈接

            留言簿(12)

            搜索

            •  

            最新評論

            閱讀排行榜


                               Emacs是否真的能煮咖啡?        by XGuru









                坊間有傳言曰:“emacs無所不能,甚至能夠用來煮咖啡!”

                煮咖啡何解?勾起了我的考究欲望。

                上網搜索之,得出幾種初步結論如下:

                1.這只是一種好玩的說法,只是用來形容emacs功能無所不包而已。

                2.Java的標志就一杯咖啡,用來形象的表示寫代碼

                      

                3.emacs的確具有煮咖啡的功能,有腳本能夠控制自動咖啡機運行。


                覺得第一種說法比較符合邏輯;第二種說法感覺有點唐突,畢竟Emacs是Richard Stallman(GNU創始人)所寫,而Java是Bill Joy(vi作者)等人完成的,這兩派都差點上升到宗教沖突了,這種解釋有點差強人意;第三種的如果是真的話就會變得很有趣。


                于是就開始了探究,首先追本溯源,找到這段腳本代碼的源頭。發現已經地址已經失效,終于在在debian的一個軟件包里找到了副本這是emacs常用腳本的一個打包。

            代碼如下
              1 ;;; coffee.el --- Submit a BREW request to an RFC2324-compliant coffee device
              2 ;;;
              3 ;;; Author: Eric Marsden <emarsden@laas.fr>
              4 ;;; Version: 0.2
              5 ;;; Copyright: (C) 1999 Eric Marsden
              6 ;;; Keywords: coffee, brew, kitchen-sink, can't
              7 ;;
              8 ;;     This program is free software; you can redistribute it and/or
              9 ;;     modify it under the terms of the GNU General Public License as
             10 ;;     published by the Free Software Foundation; either version 2 of
             11 ;;     the License, or (at your option) any later version.
             12 ;;    
             13 ;;     This program is distributed in the hope that it will be useful,
             14 ;;     but WITHOUT ANY WARRANTY; without even the implied warranty of
             15 ;;     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
             16 ;;     GNU General Public License for more details.
             17 ;;    
             18 ;;     You should have received a copy of the GNU General Public
             19 ;;     License along with this program; if not, write to the Free
             20 ;;     Software Foundation, Inc., 59 Temple Place - Suite 330, Boston,
             21 ;;     MA 02111-1307, USA.
             22 ;;
             23 ;; Please send suggestions and bug reports to <emarsden@laas.fr>.
             24 ;; The latest version of this package should be available at
             25 ;;
             26 ;;     <URL:http://purl.org/net/emarsden/home/downloads/>
             27  
             28 ;;; Commentary:
             29 ;;
             30 ;; This module provides an Emacs interface to RFC2324-compliant coffee
             31 ;; devices (Hyper Text Coffee Pot Control Protocol, or HTCPCP). It
             32 ;; prompts the user for the different additives, then issues a BREW
             33 ;; request to the coffee device.
             34 ;;
             35 ;; coffee.el requires a special BREW-capable version of Emacs/W3 to be
             36 ;; installed.
             37 ;;
             38 ;; Reference: <URL:ftp://ftp.isi.edu/in-notes/rfc2324.txt>
             39 ;;
             40 ;;
             41 ;; Thanks to Giacomo Boffi <giacomo.boffi@polimi.it> for some typos
             42 ;; and the addition of the "Brown-Coffee" sweetener type.
             43  
             44 ;;; Code:
             45  
             46 (require 'cl)
             47  
             48 (defvar coffee-host "coffee"
             49   "*The host which provides the coffee service.")
             50  
             51 (defvar coffee-pot-designator 1
             52   "*On machines with multiple pots, the number of the pot to brew in")
             53  
             54 (defvar coffee-brew-hook nil
             55   "*Hook executed before issuing a BREW request")
             56  
             57 (defconst coffee-milk-types
             58   '("Cream" "Half-and-Half" "Whole-Milk" "Part-Skim" "Skim" "Non-Dairy"))
             59  
             60 (defconst coffee-syrup-types '("Vanilla" "Almond" "Raspberry" "Chocolate"))
             61  
             62 (defconst coffee-sweetener-types '("White-Sugar" "Brown-Sugar" "Artificial-Sweetener"))
             63  
             64 (defconst coffee-alcohol-types '("Whiskey" "Rum" "Kahula" "Aquavit"))
             65  
             66 (defconst coffee-addition-types
             67   `(("Milk"      . ,coffee-milk-types)
             68     ("Syrup"     . ,coffee-syrup-types)
             69     ("Sweetener" . ,coffee-sweetener-types)
             70     ("Alcohol"   . ,coffee-alcohol-types)))
             71  
             72 ;;;###autoload
             73 (defun coffee ()
             74   "Submit a BREW request to an RFC2324-compliant coffee device"
             75   (interactive)
             76   (require 'url)
             77   (let* ((additions-list
             78           (append coffee-milk-types
             79                   coffee-syrup-types
             80                   coffee-sweetener-types
             81                   coffee-alcohol-types))
             82          (additions-string
             83           (mapconcat #'identity additions-list ","))
             84          (url (coffee-url))
             85          (url-request-method "BREW")
             86          (url-request-extra-headers
             87           `(("Content-type"     . "message-coffeepot")
             88             ("Accept-Additions" . ,additions-string)))         
             89          (url-request-data "START"))
             90     (run-hooks 'coffee-brew-hook)
             91     (url-retrieve url)))
             92  
             93 (defun coffee-additions ()
             94   (let* ((type-name
             95           (completing-read "Coffee addition: " coffee-addition-types nil t))
             96          (type (cdr (assoc type-name coffee-addition-types)))
             97          (ingredients (mapcar #'(lambda (a) (cons a a)) type))
             98          (ingredient
             99           (completing-read "Addition type: " ingredients nil t)))
            100     ingredient))
            101           
            102 (defun coffee-url ()
            103   (require 'w3-forms)
            104   (concat "coffee://" coffee-host "/"
            105           (int-to-string coffee-pot-designator)
            106           "?" (w3-form-encode-xwfu (coffee-additions))))
            107  
            108  
            109 (provide 'coffee)
            110  
            111 ;; coffee.el ends here

                這個腳本看起來還是煞有其事的,文中提到"Submit a BREW request to an RFC2324-compliant coffee device"

                能夠向與RFC2324協議兼容的咖啡設備提交BREW請求
            ,即兼容Hyper Text Coffee Pot Control Protocol (HTCPCP/1.0)協議。超文本咖啡壺協議,光看這名字就夠喜慶了,但這份協議寫得很規范,看不出一絲破綻。有細心的朋友shrek.wang提醒了我,注意看日期:

            Network Working Group                                       L. Masinter
            Request for Comments: 2324                                 1 April 1998

                1998年4月1號,愚人節!這個就讓人產生了疑問。
                通過查wiki發現,原來互聯網國際標準機構也是很有才的惡搞高手。

            這里列舉其中幾個好玩的
              • 2001年,RFC 1149由一班挪威Linux使用者協會的成員實現了。他們傳送了9個封包到約5公里外的地方,每個封包由不同的鴿子攜帶,并有一個ICMP應答要求封包(ping)。他們收到4個回應,封包流失率是55%,回應時間是3000至6000秒。[1]
              • RFC 1607 來自21世紀的觀點 Vint Cerf 1994
              • RFC 3091 圓周率數字產生協定 . H. Kennedy 2001年
            更多的可以看這里wiki

              
                 這里可以大膽地作出推斷,這個協議只是 IETF 開的一個善意的joke,而coffee.el的作者Eric Marsden也是一個幽默的程序員,于是就做了一個兼容RFC2324的腳本,他也沒想過要真正的控制咖啡機,所以這整個事情都源于程序員的冷幽默。
                                      
                 然而遠程控制咖啡機還是有可能的,這里有一個開源咖啡機;這里還有一個允許網絡控制的咖啡機(據說還是兼容RFC2324的)。
                 估計IETF應該做夢也沒想到自己開的一個玩笑竟然還真的有人做出了實物。 國外的牛人們還真是閑得蛋疼阿。可見geek們還是極富幽默感的。
            朋友們,你的心中已經有答案了么?你們想要一臺這樣的咖啡機不?







            PS.在這里BS下CPPBLOG的編輯器,真的很爛啊,文章寫到一半時點保存,竟然給發布了!

             Creative commons license

            by XGuru is licensed under a Creative Commons 署名-非商業性使用-相同方式共享 2.5 中國大陸 License.


            posted on 2010-07-27 21:15 XGuru 閱讀(12967) 評論(5)  編輯 收藏 引用

            Feedback

            # re: [趣聞]Emacs是否真的能煮咖啡? 2010-07-27 22:13 besterChen
            呵呵,很佩服LZ的考究能力~
            當初我聽說這個的時候,也很好奇,不過我也就跟 把光驅當做茶杯底座那樣理解的,沒去考究,畢竟它只是個編輯器……  回復  更多評論
              

            # re: [趣聞]Emacs是否真的能煮咖啡? 2012-02-25 22:07 co
            真的佩服LZ的探究能力。很期待一個這樣的咖啡機啊  回復  更多評論
              

            # re: [趣聞]Emacs是否真的能煮咖啡? 2014-02-11 21:10 anopos
            這個編輯器真的很好用么?  回復  更多評論
              

            # re: [趣聞]Emacs是否真的能煮咖啡? 2014-10-03 01:34 青山
            電子專業的做個智能咖啡壺沒問題。。。我是這樣理解的,結果……  回復  更多評論
              

            # re: [趣聞]Emacs是否真的能煮咖啡? 2016-06-30 15:26 Holly
            U R great!  回復  更多評論
              

            久久久久久久尹人综合网亚洲| 久久久一本精品99久久精品88| 精品久久久无码中文字幕| 久久国产精品波多野结衣AV| 亚洲精品国产自在久久| 伊人久久大香线焦AV综合影院 | 久久久91精品国产一区二区三区 | 午夜精品久久久久久99热| 国产产无码乱码精品久久鸭 | 中文字幕亚洲综合久久2| 久久青青色综合| 久久香蕉一级毛片| 久久精品中文字幕一区| 久久精品成人免费国产片小草| 一本一道久久综合狠狠老| 久久精品无码一区二区三区免费| 婷婷伊人久久大香线蕉AV| 人人狠狠综合88综合久久| 亚洲国产精品久久久久婷婷软件 | 日韩一区二区久久久久久| 麻豆av久久av盛宴av| 亚洲国产精品久久久久久| 久久精品国产亚洲AV香蕉| 午夜精品久久久久9999高清| 99久久精品久久久久久清纯| 97精品依人久久久大香线蕉97| 国产女人aaa级久久久级| 久久电影网一区| 国产精品久久久久9999高清| 亚洲精品国产字幕久久不卡| 狠狠色丁香久久婷婷综合| 综合网日日天干夜夜久久| 18禁黄久久久AAA片| 无夜精品久久久久久| 亚洲精品乱码久久久久久蜜桃| 国内精品伊人久久久久网站| 久久精品国产亚洲5555| 久久伊人精品青青草原日本| 久久91这里精品国产2020| 久久一区二区三区99| 人人妻久久人人澡人人爽人人精品|