• <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

            技術(shù),是一種態(tài)度。關(guān)注:高性能后端技術(shù)/服務(wù)器架構(gòu)/C++/C/LAMP

               :: 首頁(yè) :: 聯(lián)系 :: 聚合  :: 管理
              20 Posts :: 0 Stories :: 93 Comments :: 0 Trackbacks

            公告





            twitter / xoXGuru

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

            常用鏈接

            留言簿(12)

            搜索

            •  

            最新評(píng)論

            閱讀排行榜


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









                坊間有傳言曰:“emacs無(wú)所不能,甚至能夠用來(lái)煮咖啡!”

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

                上網(wǎng)搜索之,得出幾種初步結(jié)論如下:

                1.這只是一種好玩的說(shuō)法,只是用來(lái)形容emacs功能無(wú)所不包而已。

                2.Java的標(biāo)志就一杯咖啡,用來(lái)形象的表示寫(xiě)代碼

                      

                3.emacs的確具有煮咖啡的功能,有腳本能夠控制自動(dòng)咖啡機(jī)運(yùn)行。


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


                于是就開(kāi)始了探究,首先追本溯源,找到這段腳本代碼的源頭。發(fā)現(xiàn)已經(jīng)地址已經(jīng)失效,終于在在debian的一個(gè)軟件包里找到了副本這是emacs常用腳本的一個(gè)打包。

            代碼如下
              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

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

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

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

                1998年4月1號(hào),愚人節(jié)!這個(gè)就讓人產(chǎn)生了疑問(wèn)。
                通過(guò)查wiki發(fā)現(xiàn),原來(lái)互聯(lián)網(wǎng)國(guó)際標(biāo)準(zhǔn)機(jī)構(gòu)也是很有才的惡搞高手。

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

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







            PS.在這里BS下CPPBLOG的編輯器,真的很爛啊,文章寫(xiě)到一半時(shí)點(diǎn)保存,竟然給發(fā)布了!

             Creative commons license

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


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

            Feedback

            # re: [趣聞]Emacs是否真的能煮咖啡? 2010-07-27 22:13 besterChen
            呵呵,很佩服LZ的考究能力~
            當(dāng)初我聽(tīng)說(shuō)這個(gè)的時(shí)候,也很好奇,不過(guò)我也就跟 把光驅(qū)當(dāng)做茶杯底座那樣理解的,沒(méi)去考究,畢竟它只是個(gè)編輯器……  回復(fù)  更多評(píng)論
              

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

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

            # re: [趣聞]Emacs是否真的能煮咖啡? 2014-10-03 01:34 青山
            電子專(zhuān)業(yè)的做個(gè)智能咖啡壺沒(méi)問(wèn)題。。。我是這樣理解的,結(jié)果……  回復(fù)  更多評(píng)論
              

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


            只有注冊(cè)用戶登錄后才能發(fā)表評(píng)論。
            網(wǎng)站導(dǎo)航: 博客園   IT新聞   BlogJava   博問(wèn)   Chat2DB   管理


            亚洲成人精品久久| 波多野结衣中文字幕久久| 东京热TOKYO综合久久精品 | 国产精品99久久久久久宅男小说| 色综合久久久久网| 久久精品国产亚洲一区二区| 青草国产精品久久久久久| 亚洲欧美伊人久久综合一区二区| 色综合久久天天综线观看| 国产伊人久久| 人人狠狠综合久久亚洲高清| 日日狠狠久久偷偷色综合0| 无码国内精品久久人妻麻豆按摩| 一本久久综合亚洲鲁鲁五月天| 久久久久久久久久久免费精品| 亚洲中文字幕伊人久久无码| 久久久久精品国产亚洲AV无码| 国内精品久久久久影院薰衣草| 伊人久久大香线蕉综合影院首页| 狠狠色婷婷久久一区二区| 久久精品中文无码资源站 | 久久免费观看视频| 老男人久久青草av高清| 久久久一本精品99久久精品88| 日本精品久久久久中文字幕8| 精品久久久久久无码免费| 一日本道伊人久久综合影| 久久午夜伦鲁片免费无码| 精品无码久久久久久国产| 久久久久亚洲AV无码专区首JN | 99久久精品费精品国产一区二区| 97久久超碰成人精品网站| 久久国产成人| 精品久久久久久无码专区| 久久精品国产亚洲Aⅴ香蕉| 久久热这里只有精品在线观看| 蜜桃麻豆www久久| 伊人久久大香线蕉av不卡| 久久国产免费| 狠狠色丁香婷婷久久综合不卡 | 久久av无码专区亚洲av桃花岛|