<rt id="bn8ez"></rt>
<label id="bn8ez"></label>

  • <span id="bn8ez"></span>

    <label id="bn8ez"><meter id="bn8ez"></meter></label>

    石建 | Fat Mind

    2011年4月4日


    http://incubator.apache.org/kafka/design.html

    1.Why we built this
        asd(activity stream data)數據是任何網站的一部分,反映網站使用情況,如:那些內容被搜索、展示。通常,此部分數據被以log方式記錄在文件,然后定期的整合和分析。od(operation data)是關于機器性能數據,和其它不同途徑整合的操作數據。
        在近幾年,asd和od變成一個網站重要的一部分,更復雜的基礎設施是必須的。
         數據特點:
            a、大吞吐量的不變的ad,對實時計算是一個挑戰,會很容易超過10倍or100倍。
     
            b、傳統的記錄log方式是respectable and scalable方式去支持離線處理,但是延遲太高。
        Kafka is intended to be a single queuing platform that can support both offline and online use cases.

    2.Major Design Elements

    There is a small number of major design decisions that make Kafka different from most other messaging systems:

    1. Kafka is designed for persistent messages as the common case;消息持久
    2. Throughput rather than features are the primary design constraint;吞吐量是第一要求
    3. State about what has been consumed is maintained as part of the consumer not the server;狀態由客戶端維護
    4. Kafka is explicitly distributed. It is assumed that producers, brokers, and consumers are all spread over multiple machines;必須是分布式
    3.Basics
        Messages are the fundamental unit of communication;
        Messages are
     published to a topic by a producer which means they are physically sent to a server acting as a broker,消息被生產者發布到一個topic,意味著物理的發送消息到broker;
        多個consumer訂閱一個topic,則此topic的每個消息都會被分發到每個consumer;
        kafka是分布式:producer、broker、consumer,均可以由集群的多臺機器組成,相互協作 a logic group;
        屬于同一個consumer group的每一個consumer process,每個消息能準確的由其中的一個process消費;A more common case in our own usage is that we have multiple logical consumer groups, each consisting of a cluster of consuming machines that act as a logical whole.
        kafka不管一個topic有多少個consumer,其消息僅會存儲一份。

    4.Message Persistence and Caching

    4.1 Don't fear the filesystem !
        kafka完全依賴文件系統去存儲和cache消息;
        大家通常對磁盤的直覺是'很慢',則使人們對持久化結構,是否能提供有競爭力的性能表示懷疑;實際上,磁盤到底有多慢或多塊,完全取決于如何使用磁盤,a properly designed disk structure can often be as fast as the network.
        http://baike.baidu.com/view/969385.htm raid-5 
        http://www.china001.com/show_hdr.php?xname=PPDDMV0&dname=66IP341&xpos=172 磁盤種類
        磁盤順序讀寫的性能非常高, linear writes on a 6 7200rpm SATA RAID-5 array is about 300MB/sec;These linear reads and writes are the most predictable of all usage patterns, and hence the one detected and optimized best by the operating system using read-ahead and write-behind techniques。順序讀寫是最可預見的模式,因此操作系統通過read-head和write-behind技術去優化。
        現代操作系統,用mem作為disk的cache;Any modern OS will happily divert all free memory to disk caching with little performance penalty when the memory is reclaimed. All disk reads and writes will go through this unified cache. 
        Jvm:a、對象的內存開銷是非常大的,通常是數據存儲的2倍;b、當heap數據增大時,gc代價越來越大;
        As a result of these factors using the filesystem and relying on pagecache is superior to maintaining an in-memory cache or other structure。依賴文件系統和pagecache是優于mem cahce或其它結構的。
        數據壓縮,Doing so will result in a cache of up to 28-30GB on a 32GB machine without GC penalties. 
        This suggests a design which is very simple: maintain as much as possible in-memory and flush to the filesystem only when necessary. 盡可能的維持在內存中,僅當必須時寫回到文件系統.
        當數據被立即寫回到持久化的文件,而未調用flush,其意味著數據僅被寫入到os pagecahe,在后續某個時間由os flush。Then we add a configuration driven flush policy to allow the user of the system to control how often data is flushed to the physical disk (every N messages or every M seconds) to put a bound on the amount of data "at risk" in the event of a hard crash. 提供flush策略。

    4.2 
    Constant Time Suffices
        
    The persistent data structure used in messaging systems metadata is often a BTree. BTrees are the most versatile data structure available, and make it possible to support a wide variety of transactional and non-transactional semantics in the messaging system.
        Disk seeks come at 10 ms a pop, and each disk can do only one seek at a time so parallelism is limited. Hence even a handful of disk seeks leads to very high overhead. 
        Furthermore BTrees require a very sophisticated page or row locking implementation to avoid locking the entire tree on each operation.
    The implementation must pay a fairly high price for row-locking or else effectively serialize all reads.
        持久化消息的元數據通常是BTree結構,但磁盤結構,其代價太大。原因:尋道、避免鎖整棵樹。
        
    Intuitively a persistent queue could be built on simple reads and appends to files as is commonly the case with logging solutions.
        持久化隊列可以構建在讀和append to 文件。所以不支持BTree的一些語義,但其好處是:O(1)消耗,無鎖讀寫。
        
    the performance is completely decoupled from the data size--one server can now take full advantage of a number of cheap, low-rotational speed 1+TB SATA drives. 
    Though they have poor seek performance, these drives often have comparable performance for large reads and writes at 1/3 the price and 3x the capacity.

    4.3 Maximizing Efficiency
        Furthermore we assume each message published is read at least once (and often multiple times), hence we optimize for consumption rather than production. 更進一步,我們假設被發布的消息至少會讀一次,因此優化consumer優先于producer。
        
    There are two common causes of inefficiency :
            two many network requests, (
     APIs are built around a "message set" abstraction,
    This allows network requests to group messages together and amortize the overhead of the network roundtrip rather than sending a single message at a time.) 僅提供批量操作api,則每次網絡開銷是平分在一組消息,而不是單個消息。
        and excessive byte copying.(
    The message log maintained by the broker is itself just a directory of message sets that have been written to disk.
    Maintaining this common format allows optimization of the most important operation : network transfer of persistent log chunks.
        To understand the impact of sendfile, it is important to understand the common data path for transfer of data from file to socket:
    1. The operating system reads data from the disk into pagecache in kernel space
    2. The application reads the data from kernel space into a user-space buffer
    3. The application writes the data back into kernel space into a socket buffer
    4. The operating system copies the data from the socket buffer to the NIC buffer where it is sent over the network
        利用os提供的zero-copy,
    only the final copy to the NIC buffer is needed.

    4.4 End-to-end Batch Compression
        In many cases the bottleneck is actually not CPU but network. This is particularly true for a data pipeline that needs to send messages across data centers.
    Efficient compression requires compressing multiple messages together rather than compressing each message individually. 
    Ideally this would be possible in an end-to-end fashion — that is, data would be compressed prior to sending by the producer and remain compressed on the server, only being decompressed by the eventual consumers. 
        
    A batch of messages can be clumped together compressed and sent to the server in this form. This batch of messages will be delivered all to the same consumer and will remain in compressed form until it arrives there.
        理解:kafka 
    producer api 提供批量壓縮,broker不對此批消息做任何操作,且以壓縮的方式,一起被發送到consumer。

    4.5 Consumer state
        Keeping track of what has been consumed is one of the key things a messaging system must provide. 
    State tracking requires updating a persistent entity and potentially causes random accesses. 
        
    Most messaging systems keep metadata about what messages have been consumed on the broker. That is, as a message is handed out to a consumer, the broker records that fact locally. 大部分消息系統,存儲是否被消費的元信息在broker。則是說,一個消息被分發到一個consumer,broker記錄。
        問題:當consumer消費失敗后,會導致消息丟失;改進:每次consumer消費后,給broker ack,若broker在超時時間未收到ack,則重發此消息。
        問題:1.當消費成功,但未ack時,會導致消費2次  2.
     now the broker must keep multiple states about every single message  3.當broker是多臺機器時,則狀態之間需要同步

    4.5.1 Message delivery semantics
        
    So clearly there are multiple possible message delivery guarantees that could be provided : at most once 、at least once、exactly once。
        
    This problem is heavily studied, and is a variation of the "transaction commit" problem. Algorithms that provide exactly once semantics exist, two- or three-phase commits and Paxos variants being examples, but they come with some drawbacks. They typically require multiple round trips and may have poor guarantees of liveness (they can halt indefinitely). 
        消費分發語義,是 ‘事務提交’ 問題的變種。算法提供 exactly onece 語義,兩階段 or 三階段提交,paxos 均是例子,但它們存在缺點。典型的問題是要求多次round trip,且
    poor guarantees of liveness。
        
    Kafka does two unusual things with respect to metadata. 
    First the stream is partitioned on the brokers into a set of distinct partitions. 
    Within a partition messages are stored in the order in which they arrive at the broker, and will be given out to consumers in that same order. This means that rather than store metadata for each message (marking it as consumed, say), we just need to store the "high water mark" for each combination of consumer, topic, and partition.  
        
    4.5.2 
    Consumer state
        In Kafka, the consumers are responsible for maintaining state information (offset) on what has been consumed. 
    Typically, the Kafka consumer library writes their state data to zookeeper.
        
    This solves a distributed consensus problem, by removing the distributed part!
        
    There is a side benefit of this decision. A consumer can deliberately rewind back to an old offset and re-consume data.

    4.5.3 Push vs. pull
        
    A related question is whether consumers should pull data from brokers or brokers should push data to the subscriber.
    There are pros and cons to both approaches.
        However a push-based system has difficulty dealing with diverse consumers as the broker controls the rate at which data is transferred. push目標是consumer能在最大速率去消費,可不幸的是,當consume速率小于生產速率時,the consumer tends to be overwhelmed。
        
    A pull-based system has the nicer property that the consumer simply falls behind and catches up when it can. This can be mitigated with some kind of backoff protocol by which the consumer can indicate it is overwhelmed, but getting the rate of transfer to fully utilize (but never over-utilize) the consumer is trickier than it seems. Previous attempts at building systems in this fashion led us to go with a more traditional pull model.  不存在push問題,且也保證充分利用consumer能力。

    5. Distribution
        Kafka is built to be run across a cluster of machines as the common case. There is no central "master" node. Brokers are peers to each other and can be added and removed at anytime without any manual configuration changes. Similarly, producers and consumers can be started dynamically at any time. Each broker registers some metadata (e.g., available topics) in Zookeeper. Producers and consumers can use Zookeeper to discover topics and to co-ordinate the production and consumption. The details of producers and consumers will be described below.

    6. Producer

    6.1 Automatic producer load balancing
        Kafka supports client-side load balancing for message producers or use of a dedicated load balancer to balance TCP connections. 
     
        The advantage of using a level-4 load balancer is that each producer only needs a single TCP connection, and no connection to zookeeper is needed. 
    The disadvantage is that the balancing is done at the TCP connection level, and hence it may not be well balanced (if some producers produce many more messages then others, evenly dividing up the connections per broker may not result in evenly dividing up the messages per broker).
        
    Client-side zookeeper-based load balancing solves some of these problems. It allows the producer to dynamically discover new brokers, and balance load on a per-request basis. It allows the producer to partition data according to some key instead of randomly.

        The working of the zookeeper-based load balancing is described below. Zookeeper watchers are registered on the following events—

    • a new broker comes up
    • a broker goes down
    • a new topic is registered
    • a broker gets registered for an existing topic

        Internally, the producer maintains an elastic pool of connections to the brokers, one per broker. This pool is kept updated to establish/maintain connections to all the live brokers, through the zookeeper watcher callbacks. When a producer request for a particular topic comes in, a broker partition is picked by the partitioner (see section on semantic partitioning). The available producer connection is used from the pool to send the data to the selected broker partition.
        producer通過zk,管理與broker的連接。當一個請求,根據partition rule 計算分區,從連接池選擇對應的connection,發送數據。

    6.2 Asynchronous send

        Asynchronous non-blocking operations are fundamental to scaling messaging systems.
        
    This allows buffering of produce requests in a in-memory queue and batch sends that are triggered by a time interval or a pre-configured batch size. 

    6.3 Semantic partitioning
        
    The producer has the capability to be able to semantically map messages to the available kafka nodes and partitions. 
    This allows partitioning the stream of messages with some semantic partition function based on some key in the message to spread them over broker machines. 


    posted @ 2013-07-06 14:57 石建 | Fat Mind 閱讀(1761) | 評論 (0)編輯 收藏

    1.Js代碼,login.js文件

    //用戶的登陸信息寫入cookies
    function SetCookie(form)//兩個參數,一個是cookie的名子,一個是值
    {   
        var name = form.name.value;
        var password = form.password.value;
        var Days = 1; //此 cookie 將被保存 7 天 
        var exp  = new Date(); //生成一個現在的日期,加上保存期限,然后設置cookie的生存期限!
        exp.setTime(exp.getTime() + Days*24*60*60*1000);
        document.cookie = "user="+ escape(name) + "/" + escape(password) + ";expires=" + exp.toGMTString();
    }
    //取cookies函數--正則表達式(不會,學習正則表達式)  
    function getCookie(name)      
    {
        var arr = document.cookie.match(new RegExp("(^| )"+name+"=([^;]*)(;|$)"));
        if(arr != nullreturn unescape(arr[2]); 
        return null;
    }
    //取cookies函數--普通實現      
      function   readCookie(form){   
          var   cookieValue   =   "";   
          var   search   =   "user=";   
          if(document.cookie.length   >   0)     {   
              offset   =   document.cookie.indexOf(search);
              if(offset !=  -1){     
                  offset   +=   search.length;   
                  end   =   document.cookie.indexOf(";",offset);   
                  if   (end  ==  -1)   
                        end   =   document.cookie.length;
                  //獲取cookies里面的值          
                  cookieValue   =   unescape(document.cookie.substring(offset,end))
                  if(cookieValue != null){
                        var str = cookieValue.split("/");
                        form.name.value = str[0];
                        form.password.value = str[1]; 
                  }
              }   
          }    
      }   
    //刪除cookie,(servlet里面:設置時間為0,設置為-1和session的范圍是一樣的),javascript好像是有點區別
    function delCookie()
    {
        var name = "admin";
        var exp = new Date();
        exp.setTime(exp.getTime() - 1);
        var cval=getCookie(name);
        if(cval!=null) document.cookie= name + "="+cval+";expires="+exp.toGMTString();
    }

     

    2.jsp代碼,文件login.jsp

    <%@ page contentType="text/html; charset=gb2312" language="java"
        import="java.sql.*" errorPage=""%>
        
    <html>
        <head>
            <meta http-equiv="Content-Type" content="text/html; charset=gb2312">
            <title>javascript 控制 cookie</title>
            <link href="css/style.css" rel="stylesheet" type="text/css">
            <script type="text/javascript" src="js/login.js"></script>
        </head>
        <script language="javascript">
        function checkEmpty(form){
            for(i=0;i<form.length;i++){
                if(form.elements[i].value==""){
                    alert("表單信息不能為空");
                    return false;
                }
            }
        }
    </script>
        <body onload="readCookie(form)"> <!-- 作為JavaScript控制的cookie-->
            <div align="center">
                <table width="324" height="225" border="0" cellpadding="0" cellspacing="0">
                    <tr height="50">
                        <td ></td>
                    </tr>
                    <tr align="center">
                        <td background="images/back.jpg">
                            <br>
                            <br>
                            登陸
                            <form name="form" method="post" action="" onSubmit="return checkEmpty(form)">
                                <input type="hidden" name="id" value="-1">
                                <table width="268" border="1" cellpadding="0" cellspacing="0">
                                    <tr align="center">
                                        <td width="63" height="30">
                                            用戶名:
                                        </td>
                                        <td width="199">
                                            <input type="text" name="name" id="name">
                                        </td>
                                    </tr>
                                    <tr align="center">
                                        <td height="30">
                                            密碼:
                                        </td>
                                        <td>
                                            <input type="password" name="password" id="password">
                                        </td>
                                    </tr>
                                </table>
                                <br>
                                <input type="submit" value="提交">
                                <input type="checkbox" name="cookie" onclick="SetCookie(form)">記住我          
                            </form>
                        </td>
                    </tr>
                </table>
            </div>
        </body>
    </html>

     


    目的:當你再次打開login.jsp頁面,表單里面的內容已經寫好了,是你上一次的登陸信息!


    問題:1.JavaScript里面取cookie都是寫死的,不是很靈活!
                2.JavaScript的cookie是按照字符串的形式存放的,所以拿出的時候,你要按照你放進去的形式來選擇!
                3.本來是想實現自動登陸的,可我的每個頁面都要session的檢查!一個客戶端,一個服務器端,沒能實現!

     

     

    posted @ 2012-09-09 15:18 石建 | Fat Mind 閱讀(638) | 評論 (0)編輯 收藏
    1.變量類型
      - undefined
      - null
      - string
            - == 與 === 區別
      - number
      - boolean
      - string、number、boolean均有對應的 '對象類'
    2.函數
      - 定義函數
            - function 關鍵字
            - 參數(見例子),arguments
            - 函數內變量聲明,var區別
      - 作用域
            - 鏈式結構(子函數可以看見父函數的變量)
      - 匿名函數
          - 使用場景(非復用場景,如:jsonp回調函數)
          - this特征
    例子:
    var add = function(x) {
        return x++;

    }
    add(1,2,3); // 參數可以隨意多個,類似Java中的(int x ...)

    var fn = function(name, pass) {
        alert(name);
        alert(pass);
    };
    fn("hello","1234",5); // 按照傳遞的順序排列


    var name = "windows";
    var fn = function() {
        var name 
    = "hello";
        alert(
    this.name);
    }
    fn(); // windows,this在匿名函數內部是指向windows范圍

    var name = "windows";
    var fn = function() {
        name 
    = "hello";
        alert(
    this.name);
    }
    fn(); // 因函數內部變量name未聲明為var,則屬于全局變量,且this指向windows,則為'hello'

    function add(a) {
        return ++a;
    }
    var fn = function(x,add){
        return add(x);
    }
    fn(1, add);  // 函數作為參數

    3.閉包  
    http://www.ruanyifeng.com/blog/2009/08/learning_javascript_closures.html 【good】
    其它語言閉包概念 http://www.ibm.com/developerworks/cn/linux/l-cn-closure/

    4.對象
        - new Object()
        – 對象字面量
        – 構造函數
        - 上述操作,經歷的步驟
            –創建新對象
            –將構造方法的作用域賦給新對象(new 操作符)
            –為對象添加屬性, 方法
            –返回該對象

    var obj = new Object();  // new Object方式
    obj.name = 'zhangsan';

    var obj = {                   // 字面常量方式,定義對象
        name : 'zhangsan',
        showName : function (){
            alert(this.name);
        }
    };
    alert(obj.showName());
    function Person(name) { // 構造函數
        this.name = name;
        this.showName = function(){
            return this.name; }
        };
    var obj = new Person("zhangsan"); // 必須用 new 關鍵,否則等于調用一個普通函數
    obj.showName();
    alert(obj.name);


    資料:內部培訓ppt 
    posted @ 2012-05-20 13:50 石建 | Fat Mind 閱讀(263) | 評論 (0)編輯 收藏


    1.句柄就是一個標識符,只要獲得對象的句柄,我們就可以對對象進行任意的操作。

    2.句柄不是指針,操作系統用句柄可以找到一塊內存,這個句柄可能是標識符,mapkey,也可能是指針,看操作系統怎么處理的了。

    fd算是在某種程度上替代句柄吧;

    Linux 有相應機制,但沒有統一的句柄類型,各種類型的系統資源由各自的類型來標識,由各自的接口操作。

    3.http://tech.ddvip.com/2009-06/1244006580122204_11.html

    在操作系統層面上,文件操作也有類似于FILE的一個概念,在Linux里,這叫做文件描述符(File Descriptor),而在Windows里,叫做句柄(Handle)(以下在沒有歧義的時候統稱為句柄)。用戶通過某個函數打開文件以獲得句柄,此 后用戶操縱文件皆通過該句柄進行。

     

    設計這么一個句柄的原因在于句柄可以防止用戶隨意讀寫操作系統內核的文件對象。無論是Linux還是Windows,文件句柄總是和內核的文件對象相關聯的,但如何關聯細節用戶并不可見。內核可以通過句柄來計算出內核里文件對象的地址,但此能力并不對用戶開放。

     

    下面舉一個實際的例子,在Linux中,值為01、2fd分別代表標準輸入、標準輸出和標準錯誤輸出。在程序中打開文件得到的fd3開始增長。 fd具體是什么呢?在內核中,每一個進程都有一個私有的打開文件表,這個表是一個指針數組,每一個元素都指向一個內核的打開文件對象。而fd,就是這 個表的下標。當用戶打開一個文件時,內核會在內部生成一個打開文件對象,并在這個表里找到一個空項,讓這一項指向生成的打開文件對象,并返回這一項的下標 作為fd。由于這個表處于內核,并且用戶無法訪問到,因此用戶即使擁有fd,也無法得到打開文件對象的地址,只能夠通過系統提供的函數來操作。

     

    C語言里,操縱文件的渠道則是FILE結構,不難想象,C語言中的FILE結構必定和fd有一對一的關系,每個FILE結構都會記錄自己唯一對應的fd。


    句柄 
    http://zh.wikipedia.org/wiki/%E5%8F%A5%E6%9F%84

    程序設計 ,句柄是一種特殊的智能指針 。當一個應用程序 要引用其他系統(數據庫、操作系統 )所管理的內存 塊或對象 時,就要使用句柄。

    句柄與普通指針 的區別在于,指針包含的是引用對象 內存地址 ,而句柄則是由系統所管理的引用標識,該標識可以被系統重新定位到一個內存地址 上。這種間接訪問對象 的模式增強了系統對引用對象 的控制。(參見封裝 )。

    在上世紀80年代的操作系統(如Mac OS Windows )的內存管理 中,句柄被廣泛應用。Unix 系統的文件描述符 基本上也屬于句柄。和其它桌面環境 一樣,Windows API 大量使用句柄來標識系統中的對象 ,并建立操作系統與用戶空間 之間的通信渠道。例如,桌面上的一個窗體由一個HWND 類型的句柄來標識。

    如今,內存 容量的增大和虛擬內存 算法使得更簡單的指針 愈加受到青睞,而指向另一指針的那類句柄受到冷淡。盡管如此,許多操作系統 仍然把指向私有對象 的指針以及進程傳遞給客戶端 的內部數組 下標稱為句柄。


     

    posted @ 2012-04-06 14:02 石建 | Fat Mind 閱讀(11889) | 評論 (0)編輯 收藏

    官方 :http://code.google.com/p/powermock/ 

    1. 使用mockito的同學,推薦閱讀如下部分

        - document [必選]
            - getting started
            - motavition
        - mockito extends [必選]
            - mockito 1.8+ useage
        - common
        - tutorial
        - faq [必選]


    2. 附件:實際開發中使用到的
    powermock的一些特性,簡化后的例子(僅為說明powermock api使用)。主要包括

     

    -          修改私有域

    -          私有方法

    -            測試私有方法

    -            Mock

    -            Verify

    -          靜態方法

    -            Mock

    -            拋出異常

    -            Verify

    -          Mock類部分方法

    -          Mock Java core library,如:Thread

    -          Mock 構造器

    /Files/shijian/powermock.rar



    posted @ 2012-03-29 12:39 石建 | Fat Mind 閱讀(902) | 評論 (0)編輯 收藏


    原文地址:
    http://googleresearch.blogspot.com/2012/03/excellent-papers-for-2011.html

     

    Excellent Papers for 2011

    Posted by Corinna Cortes and Alfred Spector, Google Research

    Googlers across the company actively engage with the scientific community by publishing technical papers, contributing open-source packages, working on standards, introducing new APIs and tools, giving talks and presentations, participating in ongoing technical debates, and much more. Our publications offer technical and algorithmic advances, feature aspects we learn as we develop novel products and services, and shed light on some of the technical challenges we face at Google.

     

    谷歌公司積極參與科學界的交流,通過發表技術論文,貢獻開源軟件,制定標準,引入新的API和工具,舉辦講座和演講,參加正在進行的技術辯論,等等。我們發布的文章提供技術和算法的進步,在開發新的產品和服務過程中學習到的內容,揭示一些我們在谷歌所面臨的技術挑戰。

     

    In an effort to highlight some of our work, we periodically select a number of publications to be featured on this blog. We first posted a set of papers on this blog in mid-2010 and subsequently discussed them in more detail in the following blog postings. In a second round, we highlighted new noteworthy papers from the later half of 2010. This time we honor the influential papers authored or co-authored by Googlers covering all of 2011 -- covering roughly 10% of our total publications.  It’s tough choosing, so we may have left out some important papers.  So, do see the publications list to review the complete group.

     

    為了彰顯我們的一些工作,我們定期選擇一些列文章發布在blog。2010中期,我們第一次發布了一些列的文章在blog,并隨后在博客文章中更詳細討論它們。在第二輪中,我們強調從2010年下半年新值得注意的論文。這一次,我們給有影響力的文章的作者或合著者以榮譽,大約占總文章數的10%。這是艱難的選擇的,所以我們可能已經遺漏了一些重要文章。因此,請看完整的文章清單。

     

    In the coming weeks we will be offering a more in-depth look at these publications, but here are some summaries:

     

    在未來幾周我們將更深入的談論這些論文,但現在只做一些總結。

     

    Audio processing

     

    Cascades of two-pole–two-zero asymmetric resonators are good models of peripheral auditory function”, Richard F. Lyon,Journal of the Acoustical Society of America, vol. 130 (2011), pp. 3893-3904.
    Lyon's long title summarizes a result that he has been working toward over many years of modeling sound processing in the inner ear. 
     This nonlinear cochlear model is shown to be "good" with respect to psychophysical data on masking, physiological data on mechanical and neural response, and computational efficiency. These properties derive from the close connection between wave propagation and filter cascades. This filter-cascade model of the ear is used as an efficient sound processor for several machine hearing projects at Google.

     

    聲音處理:這個濾波器級聯模型的耳朵是用來作為一種高效的聲音處理器,是谷歌的幾個機器聲音處理項目之一。

     

    Electronic Commerce and Algorithms

     

    Online Vertex-Weighted Bipartite Matching and Single-bid Budgeted Allocations”, Gagan AggarwalGagan GoelChinmay KarandeAranyak MehtaSODA 2011.
    The authors introduce an elegant and powerful algorithmic technique to the area of online ad allocation and matching: a hybrid of random perturbations and greedy choice to make decisions on the fly. Their technique sheds new light on classic matching algorithms, and can be used, for example, to pick one among a set of relevant ads, without knowing in advance the demand for ad slots on future web page views. 

     

    作者介紹在線廣告分配和匹配方面的優雅和強大的算法技術:一種混合隨機擾動和貪婪選擇,實現在線決定。他們的技術揭示了經典的匹配算法的新的方向,例如,挑選其中一組相關的廣告,事先不知道未來的網站頁面訪問的廣告位置的需求。【關注】

     

    Milgram-routing in social networks”, Silvio Lattanzi, Alessandro Panconesi, D. Sivakumar, Proceedings of the 20th International Conference on World Wide Web, WWW 2011, pp. 725-734.
    Milgram’s "six-degrees-of-separation experiment" and the fascinating small world hypothesis that follows from it, have generated a lot of interesting research in recent years. In this landmark experiment, Milgram showed that people unknown to each other are often connected by surprisingly short chains of acquaintances. In the paper we prove theoretically and experimentally how a recent model of social networks, "Affiliation Networks", offers an explanation to this phenomena and inspires interesting technique for local routing within social networks.

     

    米爾格蘭姆的六個度分離實驗,迷人的小世界遵從它的結果,在最近幾年已經產生了很多有趣的研究。在這一具有里程碑意義的實驗,表明未知的對方往往是通過熟人,以令人驚訝的短鏈連接即可認識。在本文中,我們提供理論和實驗關于近代的社會網絡模型,Affiliation Networks,提供了一種解釋這種現象,并激發社會網絡的interesting technique for local routing。【關注】

     

    Non-Price Equilibria in Markets of Discrete Goods”, Avinatan Hassidim, Haim Kaplan, Yishay Mansour, Noam Nisan, EC, 2011.
    We present a correspondence between markets of indivisible items, and a family of auction based n player games. We show that a market has a price based (Walrasian) equilibrium if and only if the corresponding game has a pure Nash equilibrium. We then turn to markets which do not have a Walrasian equilibrium (which is the interesting case), and study properties of the mixed Nash equilibria of the corresponding games.

     

    在離散商品市場的非價格平衡【關注】

     

    HCI

     

    From Basecamp to Summit: Scaling Field Research Across 9 Locations”, Jens Riegelsberger, Audrey Yang, Konstantin Samoylov, Elizabeth Nunge, Molly Stevens, Patrick Larvie, CHI 2011 Extended Abstracts.
    The paper reports on our experience with a basecamp research hub to coordinate logistics and ongoing real-time analysis with research teams in the field. We also reflect on the implications for the meaning of research in a corporate context, where much of the value may be less in a final report, but more in the curated impressions and memories our colleagues take away from the the research trip.

    User-Defined Motion Gestures for Mobile Interaction”, Jaime Ruiz, Yang Li, Edward Lank, CHI 2011: ACM Conference on Human Factors in Computing Systems, pp. 197-206.
    Modern smartphones contain sophisticated sensors that can detect rich motion gestures — deliberate movements of the device by end-users to invoke commands. However, little is known about best-practices in motion gesture design for the mobile computing paradigm. We systematically studied the design space of motion gestures via a guessability study that elicits end-user motion gestures to invoke commands on a smartphone device. The study revealed consensus among our participants on parameters of movement and on mappings of motion gestures onto commands, by which we developed a taxonomy for motion gestures and compiled an end-user inspired motion gesture set. The work lays the foundation of motion gesture design—a new dimension for mobile interaction.

    Information Retrieval

    Reputation Systems for Open Collaboration”, B.T. Adler, L. de Alfaro, A. Kulshrestra, I. Pye, Communications of the ACM, vol. 54 No. 8 (2011), pp. 81-87.
    This paper describes content based reputation algorithms, that rely on automated content analysis to derive user and content reputation, and their applications for Wikipedia and google Maps. The Wikipedia reputation system WikiTrust relies on a chronological analysis of user contributions to articles, metering positive or negative increments of reputation whenever new contributions are made. The Google Maps system Crowdsensus compares the information provided by users on map business listings and computes both a likely reconstruction of the correct listing and a reputation value for each user. Algorithmic-based user incentives ensure the trustworthiness of evaluations of Wikipedia entries and Google Maps business information.

    Machine Learning and Data Mining

    Domain adaptation in regression”, Corinna CortesMehryar MohriProceedings of The 22nd International Conference on Algorithmic Learning Theory, ALT 2011.
    Domain adaptation is one of the most important and challenging problems in machine learning. 
     This paper presents a series of theoretical guarantees for domain adaptation in regression, gives an adaptation algorithm based on that theory that can be cast as a semi-definite programming problem, derives an efficient solution for that problem by using results from smooth optimization, shows that the solution can scale to relatively large data sets, and reports extensive empirical results demonstrating the benefits of this new adaptation algorithm.

    On the necessity of irrelevant variables”, David P. Helmbold, Philip M. LongICML, 2011
    Relevant variables sometimes do much more good than irrelevant variables do harm, so that it is possible to learn a very accurate classifier using predominantly irrelevant variables. 
     We show that this holds given an assumption that formalizes the intuitive idea that the variables are non-redundant.  For problems like this it can be advantageous to add many additional variables, even if only a small fraction of them are relevant.

    Online Learning in the Manifold of Low-Rank Matrices”, Gal Chechik, Daphna Weinshall, Uri Shalit, Neural Information Processing Systems (NIPS 23), 2011, pp. 2128-2136.
    Learning measures of similarity from examples of similar and dissimilar pairs is a problem that is hard to scale. LORETA uses retractions, an operator from matrix optimization, to learn low-rank similarity matrices efficiently. This allows to learn similarities between objects like images or texts when represented using many more features than possible before.

    Machine Translation

    Training a Parser for Machine Translation Reordering”, Jason Katz-Brown, Slav PetrovRyan McDonaldFranz Och, David Talbot, Hiroshi Ichikawa, Masakazu Seno, Proceedings of the 2011 Conference on Empirical Methods in Natural Language Processing (EMNLP '11).
    Machine translation systems often need to understand the syntactic structure of a sentence to translate it correctly. Traditionally, syntactic parsers are evaluated as standalone systems against reference data created by linguists. Instead, we show how to train a parser to optimize reordering accuracy in a machine translation system, resulting in measurable improvements in translation quality over a more traditionally trained parser.

    Watermarking the Outputs of Structured Prediction with an application in Statistical Machine Translation”, Ashish Venugopal,Jakob Uszkoreit, David Talbot, Franz Och, Juri Ganitkevitch, Proceedings of the 2011 Conference on Empirical Methods in Natural Language Processing (EMNLP).
    We propose a general method to watermark and probabilistically identify the structured results of machine learning algorithms with an application in statistical machine translation. Our approach does not rely on controlling or even knowing the inputs to the algorithm and provides probabilistic guarantees on the ability to identify collections of results from one’s own algorithm, while being robust to limited editing operations.

    Inducing Sentence Structure from Parallel Corpora for Reordering”, John DeNeroJakob UszkoreitProceedings of the 2011 Conference on Empirical Methods in Natural Language Processing (EMNLP).
    Automatically discovering the full range of linguistic rules that govern the correct use of language is an appealing goal, but extremely challenging. 
     Our paper describes a targeted method for discovering only those aspects of linguistic syntax necessary to explain how two different languages differ in their word ordering.  By focusing on word order, we demonstrate an effective and practical application of unsupervised grammar induction that improves a Japanese to English machine translation system.

    Multimedia and Computer Vision

    Kernelized Structural SVM Learning for Supervised Object Segmentation”, Luca BertelliTianli Yu, Diem Vu, Burak Gokturk,Proceedings of IEEE Conference on Computer Vision and Pattern Recognition 2011.
    The paper proposes a principled way for computers to learn how to segment the foreground from the background of an image given a set of training examples. The technology is build upon a specially designed nonlinear segmentation kernel under the recently proposed structured SVM learning framework.

    Auto-Directed Video Stabilization with Robust L1 Optimal Camera Paths”, Matthias GrundmannVivek Kwatra, Irfan Essa,IEEE Conference on Computer Vision and Pattern Recognition (CVPR 2011).
    Casually shot videos captured by handheld or mobile cameras suffer from significant amount of shake. Existing in-camera stabilization methods dampen high-frequency jitter but do not suppress low-frequency movements and bounces, such as those observed in videos captured by a walking person. On the other hand, most professionally shot videos usually consist of carefully designed camera configurations, using specialized equipment such as tripods or camera dollies, and employ ease-in and ease-out for transitions. Our stabilization technique automatically converts casual shaky footage into more pleasant and professional looking videos by mimicking these cinematographic principles. The original, shaky camera path is divided into a set of segments, each approximated by either constant, linear or parabolic motion, using an algorithm based on robust L1 optimization. The stabilizer has been part of the YouTube Editor (youtube.com/editor) since March 2011.

    The Power of Comparative Reasoning”, Jay Yagnik, Dennis Strelow, David Ross, Ruei-Sung Lin, International Conference on Computer Vision (2011).
    The paper describes a theory derived vector space transform that converts vectors into sparse binary vectors such that Euclidean space operations on the sparse binary vectors imply rank space operations in the original vector space. The transform a) does not need any data-driven supervised/unsupervised learning b) can be computed from polynomial expansions of the input space in linear time (in the degree of the polynomial) and c) can be implemented in 10-lines of code. We show competitive results on similarity search and sparse coding (for classification) tasks.

    NLP

    Unsupervised Part-of-Speech Tagging with Bilingual Graph-Based Projections”, Dipanjan Das, Slav PetrovProceedings of the 49th Annual Meeting of the Association for Computational Linguistics (ACL '11), 2011, Best Paper Award.
    We would like to have natural language processing systems for all languages, but obtaining labeled data for all languages and tasks is unrealistic and expensive. We present an approach which leverages existing resources in one language (for example English) to induce part-of-speech taggers for languages without any labeled training data. We use graph-based label propagation for cross-lingual knowledge transfer and use the projected labels as features in a hidden Markov model trained with the Expectation Maximization algorithm.

    Networks

    TCP Fast Open”, Sivasankar Radhakrishnan, Yuchung ChengJerry ChuArvind Jain, Barath Raghavan, Proceedings of the 7th International Conference on emerging Networking EXperiments and Technologies (CoNEXT), 2011.
    TCP Fast Open enables data exchange during TCP’s initial handshake. It decreases application network latency by one full round-trip time, a significant speedup for today's short Web transfers. Our experiments on popular websites show that Fast Open reduces the whole-page load time over 10% on average, and in some cases up to 40%.

    Proportional Rate Reduction for TCP”, Nandita Dukkipati, Matt Mathis, Yuchung Cheng, Monia Ghobadi, Proceedings of the 11th ACM SIGCOMM Conference on Internet Measurement 2011, Berlin, Germany - November 2-4, 2011.
    Packet losses increase latency of Web transfers and negatively impact user experience. Proportional rate reduction (PRR) is designed to recover from losses quickly, smoothly and accurately by pacing out retransmissions across received ACKs during TCP’s fast recovery. Experiments on Google Web and YouTube servers in U.S. and India demonstrate that PRR reduces the TCP latency of connections experiencing losses by 3-10% depending on response size.

    Security and Privacy

    Automated Analysis of Security-Critical JavaScript APIs”, Ankur Taly, Úlfar Erlingsson, John C. Mitchell, Mark S. Miller, Jasvir Nagra, IEEE Symposium on Security & Privacy (SP), 2011.
    As software is increasingly written in high-level, type-safe languages, attackers have fewer means to subvert system fundamentals, and attacks are more likely to exploit errors and vulnerabilities in application-level logic. 
     This paper describes a generic, practical defense against such attacks, which can protect critical application resources even when those resources are partially exposed to attackers via software interfaces. In the context of carefully-crafted fragments of JavaScript, the paper applies formal methods and semantics to prove that these defenses can provide complete, non-circumventable mediation of resource access; the paper also shows how an implementation of the techniques can establish the properties of widely-used software, and find previously-unknown bugs.

    App Isolation: Get the Security of Multiple Browsers with Just One”, Eric Y. Chen, Jason Bau, Charles Reis, Adam Barth, Collin Jackson, 18th ACM Conference on Computer and Communications Security, 2011.
    We find that anecdotal advice to use a separate web browser for sites like your bank is indeed effective at defeating most cross-origin web attacks. 
     We also prove that a single web browser can provide the same key properties, for sites that fit within the compatibility constraints.

    Speech

    Improving the speed of neural networks on CPUs”, Vincent VanhouckeAndrew Senior, Mark Z. Mao, Deep Learning and Unsupervised Feature Learning Workshop, NIPS 2011.
    As deep neural networks become state-of-the-art in real-time machine learning applications such as speech recognition, computational complexity is fast becoming a limiting factor in their adoption. We show how to best leverage modern CPU architectures to significantly speed-up their inference.

    Bayesian Language Model Interpolation for Mobile Speech Input”, Cyril AllauzenMichael RileyInterspeech 2011.
    Voice recognition on the Android platform must contend with many possible target domains - e.g. search, maps, SMS. For each of these, a domain-specific language model was built by linearly interpolating several n-gram LMs from a common set of Google corpora. The current work has found a way to efficiently compute a single n-gram language model with accuracy very close to the domain-specific LMs but with considerably less complexity at recognition time.

    Statistics

    Large-Scale Parallel Statistical Forecasting Computations in R”, Murray Stokely, Farzan Rohani, Eric Tassone, JSM Proceedings, Section on Physical and Engineering Sciences, 2011.
    This paper describes the implementation of a framework for utilizing distributed computational infrastructure from within the R interactive statistical computing environment, with applications to timeseries forecasting. This system is widely used by the statistical analyst community at Google for data analysis on very large data sets.

    Structured Data

    Dremel: Interactive Analysis of Web-Scale Datasets”, Sergey Melnik, Andrey Gubarev, Jing Jing Long, Geoffrey Romer, Shiva Shivakumar, Matt Tolton, Communications of the ACM, vol. 54 (2011), pp. 114-123.
    Dremel is a scalable, interactive ad-hoc query system. By combining multi-level execution trees and columnar data layout, it is capable of running aggregation queries over trillion-row tables in seconds. Besides continued growth internally to Google, Dremel now also backs an increasing number of external customers including BigQuery and UIs such as AdExchange front-end.

    Representative Skylines using Threshold-based Preference Distributions”, Atish Das Sarma, Ashwin Lall, Danupon Nanongkai, Richard J. Lipton, Jim Xu, International Conference on Data Engineering (ICDE), 2011.
    The paper adopts principled approach towards representative skylines and formalizes the problem of displaying k tuples such that the probability that a random user clicks on one of them is maximized. This requires mathematically modeling (a) the likelihood with which a user is interested in a tuple, as well as (b) how one negotiates the lack of knowledge of an explicit set of users. This work presents theoretical and experimental results showing that the suggested algorithm significantly outperforms previously suggested approaches.

    Hyper-local, directions-based ranking of places”, Petros Venetis, Hector Gonzalez, Alon Y. Halevy, Christian S. Jensen,PVLDB, vol. 4(5) (2011), pp. 290-30.
    Click through information is one of the strongest signals we have for ranking web pages. We propose an equivalent signal for raking real world places: The number of times that people ask for precise directions to the address of the place. We show that this signal is competitive in quality with human reviews while being much cheaper to collect, we also show that the signal can be incorporated efficiently into a location search system.

    Systems

    Power Management of Online Data-Intensive Services”, David Meisner, Christopher M. Sadler, Luiz André BarrosoWolf-Dietrich Weber, Thomas F. Wenisch, Proceedings of the 38th ACM International Symposium on Computer Architecture, 2011.
    Compute and data intensive Web services (such as Search) are a notoriously hard target for energy savings techniques. This article characterizes the statistical hardware activity behavior of servers running Web search and discusses the potential opportunities of existing and proposed energy savings techniques.

    The Impact of Memory Subsystem Resource Sharing on Datacenter Applications”, Lingjia Tang, Jason Mars, Neil Vachharajani, Robert Hundt, Mary-Lou Soffa, ISCA, 2011.
    In this work, the authors expose key characteristics of an emerging class of Google-style workloads and show how to enhance system software to take advantage of these characteristics to improve efficiency in data centers. The authors find that across datacenter applications, there is both a sizable benefit and a potential degradation from improperly sharing micro-architectural resources on a single machine (such as on-chip caches and bandwidth to memory). The impact of co-locating threads from multiple applications with diverse memory behavior changes the optimal mapping of thread to cores for each application. By employing an adaptive thread-to-core mapper, the authors improved the performance of the datacenter applications by up to 22% over status quo thread-to-core mapping, achieving performance within 3% of optimal.

    Language-Independent Sandboxing of Just-In-Time Compilation and Self-Modifying Code”, Jason Ansel, Petr Marchenko, Úlfar Erlingsson, Elijah Taylor, Brad Chen, Derek Schuff, David Sehr, Cliff L. Biffle, Bennet S. Yee, ACM SIGPLAN Conference on Programming Language Design and Implementation (PLDI), 2011.
    Since its introduction in the early 90's, Software Fault Isolation, or SFI, has been a static code technique, commonly perceived as incompatible with dynamic libraries, runtime code generation, and other dynamic code. 
     This paper describes how to address this limitation and explains how the SFI techniques in Google Native Client were extended to support modern language implementations based on just-in-time code generation and runtime instrumentation. This work is already deployed in Google Chrome, benefitting millions of users, and was developed over a summer collaboration with three Ph.D. interns; it exemplifies how Research at Google is focused on rapidly bringing significant benefits to our users through groundbreaking technology and real-world products.

    Thialfi: A Client Notification Service for Internet-Scale Applications”, Atul Adya, Gregory Cooper, Daniel MyersMichael Piatek,Proc. 23rd ACM Symposium on Operating Systems Principles (SOSP), 2011, pp. 129-142.
    This paper describes a notification service that scales to hundreds of millions of users, provides sub-second latency in the common case, and guarantees delivery even in the presence of a wide variety of failures. 
     The service has been deployed in several popular Google applications including Chrome, Google Plus, and Contacts.


    翻譯進行中.
     

    posted @ 2012-03-24 11:39 石建 | Fat Mind 閱讀(1080) | 評論 (0)編輯 收藏

    今天開始嘗試clojure,遇到的問題、經驗整理

    1.了解clojure
    http://metaphy.iteye.com/blog/458872

    2.開始HelloWrold
        - 搭建開發環境(對于從Java過來的人,肯定習慣eclipse)
          在線安裝的速度比烏龜還慢,推薦全手動方式安裝插件
        (eclipse手動安裝插件 http://www.tkk7.com/shijian/archive/2012/03/18/372141.html
          離線zip: http://roysong.iteye.com/blog/1260147
        - 跑起來
            - 先'黑窗口'吧 http://clojure.org/getting_started,熱熱身
            - eclipse開發(提醒:必須把clojure-xxx.jar加入classpath)
            - 閱讀 http://www.ibm.com/developerworks/cn/opensource/os-eclipse-clojure/,再練習

    3.如何學習
       http://weiyongqing.iteye.com/blog/1441743
        引 “我就應該一步一步來,先把clojure的doc文檔網站上的core都敲打一遍,然后,學習孫寧的RPC框架,空閑時做4clojure的問題”


    posted @ 2012-03-18 23:33 石建 | Fat Mind 閱讀(1148) | 評論 (0)編輯 收藏

    一、快捷鍵

    1.常用快捷鍵
        a. crtl + h 查找內容
        b. ctrl + shift + r 快速打開資源文件
        c. ctrl + shift + t 快速打開類文件
        d. alt + shift + o  快速打開 '選中相同詞,出現陰影'

    2.如何設置自己特定的快捷鍵
        


    二、插件

    務必閱讀:
        http://wiki.eclipse.org/FAQ_How_do_I_install_new_plug-ins%3F (為什么推薦使用eclipse update manager)
        http://www.venukb.com/2006/08/20/install-eclipse-plugins-the-easy-way/ (主要講解'manual install'安裝 方式)

    1.插件安裝方式
        1.1 在線安裝
              官網wiki寫的很清楚,優勢:1.插件之間依賴管理、版本兼容性管理  2.如同你在Windows安裝軟件一樣,當你不需要的時候可以通過update manage很容易的卸載;當你安裝更多的plguin時,更容易管理。
        eclipse wiki對manual install的看法:This obviously is a more dangerous approach, as no certification takes place about the suitability of the plug-in; it may rely on other plug-ins not available in your installation. In the case of compatibility conflicts, you won’t find out until you use the plug-in that it might break.
            可惜的是,很多時候網絡的情況不是很理想,嘗試很多遍后,依然失敗;這是促使manual install根本的原因。  
        1.2 手動安裝
            a、第一種方式:下載plugin到本地,解壓后復制features、plugin到%eclipse_home%下對應的目錄
            如此圖 http://static.flickr.com/75/219742315_9ee663e2c8_o.png
            優勢:絕對簡單;缺點:正好是通過update manager安裝的優點,插件之間的依賴、版本兼容性,以及后續的管理,都需要手動操作。
            b、第二種方式:通過.link的方式,解決'后續管理問題'
                 b-1、eclipse目錄創建 links 目錄
                 b-2、創建對應的.link文件,如:subversive.link
                 b-3、創建subversive/eclipse/,拷貝features、plugin到此目錄
                 b-4、修改subversive.link文件,如:path=E:/dev/eclipse-t/thrid-plugins/subversive
                 b-5、重啟eclipse(重啟后,發現要使用svn,必須安裝subversive connector;驗證手動安裝的缺點)
             c、提示:
                       - 手動安裝插件時,務必仔細閱讀,此插件的先前條件(否則出問題,很難排查)。
                        如:m2eclipse先決條件
    subeclipse
    、mylyn。
                        或 “Pre-requisite: an Eclipse version including Java Support (e.g. with the JDT : Java Development Tools, as in Eclipse For Java Developers, Eclipse For RCP/RAP developers, Eclipse for JavaEE developers, etc.)” http://code.google.com/p/counterclockwise/wiki/Documentation#Install_Counterclockwise_plugin
                       - 
    eclipse 手動安裝plugin,.link文件的path路徑 必須使用絕對路徑


    總結:對eclipse插件安裝,首先推薦update manager;僅當網絡環境不允許時,安裝失敗時,再嘗試手動安裝。

    2.插件資源收集

    2.1、 m2eclipse插件安裝
        1)先決條件
            a、eclipse3.2或更高版本(可忽略,一般使用的eclipse已經3.5以上 版本)
            b、jdk高于1.4版本;eclipse運行在jdk環境,非jre環境
            c、必須先安裝插件:subeclipse(svn)、mylyn(任務管理); mylyn在eclipse3.5以上版本,已默認存在,無需安裝
            svn插件在線安裝地址(網絡不確定性,更推薦下載zip,archive選擇本地文件安裝)
            http://subclipse.tigris.org/servlets/ProjectProcess;jsessionid=290480ED68C2C7E781DCCE66CE657FC2?pageID=p4wYuA
         2)安裝m2eclipse,未找到可下載到本地的zip,只能在線安裝,地址 http://www.eclipse.org/m2e/download/


    posted @ 2012-03-18 21:10 石建 | Fat Mind 閱讀(758) | 評論 (0)編輯 收藏

    題記:單元測試的過程中,遇到泛型mock的問題;重新溫習一遍,閱讀(core java 泛型)



    xmind格式(可下載) :整理過程中,記錄為xmind格式

    單元測試遇到的問題,簡化后如下:

     1     public List<? extends Date> getDateT() {
     2         return null;
     3     }
     4     public List<Date> getDate() {
     5         return null;
     6     }
     7     public void mockGetDate() {
     8         TestMain main = mock(TestMain.class);
     9         when(main.getDate()).thenReturn(new ArrayList<Date>()); //編譯OK
    10         /*
    11          * The method thenReturn(List<capture#2-of ? extends Date>) in the type 
    12          * OngoingStubbing<List<capture#2-of ? extends Date>>
                     is not applicable for the arguments (ArrayList<Date>)
    13          */
    14         when(main.getDateT()).thenReturn(new ArrayList<Date>()); //編譯錯誤
    15         when(main.getDateT()).thenReturn(new ArrayList<Timestamp>()); //編譯錯誤
    16         when(main.getDateT()).thenReturn(new ArrayList<Object>()); //編譯錯誤
    17         when(main.getDateT()).thenReturn(new ArrayList()); //編譯OK
    18     }

    仍沒理解,哪位大仙,能幫我解釋下 ?
    posted @ 2012-03-08 21:05 石建 | Fat Mind 閱讀(332) | 評論 (0)編輯 收藏

    1.應用 jar 沖突
        log4j沖突導致,應用報錯。類型轉換沖突。
        需求:定位某個類實際從那個jar加載 ? -verbose:class 參數(或者 
    -XX:+TraceClassLoading),詳細的記錄了加載了那些類、從那個jar加載。

    參見:http://agapple.iteye.com/blog/946603

    2.性能測試過程
       linux有什么命令、或軟件,可以同時收集cpu、load、上下文切換、mem、網絡IO、磁盤IO等數據嗎 ?
       vmstat 含義詳解 ? ->  圖形化報表 (痛苦的是要'人工'看著記錄數據,這簡直是程序員的污點呀)
       (vmstat的IO統計的是塊設備(如磁盤)的數據,網卡沒有對應的設備文件(http://oss.org.cn/kernel-book/ch11/11.2.3.htm),網絡IO統計使用iftop) 
       vmstat http://linux.about.com/library/cmd/blcmdl8_vmstat.htm

    3.Jboss啟動錯誤 
    java.sql.SQLException: Table already exists: JMS_MESSAGES in statement [CREATE CACHED TABLE JMS_MESSAGES]
    參見:http://dinghaoliang.blog.163.com/blog/static/126540714201082764733272/
    %jboss_home%/server/default/deploy/hsqldb-ds.xml這個文件中有一個DefaultDS數據源配置,臨時解決刪除hsqldb-ds.xml文件。原因未知。

    4.logback 0.9.19 版本,引入<encoder>,放棄 <appender><layout></appenader>
            <encoder>
                
    <pattern>%m%n</pattern>
                
    <charset class="java.nio.charset.Charset">UTF-8</charset>
            
    </encoder>

    源碼:OutputStreamAppender.java
      protected void writeOut(E event) throws IOException {
        this.encoder.doEncode(event);
      }
    對日志文件charset指定,經過debug調試,必須通過此方式配置才有效。否則取系統默認編碼。

    5.設置linux系統編碼
    http://linux.vbird.org/linux_basic/0320bash.php#variable_locale
    其實‘系統編碼’設置,即設置對應的系統變量,則所有可設置系統變量的文件都可設置編碼,export使其生效
    locale 查看當前用戶使用的編碼(),locale -a 查看機器所支持的所有編碼
    默認設置:
      a、系統級別  /etc/profile -> /etc/sysconfig/i18n,設置 LANG (無效顯示export生效)(YY:i18n有個LANGUAGE設定,不知其含義,刪除無影響)
      b、用戶級別 ~/bash_rc、~/bash_profile、~/bash_login、~/profile,讀取有限順序:從左向右;必須顯示export生效
      
    設定 LANG 或者是 LC_ALL 時,則其他的語系變數就會被這兩個變數所取代??傊痪湓挘涸诋斍坝脩粼O置LANG,是最優方案。

    posted @ 2011-12-15 15:55 石建 | Fat Mind 閱讀(715) | 評論 (0)編輯 收藏

    現象與思路 :

    1.業務變化快,導致需要不斷溝通 ?
        a、開始1、2功能一起,后來拆分開,先上1;再到1功能,各團隊不一致上線  (答:難解,要更有產品意識,幫助產品進行分析)
    2.開發:
        a、原代碼不優雅,總有想重構的沖動 (答:想是白想,一定要有結果)
        b、相互等待,接口定義不明確,如:接口jar無法提供,注釋不明確  (答:時間點&白紙黑字,先溝通再找主管)
        c、聯調準備不充分,如:hsf 因為IP發布失敗,主站頁面配置被修改 (答:前提明確要求,不能有邏輯問題)
    3.上線
        a、涉及面太廣,信息溝通丟失,如:只是暫停審核,演繹成 '停止所有crm操作'  (答:一定要直接周知到所有相關人)
        b、風險點評估的不全面,未全盤考慮,如:simbacall->bp參數對象不一致,是否會導致失敗未聯調 (答:不要遺漏或輕視任何風險點)


    2011.11.18 晚 19:30
    posted @ 2011-11-18 19:39 石建 | Fat Mind 閱讀(173) | 評論 (0)編輯 收藏

    Annotation

     

    題記:建議關于spring問題,請記得查看spring reference。

     

    一、annotation前生后世

    Annotations do not directly affect program semantics, but they do affect the way programs are treated by tools and libraries, which can in turn affect the semantics of the running program. Annotations can be read from source files, class files, or reflectively at run time.

    譯:annotation不會直接影響程序的語義,xxx。Annotation可以從源文件、class文件、通過反射在運行時讀取。

     

    參考:http://www.developer.com/print.php/3556176

    1.       定義

    Annotation type declarations are similar to normal interface declarations. An at-sign (@) precedes the interface keyword. Each method declaration defines an element of the annotation type. Method declarations must not have any parameters or a throws clause. Return types are restricted to primitives, StringClassenums, annotations, and arrays of the preceding types. Methods can have default values.

    Annotation聲明與普通的interface非常相似,在關鍵字interface前加@。每一個方法的聲明定義一個annotation的元素。方法不能有任何的參數或throws異常。返回類型被限制為:原始類型、String、Class、enum、annotation、前面描述的類型組成的數組。method定義允許有默認值。

     

    2.       Java annotation

    There are two types of annotations available with JDK5:

    1) Simple annotations: These are the basic types supplied with Tiger, which you can use to annotate your code only; you cannot use those to create a custom annotation type.

    三個基本的annotation,如:Override、DeprecatedSuppresswarnings,不能使用它去定義新的annotation

    2) Meta annotations: These are the annotation types designed for annotating annotation-type declarations. Simply speaking, these are called the annotations-of-annotations.

    annotation,定義annotation的類型。如:Target、Retention、Documented、Inherited

    A.      Target:聲明annotation注解的目標類型。如@Target(ElementType.TYPE)@Target(ElementType.METHOD)

    B.      Retention:聲明annotation被保留的長度。如:RetentionPolicy.SOURCE、RetentionPolicy.CLASSRetentionPolicy.RUNTIME

    C.      Documented:聲明被注解的target生成doc是否需要顯示annotation信息。

    D.      Inheritedxxx

     

    3.       annotation作用

    a. 不影響程序原本語義的情況下,增加信息+工具=聲明式編程。如:spring aop

    b. 編譯檢查 ?

     

     

    二、利用annotation實現aop

    1. 思路

    A.自定義注解定義規則(何時執行)

    B.標記行為(執行什么)

    C.通過反射生成代理,在對象執行任何方法時,進行攔截判斷是否符合規則;若符合,執行對應的行為。

    2. 例子

    場景:一個表演家,表演節目后,觀眾拍手鼓掌

    原始:表演家擁有所有觀眾的引用,在自己表演完后,通知觀眾鼓掌

    問題:表演家應該關注表演自身的事情,有哪些觀眾、觀眾是否鼓掌,不是其所關注的

    改進:AOP方式,表演家僅關注表演,觀眾鼓掌由其它人負責

    總結:

    面向切面編程 (AOP) 提供從另一個角度來考慮程序結構以完善面向對象編程(OOP)。 面向對象將應用程序分解成各個層次的對象,而AOP將程序分解成各個切面或者說關注點。這使得可以模塊化諸如事務管理等這些橫切多個對象的關注點。

     

    三、spring aop如何使用annotation

    1. 基本方式,通過ProxyFactoryBean

    a.通知

    b.切入點

    b.通知+切入點 à 切面

    c.實際對象+接口+切面 à 接口代理()

    2. 自動代理方式:

    基本方式的問題是,xml配置文件繁瑣。

    1)基于spring上下文的通知者Bean的自動代理(利用PostBeanProcessor ?)

    BeanNameAutoProxyCreator,有屬性:beanNames(被代理對象)、interceptorNames(通知)。自動代理beanNames指定的bean,此時interceptorNames指定通知,但interceptor需要實現特定的接口,如:MethodBeforeAdvice。

    2) 基于aspectJ注解驅動

    使用aspectJ風格的注解。原理:生成代理,僅方法級別。使用AspectJ 提供的一個庫來做切點(pointcut)解析和匹配。

    4.       <aop:config>,優點:任何類都能轉化為切面,不需要特殊接口或注解,原始pojo對象

    5.       aop參數傳遞,見:spring reference 6.3.3.6 通知參數

    a. around切點,必須傳遞ProceedingJoinPoint參數,通過ProceedingJoinPoint取得方法的所有信息。

    b. 其它切點,利用JoinPoint取得方法的所有參數。

    c. 通過參數名綁定傳遞參數,未理解。

     

     

    四、annotation相關技術

    1. cglib

    它的原理就是用Enhancer生成一個原有類的子類,并且設置好callbackproxy, 則原有類的每個方法調用都會轉為調用實現了MethodInterceptor接口的proxyintercept() 函數。

    2.  asm

    ASM is an all purpose Java bytecode manipulation and analysis framework. It can be used to modify existing classes or dynamically generate classes, directly in binary form. Provided common transformations and analysis algorithms allow to easily assemble custom complex transformations and code analysis tools.

    ASM offer similar functionality as other bytecode frameworks, but it is focused on simplicity of use and performance. 

    簡單理解asm是比cglib更高級的code generate lib

     

    五、others問題

    1. Generics 

    Generics - This long-awaited enhancement to the type system allows a type or method to operate on objects of various types while providing compile-time type safety. It adds compile-time type safety to the Collections Framework and eliminates the drudgery of casting. See theGenerics Tutorial. (JSR 14)

    泛型提供了編譯時類型檢查安全。這點很重要嗎 ?

     

    2. 為什么spring aop aspectJ anonotationpointcut聲明,必須注解在方法上 ?通過方法唯一標識一個pointcut ?

    猜測:@PointcutTarget屬性指定僅為method。方法簽名成為pointcutid。

      

     

    posted @ 2011-06-25 20:09 石建 | Fat Mind 閱讀(332) | 評論 (0)編輯 收藏
    參照:http://www.quora.com/What-are-some-interesting-and-innovative-startups-in-China

    2011年的中國互聯網還有什新奇的事發生嗎 ?

    1.團購:美團、拉手等(燒錢階段,搶用戶、流量,用戶體驗必須提升,如:退款等服務;預測:再有1年時間,團購巨頭就會形成)
    2.在線租書 : booksfly(有創意,但目前的運營方式很難有大的成長)
    3.圖片搜索 : taotaosou (有創意和前途,目前:用戶體驗差、效果差)

    4.微?。盒吕恕Ⅱv訊(蒸蒸日上,新浪占據主導地位)
    5.垂直化社交網站:Mtime、果殼(新方向,垂直化的社交會去慢慢蠶食)
    6.rss服務:鮮果(無自己特點)

    7.網頁游戲 : 忍者村、三國殺(賺錢的行業,但游戲生命周期短的特點值得考慮)
    8.在線音樂 : 豆瓣電臺、酷狗(推崇豆瓣的簡約,做到了極致)

    9.在線存儲 : 微盤、DBBank

    10.手機應用:豌豆莢、VivaMe(閱讀器\傳媒)、街旁(lbs)
    11.UC樂園(UC社交平臺,盡管UCWeb是入口,有著先天優勢)



     PS:以下純屬個人YY,隨手記錄

    1.親子、育兒教育社區 + 電商,如何做 ?淘寶http://t.cn/blAkG 全是tms靜態頁面[囧] 專業親子網站排名 http://t.cn/SwZSXr


    posted @ 2011-04-16 13:08 石建 | Fat Mind 閱讀(197) | 評論 (0)編輯 收藏

    主要參考:構建高性能web站點


    一、網卡

    網卡使用一個特定的物理層數據鏈路層標準,例如以太網來實現通訊所需要的電路系統。這為一個完整的網絡協議棧提供了基礎,使得在同一局域網中的小型計算機組以及通過路由協議連接的廣域網,例如IP,都能夠進行通訊。

    1.       作用:

    a)         唯一的mac地址,定位機器(局域網/以太網mac尋址)

    b)        數據接收和發送。擁有物理緩存區。

                             i.              接收:接收物理層數據,通過DMA方式訪問內存。

                           ii.              發送:接收上層數據,分解為適當大小的數據包發送。

    轉載:

    數據的封裝與解封:發送時將上一層交下來的數據加上首部和尾部,成為以太網的幀。接收時將以太網的幀剝去首部和尾部,然后送交上一層。
    鏈路管理:主要是CSMA/CDCarrier Sense Multiple Access with Collision Detection ,帶沖突檢測的載波監聽多路訪問)協議的實現。
    編碼與譯碼:即曼徹斯特編碼與譯碼。

    2. 協議

    以太網Ethernet)是一種計算機局域網組網技術。

    ARP協議Address Resolution Protocol),或稱地址解析協議。ARP協議的基本功能就是通過目標設備的IP地址,查詢目標設備的MAC地址。

    http://zh.wikipedia.org/zh/%E5%9C%B0%E5%9D%80%E8%A7%A3%E6%9E%90%E5%8D%8F%E8%AE%AE

    3. 傳輸速率

    網卡速率是指網卡每秒鐘接收或發送數據的能力,單位是Mbps(兆位/秒)由于存在多種規范的以太網,所以網卡也存在多種傳輸速率,以適應它所兼容的以太網。目前網卡在標準以太網中速度為10Mbps,在快速以太網中速度為100Mbps,在千兆以太網中速度為1000Mbps等。

    主流的網卡主要有10Mbps網卡、100Mbps以太網卡、10Mbps/100Mbps自適應網卡、1000Mbps千兆以太網卡以及最新出現的萬兆網卡五種。對于一般家庭用戶選購10M或者10Mbps/100Mbps自適應網卡即可,對于企業用戶建議購買100Mbps以太網卡或者1000Mbps千兆以太網卡或者萬兆網卡。

    以太網卡和交換設備都支持多速率,設備之間通過自動協商設置最佳的連接速度和雙工方式。如果協商失敗,多速率設備就會探測另一方使用的速率但是默認為半雙工方式。10/100以太網端口支持10BASE-T100BASE-TX。

    2.       特點

    a)         全雙工

    b)        傳輸速率

    c)        總線類型:PCI總線架構日益成為網卡的首選總線

    d)        MAC地址

    二、數據如何發送

    1.       將數據寫入用戶進程的內存地址空間,其實實際的開發過程只需對運行時變量賦值即可

    2.       應用程度調用系統函數,將數據從用戶態內存區復制到由內核維護的一段稱為內核緩沖區的內存地址空間。

    a)         內核緩存區大小有限,要發送的數據以隊列的形式進入

    b)        每次復制一定的數據大小,這個大小取決于網絡數據包的大小以及內核緩存區的承載能力

    3.       當數據寫入內核緩存區,內核會通知網卡控制器來讀取數據,cpu轉而處理其它任務

    a)         網卡將發送的數據從內核緩存區復制到網卡緩存區

    b)        數據的復制始終按照內部總線的寬度復制(如32位總線,每次復制32bit信息)

    4.       網卡發送數據到物理線路

    a)         需要對數據進行字節到位的轉換(即將數據按照位的順序發出)

    b)        網卡內部使用特定的物理裝置,來生成可以傳播的各種信息,如銅線,網卡會根據位信息“0/1的變化產生不同的電信號;光線,網卡會生成光信號。

    三、電磁波速度

           不管是電信號,還是光信號,進入物理介質后,其傳輸速度僅依賴其傳播介質,銅線中電信號的傳輸速度大約2.3*108m/s,光纖中光信號的傳播速度大約是2.0*108m/s。光在真空中的傳播速度是3.0*108m/s,為什么光纖中的傳播速度要慢呢 ?因為光在光纖中的傳播利用全反射原理,所以傳播距離要大于光纖長度。

           由此看見,不同的傳播介質中信號的傳播速度幾乎是常量。也就是說,不論數據發送裝置以多快的發送速度讓數據以信號的形式進入路線,在線路中信號的傳播速度幾乎可以認為是一樣快的。

           光纖與銅線相比?光纖采用全反射原理,因此光信號衰減底,因此傳播距離遠。

    四、帶寬概念

           從上面分析來看,數據的傳輸包括:發送端發送數據進入線路 + 線路傳輸,線路傳輸的速度在各種傳輸介質幾乎是相同的。

           帶寬定義:每秒傳播bit數,bit/s。

           這樣看,影響帶寬的因素僅為“發送端發送數據進入線路”,如何提升:a、提升發送速度 b、數據傳輸的并行度

    1.       發送速度

    數據發送裝置將二進制信號傳送至線路的能力。關鍵是,如果接收能力跟不上,發送能力不可能提高。原理:接收速度決定發送速度。

           也就是“流控機制”,保證接收方能夠接收數據,不會丟失數據。如Tcp滑動窗口(滑動窗口協議的基本原理,任意時刻發送方、接收方都保持一個連續的允許發送、接收的幀的序號http://blog.csdn.net/yujun00/archive/2006/03/23/636495.aspx)。

    2.    并行度,等價于計算機總線的概念。比如:32位,任意同一時刻能傳輸32位數據。

    總結:顯然,網卡影響性能結果。

     

    posted @ 2011-04-04 00:17 石建 | Fat Mind 閱讀(342) | 評論 (0)編輯 收藏

    導航

    <2011年4月>
    272829303112
    3456789
    10111213141516
    17181920212223
    24252627282930
    1234567

    統計

    常用鏈接

    留言簿

    隨筆分類

    隨筆檔案

    搜索

    最新評論

    What 、How、Why,從細節中尋找不斷的成長點
    主站蜘蛛池模板: 亚洲av中文无码字幕色不卡| 亚洲成?Ⅴ人在线观看无码| 中文字幕手机在线免费看电影| 亚洲国产精品网站在线播放| 韩国免费A级毛片久久| 国产免费AV片在线播放唯爱网| 95免费观看体验区视频| 久9热免费精品视频在线观看| 中文在线观看免费网站| 免免费国产AAAAA片| 西西大胆无码视频免费| 中文字幕专区在线亚洲| 亚洲乳大丰满中文字幕| 亚洲日产无码中文字幕| 亚洲香蕉在线观看| 涩涩色中文综合亚洲| 国产亚洲欧美日韩亚洲中文色| 亚洲精品无码专区| 乱人伦中文视频在线观看免费| 亚洲av无码一区二区三区天堂古代| 亚洲三级高清免费| 国产在线精品观看免费观看| 国产免费阿v精品视频网址| 久久免费视频精品| 免费无码A片一区二三区| 全部免费国产潢色一级| 四虎在线播放免费永久视频| 亚洲美女一区二区三区| 亚洲AV成人一区二区三区在线看| a级毛片在线免费观看| 免费又黄又硬又爽大片| 区久久AAA片69亚洲| 亚洲色成人网一二三区| 久久99精品免费一区二区| 成人在线免费看片| 在线免费视频一区| 亚洲国产精品成人| 亚洲欧美国产国产一区二区三区| 日本免费一区二区三区四区五六区| 毛片a级三毛片免费播放| 国产精品V亚洲精品V日韩精品|