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

            2010年9月7日

            2010年8月19日

            some  material

            http://blog.chinaunix.net/u/4206/showart_721067.html

            http://blog.csdn.net/wushihua/archive/2010/07/02/5709359.aspx

            linux 下:
            0. bash
            1. 用戶任意設置“工作時間”,“休息時間”。目前考慮使用命令行參數 done
            2. 動態獲取“設備號”,在不同的機子上用可不需修改 (no so urgent)
            *3. 時間顯示
            改進:
            1.1 如果休息起來五分鐘(默認休息時間)才回來,只剩下不多的工作時間,才做一會兒又要中斷。
            最好是在鎖定鍵鼠五分鐘后,在用戶回來電腦時才開始讓工作時間計時。
            考慮方案一:
            等待用戶輸入后才(解除鼠標鎖定)開始進入下一輪工作計時(done)
            較高級的方案:
            休息時間結束后,捕捉到鍵盤或者鼠標動作才開始下一輪工作計時。
            1.2 工作時間離開電腦,進入休息時間計時。若一定時間鍵鼠都沒反應。
            (done, 獲取鍵盤鼠標的空閑,若比休息時間還長,進入新一輪的工作)

            2. kill sleep后,可能鍵盤永遠鎖住。 解決關閉該程序的善后工作。(done , use signal)
            鎖住鼠標,不鎖住鍵盤,在鎖住鼠標時,Ctrl-C,結束程序,但鼠標沒有解鎖。

            備注:
            1. 是否鎖定鍵盤得明確,考慮是否對兩需求推出不同方案。暫考慮只鎖鍵盤


            some note:
            1.
            操作/dev/input/event*文件,向它寫入個input_event結構體就可以模擬按鍵的輸入
            哪個event文件可通過cat /proc/bus/input/devices 查看。
            N: Name="AT Translated Set 2 keyboard"
            H: Handlers=kbd event3

            N: Name="Logitech USB Optical Mouse"
            H: Handlers=mouse1 event4
            2.
            Essentially keyboard and mouse idle time can be
            gleaned (indirectly) from certain lines of the /proc/interrupts file. It
            seems this file contains a counter for each device
            http://software.itags.org/linux-unix/330299/

            Sense mouse and keyboard inactivity final solution:
            /*
            This is a test example.
            Ref:
            http://coderrr.wordpress.com/2008/04/20/getting-idle-time-in-unix/

            gcc -o idle idle_xscr2.c -lXss
            */
            #include <stdio.h>
            #include <X11/extensions/scrnsaver.h>
            #include <unistd.h>
                 
            int main()
            {
                  XScreenSaverInfo *info = XScreenSaverAllocInfo();
                Display *display = XOpenDisplay(0);
               
                int i=1;
            for(;i<5; i++){
                sleep(3);     
                XScreenSaverQueryInfo(display, DefaultRootWindow(display), info);
                printf("%ld ms\n", info->idle);
            }
                return 0;
            }


            編譯:
            voide@fit:~/bash$ gcc lock.c -o lock -lXss
            lock.c:24:38: error: X11/extensions/scrnsaver.h: No such file or directory
            lock.c: In function ‘main’:
            lock.c:41: error: ‘XScreenSaverInfo’ undeclared (first use in this function)
            lock.c:41: error: (Each undeclared identifier is reported only once
            lock.c:41: error: for each function it appears in.)
            lock.c:41: error: ‘info’ undeclared (first use in this function)
            lock.c:42: error: ‘Display’ undeclared (first use in this function)
            lock.c:42: error: ‘display’ undeclared (first use in this function)
            root@fit:/home/voide/bash# apt-get install libxss-dev
            root@fit:/home/voide/bash# gcc lock.c -o lock -lXss
            root@fit:/home/voide/bash# ./lock  1800 300   /* 1800s 300s*/
            Use a short time for debug
            sh: ./unlock.sh: Permission denied
            root@fit:/home/voide/bash# chmod +x *.sh

            posted @ 2010-08-19 10:52 Voider 閱讀(354) | 評論 (0)編輯 收藏

            2009年10月30日

            http://www.cplusplus.com/reference/stl/deque/
            Deque sequences have the following properties:
            • Individual elements can be accessed by their position index.
            • Iteration over the elements can be performed in any order.
            • Elements can be efficiently added and removed from any of its ends (either the beginning or the end of the sequence)


            On the drawback side, unlike vectors, deques are not guaranteed to have all its elements in contiguous連續的 storage locations, eliminating排除 thus the possibility of safe access through pointer arithmetics.
            For operations that involve frequent insertion or removals of elements at positions other than the beginning or the end, deques perform worse and have less consistent iterators and references than lists.
            posted @ 2009-10-30 14:45 Voider 閱讀(197) | 評論 (0)編輯 收藏
             

            C++ 運算符優先級列表

            http://www.cppreference.com/operator_precedence.html
            http://www.shnenglu.com/aqazero/archive/2006/06/08/8284.html
            Precedence Operator Description Example Associativity
            1 ()
            []
            ->
            .
            ::
            ++
            --
            Grouping operator
            Array access
            Member access from a pointer
            Member access from an object
            Scoping operator
            Post-increment
            Post-decrement
            (a + b) / 4;
            array[4] = 2;
            ptr->age = 34;
            obj.age = 34;
            Class::age = 2;
            for( i = 0; i < 10; i++ ) ...
            for( i = 10; i > 0; i-- ) ...
            left to right
            2 !
            ~
            ++
            --
            -
            +
            *
            &
            (type)
            sizeof
            Logical negation
            Bitwise complement
            Pre-increment
            Pre-decrement
            Unary minus
            Unary plus
            Dereference
            Address of
            Cast to a given type
            Return size in bytes
            if( !done ) ...
            flags = ~flags;
            for( i = 0; i < 10; ++i ) ...
            for( i = 10; i > 0; --i ) ...
            int i = -1;
            int i = +1;
            data = *ptr;
            address = &obj;
            int i = (int) floatNum;
            int size = sizeof(floatNum);
            right to left
            3 ->*
            .*
            Member pointer selector
            Member pointer selector
            ptr->*var = 24;
            obj.*var = 24;
            left to right
            4 *
            /
            %
            Multiplication
            Division
            Modulus
            int i = 2 * 4;
            float f = 10 / 3;
            int rem = 4 % 3;
            left to right
            5 +
            -
            Addition
            Subtraction
            int i = 2 + 3;
            int i = 5 - 1;
            left to right
            6 <<
            >>
            Bitwise shift left
            Bitwise shift right
            int flags = 33 << 1;
            int flags = 33 >> 1;
            left to right
            7 <
            <=
            >
            >=
            Comparison less-than
            Comparison less-than-or-equal-to
            Comparison greater-than
            Comparison geater-than-or-equal-to
            if( i < 42 ) ...
            if( i <= 42 ) ...
            if( i > 42 ) ...
            if( i >= 42 ) ...
            left to right
            8 ==
            !=
            Comparison equal-to
            Comparison not-equal-to
            if( i == 42 ) ...
            if( i != 42 ) ...
            left to right
            9 & Bitwise AND flags = flags & 42; left to right
            10 ^ Bitwise exclusive OR flags = flags ^ 42; left to right
            11 | Bitwise inclusive (normal) OR flags = flags | 42; left to right
            12 && Logical AND if( conditionA && conditionB ) ... left to right
            13 || Logical OR if( conditionA || conditionB ) ... left to right
            14 ? : Ternary conditional (if-then-else) int i = (a > b) ? a : b; right to left
            15 =
            +=
            -=
            *=
            /=
            %=
            &=
            ^=
            |=
            <<=
            >>=
            Assignment operator
            Increment and assign
            Decrement and assign
            Multiply and assign
            Divide and assign
            Modulo and assign
            Bitwise AND and assign
            Bitwise exclusive OR and assign
            Bitwise inclusive (normal) OR and assign
            Bitwise shift left and assign
            Bitwise shift right and assign
            int a = b;
            a += 3;
            b -= 4;
            a *= 5;
            a /= 2;
            a %= 3;
            flags &= new_flags;
            flags ^= new_flags;
            flags |= new_flags;
            flags <<= 2;
            flags >>= 2;
            right to left
            16 , Sequential evaluation operator for( i = 0, j = 0; i < 10; i++, j++ ) ... left to right
            posted @ 2009-10-30 10:31 Voider 閱讀(193) | 評論 (0)編輯 收藏

            2009年8月19日

              轉:http://www.shnenglu.com/benbendy/archive/2008/05/23/50830.html    

              轉:  http://hi.baidu.com/gwabit/blog/item/7a188726f2dc91178a82a1b6.html


             C++/OPP/OOD系列:

            層級一:語法/語意(C++)
            1.1 [Lippman2000] Essential C++
                              Essential C++,by Stanley B. Lippman Addison Wesley Longman 
                              2000,276 pages
                              Essential C++ 中文版 ,侯俊杰 譯,282頁  

            1.2 [Gregory95] C++:The Core Language 
                              C++:The Core Language by Gregory Satir 1995 O'Reilly
                              C++語言核心,張銘澤 譯 ,236頁

            1.3 [Deitel98] The Complete C++ Training Course 
                              The Complete C++ Training Course 2/e by Harvey M.Deitel 1998 
                              Prentice Hall
                              C++大學教程(第二版),邱仲潘等 譯,816頁

            1.4 [Stevens2000] Standard C++ Bible
                              Standard C++ Bible   2000  Al Stevens   IDG 
                              標準C++寶典,林麗閩等 譯,766頁

            1.5 [Eckel2000] Thinking in C++ 
                              Thinking in C++ 2/e   Bruce Eckel  2000 1470 pages Prentice 
                              Hall
                              C++ 編程思想,劉宗田等 譯,420頁

            1.6 [Lippman98] C++Primer 
                              C++ Primer,3rd Editoin,by Stanley Lippman and Josee Lajoie 
                              Addison Wesley Longman,1998 1237 pages
                              C++ Primer 中文版,侯俊杰 譯,1999,1237頁

            1.7 [Struostrup2000] The C++ Programming Language
                              The C++ Programming Language,Special Editoin,by Bjarne 
                              Stroustrup
                              Addison Wesley Longman,2000,1017 pages
                              C++程序語言經典本,葉秉哲 譯,儒林 1999

            1.7 [ANSI C++] C++規格書 1998.9.1 PDF格式
                              ANSI C++ 1996 Draft


            層級二:專家經驗(C++/OOP)
            2.1 [Meyers96] More Effective C++
                              More Effective C++,by Scott Meyers,Addison Wesley,1996,318pages
                              More Effective C++中文版,侯俊杰,培生 2000. 318頁

            2.2 [Meyers98] Effective C++ 
                              Effective C++,Second Edition,by Scott Meyers,Addison Wesley 
                              Longman,1998.256pages
                              Effective C++ 2/e 中文版,侯俊杰,培生 2000.256頁

            2.3 [Sutter99] Exceptional C++
                              Exceptional C++,by Herb Sutter,Addison Wesley 
                              Longman,2000.208pages
                              Exceptional C++中文版,侯俊杰,培生 2000.248頁

            2.4 [Sutter2001]More Exceptional C++ 
                              More Exceptional C++ by Herb Sutter,Addison Wesley 
                              Longman,2001.

            層級三:底層機制(C++ Object Model)

            3.1  [Ellis90] The Annotated C++ Reference Manual
                              The Annotated C++ Reference Manual,by Margaret A.Ellis and 
                              Bjarne Stroustrup 
                              Addison Wesley Longman,1990,447 pages.

            3.2  [Lippman96] Inside the C++ Object Model
                              Inside the C++ Object Model,by Stanley Lippman,Addison Wesley 
                              Longman,1996,280pages
                              深度探索C++物件模型,侯俊杰 譯                   

             層級四:設計觀念的復用(C++/Patterns)
             

            4.1  [Gamma95] Design Patterns:Elements of Reusable Object Oriented 
                              Software,
                              by Erich Gamma,Richard Helm,Ralph Johnson,and John 
                              Vlissides,Addison Wesley,1995.395pages
                              設計模式,李英軍等譯,機械工業出版社,2000.254頁

            4.2   [Alex2001]Modern C++ Design: Generic Programming and Design 
                              Patterns Applied
                              by Andrei Alexandrescu,Addison-Wesley,2001,352Paper


             Genericity/STL系列:

             第一個境界是使用STL:
              [Josuttis99]:The C++ Standard Library -A Tutorial and 
                              Reference,by Nicolai M.Josuttis,
                              Addison Wesley 1999.799pages

              第二個境界是了解泛型技術的內涵與STL的學理:
               [Austern98]:Generic Programming and the STL -Using and 
                              Extending the C++ Standard 
                              Template library,by Matthew H.Austern,Addison Wesley 
                              1998.548page


              第三個境界是擴充STL:
               [Stepanov2001]:C++ Standard Template Library by 
                              P.J.Plauger,Alexander A.Stepanov,
                              Meng Lee,David R.Musser,Prentice Hall 2001 

              這些就是你應該看的書,如果你想成為高手。

            posted @ 2009-08-19 09:55 Voider 閱讀(362) | 評論 (0)編輯 收藏

            2008年9月7日

            作者risc700
            1, 簡歷上寫著了解c++, 實際上不知道mfc 根 VC有什么區別. 0級
            2, 簡歷上寫著精通c++, 但是僅僅知道mfc, 認為VC就是C++的一切。 1級
            3, 總是使用malloc,或者 char[100] 來獲得內存,但不知道怎么在指定內存上面創建對象。 2級
            4, 感覺std::string 沒有 CString 好用! 聽說過g++ 3級
            5, 會使用std::string, 認為 "c/c++" 很不科學,完全就不是一個語言嘛. 知道4種以上c++ compiler. 感覺自己什么都會。 4級
            6, 看山是山,看水是水。崇拜boost source code, 嘔心瀝血的研究經典庫的代碼. 感覺自己什么都不會。5級
            7, 看山不是山,看水不是水。為自己鐘情的函數庫而奮斗著,恨不得用盡各種tricks 和 traits, 因為各種經典設計模式想得頭疼. 稍有走火入魔跡象。 6級
            8,看山仍然山,看水仍然是水。 看到每行代碼,都是匯編的指令和內存數據的移動。 代碼中幾乎不出現for 和 while 關鍵字. 不停地否定自己的過去. 7級
            9, 維護著g++,或者Watcom C++ 之類的項目,頭發也比較長,有藝術家氣質. 8級
            10, 參與 C++ Standards Committee, 代表不同的利益集團發言. 9級
            11, 徹底走火入魔, 成天幻想修改C++的語法, 添加自己的關鍵字, 重新實現一個C++的改進, 還想把c++變成腳本,解釋執行.已經超越了利益. 10級.

            C++的四層境界


            1。程序員。
            有時被稱為藍領,在C++開發小組扮演有用的角色,
            但是遇到設計難題時,需要高級程序員指導


            2。高級程序員
            與普通程序員的區別是,能獨立地解決大多數C++設計難題。
            要達到這一層次需要至少經過三個復雜的C++PROJECT,并積累了一些設計失敗的教

            訓。

            經過努力,大多數C++編程人員都能達到這一高級程序員的境界。

            3。一個公司里的GURU
            也就是常說的一軟件公司里的牛人,可稱為一個公司里的GURU,
            他們拿著相當高的薪水。,領導一個公司的技術設計。
            這樣的人需要十年以上OO的經驗并經歷多個大型軟件成功和失敗。


            4。工業界的GURU

            這樣人在所在的領域如雷貫耳,幾乎很少有公司能夠雇得起他們。
            他們通常經營著自己的咨詢公司。達到境界4的GURU們,幾乎在每天的空閑散步時間

            里都在思考技術。

            對大多數程序員來說,想達到他們的境界,是不現實的。


            -------C++ FAQ
            三位作者:
            Cline : Internet offical Forum C++FAQ 主持人,給數千名C++工程師上過課,
            計算機專業博士
            Lomow: 高級機構設計師,15年OO開發經驗,計算機專業博士
            Girou: 國際C++標準委員會成員,數學專業博士
            posted @ 2008-09-07 21:12 Voider 閱讀(212) | 評論 (0)編輯 收藏
             
            //file1.c
            #include <stdio.h>

            char ch[10];
            //file2.c
            #include <stdio.h>

            extern char *ch;

            int main()
            {
              ch[0]=1; 
              return 0;
            }
            ---------------------------------------
            gcc file1.c file2.c -o ap
            ./ap
            段錯誤
            -----------------------------------------------
            1,array vs pointer
            file2,c ch[i]實際上得到的是一個字符,但編譯器把它當成是一個指針,因為此文件中聲明為指針
            先取地址ch的內容,加上i,當作字符ch[i]的地址。實際上所謂的地址是ch[0]+i;
            char ch[10]; 符號ch具有一個地址,ch[i],只需將i+ch具有的地址相加,再取其指向的內容
            extern char *ch; ch[i],得到地址p的內容,把它加上i,再取所得地址指向的內容。
            而事實上p指向的內容是ch[0]//one char.而非地址。

            2.定義vs聲明
            定義只有一次,且分配內存,一種特殊的聲明。
            聲明可多次,不分配內存。

            3.編譯器不為指針指向的對象分配空間,只是分配指針本身的空間。
            除非在定義時賦一string初始化,且只可以是字符串常量。只讀不可修改。
             char *p="Hello world";
              p[0]='h'; //段錯誤。


            posted @ 2008-09-07 20:59 Voider 閱讀(181) | 評論 (0)編輯 收藏
            僅列出標題  
             
            久久影院久久香蕉国产线看观看| 狠狠综合久久综合88亚洲| 久久一日本道色综合久久| 久久久久99精品成人片直播| 精品国产一区二区三区久久久狼| 久久国产精品99精品国产987| 久久99精品国产麻豆不卡| 色综合久久夜色精品国产| 久久久精品人妻一区二区三区蜜桃| 91久久婷婷国产综合精品青草| 色偷偷888欧美精品久久久| 午夜精品久久久久久| 国产精品久久国产精麻豆99网站| 久久久精品久久久久特色影视| 无码伊人66久久大杳蕉网站谷歌 | 久久99国内精品自在现线| 秋霞久久国产精品电影院| 18禁黄久久久AAA片| 青青草国产精品久久| 欧美丰满熟妇BBB久久久| 九九久久精品无码专区| 久久精品国产99久久久| 久久精品极品盛宴观看| 99久久精品九九亚洲精品| 午夜精品久久久久久久久| 色婷婷噜噜久久国产精品12p| 久久亚洲精品中文字幕三区| 伊人久久大香线蕉亚洲| 一级a性色生活片久久无| 久久国产精品免费一区| 久久精品国产精品青草| 精品熟女少妇av免费久久| 亚洲精品国精品久久99热| 久久久久婷婷| 久久精品国产黑森林| 国产精品VIDEOSSEX久久发布 | 国产免费久久精品丫丫| 久久精品毛片免费观看| 国内精品久久人妻互换| 久久A级毛片免费观看| 国产亚洲精品美女久久久|