`
daoger
  • 浏览: 525353 次
  • 性别: Icon_minigender_1
  • 来自: 山东济南
社区版块
存档分类
最新评论

(转)程序员的进化

阅读更多
http://www.blogjava.net/flyingbug/archive/2006/05/18/46862.html


--------------------------------------------------------------------------------
中学阶段

      10 PRINT "HELLO WORLD"
      20 END
--------------------------------------------------------------------------------
大学一年级

      program Hello(input, output)
        begin
        writeln('Hello World')
        end.
--------------------------------------------------------------------------------
大学高年级

      (defun hello
        (print
        (cons 'Hello (list 'World))))
--------------------------------------------------------------------------------
初级程序员

      #include <stdio.h>
      void main(void)
      {
        char *message[] = {"Hello ", "World"};
        int i;

        for(i = 0; i < 2; ++i)
        printf("%s", message );
        printf("\n");
      }
--------------------------------------------------------------------------------
编程老鸟

      #include <iostream.h>
      #include <string.h>

      class string
      {
      private:
        int size;
        char *ptr;

      public:
        string() : size(0), ptr(new char('\0')) {}

        string(const string &s) : size(s.size)
        {
        ptr = new char[size + 1];
        strcpy(ptr, s.ptr);
        }

        ~string()
        {
        delete [] ptr;
        }

        friend ostream &operator <<(ostream &, const string &);
        string &operator=(const char *);
      };

      ostream &operator<<(ostream &stream, const string &s)
      {
        return(stream << s.ptr);
      }

      string &string::operator=(const char *chrs)
      {
        if (this != &chrs)
        {
        delete [] ptr;
        size = strlen(chrs);
        ptr = new char[size + 1];
        strcpy(ptr, chrs);
        }
        return(*this);
      }

      int main()
      {
        string str;

        str = "Hello World";
        cout << str << end

        return(0);
      }
--------------------------------------------------------------------------------
编程高手

      [
      uuid(2573F8F4-CFEE-101A-9A9F-00AA00342820)
      ]
      library LHello
      {
        // bring in the master library
        importlib("actimp.tlb");
        importlib("actexp.tlb");

        // bring in my interfaces
        #include "pshlo.idl"

        [
        uuid(2573F8F5-CFEE-101A-9A9F-00AA00342820)
        ]
        cotype THello
      {
      interface IHello;
      interface IPersistFile;
      };
      };

      [
      exe,
      uuid(2573F890-CFEE-101A-9A9F-00AA00342820)
      ]
      module CHelloLib
      {

        // some code related header files
        importheader(<windows.h>);
        importheader(<ole2.h>);
        importheader(<except.hxx>);
        importheader("pshlo.h");
        importheader("shlo.hxx");
        importheader("mycls.hxx");

        // needed typelibs
        importlib("actimp.tlb");
        importlib("actexp.tlb");
        importlib("thlo.tlb");

        [
        uuid(2573F891-CFEE-101A-9A9F-00AA00342820),
        aggregatable
        ]
        coclass CHello
      {
      cotype THello;
      };
      };

      #include "ipfix.hxx"

      extern HANDLE hEvent;

      class CHello : public CHelloBase
      {
      public:
        IPFIX(CLSID_CHello);

        CHello(IUnknown *pUnk);
        ~CHello();

        HRESULT __stdcall PrintSz(LPWSTR pwszString);

      private:
        static int cObjRef;
      };

      #include <windows.h>
      #include <ole2.h>
      #include <stdio.h>
      #include <stdlib.h>
      #include "thlo.h"
      #include "pshlo.h"
      #include "shlo.hxx"
      #include "mycls.hxx"

      int CHello::cObjRef = 0;

      CHello::CHello(IUnknown *pUnk) : CHelloBase(pUnk)
      {
        cObjRef++;
        return;
      }

      HRESULT __stdcall CHello::PrintSz(LPWSTR pwszString)
      {
        printf("%ws\n", pwszString);
        return(ResultFromScode(S_OK));
      }

      CHello::~CHello(void)
      {

      // when the object count goes to zero, stop the server
      cObjRef--;
      if( cObjRef == 0 )
        PulseEvent(hEvent);

      return;
      }

      #include <windows.h>
      #include <ole2.h>
      #include "pshlo.h"
      #include "shlo.hxx"
      #include "mycls.hxx"

      HANDLE hEvent;

      int _cdecl main(
      int argc,
      char * argv[]
      ) {
      ULONG ulRef;
      DWORD dwRegistration;
      CHelloCF *pCF = new CHelloCF();

      hEvent = CreateEvent(NULL, FALSE, FALSE, NULL);

      // Initialize the OLE libraries
      CoInitializeEx(NULL, COINIT_MULTITHREADED);

      CoRegisterClassObject(CLSID_CHello, pCF, CLSCTX_LOCAL_SERVER,
        REGCLS_MULTIPLEUSE, &dwRegistration);

      // wait on an event to stop
      WaitForSingleObject(hEvent, INFINITE);

      // revoke and release the class object
      CoRevokeClassObject(dwRegistration);
      ulRef = pCF->Release();

      // Tell OLE we are going away.
      CoUninitialize();

      return(0);
      }

      extern CLSID CLSID_CHello;
      extern UUID LIBID_CHelloLib;

      CLSID CLSID_CHello = { /* 2573F891-CFEE-101A-9A9F-00AA00342820 */
        0x2573F891,
        0xCFEE,
        0x101A,
        { 0x9A, 0x9F, 0x00, 0xAA, 0x00, 0x34, 0x28, 0x20 }
      };

      UUID LIBID_CHelloLib = { /* 2573F890-CFEE-101A-9A9F-00AA00342820 */
        0x2573F890,
        0xCFEE,
        0x101A,
        { 0x9A, 0x9F, 0x00, 0xAA, 0x00, 0x34, 0x28, 0x20 }
      };

      #include <windows.h>
      #include <ole2.h>
      #include <stdlib.h>
      #include <string.h>
      #include <stdio.h>
      #include "pshlo.h"
      #include "shlo.hxx"
      #include "clsid.h"

      int _cdecl main(
      int argc,
      char * argv[]
      ) {
      HRESULT hRslt;
      IHello     *pHello;
      ULONG ulCnt;
      IMoniker * pmk;
      WCHAR wcsT[_MAX_PATH];
      WCHAR wcsPath[2 * _MAX_PATH];

      // get object path
      wcsPath[0] = '\0';
      wcsT[0] = '\0';
      if( argc > 1) {
        mbstowcs(wcsPath, argv[1], strlen(argv[1]) + 1);
        wcsupr(wcsPath);
        }
      else {
        fprintf(stderr, "Object path must be specified\n");
        return(1);
        }

      // get print string
      if(argc > 2)
        mbstowcs(wcsT, argv[2], strlen(argv[2]) + 1);
      else
        wcscpy(wcsT, L"Hello World");

      printf("Linking to object %ws\n", wcsPath);
      printf("Text String %ws\n", wcsT);

      // Initialize the OLE libraries
      hRslt = CoInitializeEx(NULL, COINIT_MULTITHREADED);

      if(SUCCEEDED(hRslt)) {

        hRslt = CreateFileMoniker(wcsPath, &pmk);
        if(SUCCEEDED(hRslt))
      hRslt = BindMoniker(pmk, 0, IID_IHello, (void **)&pHello);

        if(SUCCEEDED(hRslt)) {

      // print a string out
      pHello->PrintSz(wcsT);

      Sleep(2000);
      ulCnt = pHello->Release();
      }
        else
      printf("Failure to connect, status: %lx", hRslt);

        // Tell OLE we are going away.
        CoUninitialize();
        }

      return(0);
      }
--------------------------------------------------------------------------------
黑客初阶

      #!/usr/local/bin/perl
      $msg="Hello, world.\n";
      if ($#ARGV >= 0) {
        while(defined($arg=shift(@ARGV))) {
        $outfilename = $arg;
        open(FILE, ">" . $outfilename) || die "Can't write $arg: $!\n";
        print (FILE $msg);
        close(FILE) || die "Can't close $arg: $!\n";
        }
      } else {
        print ($msg);
      }
      1;
--------------------------------------------------------------------------------
黑客有成

      #include <stdio.h>
      #define S "Hello, World\n"
      main(){exit(printf(S) == strlen(S) ? 0 : 1);}
--------------------------------------------------------------------------------
黑客高手

      % cc -o a.out ~/src/misc/hw/hw.c
      % a.out
--------------------------------------------------------------------------------
黑客

      % cat
      Hello, world.
      ^D
--------------------------------------------------------------------------------
初级经理

      10 PRINT "HELLO WORLD"
      20 END
--------------------------------------------------------------------------------
中级经理

      mail -s "Hello, world." bob@b12
      Bob, could you please write me a program that prints "Hello, world."?
      I need it by tomorrow.
      ^D
--------------------------------------------------------------------------------
高级经理

      % zmail jim
      I need a "Hello, world." program by this afternoon.
--------------------------------------------------------------------------------
首席执行官

      % letter
      letter: Command not found.
      % mail
      To: ^X ^F ^C
      % help mail
      help: Command not found.
      % damn!
      !: Event unrecognized
      % logout
--------------------------------------------------------------------------------
分享到:
评论
1 楼 i_love_sc 2006-12-22  
编程老鸟和编程高手的没看懂。

相关推荐

    Java程序员进化为架构师掌握的知识

    Java程序员进化为架构师掌握的知识,可能有点多,但是是必须的

    PHP程序员的进化之路-.zip

    PHP程序员的进化之路-

    PHP程序员的进化之路-惠新晨.pptx

    PHP程序员的进化之路-惠新晨.pptx

    如何成为一名C++程序员

    程序员入门指导,帮助想入门学习C++,及其他开发语言的程序员入门指导 详细介绍,入门法则,提高法则, 学习范围,知识性,趣味性学习C++及其他语言

    从程序员到CTO大牛企业内部PDF与PPT合集.zip

    亚马逊云平台计算服务进化之路 京东云为企业提供智能化之路 中移苏研存储产品化之路 百度基于Druid的大数据采集即计算实践 蘑菇街大数据平台工作流调度系统 饿了么离线大数据平台实践 爱奇艺广告大数据实践 魅族...

    程序员的进化

    Go程序员的演变 初级Go程序员 package fac func Factorial ( n int ) int { res := 1 for i := 1 ; i &lt;= n ; i ++ { res *= i } return res } 功能性Go程序员 package fac func Factorial ( n int ) int { ...

    知乎程序员刷题-Screeps-AI:我为Screeps进化的AI

    进化的 AI 欢迎欢迎。 来一个,都来。 这是我为精彩绝伦的游戏 Screeps () 编写的“AI”代码。 我打算将其窃取或以任何身份使用(但最好不要利用和破坏我的文明!)。 如果你愿意的话,我是一个业余程序员,或者一个...

    程序猿如何进化——云上的开发运维一体化.pdf

    程序猿如何进化——云上的开发运维一体化.pdf

    用Python实现斐波那契(Fibonacci)函数

    最近在玩Python,在粗略的看了一下Learning Python和Core Python之后,偶然发现网上有个帖子Python程序员的进化写的很有意思。于是打算仿照一篇,那篇帖子用了十余种方法完成一个阶乘函数,我在这里会用九种不同的...

    程序员:乌玛·雷德(Uma rede)社交程序程序员

    乌玛(Uma)重新编写了社会程序程序员/技术进化论。 在购物。 贡献 Vocêpode contribuir para este projeto,fazendo o Fork,eo pull request。 Ajude a manter o projeto,contribuindo。 联络人 脸谱comigo pelo...

    进化:我们在互联网上奋斗的故事

    33位互联网老兵倾力打造的成长励志大作,听我们讲述百分百真实的互联网上的奋斗故事。麒麟会CEO王铮铮 iTech Club创始人吴华鹏作序推荐

    GPT-4可以根据草图编写网页?前端程序员:你礼貌吗

    最近GPT-4炸圈了,能力比刚刚出圈的Chat-GPT所使用的GPT3.5又上升了至少一个数量级,AI不单单是进化了,可以看懂图片,还能考法律试题,甚至能懂人类的梗。 最令我惊叹的是GPT-4的图片理解能力,它甚至能仅凭一张...

    中国互联网进化简史.docx

    "中国互联网进化简史" 中国互联网的发展可以分为三个阶段:互联网 1.0 时代、互联网 2.0 时代和互联网 3.0 时代。每个阶段都有其鲜明的特点和代表人物。 互联网 1.0 时代(1995-2000 年):蛮荒之境 在这个阶段,...

    Live20R指纹仪程序员开发测试.zip

    中控指纹仪Live20R开发包SDK文档和C#、C、ActiveX、java等多语言Demo

    《Python Cookbook》第三版中文.pdf

    自从2008 年以来,Python3 横空出世并慢慢进化。Python3 的流行一直被认为需 要很长一段时间。事实上,到我写这本书的2013 年,绝大部分的Python 程序员仍然 在生产环境中使用的是版本2 系列,最主要是因为Python3 ...

    人工智能大作业Python基于卷积神经网络的五子棋项目源码+报告,含棋盘识别、博弈算法、进化学习及监督学习

    人工智能大作业Python基于卷积神经网络的五子棋项目源码+报告,含棋盘识别、博弈算法、进化学习及监督学习 一、说明 人工智能基础课程大作业,共分为四个小问题。 棋盘识别:从对局棋盘图片识别棋局落子情况,识别...

    Python3-cookbook

    自从 2008 年以来,Python 3 横空出世并慢慢进化。Python 3 的流行一直被认为需要很长一段时间。 事实上,到我写这本书的 2013 年,绝大部分的 Python 程序员仍然在生产环境中使用的是版本 2 系列, 最主要是因为 ...

    JAVA5新特性介绍

    因此学习JAVA编程语言也要紧跟时代,争取让身为JAVA程序员的自己不会沦为被淘汰的那群程序员中。本文主要针对这些新颖的特性结合实际代码示例进行介绍。学习这些新特性,并运用到实际编程工作中去是撰写本文的最终...

    程序员需要经常刷题吗-agile-mdx:使用MDX平台的敏捷演示

    需要程序员经常刷题吗敏捷mdx 使用 MDX 平台的敏捷演示 敏捷软件开发 概念 敏捷软件开发描述了一种软件开发方法,在该方法下,需求和解决方案通过自组织和跨职能团队及其客户/最终用户的协作努力而发展。 它提倡适应...

    wilcoxon实验的matlab全中文注释

    提供进化算法的wilcoxon实验代码,其中带有pso和gwo的一些数据,亲测有效,程序员不骗程序员,节约时间,励志科研

Global site tag (gtag.js) - Google Analytics