• Domingo 28 de Abril de 2024, 12:25

Autor Tema:  La Evolucion De Un Programador  (Leído 1084 veces)

cluster

  • Miembro MUY activo
  • ***
  • Mensajes: 196
    • Ver Perfil
La Evolucion De Un Programador
« en: Martes 30 de Mayo de 2006, 00:47 »
0
Código: Text
  1.  
  2. The Evolution of a Programmer
  3. ----------------------------------------------------------------------------
  4.  
  5. High School/Jr.High
  6.  
  7.   10 PRINT "HELLO WORLD"
  8.   20 END
  9.  
  10. First year in College
  11.  
  12.   program Hello(input, output)
  13.     begin
  14.       writeln('Hello World')
  15.     end.
  16.  
  17. Senior year in College
  18.  
  19.   (defun hello
  20.     (print
  21.       (cons 'Hello (list 'World))))
  22.  
  23. New professional
  24.  
  25.   #include
  26.   void main(void)
  27.   {
  28.     char *message[] = {"Hello ", "World"};
  29.     int i;
  30.  
  31.     for(i = 0; i < 2; ++i)
  32.       printf("%s", message[i]);
  33.     printf("\n");
  34.   }
  35.  
  36. Seasoned professional
  37.  
  38.   #include
  39.   #include
  40.  
  41.   class string
  42.   {
  43.   private:
  44.     int size;
  45.     char *ptr;
  46.  
  47.   public:
  48.     string() : size(0), ptr(new char('\0')) {}
  49.  
  50.     string(const string &s) : size(s.size)
  51.     {
  52.       ptr = new char[size + 1];
  53.       strcpy(ptr, s.ptr);
  54.     }
  55.  
  56.     ~string()
  57.     {
  58.       delete [] ptr;
  59.     }
  60.  
  61.     friend ostream &operator <<(ostream &, const string &);
  62.     string &operator=(const char *);
  63.   };
  64.  
  65.   ostream &operator<<(ostream &stream, const string &s)
  66.   {
  67.     return(stream << s.ptr);
  68.   }
  69.  
  70.   string &string::operator=(const char *chrs)
  71.   {
  72.     if (this != &chrs)
  73.     {
  74.       delete [] ptr;
  75.      size = strlen(chrs);
  76.       ptr = new char[size + 1];
  77.       strcpy(ptr, chrs);
  78.     }
  79.     return(*this);
  80.   }
  81.  
  82.   int main()
  83.   {
  84.     string str;
  85.  
  86.     str = "Hello World";
  87.     cout << str << endl;
  88.  
  89.     return(0);
  90.   }
  91.  
  92. Master Programmer
  93.  
  94.   [
  95.   uuid(2573F8F4-CFEE-101A-9A9F-00AA00342820)
  96.   ]
  97.   library LHello
  98.   {
  99.       // bring in the master library
  100.       importlib("actimp.tlb");
  101.       importlib("actexp.tlb");
  102.  
  103.       // bring in my interfaces
  104.       #include "pshlo.idl"
  105.  
  106.       [
  107.       uuid(2573F8F5-CFEE-101A-9A9F-00AA00342820)
  108.       ]
  109.       cotype THello
  110.    {
  111.    interface IHello;
  112.    interface IPersistFile;
  113.    };
  114.   };
  115.  
  116.   [
  117.   exe,
  118.   uuid(2573F890-CFEE-101A-9A9F-00AA00342820)
  119.   ]
  120.   module CHelloLib
  121.   {
  122.  
  123.       // some code related header files
  124.       importheader();
  125.       importheader();
  126.       importheader();
  127.       importheader("pshlo.h");
  128.       importheader("shlo.hxx");
  129.       importheader("mycls.hxx");
  130.  
  131.       // needed typelibs
  132.       importlib("actimp.tlb");
  133.       importlib("actexp.tlb");
  134.       importlib("thlo.tlb");
  135.  
  136.       [
  137.       uuid(2573F891-CFEE-101A-9A9F-00AA00342820),
  138.       aggregatable
  139.       ]
  140.       coclass CHello
  141.    {
  142.    cotype THello;
  143.    };
  144.   };
  145.  
  146.   #include "ipfix.hxx"
  147.  
  148.   extern HANDLE hEvent;
  149.  
  150.   class CHello : public CHelloBase
  151.   {
  152.   public:
  153.       IPFIX(CLSID_CHello);
  154.  
  155.       CHello(IUnknown *pUnk);
  156.       ~CHello();
  157.  
  158.       HRESULT  __stdcall PrintSz(LPWSTR pwszString);
  159.  
  160.   private:
  161.       static int cObjRef;
  162.   };
  163.  
  164.   #include
  165.   #include
  166.   #include
  167.   #include
  168.   #include "thlo.h"
  169.   #include "pshlo.h"
  170.   #include "shlo.hxx"
  171.   #include "mycls.hxx"
  172.  
  173.   int CHello::cObjRef = 0;
  174.  
  175.   CHello::CHello(IUnknown *pUnk) : CHelloBase(pUnk)
  176.   {
  177.       cObjRef++;
  178.       return;
  179.   }
  180.  
  181.   HRESULT  __stdcall  CHello::PrintSz(LPWSTR pwszString)
  182.   {
  183.       printf("%ws\n", pwszString);
  184.       return(ResultFromScode(S_OK));
  185.   }
  186.  
  187.   CHello::~CHello(void)
  188.   {
  189.  
  190.   // when the object count goes to zero, stop the server
  191.   cObjRef--;
  192.   if( cObjRef == 0 )
  193.       PulseEvent(hEvent);
  194.  
  195.   return;
  196.   }
  197.  
  198.   #include
  199.   #include
  200.   #include "pshlo.h"
  201.   #include "shlo.hxx"
  202.   #include "mycls.hxx"
  203.  
  204.   HANDLE hEvent;
  205.  
  206.    int _cdecl main(
  207.   int argc,
  208.   char * argv[]
  209.   ) {
  210.   ULONG ulRef;
  211.   DWORD dwRegistration;
  212.   CHelloCF *pCF = new CHelloCF();
  213.  
  214.   hEvent = CreateEvent(NULL, FALSE, FALSE, NULL);
  215.  
  216.   // Initialize the OLE libraries
  217.   CoInitializeEx(NULL, COINIT_MULTITHREADED);
  218.  
  219.   CoRegisterClassObject(CLSID_CHello, pCF, CLSCTX_LOCAL_SERVER,
  220.       REGCLS_MULTIPLEUSE, &dwRegistration);
  221.  
  222.   // wait on an event to stop
  223.   WaitForSingleObject(hEvent, INFINITE);
  224.  
  225.   // revoke and release the class object
  226.   CoRevokeClassObject(dwRegistration);
  227.   ulRef = pCF->Release();
  228.  
  229.   // Tell OLE we are going away.
  230.   CoUninitialize();
  231.  
  232.   return(0); }
  233.  
  234.   extern CLSID CLSID_CHello;
  235.   extern UUID LIBID_CHelloLib;
  236.  
  237.   CLSID CLSID_CHello = { /* 2573F891-CFEE-101A-9A9F-00AA00342820 */
  238.       0x2573F891,
  239.       0xCFEE,
  240.       0x101A,
  241.       { 0x9A, 0x9F, 0x00, 0xAA, 0x00, 0x34, 0x28, 0x20 }
  242.   };
  243.  
  244.   UUID LIBID_CHelloLib = { /* 2573F890-CFEE-101A-9A9F-00AA00342820 */
  245.       0x2573F890,
  246.       0xCFEE,
  247.       0x101A,
  248.       { 0x9A, 0x9F, 0x00, 0xAA, 0x00, 0x34, 0x28, 0x20 }
  249.   };
  250.  
  251.   #include
  252.   #include
  253.   #include
  254.   #include
  255.   #include
  256.   #include "pshlo.h"
  257.   #include "shlo.hxx"
  258.   #include "clsid.h"
  259.  
  260.   int _cdecl main(
  261.   int argc,
  262.   char * argv[]
  263.   ) {
  264.   HRESULT  hRslt;
  265.   IHello        *pHello;
  266.   ULONG  ulCnt;
  267.   IMoniker * pmk;
  268.   WCHAR  wcsT[_MAX_PATH];
  269.   WCHAR  wcsPath[2 * _MAX_PATH];
  270.  
  271.   // get object path
  272.   wcsPath[0] = '\0';
  273.   wcsT[0] = '\0';
  274.   if( argc > 1) {
  275.       mbstowcs(wcsPath, argv[1], strlen(argv[1]) + 1);
  276.       wcsupr(wcsPath);
  277.       }
  278.   else {
  279.       fprintf(stderr, "Object path must be specified\n");
  280.       return(1);
  281.       }
  282.  
  283.   // get print string
  284.   if(argc > 2)
  285.       mbstowcs(wcsT, argv[2], strlen(argv[2]) + 1);
  286.   else
  287.       wcscpy(wcsT, L"Hello World");
  288.  
  289.   printf("Linking to object %ws\n", wcsPath);
  290.   printf("Text String %ws\n", wcsT);
  291.  
  292.   // Initialize the OLE libraries
  293.   hRslt = CoInitializeEx(NULL, COINIT_MULTITHREADED);
  294.  
  295.   if(SUCCEEDED(hRslt)) {
  296.  
  297.       hRslt = CreateFileMoniker(wcsPath, &pmk);
  298.       if(SUCCEEDED(hRslt))
  299.    hRslt = BindMoniker(pmk, 0, IID_IHello, (void **)&pHello);
  300.  
  301.       if(SUCCEEDED(hRslt)) {
  302.  
  303.    // print a string out
  304.    pHello->PrintSz(wcsT);
  305.  
  306.    Sleep(2000);
  307.    ulCnt = pHello->Release();
  308.    }
  309.       else
  310.    printf("Failure to connect, status: %lx", hRslt);
  311.  
  312.       // Tell OLE we are going away.
  313.       CoUninitialize();
  314.       }
  315.  
  316.   return(0);
  317.   }
  318.  
  319. Apprentice Hacker
  320.  
  321.   #!/usr/local/bin/perl
  322.   $msg="Hello, world.\n";
  323.   if ($#ARGV >= 0) {
  324.     while(defined($arg=shift(@ARGV))) {
  325.       $outfilename = $arg;
  326.       open(FILE, ">" . $outfilename) || die "Can't write $arg: $!\n";
  327.       print (FILE $msg);
  328.       close(FILE) || die "Can't close $arg: $!\n";
  329.     }
  330.   } else {
  331.     print ($msg);
  332.   }
  333.   1;
  334.  
  335. Experienced Hacker
  336.  
  337.   #include
  338.   #define S "Hello, World\n"
  339.   main(){exit(printf(S) == strlen(S) ? 0 : 1);}
  340.  
  341. Seasoned Hacker
  342.  
  343.   % cc -o a.out ~/src/misc/hw/hw.c
  344.   % a.out
  345.  
  346. Guru Hacker
  347.  
  348.   % cat
  349.   Hello, world.
  350.   ^D
  351.  
  352. New Manager
  353.  
  354.   10 PRINT "HELLO WORLD"
  355.   20 END
  356.  
  357. Middle Manager
  358.  
  359.   mail -s "Hello, world." bob@b12
  360.   Bob, could you please write me a program that prints "Hello,
  361.  world."?
  362.   I need it by tomorrow.
  363.   ^D
  364.  
  365. Senior Manager
  366.  
  367.   % zmail jim
  368.   I need a "Hello, world." program by this afternoon.
  369.  
  370. Chief Executive
  371.  
  372.   % letter
  373.   letter: Command not found.
  374.   % mail
  375.   To: ^X ^F ^C
  376.   % help mail
  377.   help: Command not found.
  378.   % damn!
  379.   !: Event unrecognized
  380.   % logout
  381.  
  382.  
  383.  
  384.  

LeGatoRojo

  • Miembro HIPER activo
  • ****
  • Mensajes: 552
  • Nacionalidad: mx
    • Ver Perfil
    • LeGatoRojo
Re: La Evolucion De Un Programador
« Respuesta #1 en: Martes 30 de Mayo de 2006, 04:35 »
0
vaya que es chistos, chiste de programadores.
Un día desperte y en lugar de dientes tenía colmillos, en lugar de manos, tenía garras; pero lo más impactante fue el color escarlata de mi pelaje.

Bicholey

  • Moderador
  • ******
  • Mensajes: 1234
    • Ver Perfil
Re: La Evolucion De Un Programador
« Respuesta #2 en: Martes 30 de Mayo de 2006, 06:42 »
0
:lol:  :lol:  :lol:  :D  :D  :D

Excelente chiste fabuloso solo le falto algo de assembler para destornillarme de risa.
[size=109]LOS GATOS SIEMPRE CAEMOS DE PIE !!![/size]