Object Oriented Programming

esse quam videri
Revision as of 20:39, 8 January 2006 by Jeff (talk | contribs)
Jump to: navigation, search

Programming Object Oriented Programming

I can't get syntax highlight to work in the wiki

please see http://iam.colum.edu/oop

works now

OOP Sylabus

Classes

Syntax Highlighting Test

Java

<java> /*

  • Algernon - a rule-based inference engine in Java.
  • http://algernon-j.sourceforge.net/
  • This example shows how to open a Protege knowledge base
  • in Java and use Algernon to query the KB.
  • To run it, be sure to change the path in NEWSPAPER_PROJECT
  • to match the correct project on your system.
  • Micheal Hewett
  • 05 May 2004
  • hewett@cs.stanford.edu
  • /

package org.algernon.test;

import java.util.*; </java>

cpp

<cpp> /*

  • Algernon - a rule-based inference engine in Java.
  • http://algernon-j.sourceforge.net/
  • This example shows how to open a Protege knowledge base
  • in Java and use Algernon to query the KB.
  • To run it, be sure to change the path in NEWSPAPER_PROJECT
  • to match the correct project on your system.
  • Micheal Hewett
  • 05 May 2004
  • hewett@cs.stanford.edu
  • /

package org.algernon.test;

import java.util.*; </cpp>


csharp

<csharp> using System;


public class Person : System.Web.UI.Page

{

   private string name;
   private int age;
   private string sign;
   
   public Person()
   {
       sign = "cancer";
   }
   
   public Person(string newName)
    {
        name = newName;
       sign = "cancer"
   }
   
   public Person(string newName, string newSign )
   {
       name = newName;
       sign = newSign;
   }
   
   public string Name
   {
       get
       {
           return name;
       }
       set 
       {
           name = value;
       }
   }
   
   public int Age
   {
       get
       {
           return age;
       }
       set
       {
           age = value;
       }
   }
   
   public string Sign
   {
       get
       {
           return sign;
       }
       set
       {
           sign = value;
       }
   }
   
   public string About()
   {
       string about = "";
       
       about +=(The persons name is " + this.name + ".");
       about +=(The person is " + this.age + " years old.");
       about +=(He/She's sign is " + this.sign + ".");
       
   return about;
   }
   

} </csharp>

Perl

<perl>

  1. !/usr/local/bin/perl5.8.2
  2. envia un correo a account_for_backups@gmail.com como usuario wickle con el backup de las
  3. ultimas base de datos de wickle y con el label Backup
  4. Usa Mail::Webmail::Gmail en #http://search.cpan.org/dist/Mail-Webmail-Gmail/lib/Mail/Webmail/Gmail.pm
  5. Syntax ./send_gmail.pl file_to_backup.tar.gz

use Mail::Webmail::Gmail;

my $backup_label="Backups"; my $file_to_backup=$ARGV[0]; my $mail_to_backup="account_for_backups@gmail.com"; my $now = localtime time; print "It is now $now.\nfile to backup: $file_to_backup\n"; my ( $gmail ) = Mail::Webmail::Gmail->new(

           username => 'mygmailaccount', password => 'mypassword', );
   my $msgid = $gmail->send_message( to => 'account_for_backups@gmail.com', subject => 'Backup bases de datos '. $now, msgbody => 'Backup del dia '.$now. ' realizado', file0 => [$file_to_backup] );
   print "Msgid: $msgid\n";
   if ( $msgid ) {
       if ( $gmail->error() ) {
           print $gmail->error_msg();
       } else {
               ### Add this label to our new message ###
               $gmail->edit_labels( label => $backup_label, action => 'add', 'msgid' => $msgid );
               if ( $gmail->error() ) {
                   print $gmail->error_msg();
               } else {
                   print "Added label: $backup_label to message $msgid\n";
               }
       }
   }

</perl>