Difference between revisions of "Object Oriented Programming"
esse quam videri
Line 47: | Line 47: | ||
import java.util.*; | import java.util.*; | ||
</code> | </code> | ||
+ | |||
+ | === Perl === | ||
+ | <pre> | ||
+ | #!/usr/local/bin/perl5.8.2 | ||
+ | #envia un correo a account_for_backups@gmail.com como usuario wickle con el backup de las | ||
+ | #ultimas base de datos de wickle y con el label Backup | ||
+ | #Usa Mail::Webmail::Gmail en #http://search.cpan.org/dist/Mail-Webmail-Gmail/lib/Mail/Webmail/Gmail.pm | ||
+ | #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"; | ||
+ | } | ||
+ | } | ||
+ | } | ||
+ | </pre> |
Revision as of 18:36, 6 January 2006
Programming Object Oriented Programming
I can't get syntax highlight to work in the wiki bahhh
please see http://iam.colum.edu/oop
Syntax Highlighting Test
<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>
/*
- 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.*;
Perl
#!/usr/local/bin/perl5.8.2 #envia un correo a account_for_backups@gmail.com como usuario wickle con el backup de las #ultimas base de datos de wickle y con el label Backup #Usa Mail::Webmail::Gmail en #http://search.cpan.org/dist/Mail-Webmail-Gmail/lib/Mail/Webmail/Gmail.pm #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"; } } }