Archivo

Entradas Etiquetadas ‘python’

FTP para Desarrolladores

jueves, 29 de enero de 2009 2 comentarios

FTP para Desarrolladores

En estos ejemplos se sube un archivo de texto plano para mejores implementaciones lea la API o la documentacion de cada lenguaje o comando

Curl:

curl -T filename -u username:password ftp://hostname/filename

Perl:

use Net::FTP;
$hostname = "localhost";
$username = "user";
$password = "pass";
$filename = "file.txt";
$ftp = Net::FTP->new($hostname);
$ftp->login($username,$password);
$ftp->put($filename);
$ftp->quit;

Manejo de errores usa “or die $@” (“$ftp>message” solo cuando el login haya funcionado)

PHP:

<?php
$hostname = "localhost";
$username = "user";
$password = "pass";
$filename = "file.txt";
$conn = ftp_connect($hostname); 
ftp_login($conn, $username, $password);
ftp_put($conn,$filename,$filename,FTP_ASCII);
ftp_close($conn);
?>

Manejo de errores usando “if(!function)”

Python:

import ftplib
hostname = "localhost"
username = "user"
password = "pass"
filename = "file.txt"
ftp = ftplib.FTP(hostname)
ftp.login(username, password) 
ftp.storlines("STOR " + filename, open(filename))
ftp.quit()

Manejo de errores usando “try”, “except” y “else”

Ruby:

require 'net/ftp'
host = 'localhost'
user = 'user'
pass = 'pass'
file = 'file.txt'
ftp = Net::FTP.new(hostname)
ftp.login(username,password)
ftp.puttextfile(filename)
ftp.close

Manejo de errores usando “begin”, “rescue”, “else”, “ensure” y “end”.

Win32 batch:

ftp -s:settings.txt hostname

settings.txt:

username
password
put filename
bye

Manejo de errores usando “if not %errorlevel%==0 goto :error”

Python and NetBeans

viernes, 23 de enero de 2009 1 comentario

Python and NetBeans

Menu => Tools => Plugins


New Python Project:




Jython ( http://www.jython.org )
Python ( http://www.python.org )

Categories: develop, unix/linux, windows Tags: ,

Python 3.0 Final Released

jueves, 4 de diciembre de 2008 Sin comentarios

Python 3.0 Final Released

Python 3.0 (a.k.a. “Python 3000″ or “Py3k”) is a new version of the language that is incompatible with the 2.x line of releases. The language is mostly the same, but many details, especially how built-in objects like dictionaries and strings work, have changed considerably, and a lot of deprecated features have finally been removed. Also, the standard library has been reorganized in a few prominent places.

What’s New and download.

Categories: develop Tags:

TODO LIST 2009

lunes, 1 de diciembre de 2008 1 comentario

TODO LIST 2009

Read/Learn/Practice:

Python 2.6 (What’s New)
Perl 5 (Modules, Packages)
PHP (Changes, and news)
COBOL
.NET (C#, LINQ, (ok VB but not much))
Java (Im interested on Mobil Applications)
Haskell
Ruby (Im interested on Rails)
Parrot and Pugs
Gnu/Linux (Services and Bash)
BSD and OpenSolaris

Personal Projects 2009:

BSE (Blog’s Search Engine) (http://BSE.AyalaSoft.com)
Invoices PHP (Now is part of a Intranet) (http://valuacion.com.mx)
Forming one’s own business
And others ….

Lambda Functions on PHP 5.3.0:

 $lambda = function () { echo "Hello World!\n"; };

Parrot “Hello World” example:

.sub main
      print "Hello World!\n";
.end

COBOL “Hello World” example:

* Hello World Program
* GPL Copyleft Jonathan Riddell 2001
	IDENTIFICATION DIVISION.
	PROGRAM-ID.    hello.
	ENVIRONMENT DIVISION.
	DATA DIVISION.
 
	PROCEDURE DIVISION.
		DISPLAY "Hello ," WITH NO ADVANCING 
		DISPLAY "World!"
		STOP RUN.

Haskell “Hello World” example:

putStrLn "Hello World!"

Google App Engine

miércoles, 5 de noviembre de 2008 Sin comentarios

Google App Engine

Downloads (http://code.google.com/appengine/downloads.html)

Google App Engine use Django, webob, yaml.

You need Python (http://www.python.org) (Python 2.5)

The configuration file app.yaml

There are two main Python scripts:

Video from the The Google Code Channel:

See the applications gallery

Google App Engine

Switch to our mobile site