Hay un post de Ian Bicling sobre como usarlos en combinación.
En dicho post hay unas referencias a un HowTo sobre Descriptors (interesante leer los comentarios) y a un nuevo tutorial sobre Decorators de Bruce Eckel.
Antes de comentar al respecto postear dos referencias mas sobre Bruce: una en la que habla sobre la que será su próxima publicación, Python 3 Patterns and Idioms; y otra que la que habla porque no habrá un Thinking in Python (es interesante además porque da unas referencias a otros libros).
Bueno volviendo al tema del post...
Realmente puedes leer sobre los descriptors, pero realmente para pillarlos hay que trastear con ello y leerlo con muchaaaa calma (y lo ideal sería probando los ejemplos). Pero bueno.... El tutorial sirve para pillar la idea.
El de los descriptors por el contrario si que es sencillo. Y son muy muy potentes.
Una de las cosas que eché de menos cuando empecé con python es el poder tracear las entradas y salidas de funciones o métodos. Esto típicamente se hace en C/C++ con macros.
Pues bien... con descriptors es posible hacerlo.
El pero es que con los descriptors en principio pareceque que tienes que modificar el código fuente. Pero no!!! Aunque es la forma evidende de usar los descriptors no es la única, ya que todo el mecanismo es dinámico. De hecho... esto se podría hacer sin los descriptors, ya que todo en python es dinámico...
Que quedo con la copla para experimentar con ello en un futuro...
viernes, octubre 24, 2008
miércoles, octubre 22, 2008
Usando webkit desde python
Antes de nada comentar que no lo he probado, pero me gustaría...
Se puede usar webkit desde python a bravés de pywebkitgtk.
Relacionadas, parte de pywebkitgtk, veo que también existen Pyjamas and python-qt4-webkit.
Intentando investigar un poquito sobre este tema... que he encontrado este post de comp.lang.pyhon (enfocado principalmente a ejecutar javascript, pero relacionado):
"pyv8 is the newest addition: http://advogato.org/article/985.html
it's a python wrapper around google's v8 javascript execution
library.
then there's pykhtml: http://paul.giannaros.org/pykhtml/
it's a python wrapper around KHTML, providing very convenient access
to KDE's HTML capabilities: what pykhtml does is "pretends" that the
GUI part of KDE doesn't exist, so you can run your program as a
command-line shell; it will execute the javascript, which you will
have to wait a bit for of course; then you can walk the DOM tree
(using pykhtml bindings) using pykhtml.DOM.getElementById() and
getElementsByTagName("a") etc. etc. looking for the URLs.
there's even an AJAX example included which does 1-second polling of
the DOM model, waiting for a spell-checking web site to deliver the
answer.
then there's webkit, with the new glib bindings:
https://bugs.webkit.org/show_bug.cgi?id=16401
which are then followed up by python bindings to _those_ bindings:
http://code.google.com/p/pywebkitgtk/issues/detail?id=13
this will also allow you to execute arbitrary javascript - again, it's
similar to KHTML and in fact webkit really _is_ the KDE KHTML code
(JavaScriptCore, KJS etc) but forked, improved, etc. etc.
unfortunately, the glib bindings are tied - at three key and strategic
locations - to gtk at the moment, which will take _very_ little work
to "un"tie them [pay me and i'll do the work], so you would need to
create a blank gtk window - just like is done with pykhtml, behind the
scenes.
it would be a very simple task to create a "dummy" - console-based -
port of webkit, providing an array of callbacks which you must hand to
the library. at the moment, the design of webkit is not particularly
good in this respect: there are three ports, gtk, wx and qt, which are
heavily tied in to webkit. it would be a _far_ better design to be
passing in a struct containing function callbacks (rather a lot of
them - about eighty!) and then what you could do is have a "console"-
based port of webkit, which would do the job you needed.
alternatively, if you don't mind wrapping a binary application with
e.g. Popen3 then look at the webkit DumpRenderTree application, paying
particular attention to using the --html option. you won't have any
control over how long the javascript is executed for. after an
arbitrary and small period of time, DumpRenderTree _stops_ executing
the javascript and prints out the HTML DOM model (in a non-html-layout
fashion - it's used for debugging and testing purposes but will
suffice for your purposes).
so, as it stands, pywebkitgtk is _no worse_ than pykhtml, but with a
little bit of tweaking, the "gtk" could be removed from "pywebkitgtk"
and you'd end up with... ohh... call it "pywebkitglib" ... which would
be much better as a stand-alone library, for your purposes
then there's also "spidermonkey", which is mozilla's javascript
engine. i haven't investigated this option: haven't had a need to.
then there's also PyXPCOMExt, which is embedding python into mozilla,
and from there you have PyDOM, which allows you access to the DOM
model of the mozilla "thing". so, if you don't mind embedding your
application into XULRunner, you've got a home for executing your app
and obtaining the urls, post-javascript-execution.
the neat thing about PyXPCOMExt is that you have complete and full
access to python - so your app can make external TCP and UDP sockets,
you can embed an entire _server_ in the damn thing if you want (you
could embed... python-twisted if you wanted!) you can access the
filesystem - anything. absolutely anything. reason: the _entire_
python suite is embedded into the browser. every single bit of it.
that's about all i've been able to find, so far. there might be more
options out there. not that there aren't enough already :)
all of them will allow you complete and full access to execution of
javascript, including AJAX execution. which is why you'll need to do
that "polling" trick in many instances. "
Se puede usar webkit desde python a bravés de pywebkitgtk.
Relacionadas, parte de pywebkitgtk, veo que también existen Pyjamas and python-qt4-webkit.
Intentando investigar un poquito sobre este tema... que he encontrado este post de comp.lang.pyhon (enfocado principalmente a ejecutar javascript, pero relacionado):
"pyv8 is the newest addition: http://advogato.org/article/985.html
it's a python wrapper around google's v8 javascript execution
library.
then there's pykhtml: http://paul.giannaros.org/pykhtml/
it's a python wrapper around KHTML, providing very convenient access
to KDE's HTML capabilities: what pykhtml does is "pretends" that the
GUI part of KDE doesn't exist, so you can run your program as a
command-line shell; it will execute the javascript, which you will
have to wait a bit for of course; then you can walk the DOM tree
(using pykhtml bindings) using pykhtml.DOM.getElementById() and
getElementsByTagName("a") etc. etc. looking for the URLs.
there's even an AJAX example included which does 1-second polling of
the DOM model, waiting for a spell-checking web site to deliver the
answer.
then there's webkit, with the new glib bindings:
https://bugs.webkit.org/show_bug.cgi?id=16401
which are then followed up by python bindings to _those_ bindings:
http://code.google.com/p/pywebkitgtk/issues/detail?id=13
this will also allow you to execute arbitrary javascript - again, it's
similar to KHTML and in fact webkit really _is_ the KDE KHTML code
(JavaScriptCore, KJS etc) but forked, improved, etc. etc.
unfortunately, the glib bindings are tied - at three key and strategic
locations - to gtk at the moment, which will take _very_ little work
to "un"tie them [pay me and i'll do the work], so you would need to
create a blank gtk window - just like is done with pykhtml, behind the
scenes.
it would be a very simple task to create a "dummy" - console-based -
port of webkit, providing an array of callbacks which you must hand to
the library. at the moment, the design of webkit is not particularly
good in this respect: there are three ports, gtk, wx and qt, which are
heavily tied in to webkit. it would be a _far_ better design to be
passing in a struct containing function callbacks (rather a lot of
them - about eighty!) and then what you could do is have a "console"-
based port of webkit, which would do the job you needed.
alternatively, if you don't mind wrapping a binary application with
e.g. Popen3 then look at the webkit DumpRenderTree application, paying
particular attention to using the --html option. you won't have any
control over how long the javascript is executed for. after an
arbitrary and small period of time, DumpRenderTree _stops_ executing
the javascript and prints out the HTML DOM model (in a non-html-layout
fashion - it's used for debugging and testing purposes but will
suffice for your purposes).
so, as it stands, pywebkitgtk is _no worse_ than pykhtml, but with a
little bit of tweaking, the "gtk" could be removed from "pywebkitgtk"
and you'd end up with... ohh... call it "pywebkitglib" ... which would
be much better as a stand-alone library, for your purposes
then there's also "spidermonkey", which is mozilla's javascript
engine. i haven't investigated this option: haven't had a need to.
then there's also PyXPCOMExt, which is embedding python into mozilla,
and from there you have PyDOM, which allows you access to the DOM
model of the mozilla "thing". so, if you don't mind embedding your
application into XULRunner, you've got a home for executing your app
and obtaining the urls, post-javascript-execution.
the neat thing about PyXPCOMExt is that you have complete and full
access to python - so your app can make external TCP and UDP sockets,
you can embed an entire _server_ in the damn thing if you want (you
could embed... python-twisted if you wanted!) you can access the
filesystem - anything. absolutely anything. reason: the _entire_
python suite is embedded into the browser. every single bit of it.
that's about all i've been able to find, so far. there might be more
options out there. not that there aren't enough already :)
all of them will allow you complete and full access to execution of
javascript, including AJAX execution. which is why you'll need to do
that "polling" trick in many instances. "
lunes, octubre 20, 2008
Pasar de pdf a texto/html
Para extraer el texto del pdf, se de dos aplicaciones que funcionan bien:
Por lo visto en una etapa del pipeline de fast (de las que vienen disponibles), se usa xpf (no lo puedo asegurar al 100%).
Nosotros en cierta ocasión usabamos el segundo (¿o fue pdf2html?). Porque nos daba mejores resultados.
Si quieres hilar mas fino, y no depender de una aplicación externa existe Poppler.
Parece que ha habido un amago de hacer bindings a python para poppler...
Uno de los peor de poppler es que no hay documentación.
Dentro del paquete poppler-utils, hay utilidades de conversión.
He visto que existe el paquete pyPdf.
Por lo visto en una etapa del pipeline de fast (de las que vienen disponibles), se usa xpf (no lo puedo asegurar al 100%).
Nosotros en cierta ocasión usabamos el segundo (¿o fue pdf2html?). Porque nos daba mejores resultados.
Si quieres hilar mas fino, y no depender de una aplicación externa existe Poppler.
Parece que ha habido un amago de hacer bindings a python para poppler...
Uno de los peor de poppler es que no hay documentación.
Dentro del paquete poppler-utils, hay utilidades de conversión.
He visto que existe el paquete pyPdf.
viernes, octubre 17, 2008
Primer curso python impartido

Bueno... ayer se acabó el primer curso python.
No se como habrá resultado, ya que es dificil verse desde fuera (estaría genial poderse ver grabado, para corregir posibles defectos). Pero creo que en general ha estado bien.
Aparte de mi exposición, el material desde luego si que creo que está bastante bien.
Tras la experiencia del curso, quizás podría retocar alguna cosa (muy poca), o por mi parte mirar con mas detalle alguna referencia. Pero la verdad... para un curso de 12 horas, poco mas puedo ampliar. El tiempo está muy bien ajustado ya.
Lo malo, pero esto ya es típico de los cursos dentro de una empresa, quizas un poco de falta de interés por algun alumno (bueno es la percepción desde el lado del profesor). Pero vamos.... esto es algo de esperar. Pero con que haya ya sólo uno con interés es suficiente. Aún así, la gente con menos interés ha podido ver de que va esto de python...
El peor día fue el primero, en el que empecé con un poco de tensión, pero una vez superada el resto bien.
El último día me lleve un chasco. Hice una demo sobre como con joins() la concatenación de cadenas es mas eficaz que usando el operador '+'. Y no fue así. Los tiempos salieron similares.... [1]
A la presentación que tenía preparada le añadí contenido de la presentación de Gustavo Picón, para hacerla mas amena. Sobre todo para el comienzo.
El hacer un curso en python, es realmente muy sencillo, por la interactividad que te permite el interprete.
A la hora de escoger ejercicios para realizar por el alumno, hay dos opciones: hacer muchos ejercicios sencillos, o hacer menos pero mas complejos (no por la dicitultad del problema, sino por que consitas en hacer aplicaciones que realmente hagan algo).
Me decidí por la segunda opción.
En cuanto a la teoría indicar, que la aproximación al contenido ha sido la de pensar, según mi experiencia que debería tener. Y a partir de ahí elaborarlo, tirando de distintas fuentes y metiendo muchas referencias externas.
Lo mas sencillo hubiera sido fusilar algo ya existente, pero no me interesaba esta aproximación (mucho mas cómoda para mi). Ahora cualquiera con interés puede ver libros, u otras presentaciones y el contenido será diferente.
Al final el curso está dividido en 4 partes correspondientes a 4 dias (3 horas por dia):
- Teoría, jugar un poco con python
- Ejercicio 1 y explicación
- Teoría, comienzo de Ejercicio 2
- Explicación ejercicio 2, y practica libre
Ya para acabar, indicar que en la web hay muchas presentaciones (incluso videos). Ahí va un listado de presentaciones de guido.
Y el enlace a la presentación del curso: El mundo de python.
Notas:
[1] Efectivamente, hay novedades que no sabia sobre esto. Por lo visto desde CPython 2.4 según What's New in Python 2.4: "String concatenations in statements of the form s = s + "abc" and s += "abc" are now performed more efficiently in certain circumstances. This optimization won't be present in other Python implementations such as Jython, so you shouldn't rely on it; using the join() method of strings is still recommended when you want to efficiently glue a large number of strings together."
jueves, octubre 16, 2008
NTLM Authorization Proxy Server
Relacionado con el firefox, ya comenté hace tiempo de una extensión interesante. MM3-ProxySwitch. Es interesante si necesitamos cambiar frecuentemente de proxies.
Otra utilidad muy util es un script en python que te permite autentificarte ante un proxy NTLM.
Si tenemos el MS Proxy Server y no estamos en el dominio, con firefox será un infierno navegar, ya que nos pedirá que nos autentifiquemos con cada petición. Este script, NTLM Authorization Proxy Server, lo soluciona.
Su autor Dmitry Rozmanov.
He indagado en Pypi, pero no está. Eso si, me he encontrado otro proxy disponible.
Otra utilidad muy util es un script en python que te permite autentificarte ante un proxy NTLM.
Si tenemos el MS Proxy Server y no estamos en el dominio, con firefox será un infierno navegar, ya que nos pedirá que nos autentifiquemos con cada petición. Este script, NTLM Authorization Proxy Server, lo soluciona.
Su autor Dmitry Rozmanov.
He indagado en Pypi, pero no está. Eso si, me he encontrado otro proxy disponible.
domingo, septiembre 28, 2008
Singleton
Necesitaba encontrar un ejemplo sobre uso de metaclases en python, y me decanté por el patrón Singleton, ya que había visto algo.
Resumiendo... la mejor solución actual es usando metaclases y es:
No se si tiene algun problema, ya que no estoy nada puesto en metaclases. Para acabar unas referencias comentadas:
Resumiendo... la mejor solución actual es usando metaclases y es:
class Singleton(type):
def __init__(cls, name, bases, dct):
cls.__instance = None
super(Singleton,cls).__init__(cls, name, bases, dct)
def __call__(cls, *args, **kw):
if cls.__instance is None:
cls.__instance = super(Singleton,cls).__call__(cls, *args,**kw)
return cls.__instance
No se si tiene algun problema, ya que no estoy nada puesto en metaclases. Para acabar unas referencias comentadas:
- wiki-es: donde ví la implementación de metaclases. Pero el cçodigo aquçi incluido varia en que usa super.
- wiki-en: no tiene la opción de metaclass
- Gary Robinson, implementa un singleton siguiendo unas ideas de aquí. No he tenido tiempo de mirarlo. Pero lo dejo anotado, ya que puede merecer la pena echarle un ojo.
viernes, septiembre 26, 2008
Google Moderator
Leo en genbeta sobre una aplicación sobre Google App Engine, Google Moderator.
Veo que están metiendo preguntas para Guido sobre python.
Veo que están metiendo preguntas para Guido sobre python.
Python popularity
viernes, septiembre 12, 2008
Webkit vs Gecko
Hay un post en barrapunto sobre una comparativa entre WebKit y Gecko.
Me ha congratulado leer algún comentario sobre Gecko que cuadra totalmente con lo que yo ví una vez que intenté evaluar si nos podia servir para un proyecto:
El artículo (el de dosideas) está muy bien, y es corto.
Me ha congratulado leer algún comentario sobre Gecko que cuadra totalmente con lo que yo ví una vez que intenté evaluar si nos podia servir para un proyecto:
- no había documentación por ningún lado
- la organización del codigo es un cristo, no está nada modularizado, aparte que la cantidad de codigo de la base es... brutal!!!
El artículo (el de dosideas) está muy bien, y es corto.
sábado, septiembre 06, 2008
Google Chrome
La novedad de la semana... ¿Y será la última de septiembre? Seguro que no... ya que es el decimo aniversario de google.
Hay un post relacionado de dirson que también está muy bien, va sobre una encuesta sobre los productos de google.
Hay muchas cosas por leer entorno a Chrome, pero todavía no he tenido mucho tiempo...
Por de pronto comentar que el comic, está relamente bien. Redomendable su lectura.
Ya un detalle super geek. Tras instalarmelo me aparece un artículo de Ian Bicking, como en los marcadores y como los mas visitados...
Es curioso... porque en el usuario que uso habitualmente no lo tengo ni en favoritos. Tendré que revisar el usuario admin...
Hay un post relacionado de dirson que también está muy bien, va sobre una encuesta sobre los productos de google.
Hay muchas cosas por leer entorno a Chrome, pero todavía no he tenido mucho tiempo...
Por de pronto comentar que el comic, está relamente bien. Redomendable su lectura.
Ya un detalle super geek. Tras instalarmelo me aparece un artículo de Ian Bicking, como en los marcadores y como los mas visitados...
Es curioso... porque en el usuario que uso habitualmente no lo tengo ni en favoritos. Tendré que revisar el usuario admin...
sábado, agosto 30, 2008
Directorio de programación
En python.es surgió la idea de crear un directorio de blogs sobre python.
No había compartido nunca el enlace enl a lista, pero bueno... la verdad es que ya tengo unos cuantos contenidos en python que pueden ser interesantes.
El link irá a parar a directorioprogramacion.blogspot.com.
Habrá que echarle un ojo a ver como crece su contenido.. .
No había compartido nunca el enlace enl a lista, pero bueno... la verdad es que ya tengo unos cuantos contenidos en python que pueden ser interesantes.
El link irá a parar a directorioprogramacion.blogspot.com.
Habrá que echarle un ojo a ver como crece su contenido.. .
jueves, agosto 28, 2008
lxml
Ya he mentado en algun post anterior este parser de xml/html, pero no había tenido ocasión de probarlo.
En el proyecto ahora tenemos que manejar unos xml y hasta la fecha habíamos usado libxml2... Era el momento de cambiar... y la verdad es que está muy bien. Y bien documentado.
Ahí van unos enlaces:
En el proyecto ahora tenemos que manejar unos xml y hasta la fecha habíamos usado libxml2... Era el momento de cambiar... y la verdad es que está muy bien. Y bien documentado.
Ahí van unos enlaces:
jueves, agosto 21, 2008
Shutdown programado en windows
Hoy he aprendido un comando superutil:
shutdown -s -t [tiempo]
Te sirve para programar un shutdown en windows. Es muy util, imaginaros que habeis dejado descargandose algo y os quereis ir a la cama...
Con /? podeis ver el resto de opciones.
shutdown -s -t [tiempo]
Te sirve para programar un shutdown en windows. Es muy util, imaginaros que habeis dejado descargandose algo y os quereis ir a la cama...
Con /? podeis ver el resto de opciones.
HTTrack
Hacía mucho que no usaba un Web Spider (o crawler). Y aprovechando que para el proyecto estamos usado HTTrack, lo he probado para un uso personal.
La verdad... esta muy bien. El único pero que le hemos visto es que no puedes obtener un mapeo entre las direcciones web, y las locales.
Se puede usar tanto para Linux, como para Windows.
Y ya lo que me ha sorprendido es que hay disponible una librería python, para usarlo desde python: httrack-py.
En linux, recordar que podemos usar para para los mismo wget.
En la wikipedia, podeis encontrar muchos mas crawlers.
La verdad... esta muy bien. El único pero que le hemos visto es que no puedes obtener un mapeo entre las direcciones web, y las locales.
Se puede usar tanto para Linux, como para Windows.
Y ya lo que me ha sorprendido es que hay disponible una librería python, para usarlo desde python: httrack-py.
En linux, recordar que podemos usar para para los mismo wget.
En la wikipedia, podeis encontrar muchos mas crawlers.
martes, agosto 19, 2008
ConfigParser
Modulo muy útil para manejar ficheros de configuración en formato clave/valor y con secciones.
Vamos... al estilo de los .ini de windows.
Dentro del módulo se definen 3 clases:
Yo hasta la fecha había usado ConfigParser, pero se te puede quedar corta...
El comportamiento de los métodos get() es que si una clave no existe te da una Excepción.
Nosotros hemos ampliado el interfaz con una variante de los métodos para que si una clave no existe, te devuelva el valor que le pasas por defecto. Vamos... similar que lo que puedes hacer desde el constructor, pero a nivel de método.
Lo que si que soporta son 'interpolaciones'. Es decir, el poder usar valores de variables como valores de otras variables dentro del mismo fichero de configuración.
Otra ampliación que le hemos metido es el poder hacer sustituciones en los valores a partir de variables del entorno. Para esto usamos el formato ${varname}. La verdad... Se podría haber hecho con las interpolaciones, usando el argumento opcional 'vars'.
SafeConfigParser simplemente modifica el método ser() para garantizar que el valor pasado sea un string.
Vamos... al estilo de los .ini de windows.
Dentro del módulo se definen 3 clases:
- RawConfigParser
- ConfigParser
- SaveConfigParser
Yo hasta la fecha había usado ConfigParser, pero se te puede quedar corta...
El comportamiento de los métodos get() es que si una clave no existe te da una Excepción.
Nosotros hemos ampliado el interfaz con una variante de los métodos para que si una clave no existe, te devuelva el valor que le pasas por defecto. Vamos... similar que lo que puedes hacer desde el constructor, pero a nivel de método.
Lo que si que soporta son 'interpolaciones'. Es decir, el poder usar valores de variables como valores de otras variables dentro del mismo fichero de configuración.
Otra ampliación que le hemos metido es el poder hacer sustituciones en los valores a partir de variables del entorno. Para esto usamos el formato ${varname}. La verdad... Se podría haber hecho con las interpolaciones, usando el argumento opcional 'vars'.
SafeConfigParser simplemente modifica el método ser() para garantizar que el valor pasado sea un string.
jueves, agosto 14, 2008
Chuletilla para subversion
Estaba ya usando desde hacía tiempo subversion, pero la verdad... tampoco había leido demasiado sobre el mismo...
He ido tirando con mis conocimientos (básicos) sobre CVS. Pero notaba mis carestías, por lo que me dispuse a leer los capítulos 1,2 y 3 del siguiente libro. Se lo recomiendo a cualquier que esté trabajando con subversión; o que vaya a trabajar... Se lee rápido.
A continuación una chuletilla de cosas extraidas del susodicho..
Una vez hecho el checkout, el ciclo de trabajo típico es como sigue:
He ido tirando con mis conocimientos (básicos) sobre CVS. Pero notaba mis carestías, por lo que me dispuse a leer los capítulos 1,2 y 3 del siguiente libro. Se lo recomiendo a cualquier que esté trabajando con subversión; o que vaya a trabajar... Se lee rápido.
A continuación una chuletilla de cosas extraidas del susodicho..
Una vez hecho el checkout, el ciclo de trabajo típico es como sigue:
- Update your working copy
- svn update
- Make changes
- svn add
- svn delete
- svn copy
- svn move
- Examine your changes (estos comandos se pueden usar sin conectividad con el repositorio)
- svn status
- svn diff
- Se puede usar un programa externo
- svn revert
- Merge others' changes
- svn merge
- svn resolved
- elimina los ficheros temporales, cuando hay un conflicto
- Commit your changes
- svn commit
- svn log
- svn diff
- svn cat
- svn list
- svn import
- svn cleanup
- Revisiones
- Subversion lets you refer to these revisions by number, keyword, or date.
- Con el date, si queremos sacar lo mas cercano a una fecha (incluyendola) hay que mete el día posterior
- Las revisiones no van asociadas a archivo. Es decir si haces un checkout o un update de una revisión, te va a sacar todo lo que haya en esa rama con esa revisión (lo que hay en el HEAD, es decir lo mas actual con respecto a la revisión solicitada).
- Se pueden hacer copias con 'history'
- Los archivos pueden tener propiedades asociadas. Al ejecutar el comando se puede pedir que se ignoren.
- Y por supuesto hay muchos comandos mas... Todo bien cubierto en el documento enlazado...
- svn status --verbose --> saca info de todo, aunque no haya cambiado
- svn status --show-updates --verbose --> este ya contacta repositorio
- svn status -u -v --> la versión corta
- svn status -vu | grep "*" --> nos indica que no tenemos actualizado con respecto el repositorio
viernes, agosto 08, 2008
Web Frameworks
lunes, julio 07, 2008
Revisitando urls
Python tiene la función urlparse que permite obtener los diferentes componentes de una url.
Ejemplo:
(scheme,netLoc,path,parameters,query,fragment) = urlparse( url )
Vamos a ver que contiene cada parte....:
Si en la parte de la query ya tratamos los parametros, entonces ¿para que sirve parameters? Pues por lo visto son parámetros que pueden llevar cada 'segmento' del path. Eso si, no lo he visto en la vida.
Referencias:
Ejemplo:
(scheme,netLoc,path,parameters,query,fragment) = urlparse( url )
Vamos a ver que contiene cada parte....:
- scheme: Pues el esquema... ta claro.
- netLoc: La localización de red... (ojo! incluye el puerto)
- path: El path
- query: La query (lo que va después de ?)
- fragment: Esto es lo que va tras '#', al final de la url.
Si en la parte de la query ya tratamos los parametros, entonces ¿para que sirve parameters? Pues por lo visto son parámetros que pueden llevar cada 'segmento' del path. Eso si, no lo he visto en la vida.
Referencias:
- RFC 1738, Uniform Resource Locators (URL). This specifies the formal syntax and semantics of absolute URLs.
- RFC 1808, Relative Uniform Resource Locators. This Request For Comments includes the rules for joining an absolute and a relative URL, including a fair number of ``Abnormal Examples'' which govern the treatment of border cases.
- RFC 2396, Uniform Resource Identifiers (URI): Generic Syntax. Document describing the generic syntactic requirements for both Uniform Resource Names (URNs) and Uniform Resource Locators (URLs).
¿Para Alma?
Suena muy fuerte el rumor de que Alma Technologies va a comprar a mi empresa....
Supongo que pronto sabremos algo.
Como cosa interesante el comentar que en Alma tienen un grupo dedicado a temas de tecnologías de búsquedas. Tienen un producto: SearchBox.
Supongo que pronto sabremos algo.
Como cosa interesante el comentar que en Alma tienen un grupo dedicado a temas de tecnologías de búsquedas. Tienen un producto: SearchBox.
miércoles, junio 25, 2008
Desde luego navegapolis me está gustando mucho. Espero sigan en la misma linea...
Su último post: Directivos sin talento.
Su último post: Directivos sin talento.
Suscribirse a:
Entradas (Atom)