10 malentendidos sobre spring

septiembre 12, 2006

Interesante articulo sobre spring en oreally hoy :

1. Spring no es lightweight.

2. spring es overkill par aplicaciones simples

3. Spring no escala bien con aplicaciones realmente grandes

4. Spring  te fuerza a usar  Programación orientada a objetos (AOP) Aspect-Oriented Programming (AOP) la cua es experimental.

5. Spring sustituye a Java Enterprise Edition (JEE).

6. Spring yEJB son mutuamente excluyentes

7. Spring no puede Spring tomar aprovechar las ventajas de las anotaciones en Java 5 annotations como lo hace EJB3

8. Para aplicaciones grandes, el mantenimiento de los archivos XML de Spring es una pesadilla

9. Spring lo hace todo con reflexion, por lo tanto es lento.
10. Spring MVC es complejo y no es tan sencillo como el resto de Spring.

Hace 15 años :

agosto 7, 2006

Original

In article <6…@cernvax.cern.ch> I promised to post a short summary  of the
WorldWideWeb project.  Mail me with any queries.

WorldWideWeb – Executive Summary

The WWW project merges the techniques of information retrieval and hypertext to
make an easy but powerful global information system.

The project started with the philosophy that much academic information should
be freely available to anyone. It aims to allow information sharing within
internationally dispersed teams, and the dissemination of information by
support groups.

Reader view

The WWW world consists of documents, and links.  Indexes are special documents
which, rather than being read, may be searched. The result of such a search is
another (“virtual”) document containing links to the documents found.  A simple
protocol (“HTTP”) is used to allow a browser program to request a keyword
search by a remote information server.

The web contains documents in many formats. Those documents which are
hypertext,  (real or virtual) contain links to other documents, or places
within documents. All documents, whether real, virtual or indexes, look similar
to the reader and are contained within the same addressing scheme.

To follow a link,  a reader clicks with a mouse (or types in a number if he or
she has no mouse). To search and index, a reader gives keywords (or other
search criteria). These are the only operations  necessary to access the entire
world of data.

Information provider view

The WWW browsers can access many existing data systems via existing protocols
(FTP, NNTP) or via HTTP and a gateway. In this way, the critical mass of data
is quickly exceeded, and the increasing use of the system by readers and
information suppliers encourage each other.

Making a web is as simple as writing a few SGML files which point to your
existing data. Making it public involves running the FTP or HTTP daemon, and
making at least one link into your web from another. In fact,  any file
available by anonymous FTP can be immediately linked into a web. The very small
start-up effort is designed to allow small contributions.  At the other end of
the scale, large information providers may provide an HTTP server with full
text or keyword indexing.

The WWW model gets over the frustrating incompatibilities of data format
between suppliers and reader by allowing negotiation of format between a smart
browser and a smart server. This should provide a basis for extension into
multimedia, and allow those who share application standards to make full use of
them across the web.

This summary does not describe the many exciting possibilities opened up by the
WWW project, such as efficient document caching. the reduction of redundant
out-of-date copies, and the use of knowledge daemons.  There is more
information in the online project documentation, including some background on
hypertext and many technical notes.

Try it

A prototype (very alpha test) simple line mode browser is currently available
in source form from node  info.cern.ch [currently 128.141.201.74] as

/pub/WWW/WWWLineMode_0.9.tar.Z.

Also available is a hypertext editor for the NeXT using the NeXTStep graphical
user interface, and a skeleton server daemon.

Documentation is readable using www (Plain text of the instalation instructions
is included in the tar file!). Document

http://info.cern.ch/hypertext/WWW/TheProject.html

is as good a place to start as any. Note these coordinates may change with
later releases.

_________________________________________________________________

Tim Berners-Lee                 Tel:    +41(22)767 3755
WorldWideWeb project            Fax:    +41(22)767 7155
C.E.R.N.                        email:  t…@cernvax.cern.ch
1211 Geneva 23
Switzerland

Hidrogeno y estupidez.

julio 23, 2006

The two most common elements in the universe are Hydrogen and stupidity.

Dorothy Nevill

10 nuevas caracteristicas de Eclipse 3.2

julio 5, 2006

Poco a poco voy descubriendo las nuevas caracteristicas que trae el nuevo Eclipse 3.2. Esta vez gracias a un post publicado por ZDNet

1. Refactoring scripts and API-awareness

2. Clean Up Wizard

3. Pervasive filtering support

4. Improved patching support

5. CVS Quick Diff annotations

6. Null reference analysis

7. File system API

8. JFace field assistance

9. Custom draw trees and tables

10. Faster and smaller

Install Tomcat 5.5 en ubuntu

julio 1, 2006

Versions:

  • SDK: 1.5
  • Tomcat: 5.5

Step 1 – Instalar JRE y SDK

Code:
# sudo apt-get install java# java -version javac -help

Paso 2 – Obtener tomcat

Descarga Tomcat 5.5 desde http://jakarta.apache.org/site/downloads/

Descomprime el archivo :

Code:
tar xvfz jakarta-tomcat-5.5.x.tar.gz

N.T: Para hacer las cosas sencillas renombrar el archivo a tomcat Si prefiere no hacer esto sustituye la palabra ‘tomcat’ por ‘tomcat-5-5.x’…

Step 3 – Add tomcat

ruta para descomprimir tomcat :
/usr/local/

Step 4 – Settear JAVA_HOME y el CLASSPATH

Es necesario que JAVA_home apunte a el directorio donde esta instalado java. Para esto editaremos el fichero .bashrc. Guarda primero el archivo antiguo :

Code:
cp ~/.bashrc ~/.bashrc.oldgedit ~/.bashrc

Añadir las siguientes lineas:

File:~/.bashrc
export JAVA_HOME=/usr/lib/j2sdk1.5-sun/

export CLASSPATH=$CLASSPATH:/usr/local/tomcat/common/lib/jsp-api.jar

export CLASSPATH=$:/usr/local/tomcat/common/lib/servlet-api.jar

N.B. remember to change the word tomcat to the name of the package you placed in /usr/local.

Save and close. Es necesario reiniciar la sesion para que los cambio tengan efecto


Los proximos pasos son opcionales. Sirvenpara configurar tomcat como entorno de desarrollo.
Leer el resto de esta entrada »

JUnit : UnitTest con Java

junio 25, 2006

JUnit es el framework mas usado dentro del mundo de Java para el desarrollo de test de unidad.

JUnit is a regression testing framework written by Erich Gamma and Kent Beck. It is used by the developer who implements unit tests in Java. JUnit is Open Source Software, released under the Common Public License Version 1.0.

JUnit.org

 

Los test de unidad nos ayudan a comprobar el correcto comportamiento de nuestro código asi como a detectar fallos tanto de comportamiento como de concepto.

 

It provides a very simple way to express the way you intend your code to work. By expressing your intentions in code, you can use the JUnit test runners to verify that your code behaves according to your intentions.

JUnit : A starter guide

La estructura de un test es básicamente :

  1. Create some objects.
  2. Send those objects some messages.
  3. Verify some assertions.

Aunque su cilco de vida es ligeramente diferente
Recetas :

  1. Básico
    1. Como testear un constructor?
    2. como testear un metodo que no devuelver parametros (void return methods)?
    3. como testear un metodo getter ?
    4. como testear un metodo setter ?
    5. como testear un metodo JavaBean
    6. como testear una metodo interface ?
    7. como testear una metodo exception ?
  2. Mannaging test
    1. Donde colocar todos estos test
    2. Acerca de un "base test case" ?
  3. Automation Test
    1. Porque automatizar nuestros test?
    2. Automatizar los test con Ant ?
    3. Automatizar los test con Cruise Control?
  4. Testing XML
    1. Comparar documentos XML con XMLUnit ?
    2. Como testear una página web estática con XMLUnit ?
    3. Como validar un documento XML durante el testeo ?
  5. Testing web components
    1. Como testear un HTTP Session data ?
    2. Como testear páginas dinámicas y estáticas ?
    3. Como testear un servlet ?
    4. Como testear un JSP ?
  6. Test Design patterns
    1. Como testear un Singleton ?
    2. Como testear un template method ?
    3. Como testear un Factory method ?
  7. Repporting test
    1. Base Test Suite + Log4j ?
  8. Other
    1. Como testear un entorno de instalacion (instalation enviroment) ?

Recursos :

  1. JUnit : the framework
  2. EasyMock : EasyMock provides Mock Objects for interfaces in JUnit tests by generating them on the fly using Java's proxy mechanism.
  3. JMock : Mock is a library for testing Java code using mock objects.
  4. XMLUnit : For those of you who've got into it you'll know that test driven development is great. It gives you the confidence to change code safe in the knowledge that if something breaks you'll know about it. Except for those bits you don't know how to test. Until now XML has been one of them
  5. DBUnit : DbUnit is a JUnit extension (also usable with Ant) targeted for database-driven projects that, among other things, puts your database into a known state between test runs
  6. HTMLUnit : HtmlUnit is a java unit testing framework for testing web based applications. It is similar in concept to httpunit but is very different in implementation. Which one is better for you depends on how you like to write your tests. HttpUnit models the http protocol so you deal with request and response objects. HtmlUnit on the other hand, models the returned document so that you deal with pages and forms and table.
  7. HTTPunit : Written in Java, HttpUnit emulates the relevant portions of browser behavior, including form submission

Referencias :

  1. JUnit : A starter guide : Este es quizas el tutorial mas visitado en internet acerca de JUnit, un buen lugar para comenzar. [1]
  2. Pragmatic Unit Testing : in Java with JUnit : De la famosa serie Pragmatic programmer, starter kit en su segundo volumen nos llega este libro de buenas practicas para el desarrollo de test de unidad en nuestras aplicaciones.
  3. JUnit Recipes : practical methods for programmer testing : Este libro organizado como recetario, trata de enseñarnos como testear los diferentes comportamientos ante los que nos podemos encontrar. Desde como testear un metodo que no devuelve valor, hasta como testear EJB. A si mismo nos enseña diferentes modulos como XMLunit, ServletUnit, EasyMock.
  4. MockObjects wiki : Mock Objects is a test-first development process for building object-oriented software and a generic unit testing framework that supports that process. Mock objects give you: [2]

Desactivar consolar virtuales

junio 7, 2006

En ubuntu tenemos 6 consolas virtuales aprates del modo grafico podemos acceder a ellas pulsando Ctrl+Alt+F1…F6 y salir de llas con Ctrl+Alt+F7, cada consolo suele ocupar entorno a 1 o 2 megas de memoria RAM. Podemos desactivarlas comentando las lineas en el archivo /etc/inittab 

  • 1:2345:respawn:/sbin/getty 38400 tty1
  • 2:23:respawn:/sbin/getty 38400 tty2
  • # 3:23:respawn:/sbin/getty 38400 tty3
  • # 4:23:respawn:/sbin/getty 38400 tty4
  • # 5:23:respawn:/sbin/getty 38400 tty5
  • # 6:23:respawn:/sbin/getty 38400 tty6

El algoritmo Snowball y el stemming.

mayo 29, 2006

Que es el Stemming?
Durante la fase de tratamiento del texo (Tratare sobre esto mas adelante) podemos identificar cuatro fases.

  1. Linealizacion del texto
  2. Tokenizacion del texto
  3. Filtrado de palabras
  4. Stemming

Es de esta ultima de la que voy hablar un poco en esta entrada. En uno de los parrafos de mi futuro diplomarbeiten menciono lo siguiente

One of the problems in vector space models is the heterogeneity of the words. Removing suffixes by automatic means is an operation which is especially useful in this field. In order to maintain all the information together it is necessary to group those words with same lexema and meanings

As we saw before in a typical VSM environment, one has a collection of documents, each described by the words in the document, we can say that a document is represented by a vector of words, or terms. Normally terms with a common stem will have similar meanings, we can see that in the next example.\item Paice/Husk Stemming Algorithm

Exsiten varios algoritmos para hacer stemming :

  1. Paice/Husk Stemming Algorithm \cite{stemming:paice}
  2. Porter Stemming Algorithm \cite{stemming:porter}
  3. Lovins Stemming Algorithm \cite{Lovins68}
  4. Dawson Stemming Algorithm \cite{stemming:dawson}
  5. Krovetz Stemming Algorithm \cite{stemming:krovetz}

Yo me he decantado por el algoritmo de Porter, ya que es el usado por defecto dentro del poryecto Lucene. El algoritmo Snowball es algo asi como la implementación de referencai del proceso de stemming de Porter.

Un sencillo ejemplo para ver que es el stemming (sacado del paper de Porter) :

Palabra –> Stemm –> sufijo
CONNECT –> CONNECT –> no tiene
CONNECTED –> CONNECT –>ED
CONNECTING –> CONNECT –> ING
CONNECTION –> CONNECT & ION
CONNECTIONS –> CONNECT –> IONS

Crear un proyecto con Subversion

mayo 28, 2006

Estos son los pasos que he seguido para crear un proyecto usando Subversion:

PAra empezar hay que instalar subversion, subversion tiene diferentes dependencias, ya que para poder utilizar subversion tendremos que tener instalado Apache 2

apt-get install subversion

Como nota hay que tener cuidado si tienes instalado ya un servidor apache 1 ya que puede dar problemas que amis escuchen por el puero 80.

sudo mkdir /var/svn
sudo mkdir /var/svn/YourProjectNameHere
sudo mkdir /tmp/YourProjectNameHere
sudo mkdir /tmp/YourProjectNameHere/branches
sudo mkdir /tmp/YourProjectNameHere/tags
sudo mkdir /tmp/YourProjectNameHere/trunk
sudo svnadmin create /var/svn/YourProjectNameHere
sudo svn import /tmp/YourProjectNameHere file:///var/svn/YourProjectNameHere -m "initial import"

y ahora comprobamos que todo ha ido bien :

svn checkout file:///var/svn/YourProjectNameHere project

Para arrancar el servicio en modo demonio :

svnserve -d -r /srv/svn/

Para modificar los permisos hay que tocar los fichero /var/svn/YourProjectNameHere/conf/svnserve.conf y para incluir usuarios autentificados /var/svn/YourProjectNameHere/conf/passwd

Citando a la wikipedia

mayo 17, 2006

Supongo que como todo el mundo antes o despues hemos ido a parar a la wikipedia. Sin duda uno de los grandes desafios de la inteligencia/creación colectiva, de los movimientos por una cultura libre y del moviento copyleft.

Pues llegado a este punto a uno le surge la duda como debe citarse una página en la wikipedia, pues segun ellos mismos uno debe (o puede) seguir unas ciertas pautas. Para los amantes de BibTeX (como yo) proponen una plantilla como la que sigue.

@misc{ wiki:###,
author = "Wikipedia",
title = "Plagiarism — {W}ikipedia{,} The Free Encyclopedia",
year = "2004",
url = "http://en.wikipedia.org/……=5139350&quot;,
note = "[Online; accessed 22-July-2004]"
}

When using the LaTeX package url (\usepackage{url} somewhere in the preamble) which tends to give much more nicely formatted web addresses, the following may be preferred:

@misc{ wiki:###,
author = "Wikipedia",
title = "Plagiarism — {W}ikipedia{,} The Free Encyclopedia",
year = "2004",
url = "url{http://en.wikipedia.org/w/…….=5139350}",
note = "[Online; accessed 22-July-2004]"
}

Pero Jimmy Wales opina algo sorprendete

"Do you think students and researchers should cite Wikipedia?"

"No, I don't think people should cite it, and I don't think people should cite Britannica, either — the error rate there isn't very good. People shouldn't be citing encyclopedias in the first place. Wikipedia and other encyclopedias should be solid enough to give good, solid background information to inform your studies for a deeper level. And really, it's more reliable to read Wikipedia for background than to read random Web pages on the Internet."

Aquí queda eso, quien quiera entender que entienda.


Seguir

Recibe cada nueva publicación en tu buzón de correo electrónico.