Este es un post muy pequeño, pero creo que es absolutamente necesario. ¿Qué desarrollador web no requiere tener en su Linux un Apache, con MySQL y PHP?

Bueno, pues la forma que me ha resultado ser la mas rápida y fácil es:

sudo apt-get install lamp-server^

Simple, ¿no?

Hasta la próxima…

Atte,
Goose

PD El símbolo ^ es completamente necesario. NO olviden ponerlo…

Lo siguiente es lo que requerimos para iniciar un desarrollo WEB pequeño con Java:

Bajar e instalar MySQL (Yo uso el 5.5.11 de 64 bits mide 28.7 megas)


Bajar e instalar el JDK (Yo uso el 1.6.0.23 para 64 bits)
No olvidar crear la variable de ambiente JAVA_HOME y agregar al path JAVA_HOME/bin


Bajar e “instalar” Maven
Digo “instalar” porque es un ZIP (de menos de 3 Megas) y sólo hay que:

1) descompactarlo en una ubicación que de preferencia NO tenga espacios
2) crear variable de ambiente M2_HOME y 
3) agregar M2_HOME/bin al path del sistema

Bajar e “instalar” Tomcat 7 (yo uso el 7.0.12 de 64 bits) (http://tomcat.apache.org/download-70.cgi)
Digo “instalar” porque es un ZIP (de menos de 8 Megas) y sólo hay que:

1) descompactarlo en una ubicación que de preferencia NO tenga espacios

Bajar e instalar Eclipse (yo uso el Helios de 64 bits) (http://www.eclipse.org/downloads/)
Digo instalar (sin colimmas) porque es un ZIP (de mas de 200 Megas) y:

1) hay que descompactarlo en una ubicación que de preferencia NO tenga espacios
2) hay que indicarle qué jdk va a usar (ver post de instalación de Eclipse)

Cargar en Eclipse el plugin de Maven
Cargar en Eclipse el plugin de TestNG
Cargar en Eclipse el plugin de SVN
Cargar en Eclipse el plugin de Cobertura


Dar de alta a Tomcat en Eclipse (Window > Preferences > Server > Runtime environment Add…)

1) Apache Tomcat 7, Next
2) Tomcat installation directory: ...
3) JRE: jdk1.6.0_23
4) Finish, Ok

Alternativamente, también es posible hacer lo siguiente:

1) Abrir la pestaña de servers (click en el ícono de "Show view as a fast view" que está en la esquina inferior izquierda del IDE)
2) Click con el botón derecho en el área en blanco y selccionar "New > Server"
3) Seleccionar o crear la configuración deseada

Pronto daré instrucciones mas detalladas de cómo llevar a cabo cada una de estas instalaciones….

Saludos, Goose

Cercano al paralelo 0, a 31 bajo cero, la vida puede resultar ser… interesante.

Desde lejos, para apreciar el paisaje

Me puede indicar dónde hay un McDonalds, por favor?

Un Close-up… (Pa’ que se vea la cara)

Pa' que se vea la cara

Quieren un hielito pa su chesco?

Home… Sweet AND warm home…

A casita... con un chocolate calientito....

Querías nieve de limón? Bájala del techo y píntala de verde...

Fotos que acabo de encontrar en un baúl viejo de hace mas de 10 años, cuando me mandaron (de castigo?) al Fort Wainwright (durante 2 largos meses) como chalán de apoyo al equipo de desarrollo de aplicativos de misión crítica en el Centro de Exploración de Yacimientos Petrolíferos en AK

MyEclipse es un gran IDE. Realmente no tengo queja acerca de él. Tal vez pudiera ser un poco pesado para levantar y en si, trabajar con él, pero en general, es de lo mejor con lo que he trabajado.

Por otro lado, en diversos cursos que he dado, los participantes sugieren el uso de Eclipse dado que es completamente gratuito y un poco mas ligero que MyEclipse. Personalmente, creo que todo lo que ya trae MyEclipse, hace la vida mucho mas sencilla, siendo muy fácil agregar nuevos extras (plug-ins) y claro, esto sin considerar los que ya trae por default.

Dicho lo anterior, me di a la tarea de instalar Eclipse en mi máquina, pero no sin antes sufrir unos cuantos sinsabores que en este espacio expongo, por si alguien decide hacer lo mismo.

1) Hay que bajar el bundle de instalación. Este es un archivo ZIP de tamaño mediano: 206 Megas desde el sitio de descargas de Eclipse: http://www.eclipse.org/downloads/

Aqui es importante mencionar que la versión se satisface mis requerimientos es la versión “Java EE Developers”, que en mi caso fué la de 64 bits, dado que tengo un sistema opertivo de 64 bits y aunque me es posible correr la versión de 32 bits, deseo sacarle el mayor provecho a mi sistema.

2) Desempaqueté el ZIP en una ubicación que elegí previamente. Puede ser en cualquier lugar del disco, pero tomé una trayectoria sin espacios.

Aqui los valioso de mencionar es que al hacer doble click sobre el ícono del ejecutable, éste NO corrió. Tardé poco en darme cuenta de que tenía que hacer una pequeña modificación en el archivo eclipse.ini, ya que Eclipse NO encontraba la ruta de mi JDK.

3) Abrí el archivo eclipse.ini que originalmente contenía el siguiente texto:

 

-startup
plugins/org.eclipse.equinox.launcher_1.1.1.R36x_v20101122_1400.jar
--launcher.library
plugins/org.eclipse.equinox.launcher.win32.win32.x86_64_1.1.2.R36x_v20101222
-product
org.eclipse.epp.package.jee.product
--launcher.defaultAction
openFile
--launcher.XXMaxPermSize
256M
-showsplash
org.eclipse.platform
--launcher.XXMaxPermSize
256m
--launcher.defaultAction
openFile
-vmargs
-Dosgi.requiredJavaVersion=1.5
-Xms40m
-Xmx512m

Lo modifiqué para que quedara de la siguiente manera:

-startup
plugins/org.eclipse.equinox.launcher_1.1.1.R36x_v20101122_1400.jar
--launcher.library
plugins/org.eclipse.equinox.launcher.win32.win32.x86_64_1.1.2.R36x_v20101222
-product
org.eclipse.epp.package.jee.product
--launcher.defaultAction
openFile
-vm
/home/goose/development/Java/jdk1.6.0_23/bin/java
-showsplash
org.eclipse.platform
--launcher.XXMaxPermSize
256m
--launcher.defaultAction
openFile
-vmargs
-Dosgi.requiredJavaVersion=1.6
-Xms40m
-Xmx512m

Y como podrán observar, lo relevante está en las líneas siguientes:

-vm
/home/goose/development/Java/jdk1.6.0_23/bin/java

Que indican a Eclipse dónde se encuentra la JVM

Con lo anterior, ya no hubo ningún problema al ejecutar Eclipse e inicié con la exploración del mismo, que relataré en posteriores entradas. Así que… esperen lo que viene!

Saludos,

Goose

 

PD Se me olvidadba mencionar que algo SUPER importante es considerar que, si instalaron el Eclipse de 64 bits, entonces la trayectoria de la máquina virtual DEBE apuntar a un JDK de 64 bits. De otra manera, El Eclipse NO VA A ARRANCAR. Obviamente pasa lo mismo con un Eclipse de 32 bits. Éste requerirá de un JDK de 32 bits. Ahora si…. Hasta pronto!!!

Para bajar un JDK adecuado a su sistema, visiten:

http://www.oracle.com/technetwork/java/archive-139210.html

Tal y como el título lo indica, a continuación voy a republicar una página que encontré en donde aparece una gran lista de herramientas para modelado de UML que originalmente publicó una persona de nombre Michael W. Godfrey.

La dirección original de publicación es: http://plg.uwaterloo.ca/~migod/uml.html



My Little UML (Tools) Page

Background and Context

I (and others) teach a course in software requirements at the University of
Waterloo. For Fall 1999, we switched notations from OMT to UML, and we
went looking for a reasonable UML tool. We had been using Software Through
Pictures (OMT version) but we were unhappy with its reliability and general
usability.

Our primary requirements for the new UML tool were

  • that it should support most UML analysis diagrams (class, use-case,
    collaboration, sequence, and activity),
  • that it be easy to use, reliable, scalable,
  • that it be free or almost free to universities, and
  • that there be a free-ish Windows and/or Linux version that students may
    install on their home machines.

Second-tier requirements included that the tool should run on our Solaris
boxes, since we have relatively few PCs running Windows. We found that
some of the tools below have Unix ports, while others are “pure Java”.

We did not require support for features that many CASE tools
provide, such as UML design diagrams, or for reverse engineering or code
generation. All of these factors bear on the comments below. Your mileage
may vary depending on your own requirements!

Disclaimer
The views on this page are personal opinions. I have not accepted and will
not accept money, favours, or similar rewards for comments on any tool
mentioned on this page. Some of the vendors below have given me free
versions of their software to try out, but that’s it.

 

What tools do *I* use?

Currently (summer 2005), I use OmniGraffle for simple UML diagrams, and I
use MagicDraw for more complex diagrams, where the underlying model needs
to be represented explicitly.

Some open source tools

  • Modelling tools:
    • Gaphor, a GPL modelling tool written in Python using GTK+ (and so will run on *nix, MacOS, and Windows with Python and GTK+ installed). Currently [June 2007], it supports class, component, action/activity, and use case diagrams, with sequence and collaboration diagrams coming “soon”. The tool emphasizes drawing UML diagrams, rather than application generation.
    • Umbrello, a GPL modelling
      tool that looks interesting, tho I have taken it for only a short test
      drive. Runs under (requires) KDE and Linux. Also supports code
      generation as well as reverse engineering (code to UML) for C++ and
      Java. Their grand goal is “to reach a deep integration with other KDE
      development tools to create an unique development platform”.
    • Astade is aimed at aiding in
      autogenerating C++ source from UML models. It is meant to be practical
      rather than research oriented. Currently, it can serve as a front end
      to GCC. It is early days in its development as of November 2005. An
      installer is available for MS-Windows, or you can compile up the
      sources yourself under Linux.
    • FUJABA (the
      rather unlikely acronym stands for Forward Unto Java And Back Again),
      supports both reverse engineering of and code generation for Java
      systems. It’s a research system (released under the LGPL), that
      supports UML class and behavioural diagrams. Disclaimer: Some of the
      past and present FUJABA project members are pals of mine (Hi Jens,
      Albert, Jörg). 
    • ArgoUML, a free research
      modelling tool; fairly fully featured; the main goal is to have a
      Really Useful user interface, unlike almost all existing CASE tools;
      there are some nice UI ideas in here; I encourage you to take it for a
      test drive and consider joining in on the development. Note that there
      is a commercial version of this tool that goes by the name Poseidon and
      is marketed by a Gentleware;
      they offer a free community edition as well as fancier editions that
      cost real money. 
    • Coral is an open source
      research-based modelling and meta-modelling tool, from �bo Akademi
      University in Finland. It can be used to develop new modeling
      languages or as a platform to construct other modelling tools. It
      implements OMG standards such as MOF and UML into an extensible
      framework that can be customized to a final application. 
  • Drawing tools:
    • DIA, a freeware/GPL
      multiplatform (!!) drawing tool based on GTK; supports UML and other
      kinds of diagrams; this is intended to be a freeware Visio-like drawing
      tool rather than a modelling tool; I have a few UI quibbles, but
      overall this looks like a very nice drawing tool; DIA now comes
      standard with many Linux distributions. There are now also
      easy-to-install versions for Windows and OSX (since the port of GTK to
      those OSs made this possible). [updated Feb 2007]
    • Violet, a very simple GPL
      drawing tool written by Cay Horstmann (who has written many nice books
      on programming in C++ and Java; I’ve used two of them in courses I’ve
      taught). Pretty much all of the comments on UMLet below apply to
      Violet, as it’s pure Java (single jar file) and very simple to
      use/learn. The Violet UI is different tho; try both and see which you
      like more. 

      (Roses are Rational, violets are GNU, … get it? OK in light of
      recent events, I guess that roses are (big) blue now too.)

    • UMLet, a small, very simple, and
      easy-to-use drawing tool (as opposed to a fully fledged modelling tool)
      from the Technical University of Vienna. It’s free for educational and
      non-commerical use. While it’s pure Java, the jar file is so small
      (v1.0 is less than 60K) that it should run well for most people. This
      tool would work very well for classroom use since students can download
      their own copy and it’s so simple (and customizable), there’s no real
      learning curve. This tool will not scale up to heavyweight modelling
      of big systems, but it isn’t meant to. 

Some commercial tools
that support UML diagrams that I’ve at least had a look at
 

  • Modelling tools:
    • MagicDraw, a commercial tool;
      pure Java and will run on Windows / MacOS X and most Unix variants.
      Downloadable free community edition; more expensive editions give
      fancier features. It is very fully featured, and even compliant with
      the latest UML standard, if that matters to you. A nice piece of work. 

      • Update Fall 2004 — UWaterloo has decided to get
        a site license for MagicDraw for use in various courses, including
        the software requirements course I teach sometimes. I’ve been
        using MagicDraw quite a bit recently, and I like it. If you are a
        UWaterloo person, you can download our current licenced version here.
    • IBM Rational Rose, perhaps
      the best known UML tool; free to universities (if you ask), but it has
      a reputation for being awkward and buggy. I have not used it seriously
      since version Rose98i, so your mileage may vary (maybe it’s improved!).
      Rational was been bought by IBM severl years ago, but I’ll bet you knew
      that already. 
    • astah* (formerly known as JUDE) has a free community edition that supports basic UML diagrams. There are also commercial editions: astah* UML supports basic UML diagrams and Mind Map with import/export Java, export C#, C++ functions. astah* professional is a unique system design tool which supports UML, ER Diagram, Flowchart, CRUD, Data Flow Diagram (DFD), Requirement Table and Mind Map. astah* developed in Japan, and supports both English and Japanese. To share diagrams on web browser, astah* share is available. [Updated Oct 2009]
    • Together, a
      commercial tool; pure Java; full version can be had for free for
      academic use; worked well for my limited needs when I tried it out in
      the summer of 2001. At some point since then, the Together suite was
      acquired by Borland. 

      • The comments on this tool are so out of date, that
        my original (correct) link now
        redirects you to a page on Peter Coad’s technique for learning
        biblical Greek.
  • Drawing tools:
    • OmniGraffle
      is a drawing tool that comes bundled with new Macs (at least it
      did in Spring 2005 when I bought my first Powerbook). It’s a drawing
      tool, not a modelling tool, but it does include some UML stencils. I
      have found it to produce the
      nicest
      looking
      UML diagrams of any tool I have tried so far, and it is
      currently my tool of choice for simple UML diagrams (I use MagicDraw
      for more complicated ones). It runs on MacOS X only. A “pro” version
      is available for a little more $$$; the pro version can also be used
      to do Powerpoint-like presenatations (i.e., multi-”canvas”
      documents, not just single diagrams).
    • Visio, designed to
      be a top notch commercial drawing tool, rather than a reverse
      engineering or modelling tool per se. The level of support for UML
      diagrams has varied over the years, depending on which version you
      purchased, so be sure to check out the most recent web page if you are
      interested in using Viso for UML diagrams. Viso was bought out by
      Microsoft in 1999, but you knew that too, right? 

      • It may be possible to add This
        Visio stencil
        to the cheaper versions; that is, the stencil
        lets you draw vanilla pictures that look like UML but doesn’t give
        you fancy cross referencing between diagrams;
  • Cetus (see below also) has
    an excellent page on
    OOA/OOD
    tools
    , including (ahem) a link back to this page. 

Other UML Tools
I haven’t looked at much (because I don’t have time and frankly I doubt I will
anytime soon), but the author/company that made them shamelessly asked me to add
them to my list anyway

No endorsements implied for these tools; I haven’t looked at ‘em seriously.

  • gModeler is, well, a little
    different. It’s a free online tool for drawing UML class diagrams. It’s
    written in FlashMX (!!). I’m not sure how useful it is, but it does have a
    certain “wow that’s cool” factor to it. It runs in any Flash-enabled web
    browser (I used Galeon under Linux).
  • Steve Hanov, currently (March 2007) a graduate student in my department, has created a web-based sequence diagram generator. It takes simple textual input and creates a sequence diagram you can snarf. The service is free, but the project is not open source.
  • Rhapsody (by
    iLogix, an OMG member) is meant to be a competitor
    to Rational Rose, supporting model-driven development and all those
    good things. A 30 day trial download is
    available
    . They also appear interested in university licences. 
  • Modelistic supports UML class
    diagrams only, reverse engineered from Java code. It’s based around
    IBM’s Eclipse platform. The idea
    (they claim) is that you can define your own sets of Java model
    elements, which you then use as filters for controlling how things are
    displayed, and this makes for a powerful Java analysis / visualization
    tool.
  • Visual
    Thought
    is an apparently dead diagramming tool that has been
    released as freeware. It’s meant to be a competitor to, say, Visio but
    specializing in software diagrams. 
  • EclipseUML from Omondo is a
    visual modelling tool for Java, natively integrated with Eclipse and
    CVS. It implements all UML diagrams. They claim to support model
    driven development using live bidirectional code and model
    synchronisation, database and J2EE. They have a stripped-down free
    version and a time-limited fully featured version for download. 
  • UMLStudio is a commercial tool
    supporting UML and other notations (including user-defined ones). It
    supports code generation and reverse engineering of C++ and Java. 
  • SmartDraw is meant to be a
    competitor for Visio (i.e., it’s a drawing tool rather than a
    modelling tool). It appears only the most expensive Pro version will
    support UML, tho the company indicated to me that they might be willing
    to do a special deal for universities. It runs on Win32 platforms
    only. 
  • MetaEdit+, which seems like
    it is a “forward” engineering tool for editing design of methods. It
    claims to be both a CASE and a meta-CASE tool in that you can plug in
    your own subcomponenets. It supports UML plus several other notations.
    It runs on Win32 and several Unices, and the Linux version is “free for
    non-commercial use” (October, 2003)

  • Select Component Architect
    specializes in UML support to aid in
    component-based design (CBD) and business system design. Apparently,
    this tool suite has been around for over 10 years; previous names
    include Select Enterprise and Select OMT Professional (August
    2003)
    .
  • Visual Paradigm for the
    Unified Modeling Language
    (VP-UML) is a UML CASE suite that
    supports Java code generation; as of Jan 2002, a free beta is
    available.
  • EctoSet Modeller,
    according to its developer, is a Windows-based UML tool with scripting
    for forward engineering. Scripts are provided for generating Delphi,
    C++Builder, Java and VB code. Available in Professional and Standard
    versions, plus a free read-only viewer.

  • ProxyDesginer
    by ProxySource.com is a free
    PC-based tool for creating and sharing UML software designs.
  • JVision is a commercial tool
    intended to help reverse engineer (and then presuambly re-engineer)
    Java source code libraries into UML diagrams; demo downloadable. 
  • iUML from Kennedy-Carter claims “Intelligent
    support for Executable UML”
    and runs on NT and Unix. A free “lite”
    version is available.
  • Embarcadero
    Describe
    , a commercial tool formerly known as GDPro.
  • WithClass is “a UML tool that runs under Windows (supports C++,
    Delphi, Java, VB, IDL)”
    from MicroGold
  • WinA&D
    and MacA&D
    from Excel Software claim to
    be the only fully compliant UML tools for both Win and Mac platforms;
    their translator tools can generate UML class models from C++, Java or
    Object Pascal.
  • HAT (HOORA
    Analysis Tool)
    provides support for UML using the HOORA process,
    and claims to support Rose model imports, automatic diagrams (static
    model, dynamic model, package summary), requirements management and
    traceability, hierarchy support, dictionary support, Word documentation
    generation, C++ code generation, COM interface, and more. 
  • ObjectDomain a commercial
    tool; claims to support full UML; written in pure Java; demo
    downloadable.
  • Visual UML, a commercial
    tool.

CASE Graveyard

The following UML tools seem to have died.

  • SequenceSketcher is a MacOS-X
    application for drawing sequence diagrams only.
  • Object Technology Workbench
    according to their website, this tool provides “round-trip
    engineering and code generation, and integrates visual modeling into
    the entire development process.”
    Win32 platforms only [the tool seems to
    have died while the website lives on as a consulting group]
  • Object Engineering Workbench, or OEW,
    a commercial tool; modelling tool seems to be freely downloadable but
    extra features cost real money; all UML diagrams are supported in the
    free version; UI not as good as Rose but supports more of UML
  • FreeCASE, a freeware OO
    CASE tool that seems to be in very early development

Selected Feedback on
this page

  • … can be found here.

Some more UML
information


 


Michael W. Godfrey PhD, Associate Professor,

David R. Cheriton School of Computer Science,
University of Waterloo

Waterloo, Ontario, N2L 3G1, CANADA

Tel. +1 (519) 888-4567 ext. 34437, FAX +1 (519) 885-1208

Office: DC2340

email:

URL: http://www.uwaterloo.ca/~migod


 

Tal vez sea un comentario muy chico y muy simple, pero me ha resultado ser extremadamente útil:

du -h –max-depth=1 | sort -n

Espero que a alguien mas le sirva.

Saludos,
Goose

La idea de este post es mostrar paso a paso cómo trabajar con una relación muchos a muchos en hibernate. Para ese ejercicio, uso annotations, por lo tanto deben de asegurarse de usar una versión de hibernate que las soporte.

Bueno, dicho lo anterior, vamos a suponer que tenemos una base de datos llamada pbaHiber en algún DBMS (en mi caso, MySQL).

El siguiente script puede servirles de utilidad para no teclear tanto:

create database pbaHiber;

create table alumnos (
  id int auto_increment primary key,
  nombre varchar(20) not null,
  apPat varchar(20) not null,
  apMat varchar(20)
);


create table materias (
  id int auto_increment primary key,
  nombre varchar(20) not null,
  semestre int not null,
  creditos int not null
);

create table alumnos_materias (
  idAlumno int,
  idMateria int,
  primary key(idAlumno, idMateria)
);

alter table alumnos_materias add constraint fk_alumnos foreign key (idAlumno) references alumnos(id);
alter table alumnos_materias add constraint fk_materias foreign key (idMateria) references materias(id);

insert into alumnos values(null, 'gustavo','arellano','sandoval');
insert into alumnos values(null, 'pantaleon','bringas','turrubiates');

insert into materias values(null, 'mate', 2, 20);
insert into materias values(null, 'ingles', 2, 10);
insert into materias values(null, 'frances', 2, 10);
insert into materias values(null, 'fisica', 2, 20);

insert into alumnos_materias values(1,1);
insert into alumnos_materias values(1,2);
insert into alumnos_materias values(1,4);
insert into alumnos_materias values(2,2);
insert into alumnos_materias values(2,4);

Ahora, en el lado de java, vamos a crear los POJOS asociados. Ojo: serán 4 y no 3 como inicialmente pudiera pensarse:

1) Alumno
2) Materia
3) AlumnoMateria
4) AlumnoMateriaID

Clases mencionadas:



package mx.com.metasoft.pruebas.dto;

import javax.persistence.Column;
import javax.persistence.Embeddable;


@Embeddable

public class AlumnoMateriaId  implements java.io.Serializable {
	private static final long serialVersionUID = 1L;

    // Fields    

	@Column(name="idAlumno", nullable=false)
    private Integer idAlumno;
	
	@Column(name="idMateria", nullable=false)
    private Integer idMateria;


    // Constructors

    /** default constructor */
    public AlumnoMateriaId() {
    }

    /** full constructor */
    public AlumnoMateriaId(Integer idAlumno, Integer idMateria) {
        this.idAlumno = idAlumno;
        this.idMateria = idMateria;
    }

   
    // Property accessors

    public Integer getIdAlumno() {
        return this.idAlumno;
    }
    
    public void setIdAlumno(Integer idAlumno) {
        this.idAlumno = idAlumno;
    }

    public Integer getIdMateria() {
        return this.idMateria;
    }
    
    public void setIdMateria(Integer idMateria) {
        this.idMateria = idMateria;
    }

   public boolean equals(Object other) {
         if ( (this == other ) ) return true;
		 if ( (other == null ) ) return false;
		 if ( !(other instanceof AlumnoMateriaId) ) return false;
		 AlumnoMateriaId castOther = ( AlumnoMateriaId ) other; 
		 
		 return (this.idAlumno == castOther.idAlumno && 
				 this.idMateria == castOther.idMateria);
   }
   
   public int hashCode() {
         int result = 17;
         result = 37 * result + ( getIdAlumno() == null ? 0 : this.getIdAlumno().hashCode() );
         result = 37 * result + ( getIdMateria() == null ? 0 : this.getIdMateria().hashCode() );
         return result;
   }   

}




package mx.com.metasoft.pruebas.dto;

import javax.persistence.AttributeOverride;
import javax.persistence.AttributeOverrides;
import javax.persistence.Column;
import javax.persistence.EmbeddedId;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.Table;


@Entity
@Table(name="alumnos_materias", catalog="pbahiber")
public class AlumnoMateria  implements java.io.Serializable {
	private static final long serialVersionUID = 1L;

    // Fields
	
    @EmbeddedId
    @AttributeOverrides( {
        @AttributeOverride(name="idAlumno", column=@Column(name="idAlumno", nullable=false) ), 
        @AttributeOverride(name="idMateria", column=@Column(name="idMateria", nullable=false) ) } )
    private AlumnoMateriaId id;
    
	@ManyToOne(fetch=FetchType.LAZY)
    @JoinColumn(name="idAlumno", nullable=false, insertable=false, updatable=false)
    private Alumno alumno;
	
	@ManyToOne(fetch=FetchType.LAZY)
    @JoinColumn(name="idMateria", nullable=false, insertable=false, updatable=false)
    private Materia materia;


    // Constructors

    /** default constructor */
    public AlumnoMateria() {
    }

    /** full constructor */
    public AlumnoMateria(AlumnoMateriaId id, Alumno alumno, Materia materia) {
        this.id = id;
        this.alumno = alumno;
        this.materia = materia;
    }
   
    // Property accessors
    public AlumnoMateriaId getId() {
        return this.id;
    }
    
    public void setId(AlumnoMateriaId id) {
        this.id = id;
    }

    public Alumno getAlumno() {
        return this.alumno;
    }
    
    public void setAlumno(Alumno alumno) {
        this.alumno = alumno;
    }

    public Materia getMateria() {
        return this.materia;
    }
    
    public void setMateria(Materia materia) {
        this.materia = materia;
    }

}




package mx.com.metasoft.pruebas.dto;

import java.util.HashSet;
import java.util.Set;

import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.GeneratedValue;
import static javax.persistence.GenerationType.IDENTITY;
import javax.persistence.Id;
import javax.persistence.OneToMany;
import javax.persistence.Table;


@Entity
@Table(name="materias", catalog="pbahiber")
public class Materia  implements java.io.Serializable {
	private static final long serialVersionUID = 1L;

    // Fields    

    @Id @GeneratedValue(strategy=IDENTITY)
    @Column(name="id", unique=true, nullable=false)
    private Integer id;
    
    @Column(name="nombre", nullable=false, length=20)
    private String nombre;
    
    @Column(name="semestre", nullable=false)
    private Integer semestre;
    
    @Column(name="creditos", nullable=false)
    private Integer creditos;
    
    @OneToMany(cascade=CascadeType.ALL, fetch=FetchType.LAZY, mappedBy="materia")
    private Set<AlumnoMateria> alumnoMaterias = new HashSet<AlumnoMateria>(0);


    // Constructors

    /** default constructor */
    public Materia() {
    }

	/** minimal constructor */
    public Materia(String nombre, Integer semestre, Integer creditos) {
        this.nombre = nombre;
        this.semestre = semestre;
        this.creditos = creditos;
    }
    
    /** full constructor */
    public Materia(String nombre, Integer semestre, Integer creditos, Set<AlumnoMateria> alumnoMaterias) {
        this.nombre = nombre;
        this.semestre = semestre;
        this.creditos = creditos;
        this.alumnoMaterias = alumnoMaterias;
    }

   
    // Property accessors
    public Integer getId() {
        return this.id;
    }
    
    public void setId(Integer id) {
        this.id = id;
    }

    public String getNombre() {
        return this.nombre;
    }
    
    public void setNombre(String nombre) {
        this.nombre = nombre;
    }

    public Integer getSemestre() {
        return this.semestre;
    }
    
    public void setSemestre(Integer semestre) {
        this.semestre = semestre;
    }

    public Integer getCreditos() {
        return this.creditos;
    }
    
    public void setCreditos(Integer creditos) {
        this.creditos = creditos;
    }

    public Set<AlumnoMateria> getAlumnoMaterias() {
        return this.alumnoMaterias;
    }
    
    public void setAlumnoMaterias(Set<AlumnoMateria> alumnoMaterias) {
        this.alumnoMaterias = alumnoMaterias;
    }

}





package mx.com.metasoft.pruebas.dto;

import java.util.HashSet;
import java.util.Set;

import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.GeneratedValue;
import static javax.persistence.GenerationType.IDENTITY;
import javax.persistence.Id;
import javax.persistence.OneToMany;
import javax.persistence.Table;


@Entity
@Table(name="alumnos", catalog="pbahiber")
public class Alumno implements java.io.Serializable {
	private static final long serialVersionUID = 1L;
	

    // Fields    

    @Id @GeneratedValue(strategy=IDENTITY)
    @Column(name="id", unique=true, nullable=false)
	private Integer id;
    
    @Column(name="nombre", nullable=false, length=20)
    private String nombre;
    
    @Column(name="apPat", nullable=false, length=20)
    private String apPat;
    
    @Column(name="apMat", length=20)
    private String apMat;
    
    @OneToMany(cascade=CascadeType.ALL, fetch=FetchType.LAZY, mappedBy="alumno")
    private Set<AlumnoMateria> alumnoMaterias = new HashSet<AlumnoMateria>(0);


    // Constructors

    /** default constructor */
    public Alumno() {
    }

	/** minimal constructor */
    public Alumno(String nombre, String apPat) {
        this.nombre = nombre;
        this.apPat = apPat;
    }
    
    /** full constructor */
    public Alumno(String nombre, String apPat, String apMat, Set<AlumnoMateria> alumnoMaterias) {
        this.nombre = nombre;
        this.apPat = apPat;
        this.apMat = apMat;
        this.alumnoMaterias = alumnoMaterias;
    }

   
    // Property accessors
    public Integer getId() {
        return this.id;
    }
    
    public void setId(Integer id) {
        this.id = id;
    }

    public String getNombre() {
        return this.nombre;
    }
    
    public void setNombre(String nombre) {
        this.nombre = nombre;
    }

    public String getApPat() {
        return this.apPat;
    }
    
    public void setApPat(String apPat) {
        this.apPat = apPat;
    }

    public String getApMat() {
        return this.apMat;
    }
    
    public void setApMat(String apMat) {
        this.apMat = apMat;
    }

    public Set<AlumnoMateria> getAlumnoMaterias() {
        return this.alumnoMaterias;
    }
    
    public void setAlumnoMaterias(Set<AlumnoMateria> alumnoMaterias) {
        this.alumnoMaterias = alumnoMaterias;
    }
   
}

Lo siguiente es el archivo de configuración de Hibernate:

<?xml version='1.0' encoding='UTF-8'?>
<!DOCTYPE hibernate-configuration PUBLIC
          "-//Hibernate/Hibernate Configuration DTD 3.0//EN"
          "http://hibernate.sourceforge.net/hibernate-configuration-3.0.dtd">

<hibernate-configuration>

	<session-factory>
		<property name="dialect">
			org.hibernate.dialect.MySQLDialect
		</property>
		<property name="connection.url">
			jdbc:mysql://localhost/pbaHiber
		</property>
		<property name="connection.username">pba</property>
		<property name="connection.password">pba</property>
		<property name="connection.driver_class">
			com.mysql.jdbc.Driver
		</property>
		<property name="myeclipse.connection.profile">
			pbaHiber
		</property>
		<mapping class="mx.com.metasoft.pruebas.dto.Materia" />
		<mapping class="mx.com.metasoft.pruebas.dto.Alumno" />
		<mapping class="mx.com.metasoft.pruebas.dto.AlumnoMateria" />

	</session-factory>

</hibernate-configuration>

Obviamante este último segmento de código es puramente demostrativo. Contiene lo que básicamente será usado y para propósitos demostrativos es suficiente.

En un ambiente real, será necesario usar un pool de conecciones y de preferencia incrustar este código en un archivo de configuración de SPRING.

En próximos posts, detallaré cómo hacer lo anterior para un ambiente de producción real.

Saludos,
Goose

Actualmente estoy usando Apache 2.2.3 (en un CentOS 5.1) Pero creo que esto funcionará mas o menos igual en otras plataformas. La idea es meterle una seguridad básica a un directorio cualquiera. Los pasos son los siguientes:

1) En el archivo httpd.conf hay que crear una sección de la siguiente forma:

[codesyntax lang="xml"]

Alias /private "/www/home/private"
<Directory "/www/home/private/">
    Options Indexes MultiViews
    AllowOverride AuthConfig
</Directory>

[/codesyntax]

 

La trayectoria “/www/home/private” es sólo un ejemplo. Pueden seleccionar otra.

2) Crear un archivo de claves visible para Apache. Lo pueden hacer de la siguiente forma:
cd /www
htpasswd -c goose.claves pedrito

htpasswd pedirá la contraseña, y luego la volverá a pedir para confirmarla.

3) Crear, en el directorio a ser protegido, un archivo llamado .htaccess con la siguinete información:

AuthType Basic
AuthName “Descripción de lo que tengo en este directorio”
AuthUserFile /www/goose.claves
Require user pedrito

(también es posible usar: Require valid-user)

4) Usra chmod a+r con el archivo goose.claves y listo.

Pueden ver una versión mas detallada de esto (en inglés) en la siguiente dirección:
http://www.rahul.net/howto/basicauth.html

Salu2,
Goose

Ojo con el siguiente comando de linux:

wget --wait=20 --limit-rate=20K -k -r -p -U Mozilla http://www.abc.com

Con lo anterior, nos bajamos el sitio www.abc.com “completito”. Las opciones que le pasoamos son las siguientes:

–wait=20 (espera 20 segundos entre cada archivo bajado)
–limit-rate=20K (tamaño máximo de cada archivo)
-r (recursivo en todos los subdirectorios)
-k convierte ligas a locales
-U Mozilla (avisa que se está usando un “browser” tipo Mozilla)

Es muy útil el flag “no parent” usado de esta manera:

wget --mirror --convert-links --adjust-extension --page-requisites 
--no-parent http://example.org

que se puede actortar asi:

wget -mkEpnp http://example.org

Cheers,
Goose

Hola otra vez.

Una excelente opción que nos ofrecen los amigos de jQuery para personalizar los temas que vamos a utilizar en nuestros sitios web, puede ser encontrada en:

http://jqueryui.com/themeroller/

Créanme que realmente vale la pena invertir unos minutos en el estudio de esta fácil herramienta….
Visíten la liga!
No se arrepentirán.

Atte,
Goose

© 2017 Goose Workshop Suffusion theme by Sayontan Sinha