Menú

Mostrar Mensajes

Esta sección te permite ver todos los mensajes escritos por este usuario. Ten en cuenta que sólo puedes ver los mensajes escritos en zonas a las que tienes acceso en este momento.

Mostrar Mensajes Menú

Mensajes - Mitsu

#71
Help > Check for Updates. Allí te informará si hay actualizaciones disponibles para plugins instalados o para la plataforma.
#72
Creo que es un bug, hace tiempo cuando recién empezaba me sucedió, hasta que me decidí a aprender los layouts y hacer mis GUI a mano. Que versión de WBuilder y de Eclipse estás usando? ¿Has probado con Eclipse Kepler y a instalar el plugin en su última versión? Si no, no te queda más que arrastrar los componentes o hacerlo a mano (te recomiendo ésto, aprenderás 'de verdad').

Salu2.
#73
Java / Re: JAVA Como Refrescar JTable
19 Marzo 2014, 18:51 PM
Hmm ese log no ayuda en nada. Lo que tienes aquí es un problema de nullabilidad de algún objeto, es decir, algún objeto no ha sido inicalizado y estás tratando de acceder a él. Si tienes un NullPointerException en el catch colócalo y vuelve a probar para ver si te da un rastreo de pila más específico.
#74
Java / Re: JAVA Como Refrescar JTable
19 Marzo 2014, 18:07 PM
Necesito el rastreo completo de pila no solamente el tipo de excepción. En el rastreo de pila te indica la causa, y la posible línea que lanza la excepción. Es muy importante el análisis de excepciones.

El rastreo de pila es parecido a ésto:

Código (=java) [Seleccionar]

    Exception in thread "main" org.hibernate.exception.SQLGrammarException: could not execute statement
    at org.hibernate.exception.internal.SQLStateConversionDelegate.convert(SQLStateConversionDelegate.java:123)
    at org.hibernate.exception.internal.StandardSQLExceptionConverter.convert(StandardSQLExceptionConverter.java:49)
    at org.hibernate.engine.jdbc.spi.SqlExceptionHelper.convert(SqlExceptionHelper.java:125)
    at org.hibernate.engine.jdbc.spi.SqlExceptionHelper.convert(SqlExceptionHelper.java:110)
    at org.hibernate.engine.jdbc.internal.ResultSetReturnImpl.executeUpdate(ResultSetReturnImpl.java:136)
    at org.hibernate.engine.jdbc.batch.internal.NonBatchingBatch.addToBatch(NonBatchingBatch.java:58)
    at org.hibernate.persister.entity.AbstractEntityPersister.insert(AbstractEntityPersister.java:3067)
    at org.hibernate.persister.entity.AbstractEntityPersister.insert(AbstractEntityPersister.java:3509)
    at org.hibernate.action.internal.EntityInsertAction.execute(EntityInsertAction.java:88)
    at org.hibernate.engine.spi.ActionQueue.execute(ActionQueue.java:377)
    at org.hibernate.engine.spi.ActionQueue.executeActions(ActionQueue.java:369)
    at org.hibernate.engine.spi.ActionQueue.executeActions(ActionQueue.java:286)
    at org.hibernate.event.internal.AbstractFlushingEventListener.performExecutions(AbstractFlushingEventListener.java:339)
    at org.hibernate.event.internal.DefaultFlushEventListener.onFlush(DefaultFlushEventListener.java:52)
    at org.hibernate.internal.SessionImpl.flush(SessionImpl.java:1234)
    at org.hibernate.internal.SessionImpl.managedFlush(SessionImpl.java:404)
    at org.hibernate.engine.transaction.internal.jdbc.JdbcTransaction.beforeTransactionCommit(JdbcTransaction.java:101)
    at org.hibernate.engine.transaction.spi.AbstractTransactionImpl.commit(AbstractTransactionImpl.java:175)
    at pe.edu.unp.dao.LibroDAOI.guardar(LibroDAOI.java:39)
    at pe.edu.unp.biblioteca.Biblioteca.main(Biblioteca.java:18)
    Caused by: org.postgresql.util.PSQLException: ERROR: column "titul" of relation "libro" does not exist // AQUI LA CAUSA DE LA EXCEPCION!
     Position: 79
    at org.postgresql.core.v3.QueryExecutorImpl.receiveErrorResponse(QueryExecutorImpl.java:2161)
    at org.postgresql.core.v3.QueryExecutorImpl.processResults(QueryExecutorImpl.java:1890)
    at org.postgresql.core.v3.QueryExecutorImpl.execute(QueryExecutorImpl.java:255)
    at org.postgresql.jdbc2.AbstractJdbc2Statement.execute(AbstractJdbc2Statement.java:559)
    at org.postgresql.jdbc2.AbstractJdbc2Statement.executeWithFlags(AbstractJdbc2Statement.java:417)
    at org.postgresql.jdbc2.AbstractJdbc2Statement.executeUpdate(AbstractJdbc2Statement.java:363)
    at org.hibernate.engine.jdbc.internal.ResultSetReturnImpl.executeUpdate(ResultSetReturnImpl.java:133)
    ... 15 more
    Java Result: 1



PD: Primero tienes que agregar el modelo a la tabla, y a partir de ahí agregar los datos al modelo. Primero agrega un DefaultTableModel a tu tabla, y luego modifica el método refrescarDatos() para que reciba el modelo y le agregue las filas. Puede ser por esto que te lanza el NullPointerException.
#75
Java / Re: JAVA Como Refrescar JTable
19 Marzo 2014, 17:47 PM
Hola,

Para poder brindar una mejor ayuda, por favor etiqueta tu código entre etiquetas GeSHi y coloca el rastreo de pila que te arroja printStackTrace().

Saludos.
#76
En SOF dicen que tienes que abrir el fichero en 'modo anexado'. Esto se con el constructor de FileWriter:

Código (=java) [Seleccionar]

FileWriter(File archivo, boolean anexado)


UPDATE

Aquí les dejo la clase utilitaria por si le es de utilidad al autor del post o a alguien más. Permite agregar un nuevo cliente, buscar un cliente por NIF y obtener todos los clientes.

Código (=java) [Seleccionar]

package pe.edu.unp.util;

import java.io.BufferedReader;
import java.io.BufferedWriter;
import java.io.File;
import java.io.FileNotFoundException;
import java.io.FileReader;
import java.io.FileWriter;
import java.io.IOException;
import java.math.BigDecimal;
import java.util.ArrayList;
import java.util.List;

import pe.edu.unp.beans.Cliente;

public class FileUtil {

public static boolean agregarCliente(String ruta, Cliente cliente) throws IOException, FileNotFoundException {
File archivo = null;
BufferedWriter escritor = null;
boolean exito = false;
String nif = null;
String nombre = null;
BigDecimal deuda = null;

try {
archivo = new File(ruta);
escritor = new BufferedWriter(new FileWriter(archivo.getAbsolutePath(), true));
// recupera los nuevos datos
nif = cliente.getNif();
nombre = cliente.getNombre();
deuda = cliente.getDeuda();
escritor.write(nif+"|"+nombre+"|"+deuda.toString());
escritor.flush(); // limpia el flujo
exito = true;
} catch (IOException ex) {
throw ex;
} finally {if(escritor != null) escritor.close();} // cierra el flujo

return exito;

}

public static Cliente buscarClientePorNif(String nif, String ruta) throws IOException {
File archivo = null;
BufferedReader lector = null;
Cliente clienteEncontrado = null;
boolean encontrado = false;

try {
archivo = new File(ruta);
lector = new BufferedReader(new FileReader(archivo));
String linea = null;
while( (linea = lector.readLine()) != null) {
String[] datos = linea.split("\\|"); // tokeniza la linea
if(nif.equals(datos[0]) ) {// si el nif dado coincide con el cliente actual
BigDecimal deuda = BigDecimal.valueOf(Double.valueOf(datos[2]));
clienteEncontrado = new Cliente(datos[0],datos[1],deuda);
encontrado = true; // cliente fue encontrado
}
}
} catch (IOException ex) {
throw ex;
} finally { if(lector != null) lector.close(); /* cierra el flujo*/ }

if(encontrado) return clienteEncontrado;
else return null;

}

public static List<Cliente> obtenerAllClientes(String ruta) throws IOException {
List<Cliente> lista = new ArrayList<>();

File archivo = null;
BufferedReader lector = null;

try {
archivo = new File(ruta);
lector = new BufferedReader(new FileReader(archivo));
String linea = null;
while( (linea = lector.readLine()) != null) {
String[] datos = linea.split("\\|"); // tokeniza la linea
BigDecimal deuda = BigDecimal.valueOf(Double.valueOf(datos[2]));
lista.add(new Cliente(datos[0],datos[1],deuda));
}
} catch (IOException ex) {
throw ex;
} finally { if(lector != null) lector.close(); /* cierra el flujo*/ }

if(lista.isEmpty()) return null;
else return lista;

}

}
#77
Java / Re: Ver pantalla de ordenador
18 Marzo 2014, 22:00 PM
Que te vaya bien en tus estudios ^^ Salu2.
#78
Java / Re: No encuentro el error
18 Marzo 2014, 21:59 PM
¿No te ha lanzado la causa: Caused By: ? Allí te indica la línea espcecífica en donde el rastreo de pila detecto que se lanzó la excepción.

La excepción es NullPointerException, éste tipo de excepciones se lanzan cuando se está intentado acceder a propiedades u objetos que aún no han sido inicializados. Cuando no instancias un objeto o propiedad, su valor es nulo (no apunta a nada).

Supongamos que tenemos una clase Carro:
Código (=java) [Seleccionar]

public class Carro {
private int numeroLlantas;
private String color;

public Carro() {}
public Carro(int numeroLlantas, String color) {
this.numeroLlantas = NumeroLlantas;
this.color = color;
}

public int getNumeroLlantas() {
return numeroLlantas;
}

public String getColor() {
return color;
}

// setters

}


E intentáramos acceder a la propiedad color, tendríamos una excepción de tipo NullPointerException, ya que hemos intentado acceder a una propiedad que no ha sido inicializada:

Código (=java) [Seleccionar]

Carro micarro = new Carro();
String color = micarro.getColor(); // NullPointerException



Trata de poner el código completo que te lanza printStackTrace(), allí generalmente dice CausedBy y te indica la causa, la clase y en qué linea se ha lanzado la excepción. Salu2.

Ejemplo:
Código (=java) [Seleccionar]

Exception in thread "main" org.hibernate.exception.SQLGrammarException: could not execute statement
at org.hibernate.exception.internal.SQLStateConversionDelegate.convert(SQLStateConversionDelegate.java:123)
at org.hibernate.exception.internal.StandardSQLExceptionConverter.convert(StandardSQLExceptionConverter.java:49)
at org.hibernate.engine.jdbc.spi.SqlExceptionHelper.convert(SqlExceptionHelper.java:125)
at org.hibernate.engine.jdbc.spi.SqlExceptionHelper.convert(SqlExceptionHelper.java:110)
at org.hibernate.engine.jdbc.internal.ResultSetReturnImpl.executeUpdate(ResultSetReturnImpl.java:136)
at org.hibernate.engine.jdbc.batch.internal.NonBatchingBatch.addToBatch(NonBatchingBatch.java:58)
at org.hibernate.persister.entity.AbstractEntityPersister.insert(AbstractEntityPersister.java:3067)
at org.hibernate.persister.entity.AbstractEntityPersister.insert(AbstractEntityPersister.java:3509)
at org.hibernate.action.internal.EntityInsertAction.execute(EntityInsertAction.java:88)
at org.hibernate.engine.spi.ActionQueue.execute(ActionQueue.java:377)
at org.hibernate.engine.spi.ActionQueue.executeActions(ActionQueue.java:369)
at org.hibernate.engine.spi.ActionQueue.executeActions(ActionQueue.java:286)
at org.hibernate.event.internal.AbstractFlushingEventListener.performExecutions(AbstractFlushingEventListener.java:339)
at org.hibernate.event.internal.DefaultFlushEventListener.onFlush(DefaultFlushEventListener.java:52)
at org.hibernate.internal.SessionImpl.flush(SessionImpl.java:1234)
at org.hibernate.internal.SessionImpl.managedFlush(SessionImpl.java:404)
at org.hibernate.engine.transaction.internal.jdbc.JdbcTransaction.beforeTransactionCommit(JdbcTransaction.java:101)
at org.hibernate.engine.transaction.spi.AbstractTransactionImpl.commit(AbstractTransactionImpl.java:175)
at pe.edu.unp.dao.LibroDAOI.guardar(LibroDAOI.java:39)
at pe.edu.unp.biblioteca.Biblioteca.main(Biblioteca.java:18)
Caused by: org.postgresql.util.PSQLException: ERROR: column "titul" of relation "libro" does not exist // AQUI LA CAUSA DE LA EXCEPCION!
  Position: 79
at org.postgresql.core.v3.QueryExecutorImpl.receiveErrorResponse(QueryExecutorImpl.java:2161)
at org.postgresql.core.v3.QueryExecutorImpl.processResults(QueryExecutorImpl.java:1890)
at org.postgresql.core.v3.QueryExecutorImpl.execute(QueryExecutorImpl.java:255)
at org.postgresql.jdbc2.AbstractJdbc2Statement.execute(AbstractJdbc2Statement.java:559)
at org.postgresql.jdbc2.AbstractJdbc2Statement.executeWithFlags(AbstractJdbc2Statement.java:417)
at org.postgresql.jdbc2.AbstractJdbc2Statement.executeUpdate(AbstractJdbc2Statement.java:363)
at org.hibernate.engine.jdbc.internal.ResultSetReturnImpl.executeUpdate(ResultSetReturnImpl.java:133)
... 15 more
Java Result: 1
#79
Java / Re: No encuentro el error
18 Marzo 2014, 21:04 PM
Hola,

Cuando crees algún tema, coloca el código entre etiquetas Geshi (en el editor ahí hay puedes cambiar el coloreado de código). Hazlo porque nadie se va a molestar en leer tu código en ese estado. Hazlo para poder ayudarte.

¿Qué excepción lanza? Realiza un printStackTrace() y pega lo que te arroja para ver cuál es el posible problema, o quieres decir que el spellchecking te da error en la línea 39 y no te deja compilar?

Si es lo primero, ya sabes qué hacer, si es lo segundo, pon aquí el mensaje del error que marca.

Salu2
#80
Desarrollo Web / Re: Presentacion + Duda web
18 Marzo 2014, 17:59 PM
Hola bienvenido al foro, para todo sitio o aplicación web necesitas:


  • Un lenguaje de lado del servidor. En tu caso ya has estudiado PHP, así que sigue con él.
  • Un servidor. Mayormente los que trabajan con PHP suelen usar Apache.
  • Un motor para bases de datos: Ej. PostgreSQL, MySQL, SQLServer, Oracle, MariaDB, etc.
  • Un administrador de bases de datos. Si trabajas con PHP, está phpmyadmin.
  • HTML5 si deseas.
  • Diseño de imágenes y diseño web (CSS).
  • Y la más importante, ingenio, investigación y buena programación.

Primero, toma como referencia otros sitios/aplicaciones, investiga para que tengas una idea clara de lo que quieres hacer y la estructura que tendrá tu sitio/aplicación. Luego realizas tus alogirtmos, unas pruebas, y empiezas a programar. Lo de algoritmos algunos lo usan otros no, algunos programan directamente mientras van pensando en cómo será la base del proyecto, a mí me gusta primero tener una base sobre la cual establecer la base de mi proyecto y luego programarla, para evitar mayores errores. Suerte y salu2.