• Viernes 19 de Abril de 2024, 23:40

Mostrar Mensajes

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


Mensajes - nicokiki

Páginas: [1] 2 3 ... 12
1
C/C++ / Re: Capturando Xml En C Cpn La Libxml
« en: Domingo 7 de Agosto de 2005, 18:50 »
Hola!!!

Mira, hace unos meses q no programo en C/C++ pero encontre un ejemplo de uso de libxml2 (bajo Linux) y te lo mando. La verdad es q la funcion q decis no la use, por eso te paso el ejemplo de lo q hice para q t sirva de ayuda en algo:

Antes q nada, perdon por los q lean esto tan largo y por los errores q pude haber hecho y por el coding style q no me gustaaaa

<code>
#include "CXMLParserServidor.h"

//******************************************************
// Constructor de la clase CXMLParserServidor
//******************************************************
CXMLParserServidor::CXMLParserServidor()
{
}

//******************************************************
// Getea el atributo Comando
//******************************************************
CComando* CXMLParserServidor::getComando() const
{
  return this->Comando;
}

//******************************************************
// Setea el atributo Comando
//******************************************************
void CXMLParserServidor::setComando(CComando* Comando)
{
  this->Comando = Comando;
}

//******************************************************
// Parsea un string y lo setea en el atributo Comando
//******************************************************
void CXMLParserServidor::ParsearString(TString StringAParsear)
{
  int LongitudAParsear = StringAParsear.size();
  xmlDocPtr  Documento;
  xmlNodePtr NodoActual;

  // Obtengo el documento a parsear en formato string
  Documento = xmlParseMemory(StringAParsear.c_str(), LongitudAParsear);

  if (Documento == NULL)
  {
    cout << "Documento = null" << endl;
    return;
  }

  // Obtengo el nodo raiz
  NodoActual = xmlDocGetRootElement(Documento);

  if (NodoActual == NULL)
  {
    cout << "NodoActual = null" << endl;
    return;
  }

  // Verifico que el primer nodo sea correcto para el caso en particular
  if (xmlStrcmp(NodoActual->name, (const xmlChar *) "MENSAJE"))
  {
    cout << "El documento no es correcto" << endl;
    xmlFreeDoc(Documento);
    return;
  }

  // Obtengo el nodo hijo del raiz
  NodoActual = NodoActual->children;

  while (NodoActual != NULL)
  {
    // Parseo los Nodos
    parsearNodos(NodoActual);

    NodoActual = NodoActual->next;
  }

  cout << "Termine de parsear" << endl;

  // Libero el documento
  xmlFreeDoc(Documento);
  xmlFreeNode(NodoActual);
  return;
}

//******************************************************
// Parsea los nodos hijos del tag <MENSAJE>
//******************************************************
void CXMLParserServidor::parsearNodos(xmlNodePtr NodoActual)
{
  if (!xmlStrcmp(NodoActual->name, (const xmlChar *) "NOMBREARCHIVOBUSCADO"))
  {
    // Aca leo el contenido del XML del tag <COMANDO> y lo cargo
    // en el atributo Comando
    this->Comando->setNombreArchivoBuscado(getNombreArchivoBuscado(NodoActual));
  }
  if (!xmlStrcmp(NodoActual->name, (const xmlChar *) "COMANDO"))
  {
    // Aca leo el contenido del XML del tag <COMANDO> y lo cargo
    // en el atributo Comando
    getComandoDelXML(NodoActual);
  }
  if (!xmlStrcmp(NodoActual->name, (const xmlChar *) "NOMBRE"))
  {
    // Aca leo el contenido del XML del tag <NOMBRE> y lo cargo
    // en el atributo Comando
    this->Comando->setNombre(this->getNombreDelXML(NodoActual));
  }
  if (!xmlStrcmp(NodoActual->name, (const xmlChar *) "APELLIDO"))
  {
    // Aca leo el contenido del XML del tag <APELLIDO> y lo cargo
    // en el atributo Comando
    this->Comando->setApellido(this->getApellidoDelXML(NodoActual));
  }
  if (!xmlStrcmp(NodoActual->name, (const xmlChar *) "NICK"))
  {
    // Aca leo el contenido del XML del tag <NICK> y lo cargo
    // en el atributo Comando
    this->Comando->setNick(this->getNickDelXML(NodoActual));
  }
  if (!xmlStrcmp(NodoActual->name, (const xmlChar *) "PASSWORD"))
  {
    // Aca leo el contenido del XML del tag <PASSWORD> y lo cargo
    // en el atributo Comando
    this->Comando->setPassword(this->getPasswordDelXML(NodoActual));
  }
  if (!xmlStrcmp(NodoActual->name, (const xmlChar *) "CLAVE"))
  {
    // Aca leo el contenido del XML del tag <CLAVE> y lo cargo
    // en el atributo Comando
    this->Comando->setClave(this->getClaveDelXML(NodoActual));
  }
  if (!xmlStrcmp(NodoActual->name, (const xmlChar *) "ID"))
  {
    // Aca leo el contenido del XML del tag <COMANDO> y lo cargo
    // en el atributo Comando
    this->Comando->setIdUsuario(this->getIdDelXML(NodoActual));
  }
  if (!xmlStrcmp(NodoActual->name, (const xmlChar *) "IDUSUARIOBUSCADO"))
  {
    // Aca leo el contenido del XML del tag <COMANDO> y lo cargo
    // en el atributo Comando
    this->Comando->setIdUsuarioBuscado(this->getIdUsuarioBuscadoDelXML(NodoActual));
  }
  if (!xmlStrcmp(NodoActual->name, (const xmlChar *) "LISTADEARCHIVOS"))
  {
    // Entro un nivel, al nivel del tag <LISTADEARCHIVOS>
    xmlNodePtr NodoActualListaDeArchivos;
    NodoActualListaDeArchivos = NodoActual->children;

    while (NodoActualListaDeArchivos != NULL)
    {
      // Aca recorro por lo q esta dentro del tag <LISTADEARCHIVOS>
      // Comienzo a meterme otro nivel, el cual comienza en este tag
      parsearListaDeArchivos(NodoActualListaDeArchivos);

      NodoActualListaDeArchivos = NodoActualListaDeArchivos->next;
    }
    xmlFreeNode(NodoActualListaDeArchivos);
  }
  if (!xmlStrcmp(NodoActual->name, (const xmlChar *) "LISTADEPALABRAS"))
  {
    xmlNodePtr NodoActualListaDePalabras;
    NodoActualListaDePalabras = NodoActual->children;
    // Entro un nivel, al nivel del tag <LISTADEPALABRAS>

    while (NodoActualListaDePalabras != NULL)
    {
      // Aca recorro por lo q esta dentro del tag <LISTADEPALABRAS>
      // Comienzo a meterme otro nivel, el cual comienza en este tag
      parsearListaDePalabras(NodoActualListaDePalabras);

      NodoActualListaDePalabras = NodoActualListaDePalabras->next;
    }
    xmlFreeNode(NodoActualListaDePalabras);
  }
}

//******************************************************
// Parsea el tag <LISTADEARCHIVOS>
//******************************************************
void CXMLParserServidor::parsearListaDeArchivos(xmlNodePtr NodoActual)
{
  if (!xmlStrcmp(NodoActual->name, (const xmlChar *) "ARCHIVO"))
  {
    // Aca leo el contenido del XML del tag <ARCHIVO> y lo cargo
    // en el atributo Comando
    this->Comando->agregarNodoListaDeArchivos(this->getArchivoDelXML(NodoActual));
  }
}

//******************************************************
// Parsea el tag <LISTADEPALABRAS>
//******************************************************
void CXMLParserServidor::parsearListaDePalabras(xmlNodePtr NodoActual)
{
  if (!xmlStrcmp(NodoActual->name, (const xmlChar *) "PALABRA"))
  {
    // Aca leo el contenido del XML del tag <PALABRA> y lo cargo
    // en el atributo Comando
    getPalabraDelXML(NodoActual);
  }
}

//******************************************************
// Parsea el tag <COMANDO>
//******************************************************
void CXMLParserServidor::getComandoDelXML(xmlNodePtr NodoActual)
{
  xmlChar* Contenido;
  xmlAttr* Atributo;

  // Obtengo el puntero a atributos del nodo actual
  Atributo = (xmlAttr *)NodoActual->properties;

  // Recorro los atributos del tag <COMANDO>
  while (Atributo != NULL)
  {
    if (!xmlStrcmp(Atributo->name, (const xmlChar *) "VALOR"))
    {
      // Obtengo la propiedad Valor del presente tag
      Contenido = xmlGetProp(NodoActual, Atributo->name);

      this->Comando->setComando((char*)(Contenido));
      xmlFree(Contenido);
    }

    Atributo = Atributo->next;
  }

  // Libero el puntero a Atributo
  xmlFreeProp(Atributo);
}

//******************************************************
// Parsea el tag <PALABRA>
//******************************************************
void CXMLParserServidor::getPalabraDelXML(xmlNodePtr NodoActual)
{
  xmlChar* Contenido;

  // Obtengo el contenido del presente tag
  Contenido = xmlNodeGetContent(NodoActual);

  this->Comando->agregarPalabraListaDePalabras((char*)(Contenido));
  xmlFree(Contenido);
}

//******************************************************
// Escribe un XML en memoria (en un string de la STL)
// a partir de un CComando
//******************************************************
void CXMLParserServidor::ParsearComando()
{
  xmlDocPtr Documento;

  Documento = NuevoDocumento("MENSAJE");

  // Agrego los nodos que colgaran del tag <MENSAJE>
  AgregarNodos(Documento);

  xmlChar** buffer = (xmlChar**)xmlMemMalloc(sizeof(xmlChar*));
  int* x;
  // Guardo en memoria el XML
  xmlDocDumpMemoryEnc(Documento, buffer, x ,(const char *)("ISO-8859-1"));
  // Guardo en archivo el XML
  xmlSaveFile((const char*)("holahola.xml"), Documento);

  this->setStringParseo((char*)(*buffer));
}

//******************************************************
// Escribe el tag <COMANDO> en el XML
//******************************************************
void CXMLParserServidor::AgregarComando(xmlNodePtr NodoActual)
{
  xmlSetProp(NodoActual, (const xmlChar *)("VALOR"), (const xmlChar *)(this->Comando->getComando().c_str() ) );
}


//******************************************************
// Escribe el tag <CLAVE> en el XML
//******************************************************
void CXMLParserServidor::AgregarClave(xmlNodePtr NodoActual)
{
  xmlNodeAddContent(NodoActual, (const xmlChar *)(this->Comando->getClave().c_str() ));
}

//******************************************************
// Escribe el tag <LISTADEARCHIVOS> en el XML
//******************************************************
void CXMLParserServidor::AgregarListaDeArchivos(xmlNodePtr Nodo)
{
  for (int i = 0; i < (this->Comando->getListaDeArchivos().getLongitud()); i++)
  {
    xmlNodePtr NodoAux = xmlNewChild(Nodo, NULL, (const xmlChar *)("ARCHIVO"), NULL);

    // Agrego el tag <ARCHIVO>
    AgregarArchivo(NodoAux, i);
  }
}

//******************************************************
// Escribe el tag <LISTADEPALABRAS> en el XML
//******************************************************
void CXMLParserServidor::AgregarListaDePalabras(xmlNodePtr Nodo)
{
  for (int i = 0; i < (this->Comando->getListaDePalabras().getLongitud()); i++)
  {
    xmlNodePtr NodoAux = xmlNewChild(Nodo, NULL, (const xmlChar *)("PALABRA"), NULL);

    // Agrego el tag <PALABRA>
    AgregarPalabra(NodoAux, i);
  }
}

//******************************************************
// Escribe el tag <ARCHIVO> en el XML
//******************************************************
void CXMLParserServidor::AgregarArchivo(xmlNodePtr Nodo, int i)
{
  TString Operacion;
  xmlNodePtr NodoAltas;
  xmlNodePtr NodoAlta;
  xmlNodePtr NodoBajas;
  xmlNodePtr NodoBaja;
  xmlNodePtr NodoModificaciones;
  xmlNodePtr NodoModificacion;
  CNodoListaArchivos NodoLista =  (this->Comando->getListaDeArchivos().getNodoListaArchivos(i));

  //Tag <ATRIBUTOS>
  xmlNodePtr NodoAuxAtr = xmlNewChild(Nodo, NULL, (const xmlChar *)("ATRIBUTOS"), NULL);

  xmlChar* NormaString   = xmlXPathCastNumberToString(NodoLista.getArchivo().getNorma());
   
  xmlSetProp(NodoAuxAtr, (const xmlChar *)("NOMBRE"), (const xmlChar *)(NodoLista.getArchivo().getNombre().c_str() ) );
  xmlSetProp(NodoAuxAtr, (const xmlChar *)("TAMANIO"), (const xmlChar *)(NodoLista.getArchivo().getTamanio().c_str() ) );
  xmlSetProp(NodoAuxAtr, (const xmlChar *)("FECHAMODIF"), (const xmlChar *)(NodoLista.getArchivo().getFechaModificacion().c_str() ) );
  xmlSetProp(NodoAuxAtr, (const xmlChar *)("NORMA"), (const xmlChar *)(NormaString) );
  //Fin tag <ATRIBUTOS>

  //Tag <OPERACION>
  xmlNodePtr NodoAux = xmlNewChild(Nodo, NULL, (const xmlChar *)("OPERACION"), NULL);

  switch (NodoLista.getOperacion())
  {
    case 'C': Operacion = "CREAR";          break;
    case 'E': Operacion = "ELIMINAR";       break;
    case 'M': Operacion = "ABMS";           break;
    case 'P': Operacion = "MODIFICAR";      break;
    case 'F': Operacion = "MODIFICARYABMS"; break;
    case 'N': Operacion = "NADA";           break;
    default :                               break;
  };

  xmlNodeAddContent(NodoAux, (const xmlChar *)(Operacion.c_str() ));
  //Fin tag <OPERACION>

  //Tag <ABM>
  if (NodoLista.tieneListasABM() == true)
  {
    xmlNodePtr NodoABM = xmlNewChild(Nodo, NULL, (const xmlChar *)("ABM"), NULL);

    if (NodoLista.getLongitudListaAltas() > 0)
    {
      CListaDeABM ListaA = NodoLista.getListaDeABMAltas();
      NodoAltas = xmlNewChild(NodoABM, NULL, (const xmlChar *)("ALTAS"), NULL);
      NodoAlta = xmlNewChild(NodoAltas, NULL, (const xmlChar *)("ALTA"), NULL);

      for (short j = 0; j < ListaA.getLongitud(); j++)
      {
        xmlSetProp(NodoAlta, (const xmlChar *)("PALABRA"), (const xmlChar *)(ListaA.getABM(j).getPalabra().c_str() ) );    
        xmlSetProp(NodoAlta, (const xmlChar *)("FRECUENCIA"), (const xmlChar *)(ListaA.getABM(j).getFrecuenciaString().c_str() ) );
      }
    }
    if (NodoLista.getLongitudListaBajas() > 0)
    {
      CListaDeABM ListaB = NodoLista.getListaDeABMBajas();
      NodoBajas = xmlNewChild(NodoABM, NULL, (const xmlChar *)("BAJAS"), NULL);
      NodoBaja = xmlNewChild(NodoBajas, NULL, (const xmlChar *)("BAJA"), NULL);

      for (short j = 0; j < ListaB.getLongitud(); j++)
      {
        xmlSetProp(NodoBaja, (const xmlChar *)("PALABRA"), (const xmlChar *)(ListaB.getABM(j).getPalabra().c_str() ) );
        xmlSetProp(NodoBaja, (const xmlChar *)("FRECUENCIA"), (const xmlChar *)(ListaB.getABM(j).getFrecuenciaString().c_str() ) );
      }
    }
    if (NodoLista.getLongitudListaModificaciones() > 0)
    {
      CListaDeABM ListaM = NodoLista.getListaDeABMModificaciones();
      NodoModificaciones = xmlNewChild(NodoABM, NULL, (const xmlChar *)("MODIFICACIONES"), NULL);
      NodoModificacion = xmlNewChild(NodoModificaciones, NULL, (const xmlChar *)("MODIFICACION"), NULL);

      for (short j = 0; j < ListaM.getLongitud(); j++)
      {
        xmlSetProp(NodoModificacion, (const xmlChar *)("PALABRA"), (const xmlChar *)(ListaM.getABM(j).getPalabra().c_str() ) );
        xmlSetProp(NodoModificacion, (const xmlChar *)("FRECUENCIA"), (const xmlChar *)(ListaM.getABM(j).getFrecuenciaString().c_str() ) );
      }
    }
   
  }
  //Fin tag <ABM>  


}

//******************************************************
// Escribe el tag <PALABRA> en el XML
//******************************************************
void CXMLParserServidor::AgregarPalabra(xmlNodePtr Nodo, int i)
{
  xmlNodeAddContent(Nodo, (const xmlChar *)(this->Comando->getListaDePalabras().getPalabra(i).c_str() ));
}

//******************************************************
// Agrego un los tags
//******************************************************
void CXMLParserServidor::AgregarNodos(xmlDocPtr Documento)
{
  xmlNodePtr Raiz;
  xmlNodePtr Nodo;

  // La raiz del documento se la asigno a Raiz
  Raiz = xmlDocGetRootElement(Documento);

  if (this->Comando->getNombreArchivoBuscado().size() > 0)
  {
    Nodo = xmlNewChild(Raiz, NULL, (const xmlChar *)("NOMBREARCHIVOBUSCADO"), NULL);
    AgregarNombreArchivoBuscado(Nodo, this->Comando->getNombreArchivoBuscado());
  }
  if (this->Comando->getComando().size() > 0)
  {
    Nodo = xmlNewChild(Raiz, NULL, (const xmlChar *)("COMANDO"), NULL);
    AgregarComando(Nodo);
  }
  if (this->Comando->getApellido().size() > 0)
  {
    Nodo = xmlNewChild(Raiz, NULL, (const xmlChar *)("APELLIDO"), NULL);
    AgregarApellido(Nodo, this->Comando->getApellido());
  }
  if (this->Comando->getClave().size() > 0)
  {
    Nodo = xmlNewChild(Raiz, NULL, (const xmlChar *)("CLAVE"), NULL);
    AgregarClave(Nodo);
  }
  if (this->Comando->getIdUsuario() > 0)
  {
    Nodo = xmlNewChild(Raiz, NULL, (const xmlChar *)("ID"), NULL);
    AgregarId(Nodo, this->Comando->getIdUsuario());
  }
  if (this->Comando->getIdUsuarioBuscado() > 0)
  {
    Nodo = xmlNewChild(Raiz, NULL, (const xmlChar *)("IDUSUARIOBUSCADO"), NULL);
    AgregarIdUsuarioBuscado(Nodo, this->Comando->getIdUsuarioBuscado());
  }
  if (this->Comando->getNick().size() > 0)
  {
    Nodo = xmlNewChild(Raiz, NULL, (const xmlChar *)("NICK"), NULL);
    AgregarNick(Nodo, this->Comando->getNick());
  }
  if (this->Comando->getNombre().size() > 0)
  {
    Nodo = xmlNewChild(Raiz, NULL, (const xmlChar *)("NOMBRE"), NULL);
    AgregarNombre(Nodo, this->Comando->getNombre());
  }
  if (this->Comando->getPassword().size() > 0)
  {
    Nodo = xmlNewChild(Raiz, NULL, (const xmlChar *)("PASSWORD"), NULL);
    AgregarPassword(Nodo, this->Comando->getPassword());
  }
  if (this->Comando->getListaDeArchivos().getLongitud() > 0)
  {
    Nodo = xmlNewChild(Raiz, NULL, (const xmlChar *)("LISTADEARCHIVOS"), NULL);

    AgregarListaDeArchivos(Nodo);
  }
  if (this->Comando->getListaDePalabras().getLongitud() > 0)
  {
    Nodo = xmlNewChild(Raiz, NULL, (const xmlChar *)("LISTADEPALABRAS"), NULL);

    AgregarListaDePalabras(Nodo);
  }
}

//******************************************************
// Obtengo el string parseado o a parsear
//******************************************************
TString CXMLParserServidor::getStringParseo() const
{
  return this->StringParseo;
}

//******************************************************
// Setea el string a parsear
//******************************************************
void CXMLParserServidor::setStringParseo(TString StringParseo)
{
  this->StringParseo = StringParseo;
}

//******************************************************
// Destuctor de la clase CXMLPParser
//******************************************************
CXMLParserServidor::~CXMLParserServidor()
{
}
</code>

Salu2!!!!!!!!!!

2
JSP/Servlets / Re: No Se Despliega El Primer Registro
« en: Sábado 6 de Agosto de 2005, 22:15 »
Hola!!!!!!

Postea el codigo anterior al q mandaste porque quizas corriste el iterador antes y por eso esta en otra posicion, porque lo q decis es porq seguramente lo hayas cambiado en otro lugar

Salu2!!!!!!!

3
JSP/Servlets / Re: Sesiones En Jsp
« en: Sábado 6 de Agosto de 2005, 22:13 »
Hola!!!

Mira, la session es una interfaz verdadermante con la cual se puede interactuar. Podes setear objetos, obtenerlos y removerlos. Cada objeto de la session se identifica con una clave unica (ojo con eso). En si, la session se obtiene de HttpServletRequest haciendo:
HttpSession session = request.getSession();

Luego, para setear:
session.setAttribute("clave", tuObjeto);
Para obtener, UnaClase instancia = (UnaClase)session.getAttribute("clave");
Para eliminar: session.removeAttribute("clave");

El tiempo de vida de session se puede setear por codigo con:
session.setMaxTimeInterval() o algo asi, pero se recomienda q se haga desde web.xml (buscate en google cual es el tag porque no me lo acuerdo, pero creo q era <session> <session-timeout>... o algo asi).

Despues no hay mas magia q eso. Se puede seguir hablando mucho como por ejemplo Listeners de session (algo muy interesante): HttpSessionListener (bucsalo en google)

Bueno, con esto sobra


Salu2!!!!!!!!!!

4
Java / Re: Duda
« en: Miércoles 3 de Agosto de 2005, 00:44 »
Hola!!!!

tuTextField.setText("loQueTengasQueMostrar");

Salu2!!!!!!!!!

P.D.: Volvi despues de un tiempooo

5
Java / Re: Formato A Entrada Por Medio De Jformattedtextfield
« en: Jueves 17 de Marzo de 2005, 16:52 »
Hola de nuevo!!!!

Si queres cargar solo numeros, yo no usaria una mascara. Haria algo muy parecido a lo puse antes. O sea, cada vez q se ingresa un caracter, checkearia si lo q tengo es un numero (usando Integer.parseInt() o lo mismo con la clase Float o Double y en caso de q entre en un NumberFormatException lo saco y si no sigo adelante) y asi poder controlar q solo se acepten numeros

Salu2!!!!!!!!

6
Java / Re: Formato A Entrada Por Medio De Jformattedtextfield
« en: Jueves 17 de Marzo de 2005, 13:13 »
Hola!!!!!!!!!!

Mira, a mi se me ocurre una pero no se si estara del todo bien, pero bueno, ahi va:
Si le agregas un listener al cuadro de edicion de texto, un KeyListener mejor dicho, cada vez q hay un keyTyped() o un keyPressed() o un keyReleased() es porque una tecla se oprimio, bueno, en ese momento le haces esto:
cuadroDeTexto.setText(cuadroDeTexto.getText().toUpperCase()); siempre y cuando haya algo porque sino daria NullPointerException!!!

Creo q andaria o no¿???

Salu2!!!!!!!!!!

7
Java / Re: Se Traba El Runtime
« en: Domingo 9 de Enero de 2005, 19:39 »
Hola!!!!!!!!

Se esta trabando porque vos le estas ordenando q se trabe. Si miras la documentacion veras esto:

Citar
waitFor()
          causes the current thread to wait, if necessary, until the process represented by this Process object has terminated


Entonces hasta q no termine lo q ejecutaste tu aplicacin no terminara...


Salu2!!!!!!!

8
JSP/Servlets / Re: Libro De Jsp Y Servlets
« en: Miércoles 5 de Enero de 2005, 22:52 »
Hola!!!!!!!

Este esta bueno y esta disponible en la web:

Libro

Salu2!!!!!!!!!!

9
Java / Re: Runtime Otra Vez
« en: Domingo 2 de Enero de 2005, 22:06 »
Hola!!!!!!!

Probaste cargando en el array de Strings q te mande como ejemplo luego del nombre del .bat los tres parametros q necesitas????

Salu2!!!!!

10
Dudas informáticas / Re: Reintentar Cancelar
« en: Miércoles 29 de Diciembre de 2004, 20:24 »
Hola!!!!!!!!

Antes q nada gracias por la respuesta super rapida.
La aplicacion esta basada en Struts/Jsp/Ejb/Jboss/Oracle a grandes rasgos.

Salu2!!!!!!!!!!!!

11
Dudas informáticas / Reintentar Cancelar
« en: Miércoles 29 de Diciembre de 2004, 19:51 »
Hola a todos!!!!!

Hay veces en las q el browser pide "reenviar la informacion, oprima reintentar o cancelar"  o un mensaje parecido a ese.
De que manera se podria evitar eso???

Estoy pidiendo esto porque estamos haciedo un desarrollo en el trabajo en JSP/STRUTS/EJB y el sector de Testing se esta quejando de eso, pero no sabemos como solucionarlo

Salu2!!!!!!!!!!!!

12
Java / Re: Cómo Usar Runtime.exec()
« en: Lunes 27 de Diciembre de 2004, 17:16 »
Hola!!!!!!!!!

Ahi va un ejemplo:

Código: Text
  1.  
  2. private boolean reiniciarAplicacion()
  3. {
  4.   boolean resultado = true;
  5.     Runtime rt = Runtime.getRuntime();
  6.     try
  7.     {
  8.             String oFileSeparator = System.getProperty(&#34;file.separator&#34;);
  9.             String[] cmd = new String[3];
  10.  
  11.             if( oFileSeparator.equals( &#34;&#092;&#092;&#34; ) )
  12.             {
  13.                 cmd[0] = &#34;cmd.exe&#34;&#59;
  14.                 cmd[1] = &#34;/C&#34;&#59;
  15.                 cmd[2] = &#34;C://ejecutable&#34;;
  16.             }
  17.  
  18.             if (oFileSeparator.equals( &#34;/&#34; ))
  19.             {
  20.                 cmd[0] = &#34;.&#092;&#092;ejecutable&#34;;
  21.             }
  22.             Process proc = rt.exec(cmd);
  23.       }
  24.       catch (Throwable exc4)
  25.       {
  26.         System.out.println(&#34;No se puede iniciar.&#092;n&#34;);
  27.         exc4.printStackTrace();
  28.         return false;
  29.       }
  30.       return resultado;
  31. }
  32.  
  33.  

Salu2!!!!!!!!!!!

13
C/C++ / Re: Vectores De La Stl
« en: Domingo 19 de Diciembre de 2004, 23:01 »
Hola!!!!!!!!!!!

Si queres informacion de la STL, ENTRA ACA

Salu2!!!!!!!!!

14
C/C++ / Re: Recorrer El Arbol De Directorios En C
« en: Miércoles 8 de Diciembre de 2004, 17:34 »
Hola de nuevo!!!!!!!!!!!!

Te mando una clase que recorre un directorio (ya esta abierto el mismo con el codigo q mande antes). Tiene un par de cosas feas y cosas q hoy en dia sacaria pero bue, es lo q hay. Tener en cuenta q esto fue desarrollado bajo GNU/LINUX y q desconozco si en Windows las funciones son los mismas. Fijate q tomo la fecha de modificacion del archivo

Código: Text
  1.  
  2. #include &#34;CDirectorio.h&#34;
  3.  
  4. CDirectorio::CDirectorio()
  5. {
  6.   this-&#62;listaDeArchivos = new CListaDeArchivos;
  7. }
  8.  
  9. //******************************************************
  10. // Metodo que recorre el directorio indicado por el usuario
  11. // y llama al metodo getDatosArchivoYAgregarALista()
  12. //******************************************************
  13. TError CDirectorio::recorrerDirectorio(TString nombreDirectorio)
  14. {
  15.   struct dirent **listadeNombres;
  16.   TString nombreXML;
  17.  
  18.   //levanto los nombres en la ListadeNombres
  19.   long longitud = scandir(nombreDirectorio.c_str(), &listadeNombres, 0, alphasort);
  20.   //verifico si encontro alguno
  21.  
  22.   if (longitud &#60; 0)
  23.   {
  24.     // Error al levantar los nombres de los archivos
  25.     return ERROR_DIRECTORIO;
  26.   }
  27.   else
  28.   {
  29.     long i = 0;
  30.     short largo = 0;
  31.     while(i &#60; longitud)
  32.     {
  33.       // Tomo el nombre del archivo y exijo que termine en .XML/.xml y todas
  34.       // sus variaciones. Tampoco seran tenidos en cuenta archivos que contengan
  35.       // vocales con tilde o la &#34;ENIE&#34;
  36.       nombreXML = (const char*)listadeNombres[i]-&#62;d_name;
  37.       if (nombreXML != CONFIGURACION_XML)
  38.       {
  39.         largo = nombreXML.size() - 1;
  40.         if (((nombreXML[largo]   == 'L') || (nombreXML[largo]   == 'l')) &&
  41.             ((nombreXML[largo-1] == 'M') || (nombreXML[largo-1] == 'm')) &&
  42.             ((nombreXML[largo-2] == 'X') || (nombreXML[largo-2] == 'x')) &&
  43.             (nombreXML[largo-3] == '.'))
  44.         {
  45.           if (  (strchr((const char*)listadeNombres[i]-&#62;d_name,'ñ') == NULL) ||
  46.                 (strchr((const char*)listadeNombres[i]-&#62;d_name,'á') == NULL) ||
  47.                 (strchr((const char*)listadeNombres[i]-&#62;d_name,'é') == NULL) ||
  48.                 (strchr((const char*)listadeNombres[i]-&#62;d_name,'í') == NULL) ||
  49.                 (strchr((const char*)listadeNombres[i]-&#62;d_name,'ó') == NULL) ||
  50.                 (strchr((const char*)listadeNombres[i]-&#62;d_name,'ú') == NULL))
  51.           {
  52.             if (getDatosArchivoYAgregarALista((const char*)listadeNombres[i]-&#62;d_name, nombreDirectorio) == ERROR_DIRECTORIO)
  53.             {
  54.               free(listadeNombres);
  55.               return ERROR_BUSQUEDA_ARCHIVOS;
  56.             }
  57.           }
  58.         }
  59.         free(listadeNombres[i]);
  60.         i++;
  61.       } // Nombre distinto de configuracion.xml
  62.       else
  63.         i++;
  64.     }
  65.     free(listadeNombres);
  66.    }
  67.    return OK;
  68. }
  69.  
  70.  
  71. //******************************************************
  72. // Metodo que obtiene los datos del archivo cuyo nombre
  73. // es recibido por parametro. Los agrega a la lista
  74. //******************************************************
  75. TError CDirectorio::getDatosArchivoYAgregarALista(const char* nombreArchivo,
  76.                                                   TString directorio)
  77. {
  78.   TString strFecha;
  79.   struct stat estrStat;
  80.   CInfoDeArchivos infoArch;
  81.   CNodoListaArchivos nodo;
  82.  
  83.   TString strFileName;
  84.   strFileName = directorio.c_str() &#59;
  85.   strFileName += '/';
  86.   strFileName += nombreArchivo&#59;
  87.  
  88.   //Levanto los datos del archivo
  89.   int error = stat(strFileName.c_str() , &estrStat);
  90.  
  91.   // todo bien
  92.   if(error == 0)
  93.   {
  94.     // Si es un archivo regular =&#62; lo tomo, caso contario salteo directorios, sockets, ....
  95.     if (S_ISREG(estrStat.st_mode))
  96.     {
  97.        strFecha = ctime(&estrStat.st_mtime);
  98.        infoArch.setNombre(nombreArchivo);
  99.        infoArch.setFechaModificacion(strFecha);
  100.        // La 1era vez digo que la operacion es 'C' -&#62; CREAR
  101.        nodo.setOperacion('C');
  102.        nodo.setInfoDeArchivo(infoArch);
  103.        listaDeArchivos-&#62;agregaNodoListaArchivos(nodo);
  104.     }
  105.   }
  106.   else
  107.   {
  108.     return ERROR_DIRECTORIO;
  109.   }
  110.   return OK;
  111. }
  112.  
  113. //******************************************************
  114. CListaDeArchivos& CDirectorio::getListaDeArchivos()
  115. {
  116.   return *listaDeArchivos;
  117. }
  118.  
  119. CDirectorio::~CDirectorio()
  120. {
  121.   if (this-&#62;listaDeArchivos != NULL)
  122.     delete this-&#62;listaDeArchivos;
  123. }
  124.  
  125.  


Espero q sirva de algo

Salu2!!!!!!!!!!!!!!

15
JSP/Servlets / Re: Llenar Combo
« en: Miércoles 8 de Diciembre de 2004, 17:27 »
Hola!!!!!!!!!!!

Si lo que queres es que a partir de la seleccion de un combo, se cargue otro => lo q deberias hacer es q en el evento onChange() (Javascript ó si usas alguna tag library) llames a un servlet para q a partir de lo seleccionado cargues el otro.


Salu2!!!!!!!!!!!!!!

16
C/C++ / Re: Archivos En C++
« en: Lunes 6 de Diciembre de 2004, 17:35 »
Entra aca


Salu2!!!!!!!!!!!

17
C/C++ / Re: Recorrer El Arbol De Directorios En C
« en: Lunes 6 de Diciembre de 2004, 17:28 »
Hace una busqueda en el foro q yo puse un ejemplo de como hacerlo

Salu2!!!!!!!!!!!

18
JSP/Servlets / Re: Detener El J2ee
« en: Lunes 15 de Noviembre de 2004, 12:15 »
Hola!!!!!!!!!!

Depende del web server q uses. Pero probaste con CTRL-C ????? Al menos en JBOSS yo hago eso ylo baja bien, no es q corta todo, sino q empieza a "undeploy"

Salu2!!!!!!!!!!!!!

19
C/C++ / Re: Como Pongo La Hora??
« en: Sábado 23 de Octubre de 2004, 23:28 »
Hola!!!!!!!!!

Proba con timers

Salu2!!!!!!

20
C/C++ / Re: Directorios
« en: Sábado 23 de Octubre de 2004, 00:33 »
Hola!!!!!!!!!

No lo aclare, pero TEMP_DIR y esas cosas con mayuscula son constantes de mi aplicacion

El 0777 son los permisos que le asigo a la carpeta (permisos totales de usuario, grupo, otros)

Salu2!!!!!

21
C/C++ / Re: C++ Que La Ventana Mantenga Su Ultima Configuració
« en: Jueves 21 de Octubre de 2004, 18:08 »
Hola!!!!!!!!!

Guardalos en memoria y cuando abras otra vez la ventana => mostras los ultimos q tenes en memoria

Salu2!!!!!

22
Java / Re: Que Hago Mal?
« en: Lunes 18 de Octubre de 2004, 18:06 »
Hola!!!!!!!!!

Lo q haces mal es q pusheas en la pila cada caracter del String leido por System.in . Deberias separar las palabras y tokens

Salu2!!!!

23
C/C++ / Re: Directorios
« en: Sábado 16 de Octubre de 2004, 01:04 »
Hola!!!!!!!!

Te mando un ejemplo q hice para GNU/LINUX. Existe una rutina llamada MKDIR. Fijate de buscar si para WINDOWS es la misma.
Ahi va:
Código: Text
  1.  
  2. TError CMiClase::crearDirectorios()
  3. {
  4.   int resultado;
  5.   DIR* directorio;
  6.  
  7.   directorio = opendir(TEMP_DIR);
  8.   if (directorio == NULL)
  9.   {
  10.     resultado = mkdir(TEMP_DIR, 0777);
  11.     if (resultado == -1)
  12.       return ERROR;
  13.   }
  14.   else
  15.     closedir(directorio);
  16.  
  17.   directorio = opendir(FILES_DIR);
  18.   if (directorio == NULL)
  19.   {
  20.     resultado = mkdir(FILES_DIR, 0777);
  21.     if (resultado == -1)
  22.       return ERROR;
  23.   }
  24.   else
  25.     closedir(directorio);
  26.  
  27.   directorio = opendir(DATA_DIR);
  28.   if (directorio == NULL)
  29.   {
  30.     resultado = mkdir(DATA_DIR, 0777);
  31.     if (resultado == -1)
  32.       return ERROR;
  33.   }
  34.   else
  35.     closedir(directorio);
  36.  
  37.   return OK;
  38. }
  39.  
  40.  

Espero q sirva

Salu2!!!!

24
C/C++ / Re: Campo Variable
« en: Jueves 14 de Octubre de 2004, 18:59 »
Hola!!!!!!!!1

Podrias hacer un metodo que recibe un char q indique por q queres buscar o podrias sobrecargar el metodo y listo, o sea, escribir tantos metodos como posibilidades tengas.

Salu2!!!!!

25
JSP/Servlets / Re: Como Almacenar El Resulset En Un Vector
« en: Jueves 14 de Octubre de 2004, 18:56 »
Hola!!!!!1

De antemano te digo q al ResultSet lo podes meter en un Vector. Ahora, la pregunta es para q??? Si vos queres comparar, al metodo q hace la consulta le deberias pasar las opciones que ingreso el usuario y ahi validar si el tipo esta registrado o no.

Salu2!!!!!!

Páginas: [1] 2 3 ... 12