Follow By Email

Mostrando entradas con la etiqueta java. Mostrar todas las entradas
Mostrando entradas con la etiqueta java. Mostrar todas las entradas

martes, 26 de junio de 2012

PHP o JSP ?

 Siempre existe la preguntar de cual es la real diferencia de estos dos lenguajes. Al momento de crear un proyecto existe la pregunta ¿Qué lenguaje ocuparé? ... ¿El que más hemos usado? ... ¿O el que realmente da confianza?....    
  PHP ! Un lenguaje fácil, intuitivo y donde puedes lograr lo que quieras con el servidor... pero que hay en la seguridad? pues al ser interprete, los códigos quedan a la vista de cualquiera, quién pueda acceder de forma mal intencionada. Pues al ser interprete no existe un método de encriptación de claves para las conexiones de bases de datos u o conexiones remotas. Además al ser el más usado para la aplicaciones web, es también el mayor blanco de posibles invulnerabilidades.

  JSP ! Excesivo en códigos, haz de tener un servidor bastante bueno para soportar la cantidad de recursos que utiliza. Sin embargo es JAVA y este lenguaje es el "Futuro" según dicen. JSP es un lenguaje compilado, y si tratas de acceder al servidor, solo podrás ver .class y si estos están encriptados, pues olvida que puedas ver algún tipo de código... ya es un ejecutable para el servidor y para ti códigos compilados y encriptados.
   Pues está claro que para realizar páginas webs rápidas, la mejor opción es PHP. Pero si quieres realizar un web-service del Banco BBVA debes realizarlo en un lenguaje de la cual se requieran otros estandares de seguridad. Y JSP claramente ofrece esa posibilidad. 


           






miércoles, 31 de marzo de 2010

Juego Gato - Java


package gato;

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;

public class Gato {

    
    public static int matriz[][] = new int [3][3]; 
    public static BufferedReader br =new BufferedReader (new InputStreamReader (System.in));
    public static void main(String[] args) throws IOException {
    
        int turno=1;
        int respuesta=0;
        
    for(int i=0;i<3;i++){
        for(int b=0;b<3;b++){
            
            matriz[i][b]=0;
            System.out.print(matriz[i][b]);
           
        }
        System.out.println("");
    }
    
        System.out.println("-. Juego del Gato .-");
    //inicio del videoJuego Gato ...
    do{
        turno=turno+1;
        
        
    if(turno%2==0){
    llenarMatrizP1();
    
    }else{
        
    llenarMatrizP2();    
    }    
    
    
    mostrarMatriz();
    respuesta=verificarMatriz(respuesta);
    
    
    
    }while(respuesta==0);
    
    }

    
    
    
    
    
    
    private static void mostrarMatriz() {
        for(int i=0;i<3;i++){
        for(int b=0;b<3;b++){
            
            
            System.out.print(matriz[i][b]);
           
        }
        System.out.println("");
    }
    
    }

    private static int verificarMatriz(int respuesta) {
        
       
        int jugadorG=0;
      
        
         /* horizontal primera fila
         *   
         *  111 
         *  000
         *  000
         *
         * 
          */
         
         
            if(matriz[0][0]==1 && matriz[1][0]==1 && matriz[2][0]==1 ){
            jugadorG=1;
            respuesta=1;
            }
            
            if(matriz[0][0]==2 && matriz[1][0]==2 && matriz[2][0]==2 ){
            jugadorG=2;
            respuesta=1;
        }
       
        
         
         /* horizontal segunda fila
         *   
         *  000 
         *  111
         *  000
         *
         * 
          */
        
         
            if(matriz[0][1]==1 && matriz[1][1]==1 && matriz[2][1]==1 ){
            jugadorG=1;
            respuesta=1;
            }
            
            if(matriz[0][1]==2 && matriz[1][1]==2 && matriz[2][1]==2 ){
            jugadorG=2;
            respuesta=1;
        }
       
        
          /* horizontal tercera fila
         *   
         *  000 
         *  000
         *  111
         *
         * 
          */
     


lunes, 29 de marzo de 2010

Sinónimos y antónimos - Java

 1 package sinonimosantonimos;
 2 
 3 import java.io.BufferedReader;
 4 import java.io.IOException;
 5 import java.io.InputStreamReader;
 6 
 7 
 8 public class SinonimosAntonimos 
 9 {
10     public static classDiccionario DicCompleto[] = new classDiccionario[20];
11     
12     public static void main(String[] args) throws IOException 
13     {
14 
15         int i = 0;
16         int cont=-1;
17         int opcion=99;
18         
19         //classDiccionario DicCompleto[] = new classDiccionario[2];
20         
21         InputStreamReader ISR = new InputStreamReader(System.in);
22         BufferedReader bftexto = new BufferedReader(ISR);  
23         
24         do 
25         {
26             System.out.println("Ingrese opcion");
27             System.out.println("--------------");
28             System.out.println("1.- Ingresar palabras");
29             System.out.println("2.- Desplegar palabras");
30             System.out.println("3.- Buscar palabra");
31             System.out.println("0.- Salir");
32             opcion = Integer.parseInt(bftexto.readLine());
33             if (opcion!=0)
34             {
35                 switch (opcion)
36                 {
37                     case 1:cont=fnIngresaPalabras(cont+1);
38                            break;
39                     case 2:prDespliegaPalabras(cont);
40                            break;
41                 }
42             }
43         }
44         while (opcion!=0);
45             
46     }
47     
48     public static int fnIngresaPalabras(int i) throws IOException
49     {
50         String palabra;
51         String sinonimo;
52         String antonimo;
53                 
54         InputStreamReader ISR = new InputStreamReader(System.in);
55         BufferedReader bftexto = new BufferedReader(ISR);      
56         
57         do
58         {
59             System.out.print("Ingrese palabra : ");
60             palabra = bftexto.readLine();
61             if (!palabra.equals("XXX"))
62             {
63                 System.out.print("Ingrese Sinonimo : ");
64                 sinonimo = bftexto.readLine();
65                 System.out.print("Ingrese antonimo : ");
66                 antonimo = bftexto.readLine();
67                 DicCompleto[i] = new classDiccionario(palabra,sinonimo,antonimo);
68                 i++;
69                 if (i>DicCompleto.length-1)
70                 {
71                     System.out.println("No es posible agregar elementos");
72                     palabra = "XXX";
73                 }
74             }
75         }
76         while (!palabra.equals("XXX"));
77         return(i-1);
78     }
79     
80     public static void prDespliegaPalabras(int cont)
81     {
82         int i;
83         for (i=0;i<=cont;i++)
84             System.out.println(DicCompleto[i].getPalabra()+" "+
85                                DicCompleto[i].getSinonimo()+" "+
86                                DicCompleto[i].getAntonimo());
87     }
88 }



domingo, 28 de marzo de 2010

Vehículo llamando a clases - Java

 1 
 2 package clasevehiculos;
 3 
 4 
 5 public class ClaseVehiculos 
 6 {
 7 
 8     public static void main(String[] args) 
 9     {
10       Vehiculos auto = new Vehiculos(4, 4, 6); 
11 
12       if (auto.isEncendido())
13           System.out.println("Auto Encendido");
14       else
15           System.out.println("Auto Apagado");
16       
17       auto.darContacto();
18       
19       if (auto.isEncendido())
20           System.out.println("Auto Encendido");
21       else
22           System.out.println("Auto Apagado");
23       
24       auto.ponerEnMarcha();
25       
26       if (auto.isEnMarcha())
27           System.out.println("Auto en marcha");
28       else
29           System.out.println("Auto detenido");
30       
31       auto.quitarContacto();
32       
33       if (auto.isEncendido())
34           System.out.println("Auto Encendido");
35       else
36           System.out.println("Auto Apagado");
37       
38       auto.detenerMarcha();
39       
40       if (auto.isEnMarcha())
41           System.out.println("Auto en marcha");
42       else
43           System.out.println("Auto detenido");
44       
45       auto.quitarContacto();
46       
47       if (auto.isEncendido())
48           System.out.println("Auto Encendido");
49       else
50           System.out.println("Auto Apagado");
51           
52     }
53 }

Palíndromas Java

 1 
 2 package palindromas;
 3 
 4 import java.io.BufferedReader;
 5 import java.io.IOException;
 6 import java.io.InputStreamReader;
 7 
 8 
 9 public class Palindromas 
10 {
11 
12 
13     public static void main(String[] args) throws IOException 
14     {
15         String texto;
16         int i;
17         int j;
18         boolean esPalindroma = true;
19                 
20         InputStreamReader ISR = new InputStreamReader(System.in);
21         BufferedReader bftexto = new BufferedReader(ISR);
22         
23         texto = bftexto.readLine();
24         
25         j=texto.length()-1;
26         for (i=0;i<texto.length() && j>=i;i++)
27             if (!texto.substring(i,i+1).equals(texto.substring(j,j+1)))
28                 esPalindroma = false;
29             else
30                 j = j - 1;
31         
32         if (esPalindroma)
33             System.out.println("La palabra "+texto+" es palindroma");
34         else
35             System.out.println("La palabra "+texto+" no es palindroma");
36         
37         
38         
39     }
40 }

sábado, 27 de marzo de 2010

Leer Datos java

 1 
 2 package leerdatos;
 3 
 4 import java.io.*;
 5 
 6 public class LeerDatos 
 7 {
 8 
 9     public static void main(String[] args) throws IOException 
10     {
11         String nombres;
12         String apellidos;
13         String Num1;
14         String Num2;
15         int N1;
16         int N2;
17         int N3;
18       
19         InputStreamReader ISR = new InputStreamReader(System.in);
20         BufferedReader texto = new BufferedReader(ISR) ;
21         
22         /*System.out.print("Ingrese nombres ... ");
23         nombres = texto.readLine();
24         System.out.print("Ingrese apellidos ... ");
25         apellidos = texto.readLine();
26         System.out.println(nombres);
27         System.out.println(apellidos); */
28         
29         /*System.out.print("Ingrese primer numero ");
30         Num1 = texto.readLine();
31         System.out.print("Ingrese segundo numero ");
32         Num2 = texto.readLine();*/
33         
34         System.out.print("Ingrese primer numero ");
35         N1 = Integer.parseInt(texto.readLine());
36         System.out.print("Ingrese segundo numero ");
37         N2 = Integer.parseInt(texto.readLine());
38         
39         N3 = N1 + N2;
40         
41         System.out.println("La suma es "+N3);
42         
43         
44       }
45 }

Hola Mundo Java

 1 
 2 package holamundo;
 3 
 4 import java.util.*;
 5 
 6 public class HolaMundo {
 7     
 8     
 9     public static void main(String[] args) {
10             System.out.print("Hola mundo ");
17         
18     }
19 }