elhacker.net cabecera Bienvenido(a), Visitante. Por favor Ingresar o Registrarse
¿Perdiste tu email de activación?.

 

 


Tema destacado: AIO elhacker.NET 2021 Compilación herramientas análisis y desinfección malware


  Mostrar Mensajes
Páginas: 1 2 [3]
21  Programación / Java / Re: Clase para enviar Correo desde Java [by BadDevil] en: 30 Julio 2009, 15:56 pm
Espero que no os importe que lo pregunte aqui, pero el otro el otro dia me puse a aprender el uso de java para envios de email usando esta clase como base.

Lo corri en Netbeans y probe usando el servidor smtp de gmail y de hotmail con mis cuentas.
Todo bien.

El problema viene cuando lo intento usar con un servidor smtp corriendo en mi propia maquina (en este caso argosoft, una version antigua de 2006, pero que no es de pago...)
Me coge el mensage, pero a la hora de enviarlo falla porque se queda en:
ERROR: Timed out when waiting for data

Tengo el relay configurado con un servidor dns cualquiera, que es lo que lei por ahi que hiciera
T.T No se si es que me falta algo, o es que gmail / hotmail no recibe este tipo de mensajes
22  Programación / Ejercicios / Re: Algoritmia-Ejercicios introductorios. en: 29 Julio 2009, 16:51 pm
Las matematicas no son mi fuerte, pero espero no haberme equivocado con lo que se pedia:

El primer ejercicio y el segundo juntos en Java:

Código
  1. import java.io.*;
  2.  
  3. public class Main{
  4.  
  5.    private BufferedReader bf;
  6.  
  7.    public Main(){
  8.        bf = new BufferedReader(new InputStreamReader(System.in));
  9.    }
  10.  
  11.    private int PedirFilas() throws IOException{
  12.  
  13.        int numFilas = 0;
  14.  
  15.        System.out.println("Introduce el numero de filas:");
  16.        String filas = bf.readLine();        
  17.        try{
  18.            numFilas = Integer.parseInt(filas);
  19.            if(numFilas < 0)
  20.                numFilas = Math.abs(numFilas);
  21.        }catch (Exception e){
  22.            System.out.println("El numero introducido no es valido");
  23.            System.exit(1);
  24.        }
  25.        return numFilas;
  26.    }
  27.  
  28.    private int PedirColumnas() throws IOException{
  29.  
  30.        int numColumnas = 0;
  31.  
  32.        System.out.println();
  33.        System.out.println("Introduce el numero de columnas:");
  34.        String columnas = bf.readLine();        
  35.        try{
  36.            numColumnas = Integer.parseInt(columnas);
  37.            if(numColumnas < 0)
  38.                numColumnas = Math.abs(numColumnas);
  39.        }catch (Exception e){
  40.            System.out.println("El numero introducido no es valido");
  41.            System.exit(1);
  42.        }
  43.        return numColumnas;
  44.    }
  45.  
  46.    private void MostrarMatriz(int filas, int columnas) throws IOException{
  47.  
  48.        int numLectura = 0;
  49.        int [][] matriz = new int[filas][columnas];
  50.  
  51.        System.out.println();
  52.        System.out.println("Indicame como quieres que se muestre.");
  53.        System.out.println("-------------------------------------");
  54.        System.out.println("1 - Por filas");
  55.        System.out.println("2 - Por columnas");
  56.        String lectura = bf.readLine();
  57.        InicializarMatriz(matriz, filas, columnas);
  58.  
  59.        try{
  60.            numLectura = Integer.parseInt(lectura);
  61.            if(numLectura != 1 && numLectura != 2){
  62.                System.out.println("El numero introducido no es valido");
  63.                System.exit(1);
  64.            }
  65.        }catch (Exception e){
  66.            System.out.println("El numero introducido no es valido");
  67.            System.exit(1);
  68.        }
  69.  
  70.        System.out.println();
  71.  
  72.        if(numLectura == 1){
  73.            for(int f = 0; f < filas; f++){
  74.                System.out.println("Fila "+(f+1));
  75.                for(int c = 0; c < columnas-1; c++){
  76.                    System.out.print(matriz[f][c]);
  77.                    System.out.print(" -- ");
  78.                }
  79.                System.out.print(matriz[f][columnas-1]);
  80.                System.out.println();
  81.            }
  82.        }else{
  83.            for(int c = 0; c < columnas; c++){
  84.                System.out.println("Columna "+(c+1));
  85.                for(int f = 0; f < filas-1; f++){
  86.                    System.out.print(matriz[f][c]);
  87.                    System.out.print(" -- ");
  88.                }
  89.                System.out.print(matriz[filas-1][c]);
  90.                System.out.println();
  91.            }
  92.        }
  93.    }
  94.  
  95.    private void InicializarMatriz(int[][] matriz, int filas, int columnas) {
  96.        for(int f = 0; f < filas; f++){
  97.            for(int c = 0; c < columnas; c++){
  98.                matriz[f][c] = (int)(Math.random()*100);
  99.            }
  100.        }              
  101.    }
  102.  
  103.  
  104.    public static void main(String[] args) throws IOException {
  105.        Main main = new Main();
  106.        main.MostrarMatriz(main.PedirFilas(), main.PedirColumnas());
  107.    }
  108.  
  109. }
  110.  


Pd: O java usa mucho codigo, o yo soy muy torpe... T.T XD
Páginas: 1 2 [3]
WAP2 - Aviso Legal - Powered by SMF 1.1.21 | SMF © 2006-2008, Simple Machines