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 - Mitgus

#11
Hola. Últimamente, he tenido inconvenientes al actualizar los repos de mi Debian Wheezy 7.1. Aquí les dejo lo que bota la consola y mi sources.list

  • Sources:

    # Repositorios Oficiales
    deb http://ftp.debian.org/debian/ wheezy main contrib non-free
    deb-src http://ftp.debian.org/debian/ wheezy main contrib non-free
    #Repositorios Seguridad
    deb http://security.debian.org/ wheezy/updates main contrib non-free
    deb-src http://ftp.debian.org/debian/ wheezy/updates main contrib non-free
    # wheezy-updates
    deb http://ftp.debian.org/debian/ wheezy-updates main contrib non-free
    deb-src http://ftp.debian.org/debian/ wheezy-updates main contrib non-free
    # Repositorios Backports
    deb http://mirrors.kernel.org/debian/ wheezy-backports main contrib non-free
    deb-src http://mirrors.kernel.org/debian/ wheezy-backports main contrib non-free
    deb http://ftp.debian.org/debian/ wheezy-backports main


  • Terminal:

    Obj http://security.debian.org wheezy/updates Release.gpg                     
    Obj http://mirrors.kernel.org wheezy-backports Release.gpg                     
    Obj http://ftp.debian.org wheezy Release.gpg           
    Obj http://security.debian.org wheezy/updates Release                         
    Obj http://mirrors.kernel.org wheezy-backports Release                         
    Ign http://ftp.debian.org wheezy/updates Release.gpg                         
    Obj http://security.debian.org wheezy/updates/main i386 Packages               
    Obj http://mirrors.kernel.org wheezy-backports/main Sources                   
    Obj http://ftp.debian.org wheezy-updates Release.gpg   
    Obj http://security.debian.org wheezy/updates/contrib i386 Packages           
    Obj http://mirrors.kernel.org wheezy-backports/contrib Sources                 
    Obj http://ftp.debian.org wheezy-backports Release.gpg
    Obj http://security.debian.org wheezy/updates/non-free i386 Packages           
    Obj http://mirrors.kernel.org wheezy-backports/non-free Sources               
    Obj http://ftp.debian.org wheezy Release               
    Obj http://security.debian.org wheezy/updates/contrib Translation-en           
    Obj http://mirrors.kernel.org wheezy-backports/main i386 Packages             
    Ign http://ftp.debian.org wheezy/updates Release       
    Obj http://security.debian.org wheezy/updates/main Translation-en             
    Obj http://ftp.debian.org wheezy-updates Release                               
    Obj http://security.debian.org wheezy/updates/non-free Translation-en         
    Obj http://ftp.debian.org wheezy-backports Release                             
    Obj http://mirrors.kernel.org wheezy-backports/contrib i386 Packages         
    Obj http://mirrors.kernel.org wheezy-backports/non-free i386 Packages         
    Obj http://mirrors.kernel.org wheezy-backports/contrib Translation-en
    Obj http://ftp.debian.org wheezy/main Sources         
    Obj http://mirrors.kernel.org wheezy-backports/main Translation-en         
    Obj http://mirrors.kernel.org wheezy-backports/non-free Translation-en     
    Obj http://ftp.debian.org wheezy/contrib Sources       
    Obj http://ftp.debian.org wheezy/non-free Sources
    Obj http://ftp.debian.org wheezy/main i386 Packages
    Obj http://ftp.debian.org wheezy/contrib i386 Packages
    Obj http://ftp.debian.org wheezy/non-free i386 Packages
    Obj http://ftp.debian.org wheezy/contrib Translation-en
    Obj http://ftp.debian.org wheezy/main Translation-es
    Obj http://ftp.debian.org wheezy/main Translation-en
    Obj http://ftp.debian.org wheezy/non-free Translation-en
    Obj http://ftp.debian.org wheezy-updates/main Sources
    Obj http://ftp.debian.org wheezy-updates/contrib Sources
    Obj http://ftp.debian.org wheezy-updates/non-free Sources
    Obj http://ftp.debian.org wheezy-updates/main i386 Packages
    Obj http://ftp.debian.org wheezy-updates/contrib i386 Packages
    Obj http://ftp.debian.org wheezy-updates/non-free i386 Packages
    Obj http://ftp.debian.org wheezy-updates/contrib Translation-en
    Obj http://ftp.debian.org wheezy-updates/main Translation-en
    Obj http://ftp.debian.org wheezy-updates/non-free Translation-en
    Obj http://ftp.debian.org wheezy-backports/main i386 Packages
    Obj http://ftp.debian.org wheezy-backports/main Translation-en
    [b]Err http://ftp.debian.org wheezy/updates/main Sources
      404  Not Found [IP: 130.89.148.12 80]
    Err http://ftp.debian.org wheezy/updates/contrib Sources
      404  Not Found [IP: 130.89.148.12 80]
    Err http://ftp.debian.org wheezy/updates/non-free Sources
      404  Not Found [IP: 130.89.148.12 80]
    W: Imposible obtener http://ftp.debian.org/debian/dists/wheezy/updates/main/source/Sources  404  Not Found [IP: 130.89.148.12 80]

    W: Imposible obtener http://ftp.debian.org/debian/dists/wheezy/updates/contrib/source/Sources  404  Not Found [IP: 130.89.148.12 80]

    W: Imposible obtener http://ftp.debian.org/debian/dists/wheezy/updates/non-free/source/Sources  404  Not Found [IP: 130.89.148.12 80]

    E: Some index files failed to download. They have been ignored, or old ones used instead.[/b]



    Gracias de antemano. Un saludo.
#12
Ejercicios / Re: ayuda
29 Junio 2013, 23:36 PM
Cita de: OmarHack en 29 Junio 2013, 23:20 PM
Está claro, que el espacio en blanco no le compila en ensamblador.

;D
#13
Ejercicios / Re: ayuda
29 Junio 2013, 23:09 PM
¿? ¿Cuál es tu problema?
#14
Pues ésa es mi duda. La cosa es que tengo bastante info en W8 y no tengo un hdd externo para poder salvarla, en caso BT5 joda el grub como leí por allí..

Si se preguntan por qué coño no lo instalo en una VM, pues la razón es sencilla. Tengo 2GB de ram (core i3) y me corre como el culo  ;D

¿Alguien ya lo ha intentado?


Saludos.
#15
Ejercicios / Re: Ejercicios en JAVA
28 Junio 2013, 17:37 PM
Cita de: odlawso en 28 Junio 2013, 16:51 PM
deseo los    ejercicios con metodos java porfitas uno de ellos es :
Escriba una aplicación que permita convertir 150 centímetros a pies y pulgadas.
Una pulgada = 2.54 centímetros.


¿Por qué no simplemente razonas? Estoy seguro que un algoritmo tan sencillo se desarrolla simplemente pensando 2 minutos..
#16
Java / Re: [principiante] Loteria
28 Junio 2013, 01:47 AM
En tu código hay un bug. ¿Que pasaría si se ingresara por error una letra o caracter? Terminaría en una expeción tipo InputMismatchException. Para evitar esto, pediríamos el ingreso del número de tickets y determinaríamos si es o no un número.

Código (=java) [Seleccionar]

// Este metodo se encargará de avisarnos si lo ingresado es un número
private static boolean isNumeric(String cadena){
  try {
    Integer.parseInt(cadena);
    return true;
  } catch (NumberFormatException nfe){
    System.out.println("Ingrese solo numeros");
    return false;
   }
}


Y lo llamaríamos al ingresar un valor:

Código (=java) [Seleccionar]

boolean esNumero;
do {

System.out.println("$$$$$$$ LOTTO $$$$$$$");
                                        System.out.println("Hi, how many tickets would you like to buy?");
                                        System.out.println(" [1] 1 Ticket");
                                        System.out.println(" [2] 2 Tickets");
                                        System.out.println(" [3] 3 Tickets");
                                        System.out.println(" [4] 4 Tickets");
                                        System.out.println(" [5] 5 Tickets");
                                        System.out.println(" [0] In bankrupt - Nothing\n");
                                        String choice2 = keyboard.next();
                                        esNumero = isNumeric(choice2);
                                        if (esNumero == true){
                                        choice = Integer.parseInt(choice2);
                                        }

} while(esNumero==false || choice<0 || choice>5);



Como ves, ingresamos choice como String. Luego llamamos al metodo isNumeric para determinar si es un número. Si es un número devuelve true, de lo contrario devuelve false a la variable Boolean esNumero. Si esNumero ahora es true, convertimos choice a entero. Al final, en el while, colocamos que se vuelva a ingresar choice, mientras que No sea un numero, o mientras se ingrese un valor menor a 0 o mayor a 5.

El método isNumeric tiene un catch en caso no se pueda convertir choice a entero (aquí ya sabemos que lo ingresado no es un número), que mostrará el mensaje "Ingrese solo números".

Otro problema que tienes, es que los números que generas pueden repetirse, por lo que si hay 43, 43 en los tickets y tu tienes 43, cuenta como 2 aciertos.

Para arreglar esto, una opción es crear un método que nos avise si el ticket actual ya ha sido sacado:

Código (=java) [Seleccionar]

//determina si el valor de la bola ya ha sido sacado
boolean numeroRepetido(int num, int[] numeros, int count)
{
  // num = bola, numeros = textfields de numeros, count = cuenta
  for(int i=0; i<count; i++)
  {
    // si el numero q se ha sacado ya esta en algun textfield
    if(numeros[i] == num)
    {
      return true; //devuelve true
    }
  }
  return false;
}


Y lo llamamos cada vez que generamos un ticket:

Código (=java) [Seleccionar]
// genera los tickets
void generar_tickets(int eleccion){

System.out.println("\nPrinting tickets...");
System.out.println("----------------------");

tickets = new int[59];
yourTickets = new int[eleccion];


// Generate list of numbers
for(int i = 0; i < tickets.length; i++) {
int numero;
do{
   numero = 1+generateNumbers.nextInt(60);
}while(numeroRepetido(numero,tickets,i));
tickets[i] = numero;
}
}


Código (=java) [Seleccionar]

// genera nuestros numeros
void generar_mistickets(){
// Give him his tickets
System.out.print("\nThese are your tickets: \t");
for (int i = 0; i < yourTickets.length; i++) {
int numero;
do{
numero = 1+generateNumbers.nextInt(60);
}while(numeroRepetido(numero,yourTickets,i));
yourTickets[i] = numero;
if(i != yourTickets.length-1){
System.out.print(yourTickets[i] + ", ");
}
else
System.out.print(yourTickets[i]);
}

} // fin metodo


Como podrás ver, dentro de cada for hacemos un do - while cuando se crea un nuevo ticket. Y la condición es:

Código (=java) [Seleccionar]
while(numeroRepetido(numero,tickets,contador));

Donde numero es el número que se ha generado actualmente, tickets es el arreglo de tickets (yourTickets y tickets), y contador es la cuenta de cuántos numeros se van sacando actualmente.

Código (=java) [Seleccionar]

//determina si el valor del ticket ya ha sido sacado
boolean numeroRepetido(int num, int[] numeros, int count)
{
  // num = ticket, numeros = arreglo de tickets, count = cuenta
  for(int i=0; i<count; i++)
  {
    // si el numero q se ha sacado ya se ha sacado
    if(numeros[i] == num)
    {
      return true; //devuelve true
    }
  }
  return false;
}


Por ejemplo, si recién vamos sacando 3 tickets (i = 2). El for del método quedaría:

Código (=java) [Seleccionar]
for(int i=0; i<count; i++) {
  // 0 < 2 ó 1 < 2 -> Si, entonces compara:
  // si el numero q se ha sacado ya se ha sacado
    if(numeros[i] == num)
    {
      return true; //devuelve true
    }
    else
      return false;
  }



Otra cosita es la cantidad de aciertos. Pueden haber más de 10 aciertos en tu código. Podemos hacer esto:

Código (=java) [Seleccionar]

// Check if something matched
for(int i = 0; i < yourTickets.length; i++) {
for(int j = 0; j < tickets.length; j++) {
if (yourTickets[i] == tickets[j]) {
matched++;
System.out.println(yourTickets[i]+ " = "+tickets[j]);
}
if(matched == 5){
j=60;
i=60;
   }

  } // fin for interno
} // fin for externo


Solamente se coloca un if (matched == 5). Cuando hayan 5 aciertos (que se suponen son lo máximo), i & j se les asigna 60 solo para romper los fors.

Espero hayas entendido este pedazo de código. Un saludo.

PD: Te dejo todo el code para que lo estudies cuando veas POO.

Código (=java) [Seleccionar]

import java.util.Random;
import java.util.Scanner;

public class Loteria {

int choice;
int[] tickets;
int[] yourTickets;
int matched=0;
Scanner keyboard = new Scanner(System.in);
Random generateNumbers = new Random();

public Loteria(){
Jugar instance = new Jugar();
instance.start();
}

// genera los tickets
void generar_tickets(int eleccion){

System.out.println("\nPrinting tickets...");
System.out.println("----------------------");

tickets = new int[59];
yourTickets = new int[eleccion];


// Generate list of numbers
for(int i = 0; i < tickets.length; i++) {
int numero;
do{
   numero = 1+generateNumbers.nextInt(60);
}while(numeroRepetido(numero,tickets,i));
tickets[i] = numero;
}
}

// genera nuestros numeros
void generar_mistickets(){
// Give him his tickets
System.out.print("\nThese are your tickets: \t");
for (int i = 0; i < yourTickets.length; i++) {
int numero;
do{
numero = 1+generateNumbers.nextInt(60);
}while(numeroRepetido(numero,yourTickets,i));
yourTickets[i] = numero;
if(i != yourTickets.length-1){
System.out.print(yourTickets[i] + ", ");
}
else
System.out.print(yourTickets[i]);
}

} // fin metodo


//determina si el valor de la bola ya ha sido sacado
boolean numeroRepetido(int num, int[] numeros, int count)
{
  // num = bola, numeros = textfields de numeros, count = cuenta
  for(int i=0; i<count; i++)
  {
    // si el numero q se ha sacado ya esta en algun textfield
    if(numeros[i] == num)
    {
      return true; //devuelve true
    }
  }
  return false;
}

// compara nuestros numeros con los tickets y aumenta los aciertos
void comparar(){

System.out.println("\n\nLet's if you won something... \n");

// Check if something matched
for(int i = 0; i < yourTickets.length; i++) {
for(int j = 0; j < tickets.length; j++) {
if (yourTickets[i] == tickets[j]) {
matched++;
System.out.println(yourTickets[i]+ " = "+tickets[j]);
}
if(matched == 5){
j=60;
i=60;
   }

  } // fin for interno
} // fin for externo

// Make a pause
try {
Thread.sleep(3000);
} catch(InterruptedException e) {
}
System.out.println("Matchs:\t"+matched);
switch (matched) {
case 1:
System.out.println("You won $100!");
break;

case 2:
System.out.println("You won $200!");
break;

case 3:
System.out.println("You won $500!");
break;

case 4:
System.out.println("You won $800!");
break;

case 5:
System.out.println("GREAT. You've got the pot: $1000!");
break;

case 0:
System.out.println("Have luck next time!");
break;

}

} // fin metodo

// pregunta si se desea jugar denuevo
boolean jugar_denuevo() {

// Ask if he wants to try again
matched = 0;
System.out.println("Would you like to try again? (X to exit) \t");
String tryAgain = keyboard.nextLine();

if(tryAgain.compareToIgnoreCase("x") == 0) {
System.out.println("Thank you. Bye");
System.exit(0);
return false;
}
else {
// Just clear screen
for (int l = 0; l < 5; l++) {
System.out.println();
  }
return true;

  }
}// fin metodo

// este metodo nos indica si lo ingresado es un numero
private static boolean isNumeric(String cadena){
  try {
    Integer.parseInt(cadena);
    return true;
  } catch (NumberFormatException nfe){
    System.out.println("Ingrese solo numeros");
    return false;
   }
}

// clase que empieza el juego mediante thread
private class Jugar extends Thread{

private boolean continuar=true; //condicion del thread


public void run()  { // incia el thread
while(continuar) { // hace la tarea mientras continuar sea true
boolean esNumero;
do {

System.out.println("$$$$$$$ LOTTO $$$$$$$");
                                        System.out.println("Hi, how many tickets would you like to buy?");
                                        System.out.println(" [1] 1 Ticket");
                                        System.out.println(" [2] 2 Tickets");
                                        System.out.println(" [3] 3 Tickets");
                                        System.out.println(" [4] 4 Tickets");
                                        System.out.println(" [5] 5 Tickets");
                                        System.out.println(" [0] In bankrupt - Nothing\n");
                                        String choice2 = keyboard.nextLine();
                                        esNumero = isNumeric(choice2);
                                        if (esNumero == true){
                                        choice = Integer.parseInt(choice2);
                                        }

} while(esNumero==false || choice<0 || choice>5);

                                        if (choice == 0) {
                                        System.out.println("EXITING...");
                                        System.exit(0);
                                      }

                                       generar_tickets(choice);
                                       generar_mistickets();
                                       comparar();
                                       continuar = jugar_denuevo();

                                     
}
}
}


                       public static void main(String[] args) {
                        new Loteria();
                       }
                   } // fin.
#17
Seguridad / Re: Ayuda con antivirus por favor
27 Junio 2013, 23:04 PM
Cita de: HdM en 27 Junio 2013, 18:28 PM
¿Probaste pasando el AV en modo seguro?

Haz lo que te recomienda HdM.

Te recomiendo que utilices MalwareBytes Antimalware:

  • Descarga MalwareBytes Antimalware e instálalo.
  • Reinicia el equipo e inicia en modo seguro.
  • Abre el MalwareBytes y elige 'modo completo'.
  • Dale a analizar y espera que termine.
  • Asegúrate que todos los virus estén marcados.
  • Eliminar seleccionados (algunas veces pide reiniciar).


    Saludos.
#18
Yo son fan de recomendar primero, desarrollar una buena lógica a base de algoritmos. Ahora, hablando de lenguajes para empezar te recomendaría Python. Es el lenguaje más fácil de aprender. Transforma tus algoritmos a código Python para ir ganando cancha.

Luego ya depende de lo que quieras hacer. Si lo que deseas es programar webs, PHP, Ruby, Python (tienes una ligera ventaja ;)),Perl, etc.
Si lo que deseas es programar aplicaciones de escritorio, pues te recomiendo aprender Java y C#. Si vamos por el torno empresarial, C++ es la mejor opción.

Como te repito, todo es cuestión de lo que quieres hacer. Pero mientras más lenguajes se pueda aprender, mucho mejor. Poco a poco..


Saludos.
#19
Java / Re: [principiante] Loteria
27 Junio 2013, 22:32 PM
Claro, es importante una buena praxis. La identación es muy importante en un código ya que lo hace más legible. Pero la identación la coloca automáticamente el IDE. ¿Qué IDE usas? ¿O usas un editor de texto común?

No es necesario comentar solo con funciones. Simplemente, cuando haya un pedazo de código que creas conveniente comentar, simplemente coméntalo. Cuando recién empecé, no comentaba mis algoritmos, y a las 3 semanas no sabía ni qué había hecho. Comentar el código es muy importante.

Saludos.
#20
Java / Re: [principiante] Loteria
27 Junio 2013, 22:07 PM
Para mí its okay, yo comento mucho más mis códigos (creo que es una manía mía jeje) pero se entiende bastante bien lo que quieres hacer (aunque el 100% del code esté en inglés).

Respecto a tabulación ¿A qué te refieres?

Y por último como recomendación aprende POO, si usamos Java sin POO mejor irnos a C  ;D


Saludos.

PD: Léete el libro 'Cómo programar en Java 7ma edición - Deitel'. Aprenderás muy rápido con este libro.