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

 

 


Tema destacado: Guía actualizada para evitar que un ransomware ataque tu empresa


  Mostrar Mensajes
Páginas: 1 ... 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 [67] 68 69 70 71 72 73 74 75 76 77 78 79
661  Programación / Java / Re: ¿como abrir un dll para poder ver sus funciones? y usarlas en JNI en: 6 Diciembre 2009, 19:10 pm
no creo que puedas usar una funcion de un dll cuarquiera yo diria que tiene que estar compilada en jni el code fuente.

Saludos.
662  Programación / Java / Re: Rutas Absolutas y Relativas de Windows en JAVA en: 5 Diciembre 2009, 21:44 pm
con el System.getProperty puedes optener las que tu mismo definas o las que bienen predefinidas para crear tu propia variable usa el System.setProperty("Windows", "C:/Windows");  y para llamarla System.getProperty("Windows");

Saludos.
663  Programación / Java / Re: Ayuda con java en: 5 Diciembre 2009, 21:09 pm
 bueno ya utilizaste
Código
  1. String nombre = entrada.next()

Saludos.
664  Programación / Java / Re: Matriz transpuesta a la inversa!!!! Ayuda!!! en: 5 Diciembre 2009, 04:11 am
 :) y lleva 4 dias haciendolo  :P
665  Programación / Java / Re: clpbaord en: 5 Diciembre 2009, 04:08 am
Hola amigo .. se hace de la siguiente forma


Código
  1. import java.awt.BorderLayout;
  2. import java.awt.Color;
  3. import java.awt.datatransfer.DataFlavor;
  4. import java.awt.datatransfer.Transferable;
  5. import java.awt.dnd.DnDConstants;
  6. import java.awt.dnd.DropTarget;
  7. import java.awt.dnd.DropTargetDragEvent;
  8. import java.awt.dnd.DropTargetDropEvent;
  9. import java.awt.dnd.DropTargetEvent;
  10. import java.awt.dnd.DropTargetListener;
  11. import javax.swing.JFrame;
  12. import javax.swing.JLabel;
  13. import javax.swing.JTextArea;
  14.  
  15. public class NTest extends JFrame implements DropTargetListener {
  16.  
  17.  private DropTarget dt;
  18.  private JTextArea ta;
  19.  
  20.  public NTest() {
  21.    setSize(300, 300);
  22.    getContentPane().add(
  23.        new JLabel("Drop a list from your file chooser here:"),
  24.        BorderLayout.NORTH);
  25.    ta = new JTextArea();
  26.    ta.setBackground(Color.white);
  27.    getContentPane().add(ta, BorderLayout.CENTER);
  28.    setVisible(true);
  29.  }
  30.  public void dragEnter(DropTargetDragEvent dtde) {}
  31.  public void dragExit(DropTargetEvent dte){ }
  32.  public void dragOver(DropTargetDragEvent dtde) {}
  33.  public void dropActionChanged(DropTargetDragEvent dtde) {}
  34.  public void drop(DropTargetDropEvent dtde) {
  35.    try {
  36.      Transferable tr = dtde.getTransferable();
  37.      DataFlavor[] flavors = tr.getTransferDataFlavors();
  38.      for (int i = 0; i < flavors.length; i++) {
  39.        if (flavors[i].isFlavorJavaFileListType()) {
  40.          dtde.acceptDrop(DnDConstants.ACTION_COPY);
  41.          java.util.List list = (java.util.List) tr
  42.              .getTransferData(flavors[i]);
  43.          for (int j = 0; j < list.size(); j++) {
  44.            ta.append(list.get(j) + "\n");
  45.          }
  46.          dtde.dropComplete(true);
  47.          return;
  48.        }
  49.      }
  50.      System.out.println("Drop failed: " + dtde);
  51.      dtde.rejectDrop();
  52.    } catch (Exception e) {
  53.      e.printStackTrace();
  54.      dtde.rejectDrop();
  55.    }
  56.  }
  57.  
  58.  public static void main(String args[]) {
  59.    new NTest();
  60.  }
  61. }
666  Programación / Java / Re: Llenar una matriz con primos al azar! :S en: 3 Diciembre 2009, 00:51 am
 :)
667  Programación / Java / Re: Dibujar un engranaje en java con Graphics en: 2 Diciembre 2009, 16:02 pm
un ejemplo http://proinf.net/permalink/ruedas_dentadas debajo esta el code fuente espero te sirva

Saludos.
668  Programación / Java / Re: Llenar una matriz con primos al azar! :S en: 2 Diciembre 2009, 15:28 pm
por cierto nuca crees 2 objetos del lector de teclado utiliza siempre 1 o usa el Scanner ;)  asi te quedaria


Código
  1. import java.io.*;
  2. import java.util.Random;
  3. /**
  4.  *
  5.  * @author Felipe Poblete
  6.  */
  7. public class Main {
  8. public static boolean primo(int numero){
  9. for(int i=2; i<numero; i++) {
  10.     if (numero % i == 0) return false;
  11.    }
  12. return true;
  13.     }
  14.    public static void main(String[] args) throws IOException {
  15.        java.util.Scanner scanner = new   java.util.Scanner(System.in);
  16.        System.out.println("Ingrese el numero de Columnas: ");
  17.        int numRows =scanner.nextInt();
  18.        System.out.println("Ingrese el numero de Filas   : ");
  19.        int numColumn = scanner.nextInt();
  20.        int matriz[][] = new int[numColumn][numRows];
  21.        Random random = new Random();
  22.        for (int i=0; i < matriz.length;i++){
  23.            for (int index=0; index< numRows; index++){
  24.                while(true){
  25.                 int b = random.nextInt(1000);
  26.                 if(b >= 100 && primo(b)){
  27.                 matriz[i][index] = b;
  28.                 break;
  29.                 }else continue;
  30.                }
  31.            }
  32.        }
  33.        for(int index=0;index<matriz.length;index++){
  34.         for(int r=0;r<numRows;r++){
  35.         System.out.println(matriz[index][r]);
  36.         }
  37.        }    
  38.    }      
  39. }

Saludos:
669  Programación / Java / Re: algoritmo radix sort en java en: 2 Diciembre 2009, 05:29 am
solo funcion con positivos

Código
  1. import java.lang.*;
  2. import java.io.*;
  3.  
  4. public class RadixSort{
  5.  
  6.    public static void radixSort(int[] arr){
  7.        if(arr.length == 0)
  8.            return;
  9.        int[][] np = new int[arr.length][2];
  10.        int[] q = new int[0x100];
  11.        int i,j,k,l,f = 0;
  12.        for(k=0;k<4;k++){
  13.            for(i=0;i<(np.length-1);i++)
  14.                np[i][1] = i+1;
  15.            np[i][1] = -1;
  16.            for(i=0;i<q.length;i++)
  17.                q[i] = -1;
  18.            for(f=i=0;i<arr.length;i++){
  19.                j = ((0xFF<<(k<<3))&arr[i])>>(k<<3);
  20.                if(q[j] == -1)
  21.                    l = q[j] = f;
  22.                else{
  23.                    l = q[j];
  24.                    while(np[l][1] != -1)
  25.                        l = np[l][1];
  26.                    np[l][1] = f;
  27.                    l = np[l][1];
  28.                }
  29.                f = np[f][1];
  30.                np[l][0] = arr[i];
  31.                np[l][1] = -1;
  32.            }
  33.            for(l=q[i=j=0];i<0x100;i++)
  34.                for(l=q[i];l!=-1;l=np[l][1])
  35.                        arr[j++] = np[l][0];
  36.        }
  37.    }
  38.  
  39.    public static void main(String[] args){
  40.        int i;
  41.        int[] arr = new int[15];
  42.        System.out.print("original: ");
  43.        for(i=0;i<arr.length;i++){
  44.            arr[i] = (int)(Math.random() * 1024);
  45.            System.out.print(arr[i] + " ");
  46.        }
  47.        radixSort(arr);
  48.        System.out.print("\nsorted: ");
  49.        for(i=0;i<arr.length;i++)
  50.            System.out.print(arr[i] + " ");
  51.        System.out.println("\nDone ;-)");
  52.    }
  53. }
670  Programación / Java / Re: paquete jna java en: 1 Diciembre 2009, 23:28 pm
necesita el  code de que lo quiere hacer en c/c++ para luego pasarlo a jni

Saludos.
Páginas: 1 ... 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 [67] 68 69 70 71 72 73 74 75 76 77 78 79
WAP2 - Aviso Legal - Powered by SMF 1.1.21 | SMF © 2006-2008, Simple Machines