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

 

 


Tema destacado: Tutorial básico de Quickjs


  Mostrar Temas
Páginas: [1] 2 3
1  Comunicaciones / Redes / Problema de conexion entre el ISP y Data Center Turnkey en: 14 Marzo 2017, 19:59 pm
El ISP es CANTV y se encuentra en Venezuela el data center Turnkey se encuentra en Australia. Mis Clientes Cuando van a realizar sus solicitudes al DNS llamado efactory.sytes.net tienen respuesta lenta. El paquete de datos comprado a Turnkey para el almacenamiento queda descartado, hay disponibilidad de sobra de RAM y CPU.

Cual podría ser entonces la causa del Problema?
2  Programación / Java / GridBagLayout no posiciona los componentes en: 26 Octubre 2016, 16:01 pm
Dentro de la ventana Login los componentes se muestran totalmente desordenados, a pesar que estoy utilizando GridBagLayout

Código
  1. package drone;
  2.  
  3. import java.awt.*;
  4. import java.sql.*;
  5. import java.text.Collator;
  6. import java.util.logging.Level;
  7. import java.util.logging.Logger;
  8. import javax.swing.JOptionPane;
  9. import javax.swing.*;
  10.  
  11.  
  12.  
  13. public class Login extends javax.swing.JFrame {
  14. //private JPanel panel1;
  15. public static boolean RIGHT_TO_LEFT = false;
  16. final static boolean shouldFill = true;
  17. final static boolean shouldWeightX = true;
  18.  
  19.  
  20.    public Login() {
  21.        initComponents();
  22.        this.setSize(Toolkit.getDefaultToolkit().getScreenSize());
  23.        PnlFondo fondo = new PnlFondo();
  24.        this.setLayout(new BorderLayout());
  25.        this.add(fondo,BorderLayout.CENTER);
  26.        //getContentPane().setLayout(null);  
  27.        //addComponentsToPane(pane);
  28.    }
  29. public static void addComponentsToPane(Container pane) {
  30.        if (RIGHT_TO_LEFT) {
  31.            pane.setComponentOrientation(ComponentOrientation.RIGHT_TO_LEFT);
  32.        }
  33.  
  34.        JLabel jLabel1,jLabel2,jLabel3;
  35.        JTextField usuario;
  36.        JPasswordField contraseña;
  37.        JButton jButton2;
  38.  
  39. pane.setLayout(new GridBagLayout());
  40. if (shouldFill) {
  41. //natural height, maximum width
  42. c.fill = GridBagConstraints.HORIZONTAL;
  43. }
  44.  
  45. jLabel1 = new JLabel();
  46. if (shouldWeightX) {
  47. c.weightx = 0.5;
  48. }
  49. c.fill = GridBagConstraints.HORIZONTAL;
  50. c.gridx = 200;
  51. c.gridy = 100;
  52. pane.add(jLabel1, c);
  53.  
  54. jLabel2 = new JLabel();
  55. c.fill = GridBagConstraints.HORIZONTAL;
  56. c.weightx = 0.5;
  57. c.gridx = 200;
  58. c.gridy = 110;
  59. pane.add(jLabel2, c);
  60.  
  61. jLabel3 = new JLabel();
  62. c.fill = GridBagConstraints.HORIZONTAL;
  63. c.weightx = 0.5;
  64. c.gridx = 2;
  65. c.gridy = 0;
  66. pane.add(jLabel3, c);
  67.  
  68. usuario = new JTextField("Long-Named Button 4");
  69. c.fill = GridBagConstraints.HORIZONTAL;
  70. c.ipady = 40;      //make this component tall
  71. c.weightx = 0.0;
  72. c.gridwidth = 3;
  73. c.gridx = 0;
  74. c.gridy = 1;
  75. pane.add(usuario, c);
  76.  
  77.        contraseña = new JPasswordField("Long-Named Button 4");
  78. c.fill = GridBagConstraints.HORIZONTAL;
  79. c.ipady = 40;      //make this component tall
  80. c.weightx = 0.0;
  81. c.gridwidth = 3;
  82. c.gridx = 0;
  83. c.gridy = 1;
  84. pane.add(contraseña, c);
  85.  
  86.  
  87. jButton2 = new JButton();
  88. c.fill = GridBagConstraints.HORIZONTAL;
  89. c.ipady = 0;       //reset to default
  90. c.weighty = 1.0;   //request any extra vertical space
  91. c.anchor = GridBagConstraints.PAGE_END; //bottom of space
  92. c.insets = new Insets(10,0,0,0);  //top padding
  93. c.gridx = 1;       //aligned with button 2
  94. c.gridwidth = 2;   //2 columns wide
  95. c.gridy = 2;       //third row
  96. pane.add(jButton2, c);
  97. }
  98.    private static void createAndShowGUI() {
  99.        //Create and set up the window.
  100.        JFrame frame = new JFrame("GridBagLayoutDemo");
  101.        frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
  102.  
  103.        //Set up the content pane.
  104.        addComponentsToPane(frame.getContentPane());
  105.  
  106.        //Display the window.
  107.        frame.pack();
  108.        frame.setVisible(true);
  109.    }
  110.  
  111.    /**
  112.      * This method is called from within the constructor to initialize the form.
  113.      * WARNING: Do NOT modify this code. The content of this method is always
  114.      * regenerated by the Form Editor.
  115.      */
  116.    @SuppressWarnings("unchecked")
  117.    // <editor-fold defaultstate="collapsed" desc="Generated Code">                          
  118.    private void initComponents() {
  119.  
  120.        jLabel1 = new javax.swing.JLabel();
  121.        jLabel2 = new javax.swing.JLabel();
  122.        usuario = new javax.swing.JTextField();
  123.        jLabel3 = new javax.swing.JLabel();
  124.        contraseña = new javax.swing.JPasswordField();
  125.        jButton2 = new javax.swing.JButton();
  126.  
  127.        setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE);
  128.  
  129.        jLabel1.setText("Iniciar Sesion");
  130.  
  131.        jLabel2.setText("Usuario");
  132.  
  133.        jLabel3.setText("Contraseña");
  134.  
  135.        jButton2.setText("Aceptar");
  136.        jButton2.addActionListener(new java.awt.event.ActionListener() {
  137.            public void actionPerformed(java.awt.event.ActionEvent evt) {
  138.                jButton2ActionPerformed(evt);
  139.            }
  140.        });
  141.  
  142.        javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane());
  143.        getContentPane().setLayout(layout);
  144.        layout.setHorizontalGroup(
  145.            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
  146.            .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup()
  147.                .addContainerGap(113, Short.MAX_VALUE)
  148.                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
  149.                    .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
  150.                        .addGroup(layout.createSequentialGroup()
  151.                            .addComponent(jLabel2)
  152.                            .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
  153.                            .addComponent(usuario, javax.swing.GroupLayout.PREFERRED_SIZE, 64, javax.swing.GroupLayout.PREFERRED_SIZE))
  154.                        .addGroup(layout.createSequentialGroup()
  155.                            .addGap(20, 20, 20)
  156.                            .addComponent(jLabel1, javax.swing.GroupLayout.PREFERRED_SIZE, 84, javax.swing.GroupLayout.PREFERRED_SIZE)
  157.                            .addGap(169, 169, 169)))
  158.                    .addGroup(layout.createSequentialGroup()
  159.                        .addComponent(jLabel3)
  160.                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
  161.                        .addComponent(contraseña, javax.swing.GroupLayout.PREFERRED_SIZE, 64, javax.swing.GroupLayout.PREFERRED_SIZE)
  162.                        .addGap(163, 163, 163))))
  163.            .addGroup(layout.createSequentialGroup()
  164.                .addGap(148, 148, 148)
  165.                .addComponent(jButton2)
  166.                .addGap(0, 0, Short.MAX_VALUE))
  167.        );
  168.        layout.setVerticalGroup(
  169.            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
  170.            .addGroup(layout.createSequentialGroup()
  171.                .addContainerGap(108, Short.MAX_VALUE)
  172.                .addComponent(jLabel1, javax.swing.GroupLayout.PREFERRED_SIZE, 14, javax.swing.GroupLayout.PREFERRED_SIZE)
  173.                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
  174.                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
  175.                    .addComponent(jLabel2)
  176.                    .addComponent(usuario, javax.swing.GroupLayout.PREFERRED_SIZE, 27, javax.swing.GroupLayout.PREFERRED_SIZE))
  177.                .addGap(11, 11, 11)
  178.                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
  179.                    .addComponent(jLabel3)
  180.                    .addComponent(contraseña, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
  181.                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
  182.                .addComponent(jButton2)
  183.                .addGap(107, 107, 107))
  184.        );
  185.  
  186.        pack();
  187.    }// </editor-fold>                        
  188.  
  189.    private void jButton2ActionPerformed(java.awt.event.ActionEvent evt) {                                        
  190.  
  191.        String user=usuario.getText();
  192.        String pass=contraseña.getText();
  193.        if ((user.length()==0)||(pass.length()==0)){
  194.           JOptionPane.showMessageDialog(rootPane, "Campo usuario o contraseña vacio");
  195.             }else{
  196.            Conexion mysql= new Conexion();
  197.       Connection conn= mysql.conectar();
  198.      /* if(conn!=null){
  199.            JOptionPane.showMessageDialog(rootPane, "Conexion con base de datos");
  200.        }*/
  201.              try {
  202.                  @SuppressWarnings("null")
  203.                  Statement sentencia= conn.createStatement(ResultSet.TYPE_FORWARD_ONLY,ResultSet.CONCUR_READ_ONLY);
  204.                ResultSet rs;
  205.                rs = sentencia.executeQuery("SELECT * FROM usuarios WHERE Usuario='"+user+"' && Contraseña='"+pass+"'");
  206.                Collator comparador = Collator.getInstance();
  207.                comparador.setStrength(Collator.TERTIARY);
  208.                String tem1=rs.getString("Usuario");
  209.                String tem2=rs.getString("Contraseña");
  210.                if(rs.next()&&comparador.equals(user,tem1)&&comparador.equals(pass,tem2)){
  211.                    Menu inicio=new Menu();
  212.                    inicio.setVisible(true);
  213.                }
  214.                else{
  215.                    JOptionPane.showMessageDialog(rootPane, "Los datos son incorrectos");
  216.                }
  217.            } catch (SQLException ex) {
  218.                Logger.getLogger(Login.class.getName()).log(Level.SEVERE, null, ex);
  219.            }
  220.        }
  221.        //if (user.equals()&&pass.equals());
  222.    }                                        
  223.  
  224.    /**
  225.      * @param args the command line arguments
  226.      */
  227.    public static void main(String args[]) {
  228.        /* Set the Nimbus look and feel */
  229.        //<editor-fold defaultstate="collapsed" desc=" Look and feel setting code (optional) ">
  230.        /* If Nimbus (introduced in Java SE 6) is not available, stay with the default look and feel.
  231.          * For details see http://download.oracle.com/javase/tutorial/uiswing/lookandfeel/plaf.html
  232.          */
  233.        try {
  234.            for (javax.swing.UIManager.LookAndFeelInfo info : javax.swing.UIManager.getInstalledLookAndFeels()) {
  235.                if ("Nimbus".equals(info.getName())) {
  236.                    javax.swing.UIManager.setLookAndFeel(info.getClassName());
  237.                    break;
  238.                }
  239.            }
  240.        } catch (ClassNotFoundException ex) {
  241.            java.util.logging.Logger.getLogger(Login.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
  242.        } catch (InstantiationException ex) {
  243.            java.util.logging.Logger.getLogger(Login.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
  244.        } catch (IllegalAccessException ex) {
  245.            java.util.logging.Logger.getLogger(Login.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
  246.        } catch (javax.swing.UnsupportedLookAndFeelException ex) {
  247.            java.util.logging.Logger.getLogger(Login.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
  248.        }
  249.        //</editor-fold>
  250.  
  251.        /* Create and display the form */
  252.        java.awt.EventQueue.invokeLater(new Runnable() {
  253.            public void run() {
  254.                createAndShowGUI();
  255.                new Login().setVisible(true);
  256.            }
  257.        });
  258.  
  259.    }
  260.  
  261.    // Variables declaration - do not modify                    
  262.    private javax.swing.JPasswordField contraseña;
  263.    private javax.swing.JButton jButton2;
  264.    private javax.swing.JLabel jLabel1;
  265.    private javax.swing.JLabel jLabel2;
  266.    private javax.swing.JLabel jLabel3;
  267.    private javax.swing.JTextField usuario;
  268.    // End of variables declaration                  
  269. }
  270.  

A quien pueda ayudar, gracias por adelentado
3  Programación / Java / Problema con la conexión a la BD en: 11 Octubre 2016, 00:32 am
Esta es la clase que contiene el codigo para la conexion con la base de datos

Código
  1. package drone;
  2. import java.sql.*;
  3. import javax.swing.*;
  4.  
  5. public class Conexion {
  6.    public String db = "prototipo";
  7.    public String user= "root";
  8.    public String pass="";
  9.    public String url= "jdbc:mysql://localhost/"+db;
  10.    public Conexion()
  11.    {
  12.            }
  13.   public Connection conectar()
  14.   {
  15.       java.sql.Connection link=null;
  16.       Statement st=null;
  17.       try{
  18.                 Class.forName("com.mysql.jdbc.Driver");
  19.                 link=DriverManager.getConnection(this.url, this.user, this.pass);
  20.                 if(link!=null){
  21.                     JOptionPane.showMessageDialog(null, "conexion establecida");
  22.                 }
  23.                 /*if(link!=null){
  24.                      st=link.createStatement();
  25.                  }*/
  26.   }
  27.       catch(Exception e)
  28.       {
  29.           JOptionPane.showMessageDialog(null, "fallo conexion");
  30.           JOptionPane.showMessageDialog(null, e);
  31.       }
  32.       return link;
  33.   }
  34.    }
  35.  
  36.  

Esta es la clase Login que contiene el llamado al metodo conectar() de la clase Conexion, aqui tambien se genera el evento de boton

Código
  1. package drone;
  2.  
  3. import java.awt.BorderLayout;
  4. import java.awt.Toolkit;
  5. import java.sql.*;
  6. import java.util.logging.Level;
  7. import java.util.logging.Logger;
  8. import javax.swing.JOptionPane;
  9. import java.lang.*;
  10.  
  11.  
  12. public class Login extends javax.swing.JFrame {
  13.  
  14.  
  15.    public Login() {
  16.        initComponents();
  17.        this.setSize(Toolkit.getDefaultToolkit().getScreenSize());
  18.        PnlFondo fondo = new PnlFondo();
  19.        this.setLayout(new BorderLayout());
  20.        this.add(fondo,BorderLayout.CENTER);
  21.  
  22.    }
  23.  
  24.    /**
  25.      * This method is called from within the constructor to initialize the form.
  26.      * WARNING: Do NOT modify this code. The content of this method is always
  27.      * regenerated by the Form Editor.
  28.      */
  29.    @SuppressWarnings("unchecked")
  30.    // <editor-fold defaultstate="collapsed" desc="Generated Code">                          
  31.    private void initComponents() {
  32.  
  33.        jButton1 = new javax.swing.JButton();
  34.        jLabel1 = new javax.swing.JLabel();
  35.        jLabel2 = new javax.swing.JLabel();
  36.        usuario = new javax.swing.JTextField();
  37.        jLabel3 = new javax.swing.JLabel();
  38.        contraseña = new javax.swing.JPasswordField();
  39.        jButton2 = new javax.swing.JButton();
  40.  
  41.        setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE);
  42.  
  43.        jButton1.setText("Registrarse");
  44.  
  45.        jLabel1.setText("Iniciar Sesion");
  46.  
  47.        jLabel2.setText("Usuario");
  48.  
  49.        jLabel3.setText("Contraseña");
  50.  
  51.        jButton2.setText("Aceptar");
  52.        jButton2.addActionListener(new java.awt.event.ActionListener() {
  53.            public void actionPerformed(java.awt.event.ActionEvent evt) {
  54.                jButton2ActionPerformed(evt);
  55.            }
  56.        });
  57.  
  58.        javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane());
  59.        getContentPane().setLayout(layout);
  60.        layout.setHorizontalGroup(
  61.            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
  62.            .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup()
  63.                .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
  64.                .addComponent(jButton1)
  65.                .addGap(46, 46, 46))
  66.            .addGroup(layout.createSequentialGroup()
  67.                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
  68.                    .addGroup(layout.createSequentialGroup()
  69.                        .addGap(89, 89, 89)
  70.                        .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
  71.                            .addComponent(jLabel3)
  72.                            .addComponent(jLabel2))
  73.                        .addGap(75, 75, 75)
  74.                        .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
  75.                            .addComponent(usuario, javax.swing.GroupLayout.DEFAULT_SIZE, 64, Short.MAX_VALUE)
  76.                            .addComponent(contraseña)))
  77.                    .addGroup(layout.createSequentialGroup()
  78.                        .addGap(163, 163, 163)
  79.                        .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
  80.                            .addComponent(jButton2)
  81.                            .addComponent(jLabel1, javax.swing.GroupLayout.PREFERRED_SIZE, 84, javax.swing.GroupLayout.PREFERRED_SIZE))))
  82.                .addContainerGap(116, Short.MAX_VALUE))
  83.        );
  84.        layout.setVerticalGroup(
  85.            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
  86.            .addGroup(layout.createSequentialGroup()
  87.                .addGap(20, 20, 20)
  88.                .addComponent(jButton1)
  89.                .addGap(33, 33, 33)
  90.                .addComponent(jLabel1, javax.swing.GroupLayout.PREFERRED_SIZE, 14, javax.swing.GroupLayout.PREFERRED_SIZE)
  91.                .addGap(18, 18, 18)
  92.                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
  93.                    .addGroup(layout.createSequentialGroup()
  94.                        .addComponent(jLabel2)
  95.                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED, 27, Short.MAX_VALUE)
  96.                        .addComponent(jLabel3)
  97.                        .addGap(159, 159, 159))
  98.                    .addGroup(layout.createSequentialGroup()
  99.                        .addComponent(usuario, javax.swing.GroupLayout.PREFERRED_SIZE, 27, javax.swing.GroupLayout.PREFERRED_SIZE)
  100.                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
  101.                        .addComponent(contraseña, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
  102.                        .addGap(29, 29, 29)
  103.                        .addComponent(jButton2)
  104.                        .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))))
  105.        );
  106.  
  107.        pack();
  108.    }// </editor-fold>                        
  109.  
  110.    private void jButton2ActionPerformed(java.awt.event.ActionEvent evt) {                                        
  111.  
  112.        String user=usuario.getText();
  113.        String pass=contraseña.getText();
  114.        if ((user.length()==0)||(pass.length()==0)){
  115.           JOptionPane.showMessageDialog(rootPane, "Campo usuario o contraseña vacio");
  116.             }else{
  117.            Conexion mysql= new Conexion();
  118.       Connection conn= mysql.conectar();
  119.       if(conn!=null){
  120.           JOptionPane.showMessageDialog(rootPane, "Conexion con base de datos");
  121.       }
  122.              try {
  123.                  Statement sentencia= conn.createStatement();
  124.                ResultSet rs;
  125.                rs = sentencia.executeQuery("SELECT * FROM usuarios WHERE Usuario="+user+" && Contraseña="+pass+"");
  126.                int encontrado=rs.getRow();
  127.                if(encontrado==1){
  128.                    Menu inicio=new Menu();
  129.                    inicio.setVisible(true);
  130.                }
  131.                else{
  132.                    JOptionPane.showMessageDialog(rootPane, "Los datos son incorrectos");
  133.                }
  134.            } catch (SQLException ex) {
  135.                Logger.getLogger(Login.class.getName()).log(Level.SEVERE, null, ex);
  136.            }
  137.        }
  138.        //if (user.equals()&&pass.equals());
  139.    }                                        
  140.  
  141.    /**
  142.      * @param args the command line arguments
  143.      */
  144.    public static void main(String args[]) {
  145.        /* Set the Nimbus look and feel */
  146.        //<editor-fold defaultstate="collapsed" desc=" Look and feel setting code (optional) ">
  147.        /* If Nimbus (introduced in Java SE 6) is not available, stay with the default look and feel.
  148.          * For details see http://download.oracle.com/javase/tutorial/uiswing/lookandfeel/plaf.html
  149.          */
  150.        try {
  151.            for (javax.swing.UIManager.LookAndFeelInfo info : javax.swing.UIManager.getInstalledLookAndFeels()) {
  152.                if ("Nimbus".equals(info.getName())) {
  153.                    javax.swing.UIManager.setLookAndFeel(info.getClassName());
  154.                    break;
  155.                }
  156.            }
  157.        } catch (ClassNotFoundException ex) {
  158.            java.util.logging.Logger.getLogger(Login.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
  159.        } catch (InstantiationException ex) {
  160.            java.util.logging.Logger.getLogger(Login.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
  161.        } catch (IllegalAccessException ex) {
  162.            java.util.logging.Logger.getLogger(Login.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
  163.        } catch (javax.swing.UnsupportedLookAndFeelException ex) {
  164.            java.util.logging.Logger.getLogger(Login.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
  165.        }
  166.        //</editor-fold>
  167.  
  168.        /* Create and display the form */
  169.        java.awt.EventQueue.invokeLater(new Runnable() {
  170.            public void run() {
  171.                new Login().setVisible(true);
  172.            }
  173.        });
  174.  
  175.    }
  176.  
  177.    // Variables declaration - do not modify                    
  178.    private javax.swing.JPasswordField contraseña;
  179.    private javax.swing.JButton jButton1;
  180.    private javax.swing.JButton jButton2;
  181.    private javax.swing.JLabel jLabel1;
  182.    private javax.swing.JLabel jLabel2;
  183.    private javax.swing.JLabel jLabel3;
  184.    private javax.swing.JTextField usuario;
  185.    // End of variables declaration                  
  186. }
  187.  
  188.  

Gracias por adelantado quien me pueda ayudar
4  Programación / PHP / Problema con codeigniter en: 12 Agosto 2016, 20:59 pm
My proyecto local con Xampp 1.8.1 and codeigniter 3.0.6 me da error 404 Page not Found

Código
  1. File htaccess:
  2.  
  3. `
  4. RewriteEngine On
  5. # !IMPORTANT! Set your RewriteBase here and don't forget trailing and leading
  6. # slashes.
  7. # If your page resides at
  8. # http://www.example.com/mypage/test1
  9. # then use
  10. # RewriteBase /mypage/test1/
  11. RewriteBase /codeigniter
  12. RewriteCond %{REQUEST_FILENAME} !-f
  13. RewriteCond %{REQUEST_FILENAME} !-d
  14. RewriteRule ^(.*)$ index.php?/$1 [L]
  15.  
  16. # If we don't have mod_rewrite installed, all 404's
  17. # can be sent to index.php, and everything works as normal.
  18. # Submitted by: ElliotHaughin
  19.  
  20. ErrorDocument 404 /index.php
  21.  
  22. `
  23. File config:
  24. $config['base_url'] = 'http://localhost/codeigniter';
  25. $config['index_page'] = '';
  26.  
  27. $active_group = 'default';
  28. $query_builder = TRUE;
  29.  
  30. File database:
  31. $db['default'] = array(
  32. 'dsn' => '',
  33. 'hostname' => 'localhost',
  34. 'username' => 'root',
  35. 'password' => '',
  36. 'database' => 'sistemaderiego',
  37. 'dbdriver' => 'mysqli',
  38. 'dbprefix' => '',
  39. 'pconnect' => TRUE,
  40. 'db_debug' => (ENVIRONMENT !== 'production'),
  41. 'cache_on' => FALSE,
  42. 'cachedir' => '',
  43. 'char_set' => 'utf8',
  44. 'dbcollat' => 'utf8_general_ci',
  45. 'swap_pre' => '',
  46. 'encrypt' => FALSE,
  47. 'compress' => FALSE,
  48. 'stricton' => FALSE,
  49. 'failover' => array(),
  50. 'save_queries' => TRUE
  51. );
  52.  
  53. File route:
  54. $route['default_controller'] = 'Prueba';
  55.  
  56.  

Alguna ayuda?
5  Programación / PHP / echo no imprime en: 25 Enero 2016, 16:54 pm
Código
  1. <html>
  2. <head><title>php con html</title><head>
  3.  
  4. <body>
  5.  
  6. <? php
  7. echo "Hola mundo!";
  8. echo "Fin";
  9. ?>
  10.  
  11. </body>
  12. </html>

He probado en chrome, opera, mozilla y el resultado es el mismo: El titulo "php con html" aparece en el borde del navegador pero no se imprime "Hola mundo". La URL no es el problema de lo contrario el title no apareceria.
6  Programación / Java / Orientación acerca de proyecto en Java en: 17 Junio 2015, 17:13 pm
Debo realizar un proyecto llamado: Sistema de riego automatizado por goteo cuya aplicación voy a desarrollar utilizando Java, Dicho proyecto es un sistema de control, he leído que un sistema de este tipo requiere el manejo de los puertos seriales. Buscando en Internet no he encontrado ningún paquete que contenga las clases para manipular los puertos seriales, Cualquier opinión es Bienvenida.
7  Programación / Programación C/C++ / Compilador se reinicia en: 1 Junio 2015, 23:49 pm
Funciona bien exepto que durante la ejecucion si pasa mucho tiempo sin introducir datos el compilador se reinicia

Código
  1. #include<stdio.h>
  2. #include<stdlib.h>
  3. #include<conio.h>
  4.  
  5. void ingresar();
  6. void calcular();
  7. void imprimir();
  8.  
  9. static int plana=400, rollo=250;
  10. int tiempo=0,tipo=0,metros=0;
  11.  
  12. char nombre[10], apellido[10];
  13. int des=0;
  14. int main(){
  15.  
  16.  ingresar();
  17.  calcular();
  18.  imprimir();
  19.  printf("\n\n");
  20.  system("pause");
  21.                     }
  22. void ingresar(){
  23.  
  24.    printf(" \t\t\t***EMPRESA MAYA***");
  25.    printf(" \n\nIngrese Nombre:");
  26.    scanf("%s",&nombre);
  27.    printf(" \n Ingrese Apellido:");
  28.    scanf("%s",&apellido);
  29.    printf(" \n Ingrese tiempo de cliente:");
  30.    scanf("%d",&tiempo);
  31.    printf(" \n Seleccione el tipo de maya:");
  32.  
  33.  
  34.    do{
  35.     printf(" \n 1..Maya Plana");
  36.    printf(" \n 2..Maya en Rollo");
  37.    printf(" \n opc: ");
  38.    scanf("%d",&tipo);                          
  39.    }while((tipo!=1) && (tipo!=2));
  40.  
  41.    printf(" \n Cantidad de metros:");
  42.    scanf("%d",&metros);
  43.  
  44.    }
  45.  
  46. void calcular(){
  47.  
  48.    int costo=0;
  49.  
  50.     if(tiempo==5 && tipo==1){
  51.       costo=plana*metros;
  52.       des=costo*0.08;
  53.             }
  54.         if(tiempo>=6 && tipo==1){
  55.           costo=plana*metros;
  56.           des=costo*0.06;
  57.                 }
  58.                 if(tiempo==5 && tipo==2){
  59.                    costo=rollo*metros;
  60.                    des=costo*0.08;
  61.                    }
  62.                     if(tiempo>=6 && tipo==2){
  63.                       costo=rollo*metros;
  64.                       des=costo*0.06;
  65.                      }      
  66.  
  67.  
  68.                  }
  69.  
  70. void imprimir(){
  71.  
  72.     printf(" \n\nDescuento cliente");
  73.     printf(" \n\nNombre: %s\tApellido: %s", nombre,apellido);
  74.     printf(" \n El descuento es: %d BsF",des);
  75.     }
  76.  
8  Programación / Programación C/C++ / Duda con un while en: 1 Junio 2015, 18:20 pm
Necesito validar que la variable tipo solo tome como valor el 1 o 2, para esto utilize un do-while
pero el ciclo se repetia una y otra vez, ahora utilizo while y pasa lo mismo, donde podria estar el error?

Código
  1. #include<stdio.h>
  2. #include<stdlib.h>
  3. #include<conio.h>
  4. #include<string.h>
  5.  
  6. void ingresar();
  7. void calcular();
  8.  
  9. int valor=0,tiempo=0,tipo=0,metros=0;
  10. float costo=0;
  11. char nombre[10], apellido[10];
  12.  
  13. int main(){
  14.  
  15.  ingresar();
  16.  calcular();
  17.  
  18.  
  19.                     }
  20. void ingresar(){
  21.  
  22.    printf(" Empresa Maya");
  23.    printf(" \nIngrese nombre:");
  24.    scanf("%s",&nombre);
  25.    printf(" \n Ingrese Apellido:");
  26.    scanf("%s",&apellido);
  27.    printf(" \n Ingrese tiempo de cliente:");
  28.    scanf("%d",&tiempo);
  29.    printf(" \n Seleccione el tipo de maya:");
  30.  
  31.    printf(" \n 1..Maya Plana");
  32.    printf(" \n 2..Maya en Rollo");
  33.    printf(" \n opc: ");
  34.    scanf("%d",&tipo);
  35.    while(tipo!=1 || tipo!=2){
  36.     printf(" \n 1..Maya Plana");
  37.    printf(" \n 2..Maya en Rollo");
  38.    printf(" \n opc: ");
  39.    scanf("%d",&tipo);                          
  40.    }
  41.    printf(" \n Cantidad de metros:");
  42.    scanf("%d",&metros);
  43.  
  44.    }
  45.  
  46. void calcular(){
  47.     if(tiempo<6 && tipo==1){
  48.                 costo=(400*(8/100))*metros;
  49.                 }
  50.                 if(tiempo<6 && tipo==2){
  51.                 costo=(250*(8/100))*metros;
  52.                 }
  53.                  printf(" \n costo: %d",costo);
  54.                  }
  55.  
9  Programación / Java / Flash player y Java en: 22 Marzo 2015, 16:32 pm
Voy a crear una app en java que estara conectado a un circuito, dicho circuito quiero simularlo utilizando flash player, es decir al activar acciones desde la app se ejecute en el circuito simulado. Existe alguna forma de hacer esto?
10  Programación / Java / Fallo en inicializar matriz en: 5 Junio 2014, 16:57 pm
Código
  1.  
  2. package matriz;
  3.  
  4. import java.util.Scanner;
  5.  
  6.  
  7. public class Matriz {
  8.  
  9.    public static void main(String[] args) {
  10.  
  11. Scanner x = new Scanner (System.in);
  12.    int m = 0,n = 0, i=0,j=0,a=0,b=0, c=0, d=0;
  13.    int multi;
  14.    int M[][] = new int[m][n];
  15.     int N[][] = new int[a][b];
  16.    System.out.println(" DIMENSIONES DE LA MATRIZ 1 ");
  17.    System.out.println(" FILAS M[*][]: ");
  18.    m = x.nextInt();
  19.    System.out.println(" COLUMNAS M[][*]: ");
  20.    n = x.nextInt();
  21.     System.out.println(" LLENADO DE LA MATRIZ 1: ");
  22.    for (i=0 ; i<m;i++){
  23.    for(j=0;j<n;j++){
  24.    System.out.print(" Valor ["+(i+1)+"]["+(j+1)+"]: ");
  25.        M[i][j]= x.nextInt();
  26.    }
  27.    }
  28.    System.out.println(" DIMENSIONES DE LA MATRIZ 2 ");
  29.    System.out.println(" FILAS M[*][]: ");
  30.    a = x.nextInt();
  31.    System.out.println(" COLUMNAS M[][*]: ");
  32.    b = x.nextInt();
  33.    System.out.println(" LLENADO DE LA MATRIZ 2: ");
  34.    for (c=0 ; c<a;c++){
  35.    for(d=0;d<b;d++){
  36.    System.out.println(" Valor ["+(c+1)+"]["+(d+1)+"]: ");
  37.        N[c][d]= x.nextInt();
  38.    }
  39.    }
  40.    multi =M[i][j] * N[c][d];
  41.    System.out.println(" Multiplicacion de las matrices:  "+multi);
  42.  
  43.    }
  44. }
  45.  

En esta linea  M[j]= x.nextInt(); Netbeans me muestra el siguiente mensaje:
Exception in thread "main" java.lang.ArrayIndexOutOfBoundsException: 0
 Valor [1][1]:    at matriz.Matriz.main(Matriz.java:25)
Java Result: 1
Páginas: [1] 2 3
WAP2 - Aviso Legal - Powered by SMF 1.1.21 | SMF © 2006-2008, Simple Machines