1
0

UI.java 6.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189
  1. /*
  2. * To change this template, choose Tools | Templates
  3. * and open the template in the editor.
  4. */
  5. package PV;
  6. import de.nplusc.izc.tools.IOtools.DBWriter;
  7. import de.nplusc.izc.tools.IOtools.FileTK;
  8. import javax.swing.table.DefaultTableModel;
  9. /**
  10. *
  11. * @author LH
  12. */
  13. public class UI extends javax.swing.JFrame
  14. {
  15. /**
  16. * Creates new form UI
  17. */
  18. public UI()
  19. {
  20. initComponents();
  21. String fp = "D:\\loa\\000010\\in.sqlite";
  22. String fp2="D:\\loa\\000010\\out.txt";
  23. DBWriter dbw = new DBWriter("", fp, "", "", DBWriter.DBTYPE_SQLite);
  24. //String[][] items = dbw.queryTable("SELECT url , id FROM moz_places");
  25. String[][] idmap = dbw.queryTable("SELECT place_id , visit_date from moz_historyvisits ORDER BY visit_date");
  26. // List<String> l = new ArrayList<>();
  27. StringBuilder sb = new StringBuilder();
  28. int i=0;
  29. int j=0;
  30. int k=0;
  31. boolean c = false;
  32. // if(idmap.length>50000){c=true;
  33. // System.out.println("chunkered");
  34. // }
  35. for (String[] ue : idmap)
  36. {
  37. String date = (new java.text.SimpleDateFormat("dd/MM/yyyy HH:mm:ss").format(new java.util.Date (Long.valueOf(ue[1])/1000)));
  38. String datafield=dbw.querySingleCell("SELECT url FROM moz_places where id = "+ue[0]);
  39. if(datafield.contains("mail.google.com"))
  40. {
  41. ((DefaultTableModel)tblT.getModel()).setValueAt(datafield, i, 0);
  42. ((DefaultTableModel)tblT.getModel()).setValueAt(date, i, 1);
  43. ((DefaultTableModel)tblT.getModel()).addRow(new String[]{""});
  44. i++;
  45. sb.append(date).append("|").append(datafield).append("\n");
  46. }
  47. j++;
  48. if(j%1000==0)
  49. {
  50. System.out.println(j+"/"+idmap.length);
  51. }
  52. /* if(c)
  53. {
  54. if(i%50000==0&&i!=0)
  55. {
  56. FileTK.writeFile(sb.toString(), fp2+"chunk_"+k);
  57. sb=new StringBuffer();
  58. k++;
  59. }
  60. }
  61. */
  62. }
  63. if(!c)
  64. {
  65. FileTK.writeFile(sb.toString(), fp2);
  66. }
  67. //dbw.closeConn();
  68. }
  69. /**
  70. * This method is called from within the constructor to
  71. * initialize the form.
  72. * WARNING: Do NOT modify this code. The content of this method is
  73. * always regenerated by the Form Editor.
  74. */
  75. @SuppressWarnings("unchecked")
  76. // <editor-fold defaultstate="collapsed" desc="Generated Code">
  77. private void initComponents()
  78. {
  79. jScrollPane1 = new javax.swing.JScrollPane();
  80. tblT = new javax.swing.JTable();
  81. setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE);
  82. tblT.setModel(new javax.swing.table.DefaultTableModel(
  83. new Object [][]
  84. {
  85. {null, null}
  86. },
  87. new String []
  88. {
  89. "URL", "Zeitpunkt"
  90. }
  91. )
  92. {
  93. Class[] types = new Class []
  94. {
  95. java.lang.String.class, java.lang.String.class
  96. };
  97. public Class getColumnClass(int columnIndex)
  98. {
  99. return types [columnIndex];
  100. }
  101. });
  102. jScrollPane1.setViewportView(tblT);
  103. javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane());
  104. getContentPane().setLayout(layout);
  105. layout.setHorizontalGroup(
  106. layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
  107. .addGroup(layout.createSequentialGroup()
  108. .addGap(30, 30, 30)
  109. .addComponent(jScrollPane1, javax.swing.GroupLayout.PREFERRED_SIZE, 816, javax.swing.GroupLayout.PREFERRED_SIZE)
  110. .addContainerGap(102, Short.MAX_VALUE))
  111. );
  112. layout.setVerticalGroup(
  113. layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
  114. .addGroup(layout.createSequentialGroup()
  115. .addContainerGap()
  116. .addComponent(jScrollPane1, javax.swing.GroupLayout.PREFERRED_SIZE, 530, javax.swing.GroupLayout.PREFERRED_SIZE)
  117. .addContainerGap(27, Short.MAX_VALUE))
  118. );
  119. pack();
  120. }// </editor-fold>
  121. /**
  122. * @param args the command line arguments
  123. */
  124. public static void main(String args[])
  125. {
  126. /* Set the Nimbus look and feel */
  127. //<editor-fold defaultstate="collapsed" desc=" Look and feel setting code (optional) ">
  128. /* If Nimbus (introduced in Java SE 6) is not available, stay with the default look and feel.
  129. * For details see http://download.oracle.com/javase/tutorial/uiswing/lookandfeel/plaf.html
  130. */
  131. try
  132. {
  133. for (javax.swing.UIManager.LookAndFeelInfo info : javax.swing.UIManager.getInstalledLookAndFeels())
  134. {
  135. if ("Nimbus".equals(info.getName()))
  136. {
  137. javax.swing.UIManager.setLookAndFeel(info.getClassName());
  138. break;
  139. }
  140. }
  141. }
  142. catch (ClassNotFoundException ex)
  143. {
  144. java.util.logging.Logger.getLogger(UI.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
  145. }
  146. catch (InstantiationException ex)
  147. {
  148. java.util.logging.Logger.getLogger(UI.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
  149. }
  150. catch (IllegalAccessException ex)
  151. {
  152. java.util.logging.Logger.getLogger(UI.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
  153. }
  154. catch (javax.swing.UnsupportedLookAndFeelException ex)
  155. {
  156. java.util.logging.Logger.getLogger(UI.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
  157. }
  158. //</editor-fold>
  159. /* Create and display the form */
  160. java.awt.EventQueue.invokeLater(new Runnable()
  161. {
  162. public void run()
  163. {
  164. new UI().setVisible(true);
  165. }
  166. });
  167. }
  168. // Variables declaration - do not modify
  169. private javax.swing.JScrollPane jScrollPane1;
  170. private javax.swing.JTable tblT;
  171. // End of variables declaration
  172. }